phpgroupware-cvs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Phpgroupware-cvs] projects/inc/class.boconfig.inc.php, 1.18


From: nomail
Subject: [Phpgroupware-cvs] projects/inc/class.boconfig.inc.php, 1.18
Date: Sun, 23 May 2004 06:04:57 -0000

Update of /projects/inc
Modified Files:
        Branch: 
          class.boconfig.inc.php

date: 2004/05/02 00:11:55;  author: ceb;  state: Exp;  lines: +60 -10

Log Message:
update
=====================================================================
Index: projects/inc/class.boconfig.inc.php
diff -u projects/inc/class.boconfig.inc.php:1.17 
projects/inc/class.boconfig.inc.php:1.18
--- projects/inc/class.boconfig.inc.php:1.17    Thu Apr 29 15:53:38 2004
+++ projects/inc/class.boconfig.inc.php Sun May  2 00:11:55 2004
@@ -111,19 +111,26 @@
                {
                        $factors = 
$this->soconfig->read_employees(array('start' => $this->start,'sort' => 
$this->sort,'order' => $this->order,
                                                                                
                                                                'query' => 
$this->query,'limit' => isset($data['limit'])?$data['limit']:$this->limit,
-                                                                               
                                                                'account_id' => 
intval($data['account_id'])));
+                                                                               
                                                                'account_id' => 
$data['account_id'],'id' => $data['id']));
                        $this->total_records = $this->soconfig->total_records;
                        if(is_array($factors))
                        {
                                foreach($factors as $emp)
                                {
+                                       $edate = 
$emp['edate']>0?$this->boprojects->format_date($emp['edate']):'';
+                                       $sdate = 
$emp['sdate']>0?$this->boprojects->format_date($emp['sdate']):'';
+
                                        $emps[] = array
                                        (
-                                               'id'                    => 
$emp['id'],
-                                               'account_id'    => 
$emp['account_id'],
-                                               'account_name'  => 
$GLOBALS['phpgw']->common->grab_owner_name($emp['account_id']),
-                                               'accounting'    => 
$emp['accounting'],
-                                               'd_accounting'  => 
$emp['d_accounting']
+                                               'id'                            
=> $emp['id'],
+                                               'account_id'            => 
$emp['account_id'],
+                                               'account_name'          => 
$GLOBALS['phpgw']->common->grab_owner_name($emp['account_id']),
+                                               'accounting'            => 
$emp['accounting'],
+                                               'd_accounting'          => 
$emp['d_accounting'],
+                                               'sdate'                         
=> $emp['sdate'],
+                                               'edate'                         
=> $emp['edate'],
+                                               'sdate_formatted'       => 
$sdate['date_formatted'],
+                                               'edate_formatted'       => 
$edate['date_formatted']
                                        );
                                }
                                asort($emps);
@@ -252,6 +259,51 @@
                                                $error[] = lang('Please enter a 
name');
                                        }
                                        break;
+                               case 'accounting':
+                                       //_debug_array($values);
+
+                                       if(!$values['edate'] && 
$values['sdate'])
+                                       {
+                                               $error[] = lang('please set the 
end date');
+                                       }
+                                       else if(!$values['sdate'] && 
$values['edate'])
+                                       {
+                                               $error[] = lang('please set the 
start date');
+                                       }
+                                       else if($values['sdate'] && 
$values['edate'])
+                                       {
+                                               $existing = 
$this->read_accounting_factors(array('limit' => False,'account_id' => 
$values['account_id'],'id' => $values['id']));
+
+                                               if(is_array($existing))
+                                               {
+                                                       
//_debug_array($existing);
+
+                                                       foreach($existing as 
$exists)
+                                                       {
+                                                               
if($values['sdate'] <= $exists['sdate'] && $values['edate'] >= $exists['edate'])
+                                                               {
+                                                                       
$overlap = True;
+                                                               }
+                                                               
elseif($values['sdate'] <= $exists['sdate'] && $values['edate'] >= 
$exists['sdate'] && $values['edate'] <= $exists['edate'])
+                                                               {
+                                                                       
$overlap = True;
+                                                               }
+                                                               
elseif($values['sdate'] >= $exists['sdate'] && $values['edate'] <= 
$exists['edate'])
+                                                               {
+                                                                       
$overlap = True;
+                                                               }
+                                                               
elseif($values['sdate'] >= $exists['sdate'] && $values['sdate'] <= 
$exists['edate'] && $values['edate'] >= $exists['edate'])
+                                                               {
+                                                                       
$overlap = True;
+                                                               }
+                                                       }
+                                                       if($overlap)
+                                                       {
+                                                               $error[] = 
lang('the choosen timeframe interleaves an already existing timeframe');
+                                                       }
+                                               }
+                                       }
+                                       break;
                                default:
                                        if (strlen($values['descr']) > 250)
                                        {
@@ -285,9 +337,7 @@
                                                $error[] = lang('please enter 
the bill');
                                        }
 
-                                       $config = $this->get_site_config();
-
-                                       if ($config['activity_bill'] == 'wu')
+                                       if 
($this->boprojects->siteconfig['activity_bill'] == 'wu')
                                        {
                                                if ((! $values['minperae']) || 
($values['minperae'] == 0))
                                                {




reply via email to

[Prev in Thread] Current Thread [Next in Thread]