phpgroupware-cvs
[Top][All Lists]
Advanced

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

[Phpgroupware-cvs] CVS: projects/inc class.boprojects.inc.php, 1.42.2.5.


From: Bettina Gille <address@hidden>
Subject: [Phpgroupware-cvs] CVS: projects/inc class.boprojects.inc.php, 1.42.2.5.2.30, 1.42.2.5.2.31 class.soprojects.inc.php, 1.34.2.6.2.29, 1.34.2.6.2.30 class.uiprojects.inc.php, 1.47.2.7.2.35, 1.47.2.7.2.36
Date: Wed, 17 Sep 2003 20:49:29 -0400

Update of /cvsroot/phpgroupware/projects/inc
In directory subversions:/tmp/cvs-serv26129/inc

Modified Files:
      Tag: Version-0_9_16-branch
        class.boprojects.inc.php class.soprojects.inc.php 
        class.uiprojects.inc.php 
Log Message:
adaptions new addressbook plus previous

Index: class.boprojects.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/projects/inc/class.boprojects.inc.php,v
retrieving revision 1.42.2.5.2.30
retrieving revision 1.42.2.5.2.31
diff -C2 -r1.42.2.5.2.30 -r1.42.2.5.2.31
*** class.boprojects.inc.php    11 Sep 2003 23:36:19 -0000      1.42.2.5.2.30
--- class.boprojects.inc.php    18 Sep 2003 00:49:26 -0000      1.42.2.5.2.31
***************
*** 202,206 ****
                {
                        $cols = 
array('per_first_name','per_last_name','org_name','contact_id');
!                       return $this->contacts->get_persons($cols, 
$limit='',$maxmatchs='', $order='', 
$sort='',$criteria=array('contact_id'=>$abid));  
                        //return 
$this->contacts->read_single_entry($abid,$cols);
                }
--- 202,206 ----
                {
                        $cols = 
array('per_first_name','per_last_name','org_name','contact_id');
!                       return $this->contacts->get_persons($cols, 
$limit='',$maxmatchs='', $order='', 
$sort='',$criteria=array('contact_id'=>$abid));
                        //return 
$this->contacts->read_single_entry($abid,$cols);
                }
***************
*** 519,523 ****
                                'status'                        => 
$pro['status'],
                                'owner'                         => 
$pro['owner'],
!                               'processor'                     => 
$pro['processor']
                        );
  
--- 519,524 ----
                                'status'                        => 
$pro['status'],
                                'owner'                         => 
$pro['owner'],
!                               'processor'                     => 
$pro['processor'],
!                               'previous'                      => 
$pro['previous']
                        );
  
***************
*** 668,671 ****
--- 669,682 ----
                        }
  
+                       if ($values['previous'])
+                       {
+                               $edate = 
$this->return_value('edate',$values['previous']);
+ 
+                               if (intval($edate) == 0)
+                               {
+                                       $error[] = lang('the choosen previous 
project does not have an end date specified');
+                               }
+                       }
+ 
                        if ($action == 'mains')
                        {
***************
*** 824,827 ****
--- 835,843 ----
                        {
                                $values['edate'] = 
mktime(0,0,0,$values['emonth'],$values['eday'],$values['eyear']);
+                       }
+ 
+                       if (!$values['previous'] && $values['parent'])
+                       {
+                               $values['previous'] = 
$this->return_value('previous',$values['parent']);
                        }
  

Index: class.soprojects.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/projects/inc/class.soprojects.inc.php,v
retrieving revision 1.34.2.6.2.29
retrieving revision 1.34.2.6.2.30
diff -C2 -r1.34.2.6.2.29 -r1.34.2.6.2.30
*** class.soprojects.inc.php    10 Sep 2003 04:50:24 -0000      1.34.2.6.2.29
--- class.soprojects.inc.php    18 Sep 2003 00:49:26 -0000      1.34.2.6.2.30
***************
*** 92,96 ****
                                        'pcosts'                => 
$this->db->f('pcosts'),
                                        'main'                  => 
$this->db->f('main'),
!                                       'level'                 => 
$this->db->f('level')
                                );
                        }
--- 92,97 ----
                                        'pcosts'                => 
$this->db->f('pcosts'),
                                        'main'                  => 
$this->db->f('main'),
!                                       'level'                 => 
$this->db->f('level'),
!                                       'previous'              => 
$this->db->f('previous')
                                );
                        }
***************
*** 319,328 ****
  
                        $this->db->query('INSERT into phpgw_p_projects 
(owner,access,category,entry_date,start_date,end_date,coordinator,customer,status,'
!                                                       . 
'descr,title,budget,num,parent,time_planned,date_created,processor,investment_nr,pcosts,main,level)
 VALUES (' . $this->account
                                                        . ",'" . 
$values['access'] . "'," . intval($values['cat']) . ',' . time() . ',' . 
intval($values['sdate']) . ','
                                                        . 
intval($values['edate']) . ',' . intval($values['coordinator']) . ',' . 
intval($values['customer']) . ",'" . $values['status']
                                                        . "','" . 
$values['descr'] . "','" . $values['title'] . "'," . $values['budget'] . ",'" . 
$values['number'] . "',"
                                                        . 
intval($values['parent']) . ',' . intval($values['ptime']) . ',' . time() . ',' 
. $this->account . ",'" . $values['investment_nr']
!                                                       . "'," . 
$values['pcosts'] . ',' . intval($values['main']) . ',' . 
intval($values['level']) . ')',__LINE__,__FILE__);
  
                        $p_id = $this->db->get_last_insert_id($table,'id');
--- 320,329 ----
  
                        $this->db->query('INSERT into phpgw_p_projects 
(owner,access,category,entry_date,start_date,end_date,coordinator,customer,status,'
!                                                       . 
'descr,title,budget,num,parent,time_planned,date_created,processor,investment_nr,pcosts,main,level,previous)
 VALUES (' . $this->account
                                                        . ",'" . 
$values['access'] . "'," . intval($values['cat']) . ',' . time() . ',' . 
intval($values['sdate']) . ','
                                                        . 
intval($values['edate']) . ',' . intval($values['coordinator']) . ',' . 
intval($values['customer']) . ",'" . $values['status']
                                                        . "','" . 
$values['descr'] . "','" . $values['title'] . "'," . $values['budget'] . ",'" . 
$values['number'] . "',"
                                                        . 
intval($values['parent']) . ',' . intval($values['ptime']) . ',' . time() . ',' 
. $this->account . ",'" . $values['investment_nr']
!                                                       . "'," . 
$values['pcosts'] . ',' . intval($values['main']) . ',' . 
intval($values['level']) . ',' . intval($values['previous']) . 
')',__LINE__,__FILE__);
  
                        $p_id = $this->db->get_last_insert_id($table,'id');
***************
*** 483,487 ****
                                                        . $values['number'] . 
"', time_planned=" . intval($values['ptime']) . ', processor=' . $this->account 
. ", investment_nr='"
                                                        . 
$values['investment_nr'] . "', pcosts=" . $values['pcosts'] . ', parent=' . 
$values['parent']
!                                                       . ', level=' . 
intval($values['level']) . ' where id=' . 
$values['project_id'],__LINE__,__FILE__);
  
                        $this->db->query('SELECT max(month) FROM phpgw_p_pcosts 
where project_id=' . $values['project_id'],__LINE__,__FILE__);
--- 484,488 ----
                                                        . $values['number'] . 
"', time_planned=" . intval($values['ptime']) . ', processor=' . $this->account 
. ", investment_nr='"
                                                        . 
$values['investment_nr'] . "', pcosts=" . $values['pcosts'] . ', parent=' . 
$values['parent']
!                                                       . ', level=' . 
intval($values['level']) . ', previous=' . intval($values['previous']) . ' 
where id=' . $values['project_id'],__LINE__,__FILE__);
  
                        $this->db->query('SELECT max(month) FROM phpgw_p_pcosts 
where project_id=' . $values['project_id'],__LINE__,__FILE__);
***************
*** 511,514 ****
--- 512,586 ----
                                $this->db->query("Update phpgw_p_projects set 
status='" . $values['status'] . "' WHERE parent=" . 
$values['project_id'],__LINE__,__FILE__);
                        }
+ 
+                       if (isset($values['old_edate']) && $values['old_edate'] 
!= $values['edate'])
+                       {
+                               $this->db->query('SELECT id,start_date,end_date 
from phpgw_p_projects where previous=' . 
$values['project_id'],__LINE__,__FILE__);
+ 
+                               while($this->db->next_record())
+                               {
+                                       $following[] = array
+                                       (
+                                               'id'    => $this->db->f('id'),
+                                               'sdate' => 
$this->db->f('start_date'),
+                                               'edate' => 
$this->db->f('end_date')
+                                       );
+                               };
+ 
+                               if (is_array($following))
+                               {
+                                       $diff = 
abs($values['edate']-$values['old_edate']);
+ 
+                                       if ($values['old_edate'] > 
$values['edate'])
+                                       {
+                                               $op = 'sub';
+                                       }
+                                       else
+                                       {
+                                               $op = 'add';
+                                       }
+ 
+                                       while (list(,$fol) = each($following))
+                                       {
+                                               switch($op)
+                                               {
+                                                       case 'add':
+                                                               $nsdate = 
$fol['sdate']+$diff;
+                                                               $nedate = 
$fol['edate']+$diff;
+                                                               break;
+                                                       case 'sub':
+                                                               $nsdate = 
$fol['sdate']-$diff;
+                                                               $nedate = 
$fol['edate']-$diff;
+                                                               break;
+                                               }
+                                               $this->db->query('UPDATE 
phpgw_p_projects set start_date=' . $nsdate . ', end_date=' . $nedate . ', 
entry_date=' . time()
+                                                                               
. ', processor=' . $this->account . ' WHERE id=' . 
$fol['id'],__LINE__,__FILE__);
+ 
+                                               $this->db->query('SELECT s_id, 
edate from phpgw_p_mstones WHERE project_id=' . $fol['id'],__LINE__,__FILE__);
+ 
+                                               while($this->db->next_record())
+                                               {
+                                                       $stones[] = array
+                                                       (
+                                                               's_id'  => 
$this->db->f('s_id'),
+                                                               'edate' => 
$this->db->f('edate')
+                                                       );
+                                               };
+ 
+                                               while(is_array($stones) && 
list(,$stone) = each($stones))
+                                               {
+                                                       switch($op)
+                                                       {
+                                                               case 'add':
+                                                                       $sedate 
= $stone['edate']+$diff;
+                                                                       break;
+                                                               case 'sub':
+                                                                       $sedate 
= $stone['edate']-$diff;
+                                                                       break;
+                                                       }
+                                                       
$this->db->query('UPDATE phpgw_p_mstones set edate=' . $sedate . ' WHERE s_id=' 
. $stone['s_id'],__LINE__,__FILE__);
+                                               }
+                                       }
+                               }
+                       }
                }
  
***************
*** 675,684 ****
                                switch ($action)
                                {
!                                       case 'pro':             $column = 
'num,title'; break;
!                                       case 'edate':   $column = 'end_date'; 
break;
!                                       case 'sdate':   $column = 'start_date'; 
break;
!                                       case 'ptime':   $column = 
'time_planned'; break;
!                                       case 'invest':  $column = 
'investment_nr'; break;
!                                       case 'budget':  $column = 'budget'; 
break;
                                }
  
--- 747,757 ----
                                switch ($action)
                                {
!                                       case 'pro':                     $column 
= 'num,title'; break;
!                                       case 'edate':           $column = 
'end_date'; break;
!                                       case 'sdate':           $column = 
'start_date'; break;
!                                       case 'ptime':           $column = 
'time_planned'; break;
!                                       case 'invest':          $column = 
'investment_nr'; break;
!                                       case 'budget':          $column = 
'budget'; break;
!                                       case 'previous':        $column = 
'previous'; break;
                                }
  

Index: class.uiprojects.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/projects/inc/class.uiprojects.inc.php,v
retrieving revision 1.47.2.7.2.35
retrieving revision 1.47.2.7.2.36
diff -C2 -r1.47.2.7.2.35 -r1.47.2.7.2.36
*** class.uiprojects.inc.php    14 Sep 2003 20:38:20 -0000      1.47.2.7.2.35
--- class.uiprojects.inc.php    18 Sep 2003 00:49:26 -0000      1.47.2.7.2.36
***************
*** 62,65 ****
--- 62,67 ----
                        $action = get_var('action',array('GET'));
  
+                       //$this->action                                 = 
(isset($action)?$action:'mains');
+ 
                        $this->bo                                               
= CreateObject('projects.boprojects',True, $action);
                        $this->nextmatchs                               = 
CreateObject('phpgwapi.nextmatchs');
***************
*** 152,155 ****
--- 154,159 ----
                        
$GLOBALS['phpgw']->template->set_var('lang_add_milestone',lang('add 
milestone'));
                        
$GLOBALS['phpgw']->template->set_var('lang_milestones',lang('milestones'));
+ 
+                       
$GLOBALS['phpgw']->template->set_var('lang_previous',lang('previous project'));
                }
  
***************
*** 426,429 ****
--- 430,599 ----
                }
  
+ 
+               function list_projects_home()
+               {
+                       $action         = get_var('action',array('POST','GET'));
+                       $pro_main       = 
get_var('pro_main',array('POST','GET'));
+ 
+                       if ($_GET['cat_id'])
+                       {
+                               $this->cat_id = $_GET['cat_id'];
+                       }
+ 
+                       $this->set_app_langs();
+ 
+                       $this->t = 
CreateObject('phpgwapi.Template',$GLOBALS['phpgw']->common->get_tpl_dir('projects'));
+                       $this->t->set_file(array('projects_list_t' => 
'home_list.tpl'));
+                       
$this->t->set_block('projects_list_t','projects_list','list');
+ 
+                       if (!$action)
+                       {
+                               $action = 'mains';
+                       }
+ 
+                       $link_data = array
+                       (
+                               'menuaction'    => 
'projects.uiprojects.list_projects_home',
+                               'pro_main'              => $pro_main,
+                               'action'                => $action
+                       );
+ 
+                       if (! $this->status)
+                       {
+                               $this->status = 'active';
+                       }
+ 
+                       $pro = $this->bo->list_projects($action,$pro_main);
+ 
+ // --------------------- nextmatch variable template-declarations 
------------------------
+ 
+                       $left = 
$this->nextmatchs->left('/index.php',$this->start,$this->bo->total_records,$link_data);
+                       $right = 
$this->nextmatchs->right('/index.php',$this->start,$this->bo->total_records,$link_data);
+                       $this->t->set_var('left',$left);
+                       $this->t->set_var('right',$right);
+ 
+                       
$this->t->set_var('lang_showing',$this->nextmatchs->show_hits($this->bo->total_records,$this->start));
+ 
+ // ------------------------- end nextmatch template 
--------------------------------------
+ 
+                       if ($action == 'mains')
+                       {
+                               $action_list= '<form method="POST" action="' . 
$GLOBALS['phpgw']->link('/index.php',$link_data) . '" name="form">' . "\n"
+                                                       . '<select 
name="cat_id" onChange="this.form.submit();"><option value="none">' . 
lang('Select category') . '</option>' . "\n"
+                                                       . 
$this->bo->cats->formatted_list('select','all',$this->cat_id,True) . 
'</select>';
+                               $this->t->set_var('lang_action',lang('Jobs'));
+                       }
+                       else
+                       {
+                               $action_list= '<form method="POST" action="' . 
$GLOBALS['phpgw']->link('/index.php',$link_data) .'" name="form">' . "\n"
+                                                       . '<select 
name="pro_main" onChange="this.form.submit();"><option value="">' . 
lang('Select main project') . '</option>' . "\n"
+                                                       . 
$this->bo->select_project_list(array('status' => $status, 'selected' => 
$pro_main)) . '</select>';
+                               $this->t->set_var('lang_action',lang('Work 
hours'));
+                       }
+ 
+                       $this->t->set_var('action_list',$action_list);
+                       
$this->t->set_var('filter_action',$GLOBALS['phpgw']->link('/index.php',$link_data));
+                       
$this->t->set_var('filter_list',$this->nextmatchs->new_filter($this->filter));
+                       
$this->t->set_var('search_action',$GLOBALS['phpgw']->link('/index.php',$link_data));
+                       
$this->t->set_var('search_list',$this->nextmatchs->search(array('query' => 
$this->query)));
+                       
$this->t->set_var('status_action',$GLOBALS['phpgw']->link('/index.php',$link_data));
+                       
$this->t->set_var('status_list',$this->status_format($this->status));
+ 
+ // ---------------- list header variable template-declarations 
--------------------------
+ 
+                       
$this->t->set_var('sort_number',$this->nextmatchs->show_sort_order($this->sort,'num',$this->order,'/index.php',lang('Project
 ID'),$link_data));
+                       $this->t->set_var('lang_milestones',lang('milestones'));
+                       
$this->t->set_var('sort_title',$this->nextmatchs->show_sort_order($this->sort,'title',$this->order,'/index.php',lang('Title'),$link_data));
+                       
$this->t->set_var('sort_end_date',$this->nextmatchs->show_sort_order($this->sort,'end_date',$this->order,'/index.php',lang('Date
 due'),$link_data));
+                       
$this->t->set_var('sort_coordinator',$this->nextmatchs->show_sort_order($this->sort,'coordinator',$this->order,'/index.php',lang('Coordinator'),$link_data));
+ 
+ 
+ // -------------- end header declaration 
---------------------------------------
+ 
+             for ($i=0;$i<count($pro);$i++)
+             {
+                               
$this->nextmatchs->template_alternate_row_color(&$this->t);
+                               $edateout = 
$this->bo->formatted_edate($pro[$i]['edate']);
+ 
+                               if ($action == 'mains')
+                               {
+                                       $td_action = 
($pro[$i]['customerout']?$pro[$i]['customerout']:'&nbsp;');
+                               }
+                               else
+                               {
+                                       $td_action = 
($pro[$i]['sdateout']?$pro[$i]['sdateout']:'&nbsp;');
+                               }
+ 
+                               if ($pro[$i]['level'] > 0)
+                               {
+                                       $space = '&nbsp;.&nbsp;';
+                                       $spaceset = 
str_repeat($space,$pro[$i]['level']);
+                               }
+ 
+ // --------------- template declaration for list records 
-------------------------------------
+ 
+                               $this->t->set_var(array
+                               (
+                                       'number'                => 
$pro[$i]['number'],
+                                       'milestones'    => 
(isset($pro[$i]['mstones'])?$pro[$i]['mstones']:'&nbsp;'),
+                                       'title'                 => $spaceset . 
($pro[$i]['title']?$pro[$i]['title']:'&nbsp;'),
+                                       'end_date'              => 
(isset($pro[$i]['edate'])?$edateout:'&nbsp;'),
+                                       'coordinator'   => 
$pro[$i]['coordinatorout']
+                               ));
+ 
+                               $link_data['project_id'] = 
$pro[$i]['project_id'];
+ 
+                               if 
($this->bo->check_perms($this->grants[$pro[$i]['coordinator']],PHPGW_ACL_EDIT) 
|| $pro[$i]['coordinator'] == $this->account)
+                               {
+                                       $link_data['menuaction'] = 
'projects.uiprojects.edit_project';
+                                       
$this->t->set_var('edit',$GLOBALS['phpgw']->link('/index.php',$link_data));
+                                       
$this->t->set_var('lang_edit_entry',lang('Edit'));
+                               }
+                               else
+                               {
+                                       $this->t->set_var('edit','');
+                                       
$this->t->set_var('lang_edit_entry','&nbsp;');
+                               }
+ 
+                               $link_data['menuaction'] = 
'projects.uiprojects.view_project';
+                               
$this->t->set_var('view',$GLOBALS['phpgw']->link('/index.php',$link_data));
+                               
$this->t->set_var('lang_view_entry',lang('View'));
+ 
+                               if ($action == 'mains')
+                               {
+                                       
$this->t->set_var('action_entry',$GLOBALS['phpgw']->link('/index.php','menuaction=projects.uiprojects.list_projects&pro_main='
+                                                                               
. $pro[$i]['project_id'] . '&action=subs'));
+                                       
$this->t->set_var('lang_action_entry',lang('Jobs'));
+                               }
+                               else
+                               {
+                                       $link_data['menuaction'] = 
'projects.uiprojecthours.list_hours';
+                                       
$this->t->set_var('action_entry',$GLOBALS['phpgw']->link('/index.php',$link_data));
 
+                                       
$this->t->set_var('lang_action_entry',lang('Work hours'));
+                               }
+ 
+                               $this->t->fp('list','projects_list',True);
+                       }
+ 
+ // ------------------------- end record declaration ------------------------
+ 
+                       $this->save_sessiondata($action);
+                       return $this->t->fp('out','projects_list_t',True);
+               }
+ 
+ 
+ 
+ 
+ 
+ 
+ 
+ 
+ 
+ 
+ 
+ 
+ 
+ 
+ 
                function coordinator_format($employee = '')
                {
***************
*** 605,608 ****
--- 775,779 ----
                                
$GLOBALS['phpgw']->template->set_var('old_status',$values['status']);
                                
$GLOBALS['phpgw']->template->set_var('old_parent',$values['parent']);
+                               
$GLOBALS['phpgw']->template->set_var('old_edate',$values['edate']);
                                
$GLOBALS['phpgw']->template->set_var('lang_choose','');
                                
$GLOBALS['phpgw']->template->set_var('choose','');
***************
*** 698,701 ****
--- 869,876 ----
                        $GLOBALS['phpgw']->template->set_var('access','<input 
type="checkbox" name="values[access]" value="True"' . ($values['access'] == 
'private'?' checked':'') . '>');
  
+                       
$GLOBALS['phpgw']->template->set_var('previous_select',$this->bo->select_project_list(array('type'
 => 'all',
+                                                                               
                                                                                
                                                'status' => $values['status'],
+                                                                               
                                                                                
                                                'self' => $project_id,
+                                                                               
                                                                                
                                        'selected' => $values['previous'])));
                        if ($action == 'mains' || $action == 'amains')
                        {
***************
*** 903,906 ****
--- 1078,1085 ----
                        }
  
+                       if ($values['previous'])
+                       {
+                               
$GLOBALS['phpgw']->template->set_var('previous',$this->bo->return_value('pro',$values['previous']));
    
+                       }
                        
$GLOBALS['phpgw']->template->set_var('number',$GLOBALS['phpgw']->strip_html($values['number']));
                        
$GLOBALS['phpgw']->template->set_var('title',($values['title']?$values['title']:'&nbsp;'));
***************
*** 950,957 ****
  
                        $GLOBALS['phpgw']->template->pfp('out','view');
!                       $GLOBALS['phpgw']->hooks->process(array(
                                'location'   => 'projects_view',
                                'project_id' => $project_id
!                       ));
                }
  
--- 1129,1136 ----
  
                        $GLOBALS['phpgw']->template->pfp('out','view');
!                       /*$GLOBALS['phpgw']->hooks->process(array(
                                'location'   => 'projects_view',
                                'project_id' => $project_id
!                       ));*/
                }
  
***************
*** 1634,1639 ****
                                        $entry = 
$this->bo->read_single_contact($abid);
  
!                                       if ($entry[0]['org_name'] == '') { 
$GLOBALS['phpgw']->template->set_var('name',$entry[0]['n_given'] . ' ' . 
$entry[0]['n_family']); }
!                                       else { 
$GLOBALS['phpgw']->template->set_var('name',$entry[0]['org_name'] . ' [ ' . 
$entry[0]['n_given'] . ' ' . $entry[0]['n_family'] . ' ]'); }
                                }
                                else
--- 1813,1818 ----
                                        $entry = 
$this->bo->read_single_contact($abid);
  
!                                       if ($entry[0]['org_name'] == '') { 
$GLOBALS['phpgw']->template->set_var('name',$entry[0]['per_first_name'] . ' ' . 
$entry[0]['per_last_name']); }
!                                       else { 
$GLOBALS['phpgw']->template->set_var('name',$entry[0]['org_name'] . ' [ ' . 
$entry[0]['per_first_name'] . ' ' . $entry[0]['per_last_name'] . ' ]'); }
                                }
                                else





reply via email to

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