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.23, 1.42.2.5.2.24 class.soprojects.inc.php, 1.34.2.6.2.24, 1.34.2.6.2.25 class.uiprojects.inc.php, 1.47.2.7.2.26, 1.47.2.7.2.27
Date: Fri, 22 Aug 2003 21:33:10 -0400

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

Modified Files:
      Tag: Version-0_9_16-branch
        class.boprojects.inc.php class.soprojects.inc.php 
        class.uiprojects.inc.php 
Log Message:
update

Index: class.boprojects.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/projects/inc/class.boprojects.inc.php,v
retrieving revision 1.42.2.5.2.23
retrieving revision 1.42.2.5.2.24
diff -C2 -r1.42.2.5.2.23 -r1.42.2.5.2.24
*** class.boprojects.inc.php    26 Jul 2003 23:00:06 -0000      1.42.2.5.2.23
--- class.boprojects.inc.php    23 Aug 2003 01:33:08 -0000      1.42.2.5.2.24
***************
*** 166,171 ****
                        
$cached_data[$this->accounts->data['account_id']]['account_id']         = 
$this->accounts->data['account_id'];
                        
$cached_data[$this->accounts->data['account_id']]['account_lid']        = 
$this->accounts->data['account_lid'];
!                       
$cached_data[$this->accounts->data['account_id']]['firstname']          = 
$this->accounts->data['firstname'];
!                       
$cached_data[$this->accounts->data['account_id']]['lastname']           = 
$this->accounts->data['lastname'];
  
                        return $cached_data;
--- 166,171 ----
                        
$cached_data[$this->accounts->data['account_id']]['account_id']         = 
$this->accounts->data['account_id'];
                        
$cached_data[$this->accounts->data['account_id']]['account_lid']        = 
$this->accounts->data['account_lid'];
!                       
$cached_data[$this->accounts->data['account_id']]['firstname']          = 
$this->accounts->data['firstname'];
!                       
$cached_data[$this->accounts->data['account_id']]['lastname']           = 
$this->accounts->data['lastname'];
  
                        return $cached_data;
***************
*** 315,318 ****
--- 315,346 ----
                }
  
+               function get_acl_for_project($project_id)
+               {
+                       return 
$GLOBALS['phpgw']->acl->get_ids_for_location($project_id, 7);
+               }
+ 
+               function selected_employees($project_id)
+               {
+                       $emps = $this->get_acl_for_project($project_id);
+ 
+                       if (is_array($emps))
+                       {
+                               for($i=0;$i<count($emps);$i++)
+                               {
+                                       $this->accounts = 
CreateObject('phpgwapi.accounts',$emps[$i]);
+                                       $this->accounts->read_repository();
+ 
+                                       $empl[] = array
+                                       (
+                                               'account_id'            => 
$this->accounts->data['account_id'],
+                                               'account_lid'           => 
$this->accounts->data['account_lid'],
+                                               'account_firstname'     => 
$this->accounts->data['firstname'],
+                                               'account_lastname'      => 
$this->accounts->data['lastname']
+                                       );
+                               }
+                       }
+                       return $empl;
+               }
+ 
                function read_admins($action, $type)
                { 
***************
*** 793,808 ****
                        //_debug_array($values);
  
!                       if ($values['project_id'])
                        {
!                               if ($values['project_id'] != 0)
!                               {
!                                       $this->so->edit_project($values, 
$book_activities, $bill_activities);
!                                       return $values['project_id'];
!                               }
                        }
                        else
                        {
!                               return $this->so->add_project($values, 
$book_activities, $bill_activities);
                        }
                }
  
--- 821,844 ----
                        //_debug_array($values);
  
!                       if (intval($values['project_id']) > 0)
                        {
!                               $this->so->edit_project($values, 
$book_activities, $bill_activities);
                        }
                        else
                        {
!                               $values['project_id'] = 
$this->so->add_project($values, $book_activities, $bill_activities);
!                       }
! 
!                       $values['project_id'] = intval($values['project_id']);
! 
!                       if (is_array($values['employees']))
!                       {
!                               $this->so->delete_acl($values['project_id']);
!                               for($i=0;$i<count($values['employees']);$i++)
!                               {
!                                       
$GLOBALS['phpgw']->acl->add_repository('projects',$values['project_id'],$values['employees'][$i],7);
!                               }
                        }
+                       return $values['project_id'];
                }
  

Index: class.soprojects.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/projects/inc/class.soprojects.inc.php,v
retrieving revision 1.34.2.6.2.24
retrieving revision 1.34.2.6.2.25
diff -C2 -r1.34.2.6.2.24 -r1.34.2.6.2.25
*** class.soprojects.inc.php    26 Jul 2003 23:14:32 -0000      1.34.2.6.2.24
--- class.soprojects.inc.php    23 Aug 2003 01:33:08 -0000      1.34.2.6.2.25
***************
*** 456,459 ****
--- 456,460 ----
                        $values['investment_nr']        = 
$this->db->db_addslashes($values['investment_nr']);
                        $values['project_id']           = 
intval($values['project_id']);
+                       $values['parent']                       = 
intval($values['parent']);
  
                        $values['budget']                       = 
$values['budget'] + 0.0;
***************
*** 466,470 ****
                        if (!isset($values['main']) || !isset($values['level']))
                        {
!                               if ($values['parent'] && ($values['parent'] != 
0))
                                {
                                        $values['main']         = 
intval($this->id2item(array('project_id' => $values['parent'],'item' => 
'main')));
--- 467,471 ----
                        if (!isset($values['main']) || !isset($values['level']))
                        {
!                               if ($values['parent'] > 0)
                                {
                                        $values['main']         = 
intval($this->id2item(array('project_id' => $values['parent'],'item' => 
'main')));
***************
*** 478,482 ****
                                                        . $values['descr'] . 
"', title='" . $values['title'] . "', budget=" . $values['budget'] . ", num='"
                                                        . $values['number'] . 
"', time_planned=" . intval($values['ptime']) . ', processor=' . $this->account 
. ", investment_nr='"
!                                                       . 
$values['investment_nr'] . "', pcosts=" . $values['pcosts'] . ', parent=' . 
intval($values['parent'])
                                                        . ', level=' . 
intval($values['level']) . ' where id=' . 
$values['project_id'],__LINE__,__FILE__);
  
--- 479,483 ----
                                                        . $values['descr'] . 
"', title='" . $values['title'] . "', budget=" . $values['budget'] . ", num='"
                                                        . $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__);
  
***************
*** 1312,1315 ****
--- 1313,1322 ----
                {
                        $this->db->query('DELETE from phpgw_p_mstones where 
s_id=' . intval($s_id),__LINE__,__FILE__);
+               }
+ 
+               function delete_acl($project_id)
+               {
+                       $this->db->query("DELETE from phpgw_acl where 
acl_appname='projects' AND acl_location=" . $project_id
+                                                       . ' AND 
acl_rights=7',__LINE__,__FILE__);
                }
        }

Index: class.uiprojects.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/projects/inc/class.uiprojects.inc.php,v
retrieving revision 1.47.2.7.2.26
retrieving revision 1.47.2.7.2.27
diff -C2 -r1.47.2.7.2.26 -r1.47.2.7.2.27
*** class.uiprojects.inc.php    26 Jul 2003 23:00:06 -0000      1.47.2.7.2.26
--- class.uiprojects.inc.php    23 Aug 2003 01:33:08 -0000      1.47.2.7.2.27
***************
*** 52,55 ****
--- 52,56 ----
                        'archive'                       => True,
                        'accounts_popup'        => True,
+                       'e_accounts_popup'      => True,
                        'list_budget'           => True,
                        'view_pcosts'           => True,
***************
*** 125,128 ****
--- 126,130 ----
                        
$GLOBALS['phpgw']->template->set_var('lang_customer',lang('Customer'));
                        
$GLOBALS['phpgw']->template->set_var('lang_coordinator',lang('Coordinator'));
+                       
$GLOBALS['phpgw']->template->set_var('lang_employees',lang('Employees'));
                        
$GLOBALS['phpgw']->template->set_var('lang_creator',lang('creator'));
                        
$GLOBALS['phpgw']->template->set_var('lang_processor',lang('processor'));
***************
*** 184,188 ****
                        
$GLOBALS['phpgw']->template->set_var('link_hours',$GLOBALS['phpgw']->link('/index.php','menuaction=projects.uiprojecthours.list_hours'));
                        
$GLOBALS['phpgw']->template->set_var('link_statistics',$GLOBALS['phpgw']->link('/index.php','menuaction=projects.uistatistics.list_projects&action=mains'));
!                       
$GLOBALS['phpgw']->template->set_var('lang_statistics',lang("Statistics"));
                        
$GLOBALS['phpgw']->template->set_var('link_projects',$GLOBALS['phpgw']->link('/index.php','menuaction=projects.uiprojects.list_projects&action=mains'));
                        
$GLOBALS['phpgw']->template->set_var('lang_projects',lang('Projects'));
--- 186,190 ----
                        
$GLOBALS['phpgw']->template->set_var('link_hours',$GLOBALS['phpgw']->link('/index.php','menuaction=projects.uiprojecthours.list_hours'));
                        
$GLOBALS['phpgw']->template->set_var('link_statistics',$GLOBALS['phpgw']->link('/index.php','menuaction=projects.uistatistics.list_projects&action=mains'));
!                       
$GLOBALS['phpgw']->template->set_var('lang_statistics',lang('Statistics'));
                        
$GLOBALS['phpgw']->template->set_var('link_projects',$GLOBALS['phpgw']->link('/index.php','menuaction=projects.uiprojects.list_projects&action=mains'));
                        
$GLOBALS['phpgw']->template->set_var('lang_projects',lang('Projects'));
***************
*** 444,447 ****
--- 446,486 ----
                }
  
+               function employee_format($data)
+               {
+                       $selected       = 
(isset($data['selected'])?$data['selected']:'');
+                       $type           = ($data['type']?$data['type']:'list');
+                       $project_id     = 
($data['project_id']?$data['project_id']:0);
+ 
+                       if (!is_array($selected))
+                       {
+                               $selected = explode(',',$selected);
+                       }
+ 
+                       switch($type)
+                       {
+                               case 'list':
+                                       $employees = $this->bo->employee_list();
+                                       break;
+                               case 'field':
+                                       $employees = 
$this->bo->selected_employees($project_id);
+                                       $selected = 
$this->bo->get_acl_for_project($project_id);
+                                       break;
+                       }
+ 
+                       //_debug_array($employees);
+                       while (is_array($employees) && list($null,$account) = 
each($employees))
+                       {
+                               $s .= '<option value="' . 
$account['account_id'] . '"';
+                               if (in_array($account['account_id'],$selected))
+                               {
+                                       $s .= ' selected';
+                               }
+                               $s .= '>';
+                               $s .= $account['account_firstname'] . ' ' . 
$account['account_lastname']
+                                                                               
. ' [ ' . $account['account_lid'] . ' ]' . '</option>' . "\n";
+                       }
+                       return $s;
+               }
+ 
                function accounts_popup()
                {
***************
*** 449,452 ****
--- 488,496 ----
                }
  
+               function e_accounts_popup()
+               {
+                       
$GLOBALS['phpgw']->accounts->accounts_popup('e_projects');
+               }
+ 
                function edit_project()
                {
***************
*** 473,476 ****
--- 517,522 ----
                                $this->cat_id = 
($values['cat']?$values['cat']:'');
                                $values['coordinator']  = $_POST['accountid'];
+                               $values['employees']    = $_POST['employees'];
+ 
                                $values['project_id']   = $project_id;
                                $values['customer']             = 
$_POST['abid'];
***************
*** 528,531 ****
--- 574,581 ----
                        
$GLOBALS['phpgw']->template->set_block('edit_form','clist','clisthandle');
                        
$GLOBALS['phpgw']->template->set_block('edit_form','cfield','cfieldhandle');
+ 
+                       
$GLOBALS['phpgw']->template->set_block('edit_form','elist','elisthandle');
+                       
$GLOBALS['phpgw']->template->set_block('edit_form','efield','efieldhandle');
+ 
                        
$GLOBALS['phpgw']->template->set_block('edit_form','msfield1','msfield1handle');
                        
$GLOBALS['phpgw']->template->set_block('edit_form','msfield2','msfield2handle');
***************
*** 544,547 ****
--- 594,599 ----
                        
$GLOBALS['phpgw']->template->set_var('addressbook_link',$GLOBALS['phpgw']->link('/index.php','menuaction=projects.uiprojects.abook'));
                        
$GLOBALS['phpgw']->template->set_var('accounts_link',$GLOBALS['phpgw']->link('/index.php','menuaction=projects.uiprojects.accounts_popup'));
+                       
$GLOBALS['phpgw']->template->set_var('e_accounts_link',$GLOBALS['phpgw']->link('/index.php','menuaction=projects.uiprojects.e_accounts_popup'));
+ 
                        
$GLOBALS['phpgw']->template->set_var('lang_open_popup',lang('open popup 
window'));
                        $link_data['menuaction'] = 
'projects.uiprojects.edit_project';
***************
*** 728,731 ****
--- 780,788 ----
                                        
$GLOBALS['phpgw']->template->set_var('clisthandle','');
                                        
$GLOBALS['phpgw']->template->fp('cfieldhandle','cfield',True);
+ 
+                                       
$GLOBALS['phpgw']->template->set_var('employee_list',$this->employee_format(array('type'
 => 'field','project_id' => $project_id)));
+ 
+                                       
$GLOBALS['phpgw']->template->set_var('elisthandle','');
+                                       
$GLOBALS['phpgw']->template->fp('efieldhandle','efield',True);
                                        break;
                                default:
***************
*** 733,736 ****
--- 790,797 ----
                                                
$GLOBALS['phpgw']->template->set_var('cfieldhandle','');
                                                
$GLOBALS['phpgw']->template->fp('clisthandle','clist',True);
+ 
+                                       
$GLOBALS['phpgw']->template->set_var('employee_list',$this->employee_format(array('selected'
 => $values['employees'],'project_id' => $project_id)));
+                                               
$GLOBALS['phpgw']->template->set_var('efieldhandle','');
+                                               
$GLOBALS['phpgw']->template->fp('elisthandle','elist',True);
                                        break;
                        }





reply via email to

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