phpgroupware-cvs
[Top][All Lists]
Advanced

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

[Phpgroupware-cvs] CVS: property/inc class.uiproject.inc.php,1.26,1.27 c


From: Sigurd Nes <address@hidden>
Subject: [Phpgroupware-cvs] CVS: property/inc class.uiproject.inc.php,1.26,1.27 class.uilocation.inc.php,1.14,1.15class.uiequipment.inc.php,1.27,1.28 class.soproject.inc.php,1.16,1.17 class.solocation.inc.php,1.10,1.11 class.boproject.inc.php,1.7,1.8 class.bolocation.inc.php,1.12,1.13
Date: Fri, 20 Jun 2003 06:31:52 -0400

Update of /cvsroot/phpgroupware/property/inc
In directory subversions:/tmp/cvs-serv12507/inc

Modified Files:
        class.uiproject.inc.php class.uilocation.inc.php 
        class.uiequipment.inc.php class.soproject.inc.php 
        class.solocation.inc.php class.boproject.inc.php 
        class.bolocation.inc.php 
Log Message:
no message

Index: class.uiproject.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/property/inc/class.uiproject.inc.php,v
retrieving revision 1.26
retrieving revision 1.27
diff -C2 -r1.26 -r1.27
*** class.uiproject.inc.php     19 Jun 2003 20:03:09 -0000      1.26
--- class.uiproject.inc.php     20 Jun 2003 10:31:50 -0000      1.27
***************
*** 35,40 ****
                        $this->account                          = 
$GLOBALS['phpgw_info']['user']['account_id'];
  
-                       $this->grants                           = 
$GLOBALS['phpgw']->acl->get_grants($this->currentapp);
-                       $this->grants[$this->account] = PHPGW_ACL_READ + 
PHPGW_ACL_ADD + PHPGW_ACL_EDIT + PHPGW_ACL_DELETE;
                        $this->bo                                       = 
CreateObject($this->currentapp.'.boproject',True);
                        $this->so                                       = 
CreateObject($this->currentapp.'.soproject');
--- 35,38 ----
***************
*** 43,46 ****
--- 41,50 ----
                        $this->bolocation                       = 
CreateObject($this->currentapp.'.bolocation');
  
+                       $this->acl2                             = 
CreateObject($this->currentapp.'.acl2');
+                       $this->acl_read                         = 
$this->acl2->check('.project',1);
+                       $this->acl_add                          = 
$this->acl2->check('.project',2);
+                       $this->acl_edit                         = 
$this->acl2->check('.project',4);
+                       $this->acl_delete                       = 
$this->acl2->check('.project',8);
+ 
                        $this->start                            = 
$this->bo->start;
                        $this->query                            = 
$this->bo->query;
***************
*** 52,56 ****
  
                        
$GLOBALS['phpgw']->session->appsession('sub',$this->currentapp,'project');
- //_debug_array($GLOBALS['phpgw_info']['flags']);
                }
  
--- 56,59 ----
***************
*** 88,115 ****
                        $uicols = $this->bo->uicols;
  //_debug_array($uicols);
                        $j=0;
                        while (is_array($project_list) && list(,$project_entry) 
= each($project_list))
                        {
!                               for ($i=0;$i<count($uicols['name']);$i++)
                                {
!                                       if($uicols['input_type'][$i]!='hidden')
                                        {
  
!                                               
if($project_entry['query_location'][$uicols['name'][$i]])
                                                {
!                                                       
$content[$j]['row'][$i]['statustext']                   = lang('search');
!                                                       
$content[$j]['row'][$i]['text']                                 = 
$project_entry[$uicols['name'][$i]];
!                                                       
$content[$j]['row'][$i]['link']                         = 
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uiproject.index&query='
 . $project_entry['query_location'][$uicols['name'][$i]] . '&lookup=' . 
$lookup);
                                                }
                                                else
                                                {
!                                                       
$content[$j]['row'][$i]['value']                        = 
$project_entry[$uicols['name'][$i]];
!                                                       
$content[$j]['row'][$i]['name']                         = $uicols['name'][$i];
                                                }
  
                                        }
  
!                                       if($lookup && 
$i==(count($uicols['name'])-2))
!                                       
$content[$j]['row'][$i]['lookup_action']                        = 
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uiworkorder.edit&project_id='
 . $project_entry['project_id']);
  
                                }
--- 91,119 ----
                        $uicols = $this->bo->uicols;
  //_debug_array($uicols);
+ 
                        $j=0;
                        while (is_array($project_list) && list(,$project_entry) 
= each($project_list))
                        {
!                               for ($k=0;$k<count($uicols['name']);$k++)
                                {
!                                       if($uicols['input_type'][$k]!='hidden')
                                        {
  
!                                               
if($project_entry['query_location'][$uicols['name'][$k]])
                                                {
!                                                       
$content[$j]['row'][$k]['statustext']                   = lang('search');
!                                                       
$content[$j]['row'][$k]['text']                                 = 
$project_entry[$uicols['name'][$k]];
!                                                       
$content[$j]['row'][$k]['link']                         = 
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uiproject.index&query='
 . $project_entry['query_location'][$uicols['name'][$k]] . '&lookup=' . 
$lookup);
                                                }
                                                else
                                                {
!                                                       
$content[$j]['row'][$k]['value']                        = 
$project_entry[$uicols['name'][$k]];
!                                                       
$content[$j]['row'][$k]['name']                         = $uicols['name'][$k];
                                                }
  
                                        }
  
!                                       if($lookup && 
$k==(count($uicols['name'])-2))
!                                       
$content[$j]['row'][$k]['lookup_action']                        = 
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uiworkorder.edit&project_id='
 . $project_entry['project_id']);
  
                                }
***************
*** 117,129 ****
                                if(!$lookup)
                                {
!                                       $content[$j]['row'][$i]['statustext']   
                = lang('view the project');
!                                       $content[$j]['row'][$i]['text']         
                        = lang('view');
!                                       $content[$j]['row'][$i++]['link']       
                        = 
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uiproject.view&id='
 . $project_entry['project_id']);
!                                       $content[$j]['row'][$i]['statustext']   
                = lang('edit the project');
!                                       $content[$j]['row'][$i]['text']         
                        = lang('edit');
!                                       $content[$j]['row'][$i++]['link']       
                        = 
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uiproject.edit&id='
 . $project_entry['project_id']);
!                                       $content[$j]['row'][$i]['statustext']   
                = lang('delete the project');
!                                       $content[$j]['row'][$i]['text']         
                        = lang('delete');
!                                       $content[$j]['row'][$i++]['link']       
                        = 
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uiproject.delete&id='
 . $project_entry['project_id']);
                                }
  
--- 121,147 ----
                                if(!$lookup)
                                {
!                                       if($this->acl_read)
!                                       {
!                                               
$content[$j]['row'][$k]['statustext']                   = lang('view the 
project');
!                                               $content[$j]['row'][$k]['text'] 
                                = lang('view');
!                                               $content[$j]['row'][$k]['link'] 
                                = 
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uiproject.view&id='
 . $project_entry['project_id']);
!                                               $k++;
!                                       }
! 
!                                       if($this->acl_edit)
!                                       {
!                                               
$content[$j]['row'][$k]['statustext']                   = lang('edit the 
project');
!                                               $content[$j]['row'][$k]['text'] 
                                = lang('edit');
!                                               $content[$j]['row'][$k]['link'] 
                                = 
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uiproject.edit&id='
 . $project_entry['project_id']);
!                                               $k++;
!                                       }
! 
!                                       if($this->acl_delete)
!                                       {
!                                               
$content[$j]['row'][$k]['statustext']                   = lang('delete the 
project');
!                                               $content[$j]['row'][$k]['text'] 
                                = lang('delete');
!                                               $content[$j]['row'][$k]['link'] 
                                = 
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uiproject.delete&id='
 . $project_entry['project_id']);
!                                               $k++;
!                                       }
                                }
  
***************
*** 131,135 ****
                        }
  
- //_debug_array($content);
                        for ($i=0;$i<count($uicols['descr']);$i++)
                        {
--- 149,152 ----
***************
*** 192,207 ****
                        if(!$lookup)
                        {
!                               $table_header[$i]['width']                      
= '5%';
!                               $table_header[$i]['align']                      
= 'center';
!                               $table_header[$i]['header']             = 
lang('view');
!                               $i++;
!                               $table_header[$i]['width']                      
= '5%';
!                               $table_header[$i]['align']                      
= 'center';
!                               $table_header[$i]['header']             = 
lang('edit');
!                               $i++;
!                               $table_header[$i]['width']                      
= '5%';
!                               $table_header[$i]['align']                      
= 'center';
!                               $table_header[$i]['header']             = 
lang('delete');
!                               $i++;
                        }
                        else
--- 209,233 ----
                        if(!$lookup)
                        {
!                               if($this->acl_read)
!                               {
!                                       $table_header[$i]['width']              
        = '5%';
!                                       $table_header[$i]['align']              
        = 'center';
!                                       $table_header[$i]['header']             
        = lang('view');
!                                       $i++;
!                               }
!                               if($this->acl_edit)
!                               {
!                                       $table_header[$i]['width']              
        = '5%';
!                                       $table_header[$i]['align']              
        = 'center';
!                                       $table_header[$i]['header']             
        = lang('edit');
!                                       $i++;
!                               }
!                               if($this->acl_delete)
!                               {
!                                       $table_header[$i]['width']              
        = '5%';
!                                       $table_header[$i]['align']              
        = 'center';
!                                       $table_header[$i]['header']             
        = lang('delete');
!                                       $i++;
!                               }
                        }
                        else
***************
*** 212,221 ****
                        }
  
!                       $table_add[] = array
!                       (
!                               'lang_add'                              => 
lang('add'),
!                               'lang_add_statustext'   => lang('add a 
project'),
!                               'add_action'                    => 
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uiproject.edit')
!                       );
  
                        $link_data = array
--- 238,251 ----
                        }
  
! //_debug_array($content);
!                       if($this->acl_add)
!                       {
!                               $table_add[] = array
!                               (
!                                       'lang_add'                              
=> lang('add'),
!                                       'lang_add_statustext'   => lang('add a 
project'),
!                                       'add_action'                    => 
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uiproject.edit')
!                               );
!                       }
  
                        $link_data = array
***************
*** 287,294 ****
                function edit()
                {
                        $id                             = 
get_var('id',array('POST','GET'));
                        $values                         = 
get_var('values',array('POST'));
                        $add_request            = 
get_var('add_request',array('POST'));
! //_debug_array($add_request);
  
                        $GLOBALS['phpgw']->xslttpl->add_file(array('project'));
--- 317,331 ----
                function edit()
                {
+ 
+                       if(!$this->acl_add && !$this->acl_edit)
+                       {
+                               
$GLOBALS['phpgw']->redirect_link('/index.php','menuaction='.$this->currentapp.'.uiproject.index');
+                       }
                        $id                             = 
get_var('id',array('POST','GET'));
                        $values                         = 
get_var('values',array('POST'));
                        $add_request            = 
get_var('add_request',array('POST'));
! 
!                       $insert_record = 
$GLOBALS['phpgw']->session->appsession('insert_record',$this->currentapp);
! //_debug_array($insert_record);
  
                        $GLOBALS['phpgw']->xslttpl->add_file(array('project'));
***************
*** 303,311 ****
                        if($values && !$bypass)
                        {
! //                            $values = $values + 
$this->bocommon->get_location();
  
!                               for ($i=0; $i<count($insert_record); $i++)
                                {
!                                       
$values['location'][$insert_record[$i]]= $_POST[$insert_record[$i]];
                                }
  
--- 340,354 ----
                        if($values && !$bypass)
                        {
!                               for ($i=0; 
$i<count($insert_record['location']); $i++)
!                               {
!                                       
$values['location'][$insert_record['location'][$i]]= 
$_POST[$insert_record['location'][$i]];
!                               }
  
!                               while (is_array($insert_record['extra']) && 
list($key,) = each($insert_record['extra']))
                                {
!                                       if($_POST[$key])
!                                       {
!                                               $values['extra'][$key]  = 
$_POST[$key];
!                                       }
                                }
  
***************
*** 658,661 ****
--- 701,709 ----
                function delete()
                {
+                       if(!$this->acl_delete)
+                       {
+                               
$GLOBALS['phpgw']->redirect_link('/index.php','menuaction='.$this->currentapp.'.uiproject.index');
+                       }
+ 
                        $project_id = get_var('project_id',array('POST','GET'));
                        $confirm        = get_var('confirm',array('POST'));
***************
*** 694,697 ****
--- 742,750 ----
                function view()
                {
+                       if(!$this->acl_read)
+                       {
+                               
$GLOBALS['phpgw']->redirect_link('/index.php','menuaction='.$this->currentapp.'.uiproject.index');
+                       }
+ 
                        $id     = get_var('id',array('POST','GET'));
  

Index: class.uilocation.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/property/inc/class.uilocation.inc.php,v
retrieving revision 1.14
retrieving revision 1.15
diff -C2 -r1.14 -r1.15
*** class.uilocation.inc.php    19 Jun 2003 20:03:10 -0000      1.14
--- class.uilocation.inc.php    20 Jun 2003 10:31:50 -0000      1.15
***************
*** 300,309 ****
                        if($_POST['save'])
                        {
!                               for ($i=0; $i<count($insert_record); $i++)
                                {
!                                       $values[$insert_record[$i]]= 
$_POST[$insert_record[$i]];
                                }
                        }
  
                        $type_id                = 
get_var('type_id',array('GET'));
  
--- 300,318 ----
                        if($_POST['save'])
                        {
! 
!                               for ($i=0; 
$i<count($insert_record['location']); $i++)
!                               {
!                                       
$values[$insert_record['location'][$i]]= $_POST[$insert_record['location'][$i]];
!                               }
! 
!                               for ($i=0; $i<count($insert_record['extra']); 
$i++)
                                {
!                                       $values[$insert_record['extra'][$i]]= 
$_POST[$insert_record['extra'][$i]];
                                }
+ 
                        }
  
+ //    _debug_array($values);
+ 
                        $type_id                = 
get_var('type_id',array('GET'));
  
***************
*** 428,432 ****
                        $additional_fields[$j]['value']                 = 
$values[$additional_fields[$j]['input_name']];
                        $additional_fields[$j]['class']                 = 
'th_text';
!                       $insert_record[]                                        
        = $additional_fields[$j]['input_name'];
  
                        $j++;
--- 437,441 ----
                        $additional_fields[$j]['value']                 = 
$values[$additional_fields[$j]['input_name']];
                        $additional_fields[$j]['class']                 = 
'th_text';
!                       $insert_record['extra'][]                               
                = $additional_fields[$j]['input_name'];
  
                        $j++;
***************
*** 436,440 ****
                        $additional_fields[$j]['input_name']    = 'loc' . 
$type_id . '_name';
                        $additional_fields[$j]['value']                 = 
$values[$additional_fields[$j]['input_name']];
!                       $insert_record[]                                        
        = $additional_fields[$j]['input_name'];
                        $j++;
  
--- 445,449 ----
                        $additional_fields[$j]['input_name']    = 'loc' . 
$type_id . '_name';
                        $additional_fields[$j]['value']                 = 
$values[$additional_fields[$j]['input_name']];
!                       $insert_record['extra'][]                               
                = $additional_fields[$j]['input_name'];
                        $j++;
  
***************
*** 446,450 ****
                                $additional_fields[$j]['input_name']    = 
$custom['column_name'];
                                $additional_fields[$j]['value']                 
= $values[$additional_fields[$j]['input_name']];
!                               $insert_record[]                                
                = $additional_fields[$j]['input_name'];
  
                                $location_datatype[]= array('input_name'        
        => $custom['column_name'],
--- 455,459 ----
                                $additional_fields[$j]['input_name']    = 
$custom['column_name'];
                                $additional_fields[$j]['value']                 
= $values[$additional_fields[$j]['input_name']];
!                               $insert_record['extra'][]                       
                        = $additional_fields[$j]['input_name'];
  
                                $location_datatype[]= array('input_name'        
        => $custom['column_name'],
***************
*** 476,481 ****
                        $additional_fields[$j]['input_name']    = 'remark';
                        $additional_fields[$j]['value']                 = 
$values[$additional_fields[$j]['input_name']];
!                       $insert_record[]                                        
        = $additional_fields[$j]['input_name'];
!                       $insert_record[]                                        
        = 'cat_id';
  
  
--- 485,490 ----
                        $additional_fields[$j]['input_name']    = 'remark';
                        $additional_fields[$j]['value']                 = 
$values[$additional_fields[$j]['input_name']];
!                       $insert_record['extra'][]                               
                = $additional_fields[$j]['input_name'];
!                       $insert_record['extra'][]                               
                = 'cat_id';
  
  
***************
*** 490,494 ****
                                        {
                                                $edit_street=True;
!                                               $insert_record[]        = 
'street_id';
                                        }
  
--- 499,503 ----
                                        {
                                                $edit_street=True;
!                                               $insert_record['extra'][]       
= 'street_id';
                                        }
  
***************
*** 496,500 ****
                                        {
                                                $edit_tenant=True;
!                                               $insert_record[]        = 
'tenant_id';
                                        }
  
--- 505,509 ----
                                        {
                                                $edit_tenant=True;
!                                               $insert_record['extra'][]       
= 'tenant_id';
                                        }
  
***************
*** 505,509 ****
                                                $part_of_town_list              
                = 
$this->bocommon->select_part_of_town('select',$values['part_of_town_id']);
                                                $lang_town_statustext           
        = lang('Select the part of town the property belongs to. To do not use 
a part of town -  select NO PART OF TOWN');
!                                               $insert_record[]        = 
'part_of_town_id';
                                        }
                                        
if($config[$j]['column_name']=='owner_id')
--- 514,518 ----
                                                $part_of_town_list              
                = 
$this->bocommon->select_part_of_town('select',$values['part_of_town_id']);
                                                $lang_town_statustext           
        = lang('Select the part of town the property belongs to. To do not use 
a part of town -  select NO PART OF TOWN');
!                                               $insert_record['extra'][]       
= 'part_of_town_id';
                                        }
                                        
if($config[$j]['column_name']=='owner_id')
***************
*** 514,518 ****
                                                $lang_select_owner              
                = lang('Select owner');
                                                $lang_owner_statustext          
        = lang('Select the owner');
!                                               $insert_record[]        = 
'owner_id';
                                        }
                                }
--- 523,527 ----
                                                $lang_select_owner              
                = lang('Select owner');
                                                $lang_owner_statustext          
        = lang('Select the owner');
!                                               $insert_record['extra'][]       
= 'owner_id';
                                        }
                                }

Index: class.uiequipment.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/property/inc/class.uiequipment.inc.php,v
retrieving revision 1.27
retrieving revision 1.28
diff -C2 -r1.27 -r1.28
*** class.uiequipment.inc.php   19 Jun 2003 20:03:10 -0000      1.27
--- class.uiequipment.inc.php   20 Jun 2003 10:31:50 -0000      1.28
***************
*** 35,40 ****
                        $this->account                          = 
$GLOBALS['phpgw_info']['user']['account_id'];
  
-                       $this->grants                           = 
$GLOBALS['phpgw']->acl->get_grants($this->currentapp);
-                       $this->grants[$this->account] = PHPGW_ACL_READ + 
PHPGW_ACL_ADD + PHPGW_ACL_EDIT + PHPGW_ACL_DELETE;
                        $this->bo                                       = 
CreateObject($this->currentapp.'.boequipment',True);
                        $this->so                                       = 
CreateObject($this->currentapp.'.soequipment');
--- 35,38 ----
***************
*** 42,45 ****
--- 40,48 ----
                        $this->bolocation                       = 
CreateObject($this->currentapp.'.bolocation');
  
+                       $this->acl2                             = 
CreateObject($this->currentapp.'.acl2');
+                       $this->acl_read                         = 
$this->acl2->check('.equipment',1);
+                       $this->acl_add                          = 
$this->acl2->check('.equipment',2);
+                       $this->acl_edit                         = 
$this->acl2->check('.equipment',4);
+                       $this->acl_delete                       = 
$this->acl2->check('.equipment',8);
  
                        $this->start                            = 
$this->bo->start;
***************
*** 114,127 ****
                                }
  
! 
!                               $content[$j]['row'][$i]['statustext']           
        = lang('view the equipment');
!                               $content[$j]['row'][$i]['text']                 
                = lang('view');
!                               $content[$j]['row'][$i++]['link']               
                = 
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uiequipment.view&id='
 . $equipment_entry['equipment_id']);
!                               $content[$j]['row'][$i]['statustext']           
        = lang('edit the equipment');
!                               $content[$j]['row'][$i]['text']                 
                = lang('edit');
!                               $content[$j]['row'][$i++]['link']               
                = 
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uiequipment.edit&id='
 . $equipment_entry['equipment_id']);
!                               $content[$j]['row'][$i]['statustext']           
        = lang('delete the equipment');
!                               $content[$j]['row'][$i]['text']                 
                = lang('delete');
!                               $content[$j]['row'][$i++]['link']               
                = 
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uiequipment.delete&id='
 . $equipment_entry['equipment_id']);
  
                                $j++;
--- 117,138 ----
                                }
  
!                               if($this->acl_read)
!                               {
!                                       $content[$j]['row'][$i]['statustext']   
                = lang('view the equipment');
!                                       $content[$j]['row'][$i]['text']         
                        = lang('view');
!                                       $content[$j]['row'][$i++]['link']       
                        = 
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uiequipment.view&id='
 . $equipment_entry['equipment_id']);
!                               }
!                               if($this->acl_edit)
!                               {
!                                       $content[$j]['row'][$i]['statustext']   
                = lang('edit the equipment');
!                                       $content[$j]['row'][$i]['text']         
                        = lang('edit');
!                                       $content[$j]['row'][$i++]['link']       
                        = 
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uiequipment.edit&id='
 . $equipment_entry['equipment_id']);
!                               }
!                               if($this->acl_delete)
!                               {
!                                       $content[$j]['row'][$i]['statustext']   
                = lang('delete the equipment');
!                                       $content[$j]['row'][$i]['text']         
                        = lang('delete');
!                                       $content[$j]['row'][$i++]['link']       
                        = 
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uiequipment.delete&id='
 . $equipment_entry['equipment_id']);
!                               }
  
                                $j++;
***************
*** 188,210 ****
                        }
  
!                       $table_header[$i]['width']                      = '5%';
!                       $table_header[$i]['align']                      = 
'center';
!                       $table_header[$i]['header']             = lang('view');
!                       $i++;
!                       $table_header[$i]['width']                      = '5%';
!                       $table_header[$i]['align']                      = 
'center';
!                       $table_header[$i]['header']             = lang('edit');
!                       $i++;
!                       $table_header[$i]['width']                      = '5%';
!                       $table_header[$i]['align']                      = 
'center';
!                       $table_header[$i]['header']             = 
lang('delete');
!                       $i++;
  
!                       $table_add[] = array
!                       (
!                               'lang_add'                              => 
lang('add'),
!                               'lang_add_statustext'   => lang('add a 
equipment'),
!                               'add_action'                    => 
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uiequipment.edit')
!                       );
  
                        $link_data = array
--- 199,234 ----
                        }
  
!                       if($this->acl_read)
!                       {
!                               $table_header[$i]['width']                      
= '5%';
!                               $table_header[$i]['align']                      
= 'center';
!                               $table_header[$i]['header']                     
= lang('view');
!                               $i++;
!                       }
!                       if($this->acl_edit)
!                       {
!                               $table_header[$i]['width']                      
= '5%';
!                               $table_header[$i]['align']                      
= 'center';
!                               $table_header[$i]['header']                     
= lang('edit');
!                               $i++;
!                       }
!                       if($this->acl_delete)
!                       {
!                               $table_header[$i]['width']                      
= '5%';
!                               $table_header[$i]['align']                      
= 'center';
!                               $table_header[$i]['header']                     
= lang('delete');
!                               $i++;
!                       }
  
! 
!                       if($this->acl_add)
!                       {
!                               $table_add[] = array
!                               (
!                                       'lang_add'                              
=> lang('add'),
!                                       'lang_add_statustext'   => lang('add a 
equipment'),
!                                       'add_action'                    => 
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uiequipment.edit')
!                               );
!                       }
  
                        $link_data = array
***************
*** 263,266 ****
--- 287,295 ----
                function edit()
                {
+                       if(!$this->acl_add && !$this->acl_edit)
+                       {
+                               
$GLOBALS['phpgw']->redirect_link('/index.php','menuaction='.$this->currentapp.'.uiequipment.index');
+                       }
+ 
                        $id                             = 
get_var('id',array('POST','GET'));
                        $values                         = 
get_var('values',array('POST','GET'));
***************
*** 278,284 ****
                        {
  
!                               for ($i=0; $i<count($insert_record); $i++)
                                {
!                                       
$values['location'][$insert_record[$i]]= $_POST[$insert_record[$i]];
                                }
  
--- 307,321 ----
                        {
  
!                               for ($i=0; 
$i<count($insert_record['location']); $i++)
                                {
!                                       
$values['location'][$insert_record['location'][$i]]= 
$_POST[$insert_record['location'][$i]];
!                               }
! 
!                               while (is_array($insert_record['extra']) && 
list($key,) = each($insert_record['extra']))
!                               {
!                                       if($_POST[$key])
!                                       {
!                                               $values['extra'][$key]  = 
$_POST[$key];
!                                       }
                                }
  
***************
*** 289,292 ****
--- 326,335 ----
                                }
  
+                               if(!$values['location'])
+                               {
+                                       
$receipt['error'][]=array('msg'=>lang('Please select a location !'));
+                                       $error_id=true;
+                               }
+ 
                                if(!$values['cat_id'])
                                {
***************
*** 496,499 ****
--- 539,547 ----
                function delete()
                {
+                       if(!$this->acl_delete)
+                       {
+                               
$GLOBALS['phpgw']->redirect_link('/index.php','menuaction='.$this->currentapp.'.uiequipment.index');
+                       }
+ 
                        $equipment_id = 
get_var('equipment_id',array('POST','GET'));
                        $confirm        = get_var('confirm',array('POST'));
***************
*** 532,535 ****
--- 580,588 ----
                function view()
                {
+                       if(!$this->acl_read)
+                       {
+                               
$GLOBALS['phpgw']->redirect_link('/index.php','menuaction='.$this->currentapp.'.uiequipment.index');
+                       }
+ 
                        $id     = get_var('id',array('POST','GET'));
                        $values         = $this->bo->read_single($id);

Index: class.soproject.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/property/inc/class.soproject.inc.php,v
retrieving revision 1.16
retrieving revision 1.17
diff -C2 -r1.16 -r1.17
*** class.soproject.inc.php     19 Jun 2003 20:03:10 -0000      1.16
--- class.soproject.inc.php     20 Jun 2003 10:31:50 -0000      1.17
***************
*** 163,167 ****
                        }
  
!                       $filtermethod = ' ( fm_project.owner=' . $this->account;
                        if (is_array($this->grants))
                        {
--- 163,167 ----
                        }
  
!                       $filtermethod = ' ( fm_project.user_id=' . 
$this->account;
                        if (is_array($this->grants))
                        {
***************
*** 172,176 ****
                                }
                                reset($public_user_list);
!                               $filtermethod .= " OR 
(fm_project.access='public' OR fm_project.owner IN(" . 
implode(',',$public_user_list) . ")))";
                        }
                        else
--- 172,176 ----
                                }
                                reset($public_user_list);
!                               $filtermethod .= " OR 
(fm_project.access='public' OR fm_project.user_id IN(" . 
implode(',',$public_user_list) . ")))";
                        }
                        else
***************
*** 261,265 ****
                                $project['budget']                              
= (int)$this->db->f('budget');
                                $project['tenant_id']                   = 
$this->db->f('tenant_id');
!                               $project['owner']                               
= $this->db->f('owner');
                                $project['coordinator']                 = 
$this->db->f('coordinator');
                                $project['access']                              
= $this->db->f('access');
--- 261,265 ----
                                $project['budget']                              
= (int)$this->db->f('budget');
                                $project['tenant_id']                   = 
$this->db->f('tenant_id');
!                               $project['user_id']                             
= $this->db->f('user_id');
                                $project['coordinator']                 = 
$this->db->f('coordinator');
                                $project['access']                              
= $this->db->f('access');
***************
*** 342,348 ****
                }
  
!               function read_single_equipment_type($equipment_type_id)
                {
!                       $this->db->query("SELECT name FROM fm_equipment_type  
where id='$equipment_type_id'");
                        $this->db->next_record();
                        return $this->db->f('name');
--- 342,348 ----
                }
  
!               function equipment_type($equipment_id)
                {
!                       $this->db->query("SELECT fm_equipment_type.name FROM 
fm_equipment $this->join fm_equipment_type on fm_equipment.equipment_type_id= 
fm_equipment_type.id where equipment_id='$equipment_id'");
                        $this->db->next_record();
                        return $this->db->f('name');
***************
*** 383,386 ****
--- 383,408 ----
                {
  
+                       while (is_array($project['location']) && 
list($input_name,$value) = each($project['location']))
+                       {
+                               if($value)
+                               {
+                                       $cols[] = $input_name;
+                                       $vals[] = $value;
+                               }
+                       }
+ 
+                       while (is_array($project['extra']) && 
list($input_name,$value) = each($project['extra']))
+                       {
+                               if($value)
+                               {
+                                       $cols[] = $input_name;
+                                       $vals[] = $value;
+                               }
+                       }
+ 
+                       $cols   = "," . implode(",", $cols);
+                       $vals   = ",'" . implode("','", $vals) . "'";
+ 
+ 
                        
$this->historylog->add('SO',$project['project_id'],$project['status']);
                        
$this->historylog->add('TO',$project['project_id'],$project['cat_id']);
***************
*** 400,409 ****
                        $project['title'] = 
$this->db->db_addslashes($project['title']);
  //_debug_array($project);
!                       $this->db->query("INSERT INTO fm_project 
(id,name,equipment_id,access,category,entry_date,start_date,end_date,coordinator,status,"
!                               . 
"descr,title,budget,location_code,floor,address,key_deliver,key_fetch,other_branch,key_responsible,tenant_id,charge_tenant,owner)
 "
                                . "VALUES ('"
                                . $project['project_id']. "','"
                                . $project['name']. "','"
-                               . $project['equipment_id']. "','"
                                . "public','"
                                . $project['cat_id']. "','"
--- 422,430 ----
                        $project['title'] = 
$this->db->db_addslashes($project['title']);
  //_debug_array($project);
!                       $this->db->query("INSERT INTO fm_project 
(id,name,access,category,entry_date,start_date,end_date,coordinator,status,"
!                               . 
"descr,title,budget,location_code,floor,address,key_deliver,key_fetch,other_branch,key_responsible,tenant_id,charge_tenant,user_id
 $cols) "
                                . "VALUES ('"
                                . $project['project_id']. "','"
                                . $project['name']. "','"
                                . "public','"
                                . $project['cat_id']. "','"
***************
*** 425,429 ****
                                . $project['tenant_id']. "','"
                                . $project['charge_tenant'] . "','"
!                               . $this->account. "')",__LINE__,__FILE__);
  
  
--- 446,450 ----
                                . $project['tenant_id']. "','"
                                . $project['charge_tenant'] . "','"
!                               . $this->account. "' $vals 
)",__LINE__,__FILE__);
  
  
***************
*** 500,503 ****
--- 521,535 ----
                function edit($project)
                {
+                       while (is_array($project['location']) && 
list($input_name,$value) = each($project['location']))
+                       {
+                               $vals[] = "$input_name = '$value'";
+                       }
+                       while (is_array($project['extra']) && 
list($input_name,$value) = each($project['extra']))
+                       {
+                               $vals[] = "$input_name = '$value'";
+                       }
+ 
+                       $vals   = "," . implode(",",$vals);
+ 
                        $this->db->query("SELECT status,category,coordinator 
FROM fm_project where id='" .$project['project_id']."'",__LINE__,__FILE__);
  
***************
*** 520,531 ****
                        }
  
-                       if($project['street_number'])
-                       {
-                               $address= $project['street_name'] . ' ' . 
$project['street_number'];
-                       }
-                       else
-                       {
-                               $address= $project['street_name'];
-                       }
  
                        $project['descr'] = 
$this->db->db_addslashes($project['descr']);
--- 552,555 ----
***************
*** 552,558 ****
                                location_code   ='" . $project['location_code'] 
. "',
                                floor                   ='" . $project['floor'] 
. "',
!                               equipment_id    ='" . $project['equipment_id'] 
. "',
!                               address                 ='" . $address
!                               . "' WHERE id= '" . $project['project_id'] 
."'",__LINE__,__FILE__);
  
                        if($project['contact_phone'])
--- 576,581 ----
                                location_code   ='" . $project['location_code'] 
. "',
                                floor                   ='" . $project['floor'] 
. "',
!                               equipment_id    ='" . $project['equipment_id']
!                               . "' $vals WHERE id= '" . 
$project['project_id'] ."'",__LINE__,__FILE__);
  
                        if($project['contact_phone'])

Index: class.solocation.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/property/inc/class.solocation.inc.php,v
retrieving revision 1.10
retrieving revision 1.11
diff -C2 -r1.10 -r1.11
*** class.solocation.inc.php    19 Jun 2003 20:03:10 -0000      1.10
--- class.solocation.inc.php    20 Jun 2003 10:31:50 -0000      1.11
***************
*** 514,517 ****
--- 514,520 ----
                        }
  
+                       $cols.= 'fm_location' . $type_id .'.category as 
cat_id,';
+                       $cols_return[]                          = 'cat_id';
+ 
                        $cols.= 'loc' . $type_id .'_name';
                        $cols_return[]                          = 'loc' . 
$type_id .'_name';

Index: class.boproject.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/property/inc/class.boproject.inc.php,v
retrieving revision 1.7
retrieving revision 1.8
diff -C2 -r1.7 -r1.8
*** class.boproject.inc.php     19 Jun 2003 20:03:10 -0000      1.7
--- class.boproject.inc.php     20 Jun 2003 10:31:50 -0000      1.8
***************
*** 340,344 ****
                        }
  
!                       if($project['tenant_id'])
                        {
                                
$tenant_data=$this->bocommon->read_single_tenant($project['tenant_id']);
--- 340,350 ----
                        }
  
!                       if($project['equipment_id'])
!                       {
!                               $project['location_data']['equipment_id'] = 
$project['equipment_id'];
!                               $project['location_data']['equipment_type'] = 
$this->equipment_type($project['equipment_id']);
!                       }
! 
!                       if($project['tenant_id']>0)
                        {
                                
$tenant_data=$this->bocommon->read_single_tenant($project['tenant_id']);
***************
*** 348,351 ****
--- 354,364 ----
                                $project['location_data']['first_name'] = 
$tenant_data['first_name'];
                        }
+                       else
+                       {
+                               unset($project['location_data']['tenant_id']);
+                               
unset($project['location_data']['contact_phone']);
+                               unset($project['location_data']['last_name']);
+                               unset($project['location_data']['first_name']);
+                       }
  
  
***************
*** 430,433 ****
--- 443,458 ----
                function save($project,$action='')
                {
+ 
+ //_debug_array($project);
+                       while (is_array($project['location']) && list(,$value) 
= each($project['location']))
+                       {
+                               if($value)
+                               {
+                                       $location[] = $value;
+                               }
+                       }
+ 
+                       $project['location_code']=implode("-", $location);
+ 
                        $start_date     = 
$this->bocommon->date_array($project['start_date']);
                        $end_date       = 
$this->bocommon->date_array($project['end_date']);
***************
*** 435,439 ****
                        $project['start_date']  = mktime 
(2,0,0,$start_date['month'],$start_date['day'],$start_date['year']);
                        $project['end_date']    = mktime 
(2,0,0,$end_date['month'],$end_date['day'],$end_date['year']);
!                       
$project['location_code']=$this->bocommon->location_code($project['property_id'],$project['building_id'],$project['entrance_id'],$project['apartment_id']);
  
                        if ($action=='edit')
--- 460,464 ----
                        $project['start_date']  = mktime 
(2,0,0,$start_date['month'],$start_date['day'],$start_date['year']);
                        $project['end_date']    = mktime 
(2,0,0,$end_date['month'],$end_date['day'],$end_date['year']);
! 
  
                        if ($action=='edit')
***************
*** 454,460 ****
                }
  
!               function read_single_equipment_type($equipment_type_id)
                {
!                       return 
$this->so->read_single_equipment_type($equipment_type_id);
                }
  
--- 479,485 ----
                }
  
!               function equipment_type($equipment_id)
                {
!                       return $this->so->equipment_type($equipment_id);
                }
  

Index: class.bolocation.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/property/inc/class.bolocation.inc.php,v
retrieving revision 1.12
retrieving revision 1.13
diff -C2 -r1.12 -r1.13
*** class.bolocation.inc.php    18 Jun 2003 11:55:17 -0000      1.12
--- class.bolocation.inc.php    20 Jun 2003 10:31:50 -0000      1.13
***************
*** 202,206 ****
                                $location['location'][$i]['input_name']         
                = 'loc' . ($i+1);
                                $input_name[]                                   
                                        = 
$location['location'][$i]['input_name'];
!                               $insert_record[]                                
                                        = 
$location['location'][$i]['input_name'];
                                $location['location'][$i]['size']               
                        = 5;
                                $location['location'][$i]['name']               
                        = $location_types[($i)]['name'];
--- 202,206 ----
                                $location['location'][$i]['input_name']         
                = 'loc' . ($i+1);
                                $input_name[]                                   
                                        = 
$location['location'][$i]['input_name'];
!                               $insert_record['location'][]                    
                        = $location['location'][$i]['input_name'];
                                $location['location'][$i]['size']               
                        = 5;
                                $location['location'][$i]['name']               
                        = $location_types[($i)]['name'];
***************
*** 299,303 ****
                                                
$location['location'][$i]['lookup_function_call']                               
= $lookup_functions[$m]['name'];
                                                
$location['location'][$i]['statustext']                                         
        = lang('tenant');
! //                                            $insert_record[]                
                                                                                
= 'tenant_id';
  
                                                
$location['location'][$i]['extra'][0]['input_type']                             
= 'text';
--- 299,303 ----
                                                
$location['location'][$i]['lookup_function_call']                               
= $lookup_functions[$m]['name'];
                                                
$location['location'][$i]['statustext']                                         
        = lang('tenant');
!                                               
$insert_record['extra']['tenant_id']                                            
                                = 'tenant_id';
  
                                                
$location['location'][$i]['extra'][0]['input_type']                             
= 'text';
***************
*** 324,328 ****
                                                
$location['location'][$i]['extra'][2]['size']                                   
= 12;
                                                
$location['location'][$i]['extra'][2]['lookup_function_call']   = 
'';//$lookup_functions[$m]['name'];
!                                               $insert_record[]                
                                                                                
= 'contact_phone';
                                                
$location['location'][$i]['extra'][2]['value']                                  
= $data['values']['contact_phone'];
                                                
$location['location'][$i]['extra'][2]['statustext']                             
= lang('contact phone');
--- 324,328 ----
                                                
$location['location'][$i]['extra'][2]['size']                                   
= 12;
                                                
$location['location'][$i]['extra'][2]['lookup_function_call']   = 
'';//$lookup_functions[$m]['name'];
!                                               
$insert_record['extra']['contact_phone']                                        
                                        = 'contact_phone';
                                                
$location['location'][$i]['extra'][2]['value']                                  
= $data['values']['contact_phone'];
                                                
$location['location'][$i]['extra'][2]['statustext']                             
= lang('contact phone');
***************
*** 358,362 ****
                                $location['location'][$i]['input_name']         
                                        = 'equipment_id';
                                $input_name[]                                   
                                                                = 
'equipment_id';
!                               $insert_record[]                                
                                                                = 
'equipment_id';
                                $location['location'][$i]['size']               
                                                = 12;
                                
$location['location'][$i]['lookup_function_call']                               
= 'lookup_equipment()';
--- 358,362 ----
                                $location['location'][$i]['input_name']         
                                        = 'equipment_id';
                                $input_name[]                                   
                                                                = 
'equipment_id';
!                               $insert_record['extra']['equipment_id']         
                                                        = 'equipment_id';
                                $location['location'][$i]['size']               
                                                = 12;
                                
$location['location'][$i]['lookup_function_call']                               
= 'lookup_equipment()';





reply via email to

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