phpgroupware-cvs
[Top][All Lists]
Advanced

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

[Phpgroupware-cvs] CVS: property/inc class.uireport.inc.php,1.9,1.10 cla


From: Sigurd Nes <address@hidden>
Subject: [Phpgroupware-cvs] CVS: property/inc class.uireport.inc.php,1.9,1.10 class.uidocument.inc.php,1.11,1.12 class.sodocument.inc.php,1.6,1.7 class.bodocument.inc.php,1.7,1.8
Date: Thu, 26 Jun 2003 08:23:07 -0400

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

Modified Files:
        class.uireport.inc.php class.uidocument.inc.php 
        class.sodocument.inc.php class.bodocument.inc.php 
Log Message:
no message

Index: class.uireport.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/property/inc/class.uireport.inc.php,v
retrieving revision 1.9
retrieving revision 1.10
diff -C2 -r1.9 -r1.10
*** class.uireport.inc.php      26 Jun 2003 09:02:06 -0000      1.9
--- class.uireport.inc.php      26 Jun 2003 12:23:05 -0000      1.10
***************
*** 91,95 ****
  
                        $uicols = $this->bo->uicols;
- //_debug_array($uicols);
  
                        $j=0;
--- 91,94 ----

Index: class.uidocument.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/property/inc/class.uidocument.inc.php,v
retrieving revision 1.11
retrieving revision 1.12
diff -C2 -r1.11 -r1.12
*** class.uidocument.inc.php    26 Jun 2003 09:02:06 -0000      1.11
--- class.uidocument.inc.php    26 Jun 2003 12:23:05 -0000      1.12
***************
*** 39,42 ****
--- 39,50 ----
                        $this->bocommon                         = 
CreateObject($this->currentapp.'.bocommon');
                        $this->bolocation                       = 
CreateObject($this->currentapp.'.bolocation');
+                       $this->config                           = 
CreateObject('phpgwapi.config',$this->currentapp);
+ 
+                       $this->acl2                             = 
CreateObject($this->currentapp.'.acl2');
+                       $this->acl_read                         = 
$this->acl2->check('.document',1);
+                       $this->acl_add                          = 
$this->acl2->check('.document',2);
+                       $this->acl_edit                         = 
$this->acl2->check('.document',4);
+                       $this->acl_delete                       = 
$this->acl2->check('.document',8);
+ 
                        $this->rootdir                          = 
$this->bo->rootdir;
                        $this->fakebase                         = 
$this->bo->fakebase;
***************
*** 72,81 ****
                {
  
!                       $GLOBALS['phpgw']->xslttpl->add_file(array('document',
                                                                                
'menu',
                                                                                
'nextmatchs',
                                                                                
'search_field'));
  
!                       $lookup = get_var('lookup',array('POST','GET'));
                        $links = $this->bocommon->menu();
  
--- 80,89 ----
                {
  
!                       
$GLOBALS['phpgw']->xslttpl->add_file(array('document','values','table_header',
                                                                                
'menu',
                                                                                
'nextmatchs',
                                                                                
'search_field'));
  
! //                    $lookup = get_var('lookup',array('POST','GET'));
                        $links = $this->bocommon->menu();
  
***************
*** 84,164 ****
  //_debug_array($document_list);
  
!                       while (is_array($document_list) && list(,$document) = 
each($document_list))
                        {
!                               $location       = split("-", 
$document['location_code']);
  
!                               $content[] = array
!                               (
!                                       'document_id'                           
=> $document['document_id'],
!                                       'equipment_id'                          
=> $document['equipment_id'],
!                                       'equipment_type'                        
=> $document['equipment_type'],
!                                       'property_id'                           
=> $location[0],
!                                       'building_id'                           
=> $location[1],
!                                       'entrance_id'                           
=> $location[2],
!                                       'floor'                                 
        => $document['floor'],
!                                       'address'                               
        => $document['address'],
!                                       'link_view'                             
        => 
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uidocument.list_doc&location_code='
 . $document['location_code'] . '&equipment_id=' . $document['equipment_id']),
!                                       'lang_view_statustext'          => 
lang('view documents for this location/equipment'),
!                                       'text_view'                             
        => lang('documents'),
!                                       'text_edit'                             
        => lang('edit'),
!                                       'text_delete'                           
=> lang('delete')
!                               );
!                       }
  
  
!                       $table_header[] = array
!                       (
!                               'sort_equipment_id'     => 
$this->nextmatchs->show_sort_order(array
                                                                                
(
                                                                                
        'sort'  => $this->sort,
!                                                                               
        'var'   =>      'equipment_id',
                                                                                
        'order' =>      $this->order,
!                                                                               
        'extra' => array('menuaction'           => 
$this->currentapp.'.uidocument.index',
!                                                                               
                                                        'cat_id'                
=>$this->cat_id,
                                                                                
                                                        'district_id'   => 
$this->district_id,
!                                                                               
                                                        'filter'                
=>$this->filter,
!                                                                               
                                                        'query'                 
=>$this->query)
!                                                                               
)),
!                               'lang_equipment_id'     => lang('equipment_id'),
!                               'lang_equipment_type'   => lang('type'),
!                               'sort_property' => 
$this->nextmatchs->show_sort_order(array
                                                                                
(
                                                                                
        'sort'  => $this->sort,
!                                                                               
        'var'   =>      'location_code',
                                                                                
        'order' =>      $this->order,
!                                                                               
        'extra'         => array('menuaction'           => 
$this->currentapp.'.uidocument.index',
!                                                                               
                                                        'cat_id'                
=>$this->cat_id,
                                                                                
                                                        'district_id'   => 
$this->district_id,
!                                                                               
                                                        'filter'                
=>$this->filter,
!                                                                               
                                                        'query'                 
=>$this->query)
!                                                                               
)),
!                               'lang_property'         => lang('Property'),
!                               'lang_building'         => lang('Building'),
!                               'lang_entrance'         => lang('Entrance'),
!                               'lang_floor'            => lang('Floor'),
!                               'sort_address'  => 
$this->nextmatchs->show_sort_order(array
                                                                                
(
                                                                                
        'sort'  => $this->sort,
                                                                                
        'var'   =>      'address',
                                                                                
        'order' =>      $this->order,
!                                                                               
        'extra'         => array('menuaction'           => 
$this->currentapp.'.uidocument.index',
!                                                                               
                                                        'cat_id'                
=>$this->cat_id,
                                                                                
                                                        'district_id'   => 
$this->district_id,
!                                                                               
                                                        'filter'                
=>$this->filter,
!                                                                               
                                                        'query'                 
=>$this->query)
!                                                                               
)),
!                               'lang_address'  => lang('Address'),
!                               'lang_view'                     => lang('view'),
!                               'lang_edit'                     => lang('edit'),
!                               'lang_delete'           => lang('delete'),
!                               'lang_select'           => lang('Select')
!                               );
  
!                       $table_add[] = array
!                       (
!                               'lang_add'                              => 
lang('add'),
!                               'lang_add_statustext'   => lang('add a 
document'),
!                               'add_action'                    => 
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uidocument.edit')
!                       );
  
                        $link_data = array
--- 92,211 ----
  //_debug_array($document_list);
  
! 
!                       $uicols = $this->bo->uicols;
! 
!                       $j=0;
!                       while (is_array($document_list) && 
list(,$document_entry) = each($document_list))
                        {
!                               for ($k=0;$k<count($uicols['name']);$k++)
!                               {
!                                       if($uicols['input_type'][$k]!='hidden')
!                                       {
  
!                                               
if($document_entry['query_location'][$uicols['name'][$k]])
!                                               {
!                                                       
$content[$j]['row'][$k]['statustext']           = lang('search');
!                                                       
$content[$j]['row'][$k]['text']                         = 
$document_entry[$uicols['name'][$k]];
!                                                       
$content[$j]['row'][$k]['link']                         = 
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uidocument.index&query='
 . $document_entry['query_location'][$uicols['name'][$k]] . '&lookup=' . 
$lookup . '&cat_id=' . $this->cat_id);
!                                               }
!                                               else
!                                               {
!                                                       
$content[$j]['row'][$k]['value']                        = 
$document_entry[$uicols['name'][$k]];
!                                                       
$content[$j]['row'][$k]['name']                         = $uicols['name'][$k];
!                                               }
  
+                                       }
+                               }
  
!                               if(!$lookup)
!                               {
!                                       if($this->acl_read)
!                                       {
!                                               
$content[$j]['row'][$k]['statustext']                   = lang('view documents 
for this location/equipment');
!                                               $content[$j]['row'][$k]['text'] 
                                = lang('documents');
!                                               $content[$j]['row'][$k]['link'] 
                                = 
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uidocument.list_doc&location_code='
 . $document_entry['location_code'] . '&equipment_id=' . 
$document_entry['equipment_id']);
!                                               $k++;
!                                       }
!                               }
! 
!                               $j++;
!                       }
! 
!                       for ($i=0;$i<count($uicols['descr']);$i++)
!                       {
!                               if($uicols['input_type'][$i]!='hidden')
!                               {
!                                       $table_header[$i]['header']     = 
$uicols['descr'][$i];
!                                       $table_header[$i]['width']              
= '5%';
!                                       $table_header[$i]['align']              
= 'center';
!                                       if($uicols['name'][$i]=='loc1')
!                                       {
!                                               $table_header[$i]['sort_link']  
=true;
!                                               $table_header[$i]['sort']       
        = $this->nextmatchs->show_sort_order(array
                                                                                
(
                                                                                
        'sort'  => $this->sort,
!                                                                               
        'var'   =>      'location_code',
                                                                                
        'order' =>      $this->order,
!                                                                               
        'extra'         => array('menuaction'   => 
$this->currentapp.'.uidocument.index',
!                                                                               
                                                        'type_id'       
=>$type_id,
!                                                                               
                                                        'query'         
=>$this->query,
!                                                                               
                                                        'lookup'        
=>$lookup,
                                                                                
                                                        'district_id'   => 
$this->district_id,
!                                                                               
                                                        'cat_id'        
=>$this->cat_id)
!                                                                               
));
!                                       }
!                                       if($uicols['name'][$i]=='document_id')
!                                       {
!                                               $table_header[$i]['sort_link']  
=true;
!                                               $table_header[$i]['sort']       
        = $this->nextmatchs->show_sort_order(array
                                                                                
(
                                                                                
        'sort'  => $this->sort,
!                                                                               
        'var'   =>      'document_id',
                                                                                
        'order' =>      $this->order,
!                                                                               
        'extra'         => array('menuaction'   => 
$this->currentapp.'.uidocument.index',
!                                                                               
                                                        'type_id'       
=>$type_id,
!                                                                               
                                                        'query'         
=>$this->query,
!                                                                               
                                                        'lookup'        
=>$lookup,
                                                                                
                                                        'district_id'   => 
$this->district_id,
!                                                                               
                                                        'cat_id'        
=>$this->cat_id)
!                                                                               
));
!                                       }
!                                       if($uicols['name'][$i]=='address')
!                                       {
!                                               $table_header[$i]['sort_link']  
=true;
!                                               $table_header[$i]['sort']       
        = $this->nextmatchs->show_sort_order(array
                                                                                
(
                                                                                
        'sort'  => $this->sort,
                                                                                
        'var'   =>      'address',
                                                                                
        'order' =>      $this->order,
!                                                                               
        'extra'         => array('menuaction'   => 
$this->currentapp.'.uidocument.index',
!                                                                               
                                                        'type_id'       
=>$type_id,
!                                                                               
                                                        'query'         
=>$this->query,
!                                                                               
                                                        'lookup'        
=>$lookup,
                                                                                
                                                        'district_id'   => 
$this->district_id,
!                                                                               
                                                        'cat_id'        
=>$this->cat_id)
!                                                                               
));
!                                       }
!                               }
!                       }
  
!                       if($this->acl_read)
!                       {
!                               $table_header[$i]['width']                      
= '5%';
!                               $table_header[$i]['align']                      
= 'center';
!                               $table_header[$i]['header']                     
= lang('view');
!                               $i++;
!                       }
! 
!                       if($this->acl_add)
!                       {
!                               $table_add[] = array
!                               (
!                                       'lang_add'                              
=> lang('add'),
!                                       'lang_add_statustext'   => lang('add a 
document'),
!                                       'add_action'                    => 
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uidocument.edit')
! 
!                               );
!                       }
  
                        $link_data = array
***************
*** 265,268 ****
--- 312,319 ----
  //_debug_array($receipt);
  
+ 
+                       $this->config->read_repository();
+                       $link_to_files = 
$this->config->config_data['files_url'];
+ 
                        $links = $this->bocommon->menu();
  
***************
*** 271,285 ****
  //_debug_array($document_list);
  
                        while (is_array($document_list) && list(,$document) = 
each($document_list))
                        {
  
                                $content[] = array
                                (
                                        'document_id'                           
=> $document['document_id'],
                                        'document_name'                         
=> $document['document_name'],
                                        'title'                                 
        => $document['title'],
!                                       'owner'                                 
        => $document['owner'],
                                        'category'                              
        => $document['category'],
!                                       'link_view_file'                        
=> 
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uidocument.view_file&document_id='
 . $document['document_id']),
                                        'link_view'                             
        => 
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uidocument.view&document_id='
 . $document['document_id'] . '&from=list_doc'),
                                        'link_edit'                             
        => 
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uidocument.edit&document_id='
 . $document['document_id'] . '&from=list_doc'),
--- 322,351 ----
  //_debug_array($document_list);
  
+                       if(!$equipment_id)
+                       {
+                               $directory      = 'home/document' . SEP . 
$location['loc1'];
+                       }
+                       else
+                       {
+                               $directory      = 'home/document' . SEP . 
$location['loc1'] . SEP . $equipment_id;
+                       }
+ 
                        while (is_array($document_list) && list(,$document) = 
each($document_list))
                        {
+                               if(!$link_to_files)
+                               {
+                                       $link_view_file = 
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uidocument.view_file&document_id='
 . $document['document_id']);
+                               }
  
                                $content[] = array
                                (
+                                       'directory'                             
        => $directory,
                                        'document_id'                           
=> $document['document_id'],
                                        'document_name'                         
=> $document['document_name'],
                                        'title'                                 
        => $document['title'],
!                                       'user'                                  
        => $document['user'],
                                        'category'                              
        => $document['category'],
!                                       'link_view_file'                        
=> $link_view_file,
!                                       'link_to_files'                         
=> $link_to_files,
                                        'link_view'                             
        => 
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uidocument.view&document_id='
 . $document['document_id'] . '&from=list_doc'),
                                        'link_edit'                             
        => 
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uidocument.edit&document_id='
 . $document['document_id'] . '&from=list_doc'),
***************
*** 338,343 ****
                        );
  
- 
- //_debug_array($link_data);
                        $msgbox_data = $this->bocommon->msgbox_data($receipt);
  
--- 404,407 ----
***************
*** 409,420 ****
                        $document_id            = 
get_var('document_id',array('POST','GET'));
                        $values = $this->bo->read_single($document_id);
! 
                        if(!$values['equipment_id'])
                        {
!                               $file = $this->fakebase. SEP . 'document' . SEP 
. $values['property_id'] . SEP . $values['document_name'];
                        }
                        else
                        {
!                               $file = $this->fakebase. SEP . 'document' . SEP 
. $values['property_id'] . SEP . $values['equipment_id'] . SEP . 
$values['document_name'];
                        }
  
--- 473,484 ----
                        $document_id            = 
get_var('document_id',array('POST','GET'));
                        $values = $this->bo->read_single($document_id);
! //_debug_array($values);
                        if(!$values['equipment_id'])
                        {
!                               $file = $this->fakebase. SEP . 'document' . SEP 
. $values['location_data']['loc1'] . SEP . $values['document_name'];
                        }
                        else
                        {
!                               $file = $this->fakebase. SEP . 'document' . SEP 
. $values['location_data']['loc1'] . SEP . $values['equipment_id'] . SEP . 
$values['document_name'];
                        }
  
***************
*** 455,458 ****
--- 519,523 ----
                        $document_id            = 
get_var('document_id',array('POST','GET'));
                        $values                         = 
get_var('values',array('POST'));
+                       $insert_record          = 
$GLOBALS['phpgw']->session->appsession('insert_record',$this->currentapp);
  
                        if(!$from)
***************
*** 464,492 ****
                        $receipt        = $this->bo->create_home_dir();
  
!                       if($values)
!                       {
!                               $values = $values + 
$this->bocommon->get_location();
!                       }
!                       else
                        {
-                               $location_code                          = 
get_var('location_code',array('POST','GET'));
-                               $values['equipment_id']         = 
get_var('equipment_id',array('POST','GET'));
-                               $values['descr']                        = 
get_var('descr',array('POST','GET'));
  
!                               if($location_code)
!                               {
!                                       
$location_data=$this->bocommon->read_location_data($location_code);
  
!                                       $values=$values + $location_data;
                                }
-                       }
  
!                       $values['document_date']                = 
get_var('document_date',array('POST'));
!                       $values['vendor_id']            = 
get_var('vendor_id',array('POST'));
  
! //_debug_array($values);
  
-                       if ($values['save'])
-                       {
                                
$values['document_name']=$_FILES['document_file']['name'];
  
--- 529,560 ----
                        $receipt        = $this->bo->create_home_dir();
  
! //_debug_array($values);
! 
!                       if ($values['save'])
                        {
  
!                               $values['document_date']                = 
get_var('document_date',array('POST'));
!                               $values['vendor_id']            = 
get_var('vendor_id',array('POST'));
  
!                               for ($i=0; 
$i<count($insert_record['location']); $i++)
!                               {
!                                       
if($_POST[$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];
!                                       }
!                               }
  
!                               $values['street_name']          = 
$_POST['street_name'];
!                               $values['street_number']        = 
$_POST['street_number'];
!                               $values['location_name']        = $_POST['loc' 
. (count($values['location'])).'_name']; // if not address - get the parent 
name as address
  
                                
$values['document_name']=$_FILES['document_file']['name'];
  
***************
*** 506,521 ****
  //                                    
$receipt['error'][]=array('msg'=>lang('Please select a status !'));
                                }
!                               if(!$values['property_id'])
                                {
                                        
$receipt['error'][]=array('msg'=>lang('Please select a location !'));
                                }
  
!                               if(!$values['equipment_id'])
                                {
!                                       $to_file = $this->fakebase. SEP . 
'document' . SEP . $values['property_id'] . SEP . $values['document_name'];
                                }
                                else
                                {
!                                       $to_file = $this->fakebase. SEP . 
'document' . SEP . $values['property_id'] . SEP . $values['equipment_id'] . SEP 
. $values['document_name'];
                                }
  
--- 574,590 ----
  //                                    
$receipt['error'][]=array('msg'=>lang('Please select a status !'));
                                }
!                               if(!$values['location'])
                                {
                                        
$receipt['error'][]=array('msg'=>lang('Please select a location !'));
                                }
  
! //_debug_array($values);
!                               if(!$values['extra']['equipment_id'])
                                {
!                                       $to_file = $this->fakebase. SEP . 
'document' . SEP . $values['location']['loc1'] . SEP . $values['document_name'];
                                }
                                else
                                {
!                                       $to_file = $this->fakebase. SEP . 
'document' . SEP . $values['location']['loc1'] . SEP . 
$values['extra']['equipment_id'] . SEP . $values['document_name'];
                                }
  
***************
*** 528,532 ****
                                }
  
!                               
$this->bo->create_document_dir($values['property_id'], $values['equipment_id']);
  
                                $values['document_id'] = $document_id;
--- 597,601 ----
                                }
  
!                               
$this->bo->create_document_dir($values['location']['loc1'], 
$values['extra']['equipment_id']);
  
                                $values['document_id'] = $document_id;
***************
*** 553,557 ****
        //                                      
$document_id=$receipt['document_id'];
                                                
$GLOBALS['phpgw']->session->appsession('session_data','document_receipt',$receipt);
!                                               
$GLOBALS['phpgw']->redirect_link('/index.php','menuaction='.$this->currentapp.'.uidocument.list_doc&location_code='
 .$values['location_code'] . '&equipment_id=' . $values['equipment_id'] );
                                        }
                                }
--- 622,626 ----
        //                                      
$document_id=$receipt['document_id'];
                                                
$GLOBALS['phpgw']->session->appsession('session_data','document_receipt',$receipt);
!                                               
$GLOBALS['phpgw']->redirect_link('/index.php','menuaction='.$this->currentapp.'.uidocument.list_doc&location_code='
 .implode("-", $values['location']) . '&equipment_id=' . 
$values['extra']['equipment_id'] );
                                        }
                                }
***************
*** 559,562 ****
--- 628,636 ----
                                {
                                        $values['document_name']='';
+                                       if($values['location'])
+                                       {
+                                               $location_code=implode("-", 
$values['location']);
+                                               $values['location_data'] = 
$this->bolocation->read_single($location_code,$values['extra']);
+                                       }
                                }
                        }
***************
*** 587,604 ****
  
  
!                       
$location_data=$this->bocommon->initiate_ui_location(array(
!                                               'location_type' => 'form',
!                                               'equipment'             => true,
!                                               'apartment'             => true,
!                                               'equipment_id'  => 
$values['equipment_id'],
!                                               'property_id'   => 
$values['property_id'],
!                                               'property_name' => 
$values['property_name'],
!                                               'building_id'   => 
$values['building_id'],
!                                               'entrance_id'   => 
$values['entrance_id'],
!                                               'floor'                 => 
$values['floor'],
!                                               'street_name'   => 
$values['street_name'],
!                                               'street_number' => 
$values['street_number'],
!                                               'apartment_id'  => 
$values['apartment_id']));
! 
  
  
--- 661,672 ----
  
  
!                       
$location_data=$this->bolocation->initiate_ui_location(array(
!                                               'values'                => 
$values['location_data'],
!                                               'type_id'               => -1, 
// calculated from location_types
!                                               'no_link'               => 
False, // disable lookup links for location type less than type_id
!                                               'tenant'                => 
False,
!                                               'equipment'             => True,
!                                               'lookup_type'   => 'form'
!                                               ));
  
  
***************
*** 809,827 ****
                        }
  
! 
!                       
$location_data=$this->bocommon->initiate_ui_location(array(
!                                               'location_type' => 'view',
!                                               'equipment'             => true,
!                                               'apartment'             => true,
!                                               'equipment_id'  => 
$values['equipment_id'],
!                                               'property_id'   => 
$values['property_id'],
!                                               'property_name' => 
$values['property_name'],
!                                               'building_id'   => 
$values['building_id'],
!                                               'entrance_id'   => 
$values['entrance_id'],
!                                               'floor'                 => 
$values['floor'],
!                                               'street_name'   => 
$values['street_name'],
!                                               'street_number' => 
$values['street_number'],
!                                               'apartment_id'  => 
$values['apartment_id']));
! 
  
  
--- 877,888 ----
                        }
  
!                       
$location_data=$this->bolocation->initiate_ui_location(array(
!                                               'values'                => 
$values['location_data'],
!                                               'type_id'               => 
count(explode('-',$values['location_data']['location_code'])),
!                                               'no_link'               => 
False, // disable lookup links for location type less than type_id
!                                               'tenant'                => 
False,
!                                               'equipment'             => 
$values['location_data']['equipment_id'],
!                                               'lookup_type'   => 'view'
!                                               ));
  
  

Index: class.sodocument.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/property/inc/class.sodocument.inc.php,v
retrieving revision 1.6
retrieving revision 1.7
diff -C2 -r1.6 -r1.7
*** class.sodocument.inc.php    21 May 2003 20:09:51 -0000      1.6
--- class.sodocument.inc.php    26 Jun 2003 12:23:05 -0000      1.7
***************
*** 16,20 ****
                        $this->db                       = $GLOBALS['phpgw']->db;
                        $this->db2                      = $this->db;
-                       $this->grants           = 
$GLOBALS['phpgw']->acl->get_grants($this->currentapp);
                        $this->account          = 
$GLOBALS['phpgw_info']['user']['account_id'];
                        $this->bocommon         = 
CreateObject($this->currentapp.'.bocommon',True);
--- 16,19 ----
***************
*** 103,106 ****
--- 102,142 ----
                        }
  
+ 
+                       $entity_table = 'fm_document';
+ 
+                       $cols .= $entity_table . '.location_code';
+                       $cols_return[] = 'location_code';
+ 
+                       $cols .= ",$entity_table.id as document_id";
+                       $cols_return[]                          = 'document_id';
+ 
+ 
+                       if ($cat_id == 'equipment')
+                       {
+                               $cols .= ",$entity_table.equipment_id";
+                               $cols_return[]                          = 
'equipment_id';
+                               $uicols['input_type'][]         = 'text';
+                               $uicols['name'][]                       = 
'equipment_id';
+                               $uicols['descr'][]                      = 
lang('Equipment ID');
+                               $uicols['statustext'][]         = 
lang('Equipment ID');
+ 
+                               $cols .= ',fm_equipment_type.name as 
equipment_type';
+                               $cols_return[]                          = 
'equipment_type';
+                               $uicols['input_type'][]         = 'text';
+                               $uicols['name'][]                       = 
'equipment_type';
+                               $uicols['descr'][]                      = 
lang('Type');
+                               $uicols['statustext'][]         = 
lang('Equipment Type');
+ 
+                               $joinmethod .= " $this->join  fm_equipment ON 
($entity_table.equipment_id = fm_equipment.equipment_id))";
+                               $paranthesis .='(';
+                               $joinmethod .= " $this->join  fm_equipment_type 
ON (fm_equipment.equipment_type_id = fm_equipment_type.id))";
+                               $paranthesis .='(';
+ 
+                       }
+ 
+ 
+                       $sql    = 
$this->bocommon->generate_sql(array('entity_table'=>$entity_table,'cols'=>$cols,'cols_return'=>$cols_return,
+                                                                               
                                        
'uicols'=>$uicols,'joinmethod'=>$joinmethod,'paranthesis'=>$paranthesis,'query'=>$query));
+ 
                        if ($order)
                        {
***************
*** 111,116 ****
                                $ordermethod = ' order by location_code ASC';
                        }
! 
!                       $filtermethod = ' ( fm_document.owner=' . 
$this->account;
                        if (is_array($this->grants))
                        {
--- 147,151 ----
                                $ordermethod = ' order by location_code ASC';
                        }
!                       $filtermethod = ' ( fm_document.user_id=' . 
$this->account;
                        if (is_array($this->grants))
                        {
***************
*** 121,125 ****
                                }
                                reset($public_user_list);
!                               $filtermethod .= " OR 
(fm_document.access='public' OR fm_document.owner IN(" . 
implode(',',$public_user_list) . ")))";
                        }
                        else
--- 156,160 ----
                                }
                                reset($public_user_list);
!                               $filtermethod .= " OR 
(fm_document.access='public' OR fm_document.user_id IN(" . 
implode(',',$public_user_list) . ")))";
                        }
                        else
***************
*** 142,149 ****
                        endif;
  
  
                        if ($filter)
                        {
!                               $filtermethod .= " AND 
fm_document.owner='$filter' ";
                        }
  
--- 177,188 ----
                        endif;
  
+                       if ($equipment_type)
+                       {
+                               $filtermethod .= " AND 
fm_equipment.equipment_type_id ='$equipment_type' ";
+                       }
  
                        if ($filter)
                        {
!                               $filtermethod .= " AND 
fm_document.user_id='$filter' ";
                        }
  
***************
*** 153,171 ****
                                $query = ereg_replace('"','',$query);
  
!                               $querymethod = " AND fm_document.address LIKE 
'%$query%' or fm_document.location_code LIKE '%$query%'";
                        }
  
                        $groupmethod= " GROUP BY 
fm_document.location_code,fm_document.equipment_id ";
  
!                       if ($equipment_type)
!                       {
  
!                               $sql = "SELECT fm_document.* FROM fm_document 
$this->join fm_equipment on fm_document.equipment_id = 
fm_equipment.equipment_id"
!                               . " WHERE  $filtermethod $querymethod AND 
fm_equipment.equipment_type_id ='$equipment_type' $groupmethod";
!                       }
!                       else
!                       {
!                               $sql = "SELECT * FROM fm_document WHERE  
$filtermethod $querymethod $groupmethod";
!                       }
  
                        $this->db2->query($sql,__LINE__,__FILE__);
--- 192,207 ----
                                $query = ereg_replace('"','',$query);
  
!                               $querymethod = " AND (fm_document.address LIKE 
'%$query%' or fm_document.location_code LIKE '%$query%')";
                        }
  
                        $groupmethod= " GROUP BY 
fm_document.location_code,fm_document.equipment_id ";
  
!                       $sql .= "  WHERE $filtermethod $querymethod 
$groupmethod";
  
! //echo $sql;
!                       $this->uicols           = $this->bocommon->uicols;
!                       $cols_return            = $this->bocommon->cols_return;
!                       $type_id                        = 
$this->bocommon->type_id;
!                       $this->cols_extra       = $this->bocommon->cols_extra;
  
                        $this->db2->query($sql,__LINE__,__FILE__);
***************
*** 173,191 ****
                        $this->db->limit_query($sql . 
$ordermethod,$start,__LINE__,__FILE__);
  
                        while ($this->db->next_record())
                        {
!                               $ngrants = 
(int)$this->grants[$this->db->f('fm_document.owner')];
!                               $document_list[] = array
!                               (
!                                       'document_id'           => 
$this->db->f('id'),
!                                       'equipment_id'          => 
$this->db->f('equipment_id'),
!                                       'location_code'         => 
$this->db->f('location_code'),
!                                       'floor'                         => 
$this->db->f('floor'),
!                                       'address'                       => 
$this->db->f('address'),
!                                       'category'                      => 
$this->db->f('category'),
!                                       'title'                         => 
$this->db->f('title'),
!                                       'grants'                        => 
$ngrants
!                                       );
                        }
  //_debug_array($document_list);
                        return $document_list;
--- 209,232 ----
                        $this->db->limit_query($sql . 
$ordermethod,$start,__LINE__,__FILE__);
  
+                       $j=0;
                        while ($this->db->next_record())
                        {
!                               for ($i=0;$i<count($cols_return);$i++)
!                               {
!                                       $document_list[$j][$cols_return[$i]] = 
$this->db->f($cols_return[$i]);
!                               }
! 
!                               $location_code= $this->db->f('location_code');
!                               $location = split('-',$location_code);
!                               for ($m=0;$m<count($location);$m++)
!                               {
!                                       $document_list[$j]['loc' . ($m+1)] = 
$location[$m];
!                                       
$document_list[$j]['query_location']['loc' . ($m+1)]=implode("-", 
array_slice($location, 0, ($m+1)));
!                               }
! 
!                               $j++;
                        }
+ 
+ 
  //_debug_array($document_list);
                        return $document_list;
***************
*** 261,265 ****
                                        'title'                         => 
$this->db->f('title'),
                                        'category'                      => 
$this->db->f('category'),
!                                       'owner'                         => 
$this->db->f('owner')
                                        );
                        }
--- 302,306 ----
                                        'title'                         => 
$this->db->f('title'),
                                        'category'                      => 
$this->db->f('category'),
!                                       'user_id'                               
=> $this->db->f('user_id')
                                        );
                        }
***************
*** 301,312 ****
                function add($document)
                {
  
!                       if($document['street_number'])
                        {
!                               $address= $document['street_name'] . ' ' . 
$document['street_number'];
                        }
!                       else
                        {
!                               $address= $document['street_name'];
                        }
  
--- 342,381 ----
                function add($document)
                {
+                       while (is_array($document['location']) && 
list($input_name,$value) = each($document['location']))
+                       {
+                               if($value)
+                               {
+                                       $cols[] = $input_name;
+                                       $vals[] = $value;
+                               }
+                       }
  
! 
!                       while (is_array($document['extra']) && 
list($input_name,$value) = each($document['extra']))
                        {
!                               if($value)
!                               {
!                                       $cols[] = $input_name;
!                                       $vals[] = $value;
!                               }
                        }
! 
!                       if($cols)
                        {
!                               $cols   = "," . implode(",", $cols);
!                               $vals   = ",'" . implode("','", $vals) . "'";
!                       }
! 
! 
!                       if($document['street_name'])
!                       {
!                               $address[]= $document['street_name'];
!                               $address[]= $document['street_number'];
!                               $address        = implode(" ", $address);
!                       }
! 
!                       if(!$address)
!                       {
!                               $address = $document['location_name'];
                        }
  
***************
*** 315,324 ****
                        $document['title'] = 
$this->db->db_addslashes($document['title']);
  //_debug_array($document);
!                       $this->db->query("INSERT INTO fm_document 
(document_name,title,equipment_id,access,category,entry_date,document_date,version,coordinator,status,"
!                               . 
"descr,location_code,floor_id,address,branch_id,vendor_id,owner) "
                                . "VALUES ('"
                                . $document['document_name']. "','"
                                . $document['title']. "','"
-                               . $document['equipment_id']. "','"
                                . "public','"
                                . $document['cat_id']. "','"
--- 384,392 ----
                        $document['title'] = 
$this->db->db_addslashes($document['title']);
  //_debug_array($document);
!                       $this->db->query("INSERT INTO fm_document 
(document_name,title,access,category,entry_date,document_date,version,coordinator,status,"
!                               . 
"descr,location_code,address,branch_id,vendor_id,user_id $cols) "
                                . "VALUES ('"
                                . $document['document_name']. "','"
                                . $document['title']. "','"
                                . "public','"
                                . $document['cat_id']. "','"
***************
*** 330,338 ****
                                . $document['descr']. "','"
                                . $document['location_code']. "','"
-                               . $document['floor_id'] . "','"
                                . $address . "','"
                                . $document['branch_id']. "','"
                                . $document['vendor_id']. "','"
!                               . $this->account. "')",__LINE__,__FILE__);
  
                        $receipt['document_id'] = 
$this->db->get_last_insert_id('fm_document','id');
--- 398,405 ----
                                . $document['descr']. "','"
                                . $document['location_code']. "','"
                                . $address . "','"
                                . $document['branch_id']. "','"
                                . $document['vendor_id']. "','"
!                               . $this->account. "' $vals 
)",__LINE__,__FILE__);
  
                        $receipt['document_id'] = 
$this->db->get_last_insert_id('fm_document','id');
***************
*** 348,351 ****
--- 415,446 ----
                function edit($document)
                {
+                       while (is_array($document['location']) && 
list($input_name,$value) = each($document['location']))
+                       {
+                               $vals[] = "$input_name = '$value'";
+                       }
+ 
+                       while (is_array($document['extra']) && 
list($input_name,$value) = each($document['extra']))
+                       {
+                               $vals[] = "$input_name = '$value'";
+                       }
+ 
+                       if($vals)
+                       {
+                               $vals   = "," . implode(",",$vals);
+                       }
+ 
+                       if($document['street_name'])
+                       {
+                               $address[]= $document['street_name'];
+                               $address[]= $document['street_number'];
+                               $address        = implode(" ", $address);
+                       }
+ 
+                       if(!$address)
+                       {
+                               $address = $document['location_name'];
+                       }
+ 
+ 
  /*                    $this->db->query("SELECT status,category,coordinator 
FROM fm_document where id='" .$document['document_id']."'",__LINE__,__FILE__);
                        $this->db->next_record();
***************
*** 397,405 ****
                                version                 ='" . 
$document['version'] . "',
                                location_code   ='" . 
$document['location_code'] . "',
-                               floor_id                ='" . 
$document['floor_id'] . "',
-                               equipment_id    ='" . $document['equipment_id'] 
. "',
                                vendor_id               ='" . 
$document['vendor_id'] . "',
                                address                 ='" . $address
!                               . "' WHERE id= '" . $document['document_id'] 
."'",__LINE__,__FILE__);
  
                        $receipt['document_id'] = $document['document_id'];
--- 492,498 ----
                                version                 ='" . 
$document['version'] . "',
                                location_code   ='" . 
$document['location_code'] . "',
                                vendor_id               ='" . 
$document['vendor_id'] . "',
                                address                 ='" . $address
!                               . "' $vals WHERE id= '" . 
$document['document_id'] ."'",__LINE__,__FILE__);
  
                        $receipt['document_id'] = $document['document_id'];

Index: class.bodocument.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/property/inc/class.bodocument.inc.php,v
retrieving revision 1.7
retrieving revision 1.8
diff -C2 -r1.7 -r1.8
*** class.bodocument.inc.php    26 Jun 2003 09:02:06 -0000      1.7
--- class.bodocument.inc.php    26 Jun 2003 12:23:05 -0000      1.8
***************
*** 66,70 ****
                                $this->query = $query;
                        }
!                       if(!empty($filter))
                        {
                                $this->filter = $filter;
--- 66,70 ----
                                $this->query = $query;
                        }
!                       if(isset($filter))
                        {
                                $this->filter = $filter;
***************
*** 282,296 ****
                        $this->total_records = $this->so->total_records;
  
!                       $dateformat = 
$GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat'];
  
                        for ($i=0; $i<count($document); $i++)
                        {
!                               if($document[$i]['equipment_id'])
                                {
!                                       $document[$i]['equipment_type'] = 
$this->bocommon->get_equipment_type($document[$i]['equipment_id']);
                                }
-                               $document[$i]['coordinator'] = 
$GLOBALS['phpgw']->accounts->id2name($document[$i]['coordinator']);
-                               $document[$i]['document_date'] = 
$GLOBALS['phpgw']->common->show_date($document[$i]['start_date'],$dateformat);
-                               $document[$i]['entry_date'] = 
$GLOBALS['phpgw']->common->show_date($document[$i]['entry_date'],$dateformat);
                        }
  
--- 282,297 ----
                        $this->total_records = $this->so->total_records;
  
!                       $this->uicols   = $this->so->uicols;
!                       $cols_extra             = $this->so->cols_extra;
  
+                       $dateformat = 
$GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat'];
                        for ($i=0; $i<count($document); $i++)
                        {
!                               
$location_data=$this->solocation->read_single($document[$i]['location_code']);
! 
!                               for ($j=0;$j<count($cols_extra);$j++)
                                {
!                                       $document[$i][$cols_extra[$j]] = 
$location_data[$cols_extra[$j]];
                                }
                        }
  
***************
*** 312,316 ****
                                        $document[$i]['equipment_type'] = 
$this->bocommon->get_equipment_type($document[$i]['equipment_id']);
                                }
!                               $document[$i]['owner'] = 
$GLOBALS['phpgw']->accounts->id2name($document[$i]['owner']);
                                $document[$i]['document_date'] = 
$GLOBALS['phpgw']->common->show_date($document[$i]['start_date'],$dateformat);
                                $document[$i]['entry_date'] = 
$GLOBALS['phpgw']->common->show_date($document[$i]['entry_date'],$dateformat);
--- 313,317 ----
                                        $document[$i]['equipment_type'] = 
$this->bocommon->get_equipment_type($document[$i]['equipment_id']);
                                }
!                               $document[$i]['user'] = 
$GLOBALS['phpgw']->accounts->id2name($document[$i]['user_id']);
                                $document[$i]['document_date'] = 
$GLOBALS['phpgw']->common->show_date($document[$i]['start_date'],$dateformat);
                                $document[$i]['entry_date'] = 
$GLOBALS['phpgw']->common->show_date($document[$i]['entry_date'],$dateformat);
***************
*** 329,335 ****
                        $document['vendor_email']               = 
$vendor[0]['email'];
  
!       //              
$location_data=$this->socommon->read_location_data($document['location_code']);
  
-                       $document=$document + $location_data;
  
                        return $document;
--- 330,344 ----
                        $document['vendor_email']               = 
$vendor[0]['email'];
  
!                       if($document['location_code'])
!                       {
!                               $document['location_data'] 
=$this->solocation->read_single($document['location_code']);
!                       }
! 
!                       if($document['equipment_id'])
!                       {
!                               $document['location_data']['equipment_id']      
        = $document['equipment_id'];
!                               $document['location_data']['equipment_type']    
= $this->bocommon->get_equipment_type($document['equipment_id']);
!                       }
  
  
                        return $document;
***************
*** 446,453 ****
  
  
!               function create_document_dir($property_id='',$equipment_id='')
                {
                        if(!$this->vfs->file_exists(array(
!                                       'string' => $this->fakebase. SEP . 
'document' .  SEP . $property_id,
                                        'relatives' => Array(RELATIVE_NONE)
                                )))
--- 455,462 ----
  
  
!               function create_document_dir($loc1='',$equipment_id='')
                {
                        if(!$this->vfs->file_exists(array(
!                                       'string' => $this->fakebase. SEP . 
'document' .  SEP . $loc1,
                                        'relatives' => Array(RELATIVE_NONE)
                                )))
***************
*** 455,459 ****
                                $this->vfs->override_acl = 1;
                                if(!$this->vfs->mkdir (array(
!                                    'string' => $this->fakebase. SEP . 
'document' .  SEP . $property_id,
                                     'relatives' => array(
                                          RELATIVE_NONE
--- 464,468 ----
                                $this->vfs->override_acl = 1;
                                if(!$this->vfs->mkdir (array(
!                                    'string' => $this->fakebase. SEP . 
'document' .  SEP . $loc1,
                                     'relatives' => array(
                                          RELATIVE_NONE
***************
*** 461,469 ****
                                )))
                                {
!                                       
$receipt['error'][]=array('msg'=>lang('failed to create directory') . ' :'. 
$this->fakebase. SEP . 'document' .  SEP . $property_id);
                                }
                                else
                                {
!                                       
$receipt['message'][]=array('msg'=>lang('directory created') . ' :'. 
$this->fakebase. SEP . 'document' .  SEP . $property_id);
                                }
                                $this->vfs->override_acl = 0;
--- 470,478 ----
                                )))
                                {
!                                       
$receipt['error'][]=array('msg'=>lang('failed to create directory') . ' :'. 
$this->fakebase. SEP . 'document' .  SEP . $loc1);
                                }
                                else
                                {
!                                       
$receipt['message'][]=array('msg'=>lang('directory created') . ' :'. 
$this->fakebase. SEP . 'document' .  SEP . $loc1);
                                }
                                $this->vfs->override_acl = 0;
***************
*** 473,477 ****
                        {
                                if(!$this->vfs->file_exists(array(
!                                               'string' => $this->fakebase. 
SEP . 'document' .  SEP . $property_id .  SEP . $equipment_id,
                                                'relatives' => 
Array(RELATIVE_NONE)
                                        )))
--- 482,486 ----
                        {
                                if(!$this->vfs->file_exists(array(
!                                               'string' => $this->fakebase. 
SEP . 'document' .  SEP . $loc1 .  SEP . $equipment_id,
                                                'relatives' => 
Array(RELATIVE_NONE)
                                        )))
***************
*** 480,484 ****
  
                                        if(!$this->vfs->mkdir (array(
!                                            'string' => $this->fakebase. SEP . 
'document' .  SEP . $property_id .  SEP . $equipment_id,
                                             'relatives' => array(
                                                  RELATIVE_NONE
--- 489,493 ----
  
                                        if(!$this->vfs->mkdir (array(
!                                            'string' => $this->fakebase. SEP . 
'document' .  SEP . $loc1 .  SEP . $equipment_id,
                                             'relatives' => array(
                                                  RELATIVE_NONE
***************
*** 486,494 ****
                                        )))
                                        {
!                                               
$receipt['error'][]=array('msg'=>lang('failed to create directory') . ' :'. 
$this->fakebase. SEP . 'document'  .  SEP . $property_id .  SEP . 
$equipment_id);
                                        }
                                        else
                                        {
!                                               
$receipt['message'][]=array('msg'=>lang('directory created') . ' :'. 
$this->fakebase. SEP . 'document' .  SEP . $property_id .  SEP . $equipment_id);
                                        }
                                        $this->vfs->override_acl = 0;
--- 495,503 ----
                                        )))
                                        {
!                                               
$receipt['error'][]=array('msg'=>lang('failed to create directory') . ' :'. 
$this->fakebase. SEP . 'document'  .  SEP . $loc1 .  SEP . $equipment_id);
                                        }
                                        else
                                        {
!                                               
$receipt['message'][]=array('msg'=>lang('directory created') . ' :'. 
$this->fakebase. SEP . 'document' .  SEP . $loc1 .  SEP . $equipment_id);
                                        }
                                        $this->vfs->override_acl = 0;
***************
*** 508,512 ****
                        $values['document_date']        = mktime 
(2,0,0,$document_date['month'],$document_date['day'],$document_date['year']);
  
!                       
$values['location_code']=$this->bocommon->location_code($values['property_id'],$values['building_id'],$values['entrance_id'],$values['apartment_id']);
  
  //_debug_array($values);
--- 517,529 ----
                        $values['document_date']        = mktime 
(2,0,0,$document_date['month'],$document_date['day'],$document_date['year']);
  
!                       while (is_array($values['location']) && list(,$value) = 
each($values['location']))
!                       {
!                               if($value)
!                               {
!                                       $location[] = $value;
!                               }
!                       }
! 
!                       $values['location_code']=implode("-", $location);
  
  //_debug_array($values);





reply via email to

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