phpgroupware-cvs
[Top][All Lists]
Advanced

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

[Phpgroupware-cvs] CVS: property/inc class.boadmin_location.inc.php,1.2


From: Sigurd Nes <address@hidden>
Subject: [Phpgroupware-cvs] CVS: property/inc class.boadmin_location.inc.php,1.2,1.3 class.bocommon.inc.php,1.50,1.51 class.bolocation.inc.php,1.5,1.6 class.bolookup.inc.php,1.7,1.8class.soadmin_location.inc.php,1.7,1.8 class.soapartment.inc.php,1.5,1.6 class.socommon.inc.php,1.21,1.22 class.soequipment.inc.php,1.12,1.13class.soinvestment.inc.php,1.12,1.13 class.soinvoice.inc.php,1.21,1.22 class.solocation.inc.php,1.3,1.4 class.solookup.inc.php,1.17,1.18 class.soproperty.inc.php,1.17,1.18 class.soreport.inc.php,1.1,1.2 class.soXport.inc.php,1.23,1.24 class.uilocation.inc.php,1.6,1.7 class.uilookup.inc.php,1.19,1.20
Date: Fri, 13 Jun 2003 07:05:32 -0400

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

Modified Files:
        class.boadmin_location.inc.php class.bocommon.inc.php 
        class.bolocation.inc.php class.bolookup.inc.php 
        class.soadmin_location.inc.php class.soapartment.inc.php 
        class.socommon.inc.php class.soequipment.inc.php 
        class.soinvestment.inc.php class.soinvoice.inc.php 
        class.solocation.inc.php class.solookup.inc.php 
        class.soproperty.inc.php class.soreport.inc.php 
        class.soXport.inc.php class.uilocation.inc.php 
        class.uilookup.inc.php 
Log Message:
no message

Index: class.boadmin_location.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/property/inc/class.boadmin_location.inc.php,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -r1.2 -r1.3
*** class.boadmin_location.inc.php      30 May 2003 10:43:03 -0000      1.2
--- class.boadmin_location.inc.php      13 Jun 2003 11:05:29 -0000      1.3
***************
*** 256,259 ****
--- 256,261 ----
                        $datatypes[4]['id']= 'decimal';
                        $datatypes[4]['name']= lang('decimal');
+                       $datatypes[5]['id']= 'date';
+                       $datatypes[5]['name']= lang('date');
  
                        while (is_array($datatypes) && list(,$type) = 
each($datatypes))

Index: class.bocommon.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/property/inc/class.bocommon.inc.php,v
retrieving revision 1.50
retrieving revision 1.51
diff -C2 -r1.50 -r1.51
*** class.bocommon.inc.php      1 Jun 2003 21:38:06 -0000       1.50
--- class.bocommon.inc.php      13 Jun 2003 11:05:29 -0000      1.51
***************
*** 48,52 ****
  
                        $this->currentapp               = 
$GLOBALS['phpgw_info']['flags']['currentapp'];
!                       $this->socommon                 = 
CreateObject($this->currentapp.'.socommon',True);
                        $this->accounts                 = 
CreateObject('phpgwapi.accounts');
                        $this->acl2                     = 
CreateObject($this->currentapp.'.acl2');
--- 48,52 ----
  
                        $this->currentapp               = 
$GLOBALS['phpgw_info']['flags']['currentapp'];
!                       $this->socommon                 = 
CreateObject($this->currentapp.'.socommon');
                        $this->accounts                 = 
CreateObject('phpgwapi.accounts');
                        $this->acl2                     = 
CreateObject($this->currentapp.'.acl2');
***************
*** 516,611 ****
                        }
  
!                       $menu = array
!                       (
!                               'link_property'         =>      
$GLOBALS['phpgw']->link('/index.php','menuaction='.$currentapp.'.uiproperty.index'),
!                               'lang_property'         =>      
lang('Property'),
!                               'link_equipment'        =>      
$GLOBALS['phpgw']->link('/index.php','menuaction='.$currentapp.'.uiequipment.index'),
!                               'lang_equipment'        =>      
lang('Equipment'),
!                               'link_requirement'      =>      
$GLOBALS['phpgw']->link('/property/list_requirement.php'),
!                               'lang_requirement'      =>      
lang('Requirement'),
!                               'link_request'          =>      
$GLOBALS['phpgw']->link('/property/list_request.php'),
!                               'lang_request'          =>      lang('Request'),
!                               'link_documents'        =>      
$GLOBALS['phpgw']->link('/property/list_documents.php'),
!                               'lang_documents'        =>      
lang("Documents"),
!                               'link_events'           =>      
$GLOBALS['phpgw']->link('/calendar/index.php'),
!                               'lang_events'           =>      lang('Events'),
!                               'link_helpdesk'         =>      
$GLOBALS['phpgw']->link('/index.php','menuaction='.$currentapp.'.uitts.index'),
!                               'lang_helpdesk'         =>      
lang('Helpdesk'),
!                               'link_project'          =>      
$GLOBALS['phpgw']->link('/index.php','menuaction='.$currentapp.'.uiproject.index'),
!                               'lang_project'          =>      lang('Project'),
!                               'link_invoice'          =>      
$GLOBALS['phpgw']->link('/index.php','menuaction='.$currentapp.'.uiinvoice.index'),
!                               'lang_invoice'          =>      lang('Invoice'),
!                               'link_pricebook'        =>      
$GLOBALS['phpgw']->link('/index.php','menuaction='.$currentapp.'.uipricebook.index'),
!                               'lang_pricebook'        =>      
lang('Pricebook'),
!                               'link_documentation'=>  
$GLOBALS['phpgw']->link('/index.php','menuaction='.$currentapp.'.uidocument.index'),
!                               'lang_documentation'=>  lang('Documentation'),
!                               'link_report'=> 
$GLOBALS['phpgw']->link('/index.php','menuaction='.$currentapp.'.uireport.index'),
!                               'lang_report'=> lang('Report')
!                       );
  
                        if ($sub == equipment)
                        {
!                               
$menu['sublink_equipment']=$GLOBALS['phpgw']->link('/index.php','menuaction='.$currentapp.'.uiequipment.index');
!                               $menu['sublang_equipment']=lang('Equipment');
!                               
$menu['sublink_meter']=$GLOBALS['phpgw']->link('/index.php','menuaction='.$currentapp.'.uimeter.index');
!                               $menu['sublang_meter']=lang('Meter');
                                if ($this->acl2->check('.equipment',16))
                                {
!                                       
$menu['sublink_equipment_type']=$GLOBALS['phpgw']->link('/index.php','menuaction='.$currentapp.'.uistandard_entity.index&type=equipment');
!                                       
$menu['sublang_equipment_type']=lang('Equipment type');
                                }
-                               else
-                               {
-                                       $menu['sublink_equipment_type']='';
-                                       $menu['sublang_equipment_type']='';
-                               }
-                       }
-                       else
-                       {
-                               $menu['sublink_equipment']='';
-                               $menu['sublang_equipment']='';
-                               $menu['sublink_equipment_type']='';
-                               $menu['sublang_equipment_type']='';
                        }
  
                        if ($sub == property)
                        {
-                               $location       = 
$this->soadmin_location->select_location_type();
  
!                               for ($i=0; $i<count($location); $i++)
!                               {
!                                       
$menu['location'][$i]['sublink_location'] = 
$GLOBALS['phpgw']->link('/index.php','menuaction='.$currentapp.'.uilocation.index&type_id='
 .$location[$i]['id'] );
!                                       
$menu['location'][$i]['sublang_location'] = $location[$i]['name'];
!                                       
$menu['location'][$i]['statsutext_location'] = $location[$i]['descr'];
!                               }
! 
!                               
$menu['sublink_property']=$GLOBALS['phpgw']->link('/index.php','menuaction='.$currentapp.'.uiproperty.index');
!                               $menu['sublang_property']=lang('Property');
!                               
$menu['sublink_building']=$GLOBALS['phpgw']->link('/index.php','menuaction='.$currentapp.'.uibuilding.index');
!                               $menu['sublang_building']=lang('Building');
!                               
$menu['sublink_entrance']=$GLOBALS['phpgw']->link('/index.php','menuaction='.$currentapp.'.uientrance.index');
!                               $menu['sublang_entrance']=lang('Entrance');
!                               
$menu['sublink_apartment']=$GLOBALS['phpgw']->link('/index.php','menuaction='.$currentapp.'.uiapartment.index');
!                               $menu['sublang_apartment']=lang('Apartment');
!                               
$menu['sublink_drawing']=$GLOBALS['phpgw']->link('/index.php','menuaction='.$currentapp.'.uidrawing.index');
!                               $menu['sublang_drawing']=lang('Drawing');
!                               
$menu['sublink_gabnr']=$GLOBALS['phpgw']->link('/index.php','menuaction='.$currentapp.'.uigab.index');
!                               $menu['sublang_gabnr']=lang('gabnr');
  
!                       }
!                       else
!                       {
!                               $menu['sublink_property']='';
!                               $menu['sublang_property']='';
!                           $menu['sublink_building']='';
!                           $menu['sublang_building']='';
!                           $menu['sublink_entrance']='';
!                       $menu['sublang_entrance']='';
!                           $menu['sublink_apartment']='';
!                       $menu['sublang_apartment']='';
!                           $menu['sublink_drawing']='';
!                       $menu['sublang_drawing']='';
!                           $menu['sublink_gabnr']='';
!                       $menu['sublang_gabnr']='';
  
                        }
--- 516,610 ----
                        }
  
!                       $i=0;
!                       $menu['module'][$i]['link']             = 
$GLOBALS['phpgw']->link('/index.php','menuaction='.$currentapp.'.uiproperty.index');
!                       $menu['module'][$i]['lang']             = 
lang('Property');
!                       $menu['module'][$i]['statustext']       = 
lang('Property');
!                       $i++;
!                       $menu['module'][$i]['link']             = 
$GLOBALS['phpgw']->link('/index.php','menuaction='.$currentapp.'.uiequipment.index');
!                       $menu['module'][$i]['lang']             = 
lang('Equipment');
!                       $menu['module'][$i]['statustext']       = 
lang('Equipment');
! 
!                       $i++;
!                       $menu['module'][$i]['link']                     =       
$GLOBALS['phpgw']->link('/index.php','menuaction='.$currentapp.'.uitts.index');
!                       $menu['module'][$i]['lang']                     =       
lang('Helpdesk');
!                       $menu['module'][$i]['statustext']       =       
lang('Helpdesk');
!                       $i++;
!                       $menu['module'][$i]['link']                     =       
$GLOBALS['phpgw']->link('/index.php','menuaction='.$currentapp.'.uiproject.index');
!                       $menu['module'][$i]['lang']                     =       
lang('Project');
!                       $menu['module'][$i]['statustext']       =       
lang('Project');
!                       $i++;
!                       $menu['module'][$i]['link']                     =       
$GLOBALS['phpgw']->link('/index.php','menuaction='.$currentapp.'.uiinvoice.index');
!                       $menu['module'][$i]['lang']                     =       
lang('Invoice');
!                       $menu['module'][$i]['statustext']       =       
lang('Invoice');
!                       $i++;
!                       $menu['module'][$i]['link']                     =       
$GLOBALS['phpgw']->link('/index.php','menuaction='.$currentapp.'.uipricebook.index');
!                       $menu['module'][$i]['lang']                     =       
lang('Pricebook');
!                       $menu['module'][$i]['statustext']       =       
lang('Pricebook');
!                       $i++;
!                       $menu['module'][$i]['link']                     =       
$GLOBALS['phpgw']->link('/index.php','menuaction='.$currentapp.'.uidocument.index');
!                       $menu['module'][$i]['lang']                     =       
lang('Documentation');
!                       $menu['module'][$i]['statustext']       =       
lang('Documentation');
!                       $i++;
!                       $menu['module'][$i]['link']                     =       
$GLOBALS['phpgw']->link('/index.php','menuaction='.$currentapp.'.uireport.index');
!                       $menu['module'][$i]['lang']                     =       
lang('Report');
!                       $menu['module'][$i]['statustext']       =       
lang('Report');
  
+                       $i=0;
                        if ($sub == equipment)
                        {
!                               $menu['sub_menu'][$i]['link']                   
=       
$GLOBALS['phpgw']->link('/index.php','menuaction='.$currentapp.'.uiequipment.index');
!                               $menu['sub_menu'][$i]['lang']                   
=       lang('Equipment');
!                               $menu['sub_menu'][$i]['statustext']             
=       lang('Equipment');
!                               $i++;
!                               $menu['sub_menu'][$i]['link']                   
=       
$GLOBALS['phpgw']->link('/index.php','menuaction='.$currentapp.'.uimeter.index');
!                               $menu['sub_menu'][$i]['lang']                   
=       lang('Meter');
!                               $menu['sub_menu'][$i]['statustext']             
=       lang('Meter');
! 
! 
                                if ($this->acl2->check('.equipment',16))
                                {
!                                       $i++;
!                                       $menu['sub_menu'][$i]['link']           
        =       
$GLOBALS['phpgw']->link('/index.php','menuaction='.$currentapp.'.uistandard_entity.index&type=equipment');
!                                       $menu['sub_menu'][$i]['lang']           
        =       lang('Equipment type');
!                                       $menu['sub_menu'][$i]['statustext']     
        =       lang('Equipment type');
                                }
                        }
  
                        if ($sub == property)
                        {
  
!                               $i++;
!                               $menu['sub_menu'][$i]['link']                   
=       
$GLOBALS['phpgw']->link('/index.php','menuaction='.$currentapp.'.uiproperty.index');
!                               $menu['sub_menu'][$i]['lang']                   
=       lang('Property');
!                               $menu['sub_menu'][$i]['statustext']             
=       lang('Property');
!                               $i++;
!                               $menu['sub_menu'][$i]['link']                   
=       
$GLOBALS['phpgw']->link('/index.php','menuaction='.$currentapp.'.uibuilding.index');
!                               $menu['sub_menu'][$i]['lang']                   
=       lang('Building');
!                               $menu['sub_menu'][$i]['statustext']             
=       lang('Building');
!                               $i++;
!                               $menu['sub_menu'][$i]['link']                   
=       
$GLOBALS['phpgw']->link('/index.php','menuaction='.$currentapp.'.uientrance.index');
!                               $menu['sub_menu'][$i]['lang']                   
=       lang('Entrance');
!                               $menu['sub_menu'][$i]['statustext']             
=       lang('Entrance');
!                               $i++;
!                               $menu['sub_menu'][$i]['link']                   
=       
$GLOBALS['phpgw']->link('/index.php','menuaction='.$currentapp.'.uiapartment.index');
!                               $menu['sub_menu'][$i]['lang']                   
=       lang('Apartment');
!                               $menu['sub_menu'][$i]['statustext']             
=       lang('Apartment');
!                               $i++;
!                               $menu['sub_menu'][$i]['link']                   
=       
$GLOBALS['phpgw']->link('/index.php','menuaction='.$currentapp.'.uidrawing.index');
!                               $menu['sub_menu'][$i]['lang']                   
=       lang('Drawing');
!                               $menu['sub_menu'][$i]['statustext']             
=       lang('Drawing');
!                               $i++;
!                               $menu['sub_menu'][$i]['link']                   
=       
$GLOBALS['phpgw']->link('/index.php','menuaction='.$currentapp.'.uigab.index');
!                               $menu['sub_menu'][$i]['lang']                   
=       lang('gabnr');
!                               $menu['sub_menu'][$i]['statustext']             
=       lang('gabnr');
  
!                               $location       = 
$this->soadmin_location->select_location_type();
!                               for ($j=0; $j<count($location); $j++)
!                               {
!                                       $i++;
!                                       $menu['sub_menu'][$i]['link'] = 
$GLOBALS['phpgw']->link('/index.php','menuaction='.$currentapp.'.uilocation.index&type_id='
 .$location[$j]['id'] );
!                                       $menu['sub_menu'][$i]['lang'] = 
$location[$j]['name'];
!                                       $menu['sub_menu'][$i]['statustext'] = 
$location[$j]['descr'];
!                               }
  
                        }
***************
*** 613,624 ****
                        if ($sub == invoice)
                        {
!                               
$menu['sub_invoice_list']=$GLOBALS['phpgw']->link('/index.php','menuaction='.$currentapp.'.uiinvoice.index');
!                               
$menu['sub_invoice_paid']=$GLOBALS['phpgw']->link('/index.php','menuaction='.$currentapp.'.uiinvoice.index&paid=true');
!                               
$menu['sub_invoice_consume']=$GLOBALS['phpgw']->link('/index.php','menuaction='.$currentapp.'.uiinvoice.consume');
!                               $menu['sublang_invoice_list']=lang('Invoice');
!                               $menu['sublang_invoice_paid']=lang('Paid');
!                               
$menu['sublang_invoice_consume']=lang('consume');
                                if ($this->acl2->check('.invoice',16))
                                {
                                        
$menu['sub_invoice_investment_value']=$GLOBALS['phpgw']->link('/index.php','menuaction='.$currentapp.'.uiinvestment.index');
                                        
$menu['sublang_invoice_investment_value']=lang('Investment value');
--- 612,644 ----
                        if ($sub == invoice)
                        {
!                               $i++;
!                               $menu['sub_menu'][$i]['link']                   
=       
$GLOBALS['phpgw']->link('/index.php','menuaction='.$currentapp.'.uiinvoice.index');
!                               $menu['sub_menu'][$i]['lang']                   
=       lang('Invoice');
!                               $menu['sub_menu'][$i]['statustext']             
=       lang('Invoice');
!                               $i++;
!                               $menu['sub_menu'][$i]['link']                   
=       
$GLOBALS['phpgw']->link('/index.php','menuaction='.$currentapp.'.uiinvoice.index&paid=true');
!                               $menu['sub_menu'][$i]['lang']                   
=       lang('Paid');
!                               $menu['sub_menu'][$i]['statustext']             
=       lang('Paid');
!                               $i++;
!                               $menu['sub_menu'][$i]['link']                   
=       
$GLOBALS['phpgw']->link('/index.php','menuaction='.$currentapp.'.uiinvoice.consume');
!                               $menu['sub_menu'][$i]['lang']                   
=       lang('consume');
!                               $menu['sub_menu'][$i]['statustext']             
=       lang('consume');
! 
                                if ($this->acl2->check('.invoice',16))
                                {
+ 
+                                       $i++;
+                                       $menu['sub_menu'][$i]['link']           
        =       
$GLOBALS['phpgw']->link('/index.php','menuaction='.$currentapp.'.uiinvestment.index');
+                                       $menu['sub_menu'][$i]['lang']           
        =       lang('Investment value');
+                                       $menu['sub_menu'][$i]['statustext']     
        =       lang('Investment value');
+                                       $i++;
+                                       $menu['sub_menu'][$i]['link']           
        =       
$GLOBALS['phpgw']->link('/index.php','menuaction='.$currentapp.'.uiXport.import');
+                                       $menu['sub_menu'][$i]['lang']           
        =       lang('Import invoice');
+                                       $menu['sub_menu'][$i]['statustext']     
        =       lang('Import invoice');
+                                       $i++;
+                                       $menu['sub_menu'][$i]['link']           
        =       
$GLOBALS['phpgw']->link('/index.php','menuaction='.$currentapp.'.uiXport.export');
+                                       $menu['sub_menu'][$i]['lang']           
        =       lang('Export invoice');
+                                       $menu['sub_menu'][$i]['statustext']     
        =       lang('Export invoice');
+ 
                                        
$menu['sub_invoice_investment_value']=$GLOBALS['phpgw']->link('/index.php','menuaction='.$currentapp.'.uiinvestment.index');
                                        
$menu['sublang_invoice_investment_value']=lang('Investment value');
***************
*** 628,685 ****
                                        
$menu['sublang_invoice_export']=lang('Export invoice');
                                }
-                               else
-                               {
-                                       
$menu['sublang_invoice_investment_value']='';
-                                       $menu['sublang_invoice_import']='';
-                                       $menu['sublang_invoice_export']='';
-                               }
- 
                        }
-                       else
-                       {
-                               $menu['sub_invoice_list']='';
-                               $menu['sub_invoice_paid']='';
-                       $menu['sub_invoice_powermeter']='';
-                               $menu['sublang_invoice_paid']='';
-                               $menu['sub_invoice_consume']='';
-                       $menu['sublang_invoice_list']='';
-                       $menu['sublang_invoice_powermeter']='';
-                               $menu['sublang_invoice_consume']='';
-                               $menu['sub_invoice_investment_value']='';
-                               $menu['sublang_invoice_investment_value']='';
-                               $menu['sublang_invoice_import']='';
-                               $menu['sub_invoice_import']='';
-                               $menu['sublang_invoice_export']='';
-                       }
-                       if ($sub == pricebook && 
$this->acl2->check('.pricebook',16))
-                       {
-                               $menu['sublang_vendor_activities']=lang('Per 
Vendor');
-                               
$menu['sub_vendor_activities']=$GLOBALS['phpgw']->link('/index.php','menuaction='.$currentapp.'.uipricebook.index');
- 
-                               
$menu['sub_activities_list']=$GLOBALS['phpgw']->link('/index.php','menuaction='.$currentapp.'.uipricebook.activity');
-                               $menu['sublang_activities_list']=lang('Per 
Agreement');
  
!                               
$menu['sub_list_agreement']=$GLOBALS['phpgw']->link('/index.php','menuaction='.$currentapp.'.uipricebook.agreement');
!                               $menu['sublang_agreement']=lang('Agreement');
!                       }
!                       else
                        {
!                               $menu['sub_activities_list']='';
!                               $menu['sub_vendor_activities']='';
!                       $menu['sub_list_agreement']='';
!                       $menu['sublang_activities_list']='';
!                       $menu['sublang_vendor_activities']='';
!                       $menu['sublang_agreement']='';
                        }
                        if ($sub == project)
                        {
!                               
$menu['sub_workorder_list']=$GLOBALS['phpgw']->link('/index.php','menuaction='.$currentapp.'.uiworkorder.index');
!                               
$menu['sub_workorder_request']=$GLOBALS['phpgw']->link('/index.php','menuaction='.$currentapp.'.uirequest.index');
!                               
$menu['sub_workorder_template']=$GLOBALS['phpgw']->link('/index.php','menuaction='.$currentapp.'.uitemplate.index');
!                               
$menu['sub_workorder_project']=$GLOBALS['phpgw']->link('/index.php','menuaction='.$currentapp.'.uiproject.index');
!                               
$menu['sublang_workorder_project']=lang('Project');
!                               
$menu['sublang_workorder_list']=lang('Workorder');
!                               
$menu['sublang_workorder_request']=lang('Request');
!                               
$menu['sublang_workorder_template']=lang('Workorder template');
                                if($this->acl2->check('.project',16))
                                {
--- 648,688 ----
                                        
$menu['sublang_invoice_export']=lang('Export invoice');
                                }
                        }
  
!                       if ($sub == pricebook && 
$this->acl2->check('.pricebook',16))
                        {
!                               $i++;
!                               $menu['sub_menu'][$i]['link']                   
=       
$GLOBALS['phpgw']->link('/index.php','menuaction='.$currentapp.'.uipricebook.index');
!                               $menu['sub_menu'][$i]['lang']                   
=       lang('Per Vendor');
!                               $menu['sub_menu'][$i]['statustext']             
=       lang('Per Vendor');
!                               $i++;
!                               $menu['sub_menu'][$i]['link']                   
=       
$GLOBALS['phpgw']->link('/index.php','menuaction='.$currentapp.'.uipricebook.activity');
!                               $menu['sub_menu'][$i]['lang']                   
=       lang('Per Agreement');
!                               $menu['sub_menu'][$i]['statustext']             
=       lang('Per Agreement');
!                               $i++;
!                               $menu['sub_menu'][$i]['link']                   
=       
$GLOBALS['phpgw']->link('/index.php','menuaction='.$currentapp.'.uipricebook.agreement');
!                               $menu['sub_menu'][$i]['lang']                   
=       lang('Agreement');
!                               $menu['sub_menu'][$i]['statustext']             
=       lang('Agreement');
                        }
+ 
                        if ($sub == project)
                        {
!                               $i++;
!                               $menu['sub_menu'][$i]['link']                   
=       
$GLOBALS['phpgw']->link('/index.php','menuaction='.$currentapp.'.uiproject.index');
!                               $menu['sub_menu'][$i]['lang']                   
=       lang('Project');
!                               $menu['sub_menu'][$i]['statustext']             
=       lang('Project');
!                               $i++;
!                               $menu['sub_menu'][$i]['link']                   
=       
$GLOBALS['phpgw']->link('/index.php','menuaction='.$currentapp.'.uiworkorder.index');
!                               $menu['sub_menu'][$i]['lang']                   
=       lang('Workorder');
!                               $menu['sub_menu'][$i]['statustext']             
=       lang('Workorder');
!                               $i++;
!                               $menu['sub_menu'][$i]['link']                   
=       
$GLOBALS['phpgw']->link('/index.php','menuaction='.$currentapp.'.uirequest.index');
!                               $menu['sub_menu'][$i]['lang']                   
=       lang('Request');
!                               $menu['sub_menu'][$i]['statustext']             
=       lang('Request');
!                               $i++;
!                               $menu['sub_menu'][$i]['link']                   
=       
$GLOBALS['phpgw']->link('/index.php','menuaction='.$currentapp.'.uitemplate.index');
!                               $menu['sub_menu'][$i]['lang']                   
=       lang('template');
!                               $menu['sub_menu'][$i]['statustext']             
=       lang('Workorder template');
! 
                                if($this->acl2->check('.project',16))
                                {
***************
*** 687,730 ****
                                        
$menu['sublang_workorder_event']=lang('Event');
                                }
-                               else
-                               {
-                                       $menu['sub_workorder_event']='';
-                                       $menu['sublang_workorder_event']='';
-                               }
-                       }
-                       else
-                       {
-                               $menu['sub_workorder_list']='';
-                               $menu['sub_workorder_request']='';
-                       $menu['sub_workorder_archive']='';
-                       $menu['sub_workorder_template']='';
-                       $menu['sub_workorder_project']='';
-                       $menu['sublang_workorder_list']='';
-                       $menu['sublang_workorder_request']='';
-                       $menu['sublang_workorder_archive']='';
-                       $menu['sublang_workorder_template']='';
-                       $menu['sublang_workorder_project']='';
-                               $menu['sub_workorder_event']='';
-                               $menu['sublang_workorder_event']='';
                        }
                        if ($sub == admin_location && 
$this->acl2->check('.property',16))
                        {
!                               
$menu['sub_location_type_list']=$GLOBALS['phpgw']->link('/index.php','menuaction='.$currentapp.'.uiadmin_location.index');
!                               
$menu['sublang_location_type_list']=lang('Location type');
!                               
$menu['sub_location_config']=$GLOBALS['phpgw']->link('/index.php','menuaction='.$currentapp.'.uiadmin_location.config');
!                               $menu['sublang_location_config']=lang('Config');
!                       }
!                       else
!                       {
!                               $menu['sub_location_type_list']='';
!                               $menu['sublang_location_type_list']='';
!                               $menu['sub_location_config']='';
!                               $menu['sublang_location_config']='';
!                       }
  
  
                        return $menu;
                }
- 
  
                function add_leading_zero($num)
--- 690,710 ----
                                        
$menu['sublang_workorder_event']=lang('Event');
                                }
                        }
+ 
                        if ($sub == admin_location && 
$this->acl2->check('.property',16))
                        {
!                               $i++;
!                               $menu['sub_menu'][$i]['link']                   
=       
$GLOBALS['phpgw']->link('/index.php','menuaction='.$currentapp.'.uiadmin_location.index');
!                               $menu['sub_menu'][$i]['lang']                   
=       lang('Location type');
!                               $menu['sub_menu'][$i]['statustext']             
=       lang('Location type');
!                               $i++;
!                               $menu['sub_menu'][$i]['link']                   
=       
$GLOBALS['phpgw']->link('/index.php','menuaction='.$currentapp.'.uiadmin_location.config');
!                               $menu['sub_menu'][$i]['lang']                   
=       lang('Config');
!                               $menu['sub_menu'][$i]['statustext']             
=       lang('Location Config');
  
+                       }
  
                        return $menu;
                }
  
                function add_leading_zero($num)

Index: class.bolocation.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/property/inc/class.bolocation.inc.php,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -r1.5 -r1.6
*** class.bolocation.inc.php    6 Jun 2003 11:38:17 -0000       1.5
--- class.bolocation.inc.php    13 Jun 2003 11:05:29 -0000      1.6
***************
*** 64,68 ****
                        $filter = get_var('filter',array('POST','GET'));
                        $cat_id = get_var('cat_id',array('POST','GET'));
! 
  
                        if ($start)
--- 64,68 ----
                        $filter = get_var('filter',array('POST','GET'));
                        $cat_id = get_var('cat_id',array('POST','GET'));
!                       $lookup_tenant  = 
get_var('lookup_tenant',array('POST','GET'));
  
                        if ($start)
***************
*** 95,98 ****
--- 95,102 ----
                                $this->cat_id = $cat_id;
                        }
+                       if(isset($cat_id))
+                       {
+                               $this->lookup_tenant = $lookup_tenant;
+                       }
                }
  
***************
*** 118,121 ****
--- 122,158 ----
  
  
+               function get_owner_list($selected='')
+               {
+ 
+                       $owners = $this->so->get_owner_list();
+ 
+                       while (is_array($owners) && list(,$owner) = 
each($owners))
+                       {
+                               $sel_owner = '';
+                               if ($owner['id']==$selected)
+                               {
+                                       $sel_owner = 'selected';
+                               }
+ 
+                               $owner_list[] = array
+                               (
+                                       'id'    => $owner['id'],
+                                       'name'          => $owner['name'],
+                                       'selected'      => $sel_owner
+                               );
+                       }
+ 
+                       for ($i=0;$i<count($owner_list);$i++)
+                       {
+                               if ($owner_list[$i]['selected'] != 'selected')
+                               {
+                                       unset($owner_list[$i]['selected']);
+                               }
+                       }
+ 
+                       return $owner_list;
+               }
+ 
+ 
                function initiate_ui_location($data)
                {
***************
*** 135,159 ****
  
                        $config = $this->soadmin_location->read_config('');
  //_debug_array($config);
                        $location_types = 
$this->soadmin_location->select_location_type();
  //_debug_array($location_types);
!                       $fm_location_colst = 
$this->soadmin_location->read_attrib(array('type_id'=>4));
  //_debug_array($fm_location_colst);
  
- 
                        for ($i=0;$i<$data['type_id'];$i++)
                        {
                                $location['location'][$i]['input_type']         
                = 'text';
                                $location['location'][$i]['input_name']         
                = 'loc' . ($i+1);
                                $location['location'][$i]['size']               
                        = 5;
-                               
$location['location'][$i]['lookup_function_call']       = 'lookup_loc' . ($i+1) 
. '()';
-                               $location['location'][$i]['lookup_link']        
                = True;
                                $location['location'][$i]['name']               
                        = $location_types[($i)]['name'];
                                $location['location'][$i]['value']              
                        = $data['values']['loc' . ($i+1)];
!                               $location['location'][$i]['statustext']         
                = lang('Klick this link to select') . 
$location_types[($i)]['name'];
  
                                if($i==0)
                                {
                                        
$location['location'][$i]['extra'][0]['input_name']             = 'loc' . 
($i+1).'_name';
                                        
$location['location'][$i]['extra'][0]['input_type']                             
= 'text';
                                        
$location['location'][$i]['extra'][0]['size']                           = 30;
--- 172,198 ----
  
                        $config = $this->soadmin_location->read_config('');
+ 
+                       $this->config   = $config;
  //_debug_array($config);
                        $location_types = 
$this->soadmin_location->select_location_type();
+                       $this->location_types   = $location_types;
  //_debug_array($location_types);
!                       $fm_location_colst = 
$this->soadmin_location->read_attrib(array('type_id'=>$data['type_id']));
  //_debug_array($fm_location_colst);
  
                        for ($i=0;$i<$data['type_id'];$i++)
                        {
                                $location['location'][$i]['input_type']         
                = 'text';
                                $location['location'][$i]['input_name']         
                = 'loc' . ($i+1);
+                               $input_name[]                                   
                                        = 
$location['location'][$i]['input_name'];
                                $location['location'][$i]['size']               
                        = 5;
                                $location['location'][$i]['name']               
                        = $location_types[($i)]['name'];
                                $location['location'][$i]['value']              
                        = $data['values']['loc' . ($i+1)];
!                               $location['location'][$i]['statustext']         
                = lang('Klick this link to select') . ' ' . 
$location_types[($i)]['name'];
  
                                if($i==0)
                                {
                                        
$location['location'][$i]['extra'][0]['input_name']             = 'loc' . 
($i+1).'_name';
+                                       $input_name[]                           
                                                        = 
$location['location'][$i]['extra'][0]['input_name'];
                                        
$location['location'][$i]['extra'][0]['input_type']                             
= 'text';
                                        
$location['location'][$i]['extra'][0]['size']                           = 30;
***************
*** 162,170 ****
  
                                }
-                               $location['lookup_functions'] .= 'function 
lookup_loc' . ($i+1) . '()' ."\r\n";
-                               $location['lookup_functions'] .= '{'."\r\n";
-                               $location['lookup_functions'] .= 
'Window1=window.open('."'" . $location_link .'&type_id=' . ($i+1) . "'" 
.',"Search","width=800,height=700,toolbar=no,scrollbars=yes,resizable=yes");'."\r\n";
-                               $location['lookup_functions'] .= '}'."\r\n";
  
                        }
  
--- 201,219 ----
  
                                }
  
+                               
$location['location'][$i]['lookup_function_call']       = 'lookup_loc' . ($i+1) 
. '()';
+                               $location['location'][$i]['lookup_link']        
                = True;
+                               $location['location'][$i]['readonly']           
                = True;
+                               $lookup_functions[$i]['name']                   
                        = 'lookup_loc' . ($i+1) . '()';
+                               $lookup_functions[$i]['action']                 
                        = 'Window1=window.open('."'" . $location_link 
.'&type_id=' . ($i+1) . '&lookup_name=' . $i . "'" 
.',"Search","width=800,height=700,toolbar=no,scrollbars=yes,resizable=yes");';
+ 
+                               if($data['no_link']>=($i+3))
+                               {
+                                       
$location['location'][$i]['lookup_link']                = False;
+                                       $lookup_functions[$i]['action']         
                        = 'Window1=window.open('."'" . $location_link 
.'&type_id=' . ($data['no_link']-1) . '&lookup_name=' . ($data[no_link]-2) . 
"'" 
.',"Search","width=800,height=700,toolbar=no,scrollbars=yes,resizable=yes");';
+                                       $location['location'][$i]['statustext'] 
                = lang('Klick this link to select') . ' ' . 
$location_types[($data[no_link]-2)]['name'];
+                               }
+ 
+                               $m=$i;
                        }
  
***************
*** 172,186 ****
                        for ($j=0;$j<count($fm_location_colst);$j++)
                        {
!                               if($fm_location_colst[$j]['location_type'] <= 
$data['type_id'] && $fm_location_colst[$j]['location_form'])
                                {
                                        $location['location'][$i]['input_type'] 
                        = 'text';
!                                       $location['location'][$i]['input_name'] 
                        = $fm_location_colst[$j]['name'];
                                        $location['location'][$i]['size']       
                                = 5;
                                        
$location['location'][$i]['lookup_function_call']       = 'lookup_loc' . 
$fm_location_colst[$j]['location_type'] . '()';
                                        
$location['location'][$i]['lookup_link']                        = True;
!                                       $location['location'][$i]['name']       
                                = $fm_location_colst[$j]['descr'];
!                                       $location['location'][$i]['value']      
                                = 
$data['values'][$fm_location_colst[$j]['name']];
!                                       $location['location'][$i]['statustext'] 
                        = lang('Klick this link to select') . 
$location_types[($fm_location_colst[$j]['location_type']-1)]['name'];
                                        $i++;
                                }
                        }
--- 221,238 ----
                        for ($j=0;$j<count($fm_location_colst);$j++)
                        {
!                               if($fm_location_colst[$j]['location_type'] <= 
$data['type_id'] && $fm_location_colst[$j]['lookup_form'])
                                {
                                        $location['location'][$i]['input_type'] 
                        = 'text';
!                                       $location['location'][$i]['input_name'] 
                        = $fm_location_colst[$j]['column_name'];
!                                       $input_name[]                           
                                                = 
$location['location'][$i]['input_name'];
                                        $location['location'][$i]['size']       
                                = 5;
                                        
$location['location'][$i]['lookup_function_call']       = 'lookup_loc' . 
$fm_location_colst[$j]['location_type'] . '()';
                                        
$location['location'][$i]['lookup_link']                        = True;
!                                       $location['location'][$i]['name']       
                                = $fm_location_colst[$j]['input_text'];
!                                       $location['location'][$i]['value']      
                                = 
$data['values'][$fm_location_colst[$j]['column_name']];
!                                       $location['location'][$i]['statustext'] 
                        = lang('Klick this link to select') . ' ' . 
$location_types[($fm_location_colst[$j]['location_type']-1)]['name'];
                                        $i++;
+ //echo 'i :' . $i . '<br>';
+ 
                                }
                        }
***************
*** 188,194 ****
                        for ($j=0;$j<count($config);$j++)
                        {
!                               if($config[$j]['location_type'] <= 
$data['type_id'] && $config[$j]['location_form'] )
                                {
                                        $location['location'][$i]['input_name'] 
                        = $config[$j]['column_name'];
                                        $location['location'][$i]['size']       
                                = 5;
                                        $location['location'][$i]['value']      
                                = 
$data['location']['value'][$config[$j]['column_name']];
--- 240,247 ----
                        for ($j=0;$j<count($config);$j++)
                        {
!                               if($config[$j]['location_type'] <= 
$data['type_id'] && $config[$j]['lookup_form'] )
                                {
                                        $location['location'][$i]['input_name'] 
                        = $config[$j]['column_name'];
+                                       $input_name[]                           
                                                = 
$location['location'][$i]['input_name'];
                                        $location['location'][$i]['size']       
                                = 5;
                                        $location['location'][$i]['value']      
                                = 
$data['location']['value'][$config[$j]['column_name']];
***************
*** 197,201 ****
                                        $location['location'][$i]['name']       
                                = $config[$j]['descr'];
                                        $location['location'][$i]['value']      
                                = $data['values'][$config[$j]['column_name']];
!                                       $location['location'][$i]['statustext'] 
                        = lang('Klick this link to select') . 
$location_types[($fm_location_colst[$j]['location_type']-1)]['name'];
                                        $location['location'][$i]['input_type'] 
                        = 'text';
  
--- 250,254 ----
                                        $location['location'][$i]['name']       
                                = $config[$j]['descr'];
                                        $location['location'][$i]['value']      
                                = $data['values'][$config[$j]['column_name']];
!                                       $location['location'][$i]['statustext'] 
                        = lang('Klick this link to select') . ' ' 
.$location_types[($fm_location_colst[$j]['location_type']-1)]['name'];
                                        $location['location'][$i]['input_type'] 
                        = 'text';
  
***************
*** 208,211 ****
--- 261,265 ----
                                                
$location['location'][$i]['extra'][0]['input_type']                             
= 'text';
                                                
$location['location'][$i]['extra'][0]['input_name']                             
= 'street_name';
+                                               $input_name[]                   
                                                                                
= $location['location'][$i]['extra'][0]['input_name'];
                                                
$location['location'][$i]['extra'][0]['size']                                   
= 30;
                                                
$location['location'][$i]['extra'][0]['lookup_function_call']   = 'lookup_loc' 
. ($i+1) . '()';
***************
*** 214,217 ****
--- 268,272 ----
                                                
$location['location'][$i]['extra'][1]['input_type']                             
= 'text';
                                                
$location['location'][$i]['extra'][1]['input_name']                             
= 'street_number';
+                                               $input_name[]                   
                                                                                
= $location['location'][$i]['extra'][1]['input_name'];
                                                
$location['location'][$i]['extra'][1]['size']                                   
= 6;
                                                
$location['location'][$i]['extra'][1]['lookup_function_call']   = 'lookup_loc' 
. ($i+1) . '()';
***************
*** 219,238 ****
                                        }
  
!                                       
if($config[$j]['column_name']=='tenant_id')
                                        {
!                                               
$location['location'][$i]['name']                                       = 
lang('Tenant');
!                                               
$location['location'][$i]['input_type']                         = 'hidden';
  
                                                
$location['location'][$i]['extra'][0]['input_type']                             
= 'text';
!                                               
$location['location'][$i]['extra'][0]['input_name']                             
= 'tenant_name';
!                                               
$location['location'][$i]['extra'][0]['size']                                   
= 30;
!                                               
$location['location'][$i]['extra'][0]['lookup_function_call']   = 'lookup_loc' 
. ($i+1) . '()';
!                                               
$location['location'][$i]['extra'][0]['value']                                  
= $data['values']['tenant_name'];
  
                                                
$location['location'][$i]['extra'][1]['input_type']                             
= 'text';
!                                               
$location['location'][$i]['extra'][1]['input_name']                             
= 'tenant_phone';
!                                               
$location['location'][$i]['extra'][1]['size']                                   
= 12;
!                                               
$location['location'][$i]['extra'][1]['lookup_function_call']   = 'lookup_loc' 
. ($i+1) . '()';
!                                               
$location['location'][$i]['extra'][1]['value']                                  
= $data['values']['tenant_phone'];
                                        }
                                        $i++;
--- 274,311 ----
                                        }
  
!                                       
if($config[$j]['column_name']=='tenant_id' && $data['tenant'])
                                        {
!                                               $m++;
!                                               $lookup_functions[$m]['name'] = 
'lookup_loc' . ($m+1) . '()';
!                                               $lookup_functions[$m]['action'] 
= 'Window1=window.open('."'" . $location_link .'&lookup_tenant=1&type_id=' . 
$config[$j]['location_type'] . '&lookup_name=' . $i ."'" 
.',"Search","width=800,height=700,toolbar=no,scrollbars=yes,resizable=yes");';
! 
!                                               
$location['location'][$i]['name']                                               
                = lang('Tenant');
!                                               
$location['location'][$i]['input_type']                                         
        = 'hidden';
!                                               
$location['location'][$i]['lookup_function_call']                               
= $lookup_functions[$m]['name'];
!                                               
$location['location'][$i]['statustext']                                         
        = lang('tenant');
  
                                                
$location['location'][$i]['extra'][0]['input_type']                             
= 'text';
!                                               
$location['location'][$i]['extra'][0]['input_name']                             
= 'last_name';
!                                               $input_name[]                   
                                                                                
= $location['location'][$i]['extra'][0]['input_name'];
!                                               
$location['location'][$i]['extra'][0]['size']                                   
= 15;
!                                               
$location['location'][$i]['extra'][0]['lookup_function_call']   = 
$lookup_functions[$m]['name'];
!                                               
$location['location'][$i]['extra'][0]['value']                                  
= $data['values']['last_name'];
!                                               
$location['location'][$i]['extra'][0]['statustext']                             
= lang('last name');
  
                                                
$location['location'][$i]['extra'][1]['input_type']                             
= 'text';
!                                               
$location['location'][$i]['extra'][1]['input_name']                             
= 'first_name';
!                                               $input_name[]                   
                                                                                
= $location['location'][$i]['extra'][1]['input_name'];
!                                               
$location['location'][$i]['extra'][1]['size']                                   
= 15;
!                                               
$location['location'][$i]['extra'][1]['lookup_function_call']   = 
$lookup_functions[$m]['name'];
!                                               
$location['location'][$i]['extra'][1]['value']                                  
= $data['values']['first_name'];
!                                               
$location['location'][$i]['extra'][1]['statustext']                             
= lang('first name');
! 
!                                               
$location['location'][$i]['extra'][2]['input_type']                             
= 'text';
!                                               
$location['location'][$i]['extra'][2]['input_name']                             
= 'contact_phone';
!                                               $input_name[]                   
                                                                                
= $location['location'][$i]['extra'][2]['input_name'];
!                                               
$location['location'][$i]['extra'][2]['size']                                   
= 12;
!                                               
$location['location'][$i]['extra'][2]['lookup_function_call']   = 
$lookup_functions[$m]['name'];
!                                               
$location['location'][$i]['extra'][2]['value']                                  
= $data['values']['contact_phone'];
!                                               
$location['location'][$i]['extra'][2]['statustext']                             
= lang('contact phone');
                                        }
                                        $i++;
***************
*** 240,244 ****
                        }
  
! //_debug_array($location['location']);
  
                        return $location;
--- 313,368 ----
                        }
  
!                       if($data['equipment'])
!                       {
!                               $m++;
!                               $equipment_link         = 
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uilookup.equipment&location_type='
 . $data['type_id']);
! 
!                               $lookup_functions[$m]['name'] = 
'lookup_equipment()';
!                               $lookup_functions[$m]['action'] = 
'Window1=window.open('."'" . $equipment_link ."'" 
.',"Search","width=800,height=700,toolbar=no,scrollbars=yes,resizable=yes");';
! 
!                               $location['location'][$i]['input_type']         
                                        = 'text';
!                               $location['location'][$i]['input_name']         
                                        = 'equipment_id';
!                               $input_name[]                                   
                                                                = 
'equipment_id';
!                               $location['location'][$i]['size']               
                                                = 12;
!                               
$location['location'][$i]['lookup_function_call']                               
= 'lookup_equipment()';
!                               $location['location'][$i]['lookup_link']        
                                        = True;
!                               $location['location'][$i]['name']               
                                                = lang('equipment');
!                               $location['location'][$i]['value']              
                                                = 
$data['values']['equipment_id'];
!                               $location['location'][$i]['statustext']         
                                        = lang('Klick this link to select') .' 
' . lang('equipment');
! 
!                               
$location['location'][$i]['extra'][0]['input_name']                             
= 'equipment_type';
!                               $input_name[]                                   
                                                                = 
$location['location'][$i]['extra'][0]['input_name'];
!                               
$location['location'][$i]['extra'][0]['input_type']                             
= 'text';
!                               $location['location'][$i]['extra'][0]['size']   
                                = 30;
!                               
$location['location'][$i]['extra'][0]['lookup_function_call']   = 
'lookup_equipment()';
!                               $location['location'][$i]['extra'][0]['value']  
                                = $data['values']['equipment_type'];
! 
!                       }
! 
!                       
$GLOBALS['phpgw']->session->appsession('lookup_fields',$this->currentapp,$input_name);
! 
!                       for ($i=0;$i<count($location['location']);$i++)
!                       {
!                               $lookup_name[] = 
$location['location'][$i]['name'];
! 
!                       }
! 
!                       
$GLOBALS['phpgw']->session->appsession('lookup_name',$this->currentapp,$lookup_name);
! 
!                       for ($j=0;$j<count($lookup_functions);$j++)
!                       {
!                               $location['lookup_functions'] .= 'function ' . 
$lookup_functions[$j]['name'] ."\r\n";
!                               $location['lookup_functions'] .= '{'."\r\n";
! 
!                               for ($k=0;$k<count($input_name);$k++)
!                               {
!                                       $location['lookup_functions'] .= 
"document.form." . $input_name[$k] . ".value = '';" ."\r\n";
!                               }
!                               $location['lookup_functions'] .= 
$lookup_functions[$j]['action'] ."\r\n";
!                               $location['lookup_functions'] .= '}'."\r\n";
!                       }
! 
! 
! //_debug_array($lookup_name);
  
                        return $location;
***************
*** 248,252 ****
  
  
!               function 
select_category_location_list($format='',$selected='',$type_id='')
                {
                        switch($format)
--- 372,376 ----
  
  
!               function 
select_category_list($format='',$selected='',$type_id='')
                {
                        switch($format)
***************
*** 260,264 ****
                        }
  
!                       $categories= 
$this->so->select_category_location_list($type_id);
  
                        while (is_array($categories) && list(,$category) = 
each($categories))
--- 384,388 ----
                        }
  
!                       $categories= $this->so->select_category_list($type_id);
  
                        while (is_array($categories) && list(,$category) = 
each($categories))
***************
*** 293,297 ****
                {
                        $location = $this->so->read(array('start' => 
$this->start,'query' => $this->query,'sort' => $this->sort,'order' => 
$this->order,
!                                                                               
        'filter' => $this->filter,'cat_id' => $this->cat_id,'type_id' => 
$type_id));
                        $this->total_records = $this->so->total_records;
                        $this->uicols = $this->so->uicols;
--- 417,421 ----
                {
                        $location = $this->so->read(array('start' => 
$this->start,'query' => $this->query,'sort' => $this->sort,'order' => 
$this->order,
!                                                                               
        'filter' => $this->filter,'cat_id' => $this->cat_id,'type_id' => 
$type_id,'lookup_tenant'=>$this->lookup_tenant));
                        $this->total_records = $this->so->total_records;
                        $this->uicols = $this->so->uicols;

Index: class.bolookup.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/property/inc/class.bolookup.inc.php,v
retrieving revision 1.7
retrieving revision 1.8
diff -C2 -r1.7 -r1.8
*** class.bolookup.inc.php      23 May 2003 08:40:19 -0000      1.7
--- class.bolookup.inc.php      13 Jun 2003 11:05:29 -0000      1.8
***************
*** 150,153 ****
--- 150,162 ----
                }
  
+               function read_tenant()
+               {
+                       $tenant = $this->so->read_tenant(array('start' => 
$this->start,'query' => $this->query,'sort' => $this->sort,'order' => 
$this->order,
+                                                                               
        'filter' => $this->filter,'cat_id' => $this->cat_id));
+                       $this->total_records = $this->so->total_records;
+ 
+                       return $tenant;
+               }
+ 
                function read_ns3420()
                {
***************
*** 204,208 ****
                }
  
!               function read_tenant()
                {
                        $location = $this->so->read_tenant(array('start' => 
$this->start,'query' => $this->query,'sort' => $this->sort,'order' => 
$this->order,
--- 213,217 ----
                }
  
!               function read_tenant_old()
                {
                        $location = $this->so->read_tenant(array('start' => 
$this->start,'query' => $this->query,'sort' => $this->sort,'order' => 
$this->order,
***************
*** 215,221 ****
--- 224,232 ----
                function read_equipment()
                {
+ 
                        $equipment = $this->so->read_equipment(array('start' => 
$this->start,'query' => $this->query,'sort' => $this->sort,'order' => 
$this->order,
                                                                                
        'filter' => $this->filter,'cat_id' => $this->cat_id,'district_id' => 
$this->district_id));
                        $this->total_records = $this->so->total_records;
+                       $this->uicols   = $this->so->uicols;
  
                        return $equipment;

Index: class.soadmin_location.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/property/inc/class.soadmin_location.inc.php,v
retrieving revision 1.7
retrieving revision 1.8
diff -C2 -r1.7 -r1.8
*** class.soadmin_location.inc.php      6 Jun 2003 10:23:03 -0000       1.7
--- class.soadmin_location.inc.php      13 Jun 2003 11:05:29 -0000      1.8
***************
*** 131,137 ****
                                (
                                        'column_name'           => 
$this->db->f('column_name'),
!                                       'input_name'            => 
$this->db->f('input_name'),
                                        'f_key'                         => 
$this->db->f('f_key'),
!                                       'location_form'         => 
$this->db->f('location_form'),
                                        'ref_to_category'       => 
$this->db->f('ref_to_category'),
                                        'query_value'           => 
$this->db->f('query_value'),
--- 131,137 ----
                                (
                                        'column_name'           => 
$this->db->f('column_name'),
!                                       'input_text'            => 
$this->db->f('input_text'),
                                        'f_key'                         => 
$this->db->f('f_key'),
!                                       'lookup_form'           => 
$this->db->f('lookup_form'),
                                        'ref_to_category'       => 
$this->db->f('ref_to_category'),
                                        'query_value'           => 
$this->db->f('query_value'),
***************
*** 193,198 ****
                        $this->db->transaction_begin();
  
!                       $this->db->query("INSERT INTO fm_location_type 
(id,name, descr, prefix) "
!                               . "VALUES ('" . $standard['id'] . "','" . 
$standard['name'] . "','" . $standard['descr'] . "','" . $standard['prefix']. 
"')",__LINE__,__FILE__);
  
                        $receipt['id']= $standard['id'];
--- 193,198 ----
                        $this->db->transaction_begin();
  
!                       $this->db->query("INSERT INTO fm_location_type 
(id,name, descr) "
!                               . "VALUES ('" . $standard['id'] . "','" . 
$standard['name'] . "','" . $standard['descr']. "')",__LINE__,__FILE__);
  
                        $receipt['id']= $standard['id'];
***************
*** 223,227 ****
                        }
  
!                       $fd['name'] = array('type' => 'varchar', 'precision' => 
25, 'nullable' => True);
                        $fd['entry_date'] = array('type' => 'int', 'precision' 
=> 4, 'nullable' => True);
                        $fd['category'] = array('type' => 'int', 'precision' => 
4, 'nullable' => True);
--- 223,227 ----
                        }
  
!                       $fd['loc' .$standard['id'] . '_name'] = array('type' => 
'varchar', 'precision' => 25, 'nullable' => True);
                        $fd['entry_date'] = array('type' => 'int', 'precision' 
=> 4, 'nullable' => True);
                        $fd['category'] = array('type' => 'int', 'precision' => 
4, 'nullable' => True);
***************
*** 229,232 ****
--- 229,233 ----
                        $fd['remark'] = array('type' => 'text', 'nullable' => 
True);
  
+                       
$add_columns_in_tables=array('fm_report','fm_equipment','fm_project','fm_tts_tickets','fm_request',fm_document);
  
                        if($this->oProc->CreateTable('fm_location'. 
$standard['id'],array('fd' => $fd,'pk' => $pk,'fk' => $fk,'ix' => 
array('location_code'),'uc' => array())))
***************
*** 243,246 ****
--- 244,252 ----
                                'uc' => array()));
  
+                               for ($i=0;$i<count($add_columns_in_tables);$i++)
+                               {
+                                       
$this->oProc->AddColumn($add_columns_in_tables[$i],'loc'. $standard['id'], 
array('type' => 'varchar', 'precision' => 4, 'nullable' => True));
+                               }
+ 
  
                                $receipt['message'][] = array('msg'     => 
lang('table %1 has been saved','fm_location'. $receipt['id'])        );
***************
*** 280,284 ****
                                $standard['descr'] = 
$this->db->db_addslashes($standard['descr']);
  
!                               $this->db->query("UPDATE $table set descr='" . 
$standard['descr'] . "', name='". $standard['name'] . "', prefix='". 
$standard['prefix']
                                        . "' WHERE id='" . $standard['id']. 
"'",__LINE__,__FILE__);
  
--- 286,290 ----
                                $standard['descr'] = 
$this->db->db_addslashes($standard['descr']);
  
!                               $this->db->query("UPDATE $table set descr='" . 
$standard['descr'] . "', name='". $standard['name']
                                        . "' WHERE id='" . $standard['id']. 
"'",__LINE__,__FILE__);
  
***************
*** 364,368 ****
                        }
  
!                       $sql = "SELECT 
$table.id,$table.list,$table.location_form ,$table.column_name 
,$table.input_name, $table.datatype ,$type_table.name as type FROM $type_table 
$this->join $table on $table.type_id = $type_table.id where $table.type_id= 
'$type_id' $querymethod";
  
                        $this->db2->query($sql,__LINE__,__FILE__);
--- 370,374 ----
                        }
  
!                       $sql = "SELECT 
$table.id,$table.list,$table.location_form,lookup_form,$table.column_name,$table.size
 ,statustext,$table.input_text, $table.datatype ,$type_table.name as type FROM 
$type_table $this->join $table on $table.type_id = $type_table.id where 
$table.type_id= '$type_id' $querymethod";
  
                        $this->db2->query($sql,__LINE__,__FILE__);
***************
*** 377,383 ****
                                        'location_type' => $type_id,
                                        'list'                  => 
$this->db->f('list'),
                                        'location_form' => 
$this->db->f('location_form'),
!                                       'name'                  => 
$this->db->f('column_name'),
!                                       'descr'                 => 
$this->db->f('input_name'),
                                        'type_name'             => 
$this->db->f('type'),
                                        'datatype'              => 
$this->db->f('datatype')
--- 383,392 ----
                                        'location_type' => $type_id,
                                        'list'                  => 
$this->db->f('list'),
+                                       'lookup_form'   => 
$this->db->f('lookup_form'),
                                        'location_form' => 
$this->db->f('location_form'),
!                                       'column_name'   => 
$this->db->f('column_name'),
!                                       'size'                  => 
$this->db->f('size'),
!                                       'statustext'    => 
$this->db->f('statustext'),
!                                       'input_text'    => 
$this->db->f('input_text'),
                                        'type_name'             => 
$this->db->f('type'),
                                        'datatype'              => 
$this->db->f('datatype')
***************
*** 401,405 ****
                                $attrib['id']                                   
        = $this->db->f('id');
                                $attrib['column_name']                          
= $this->db->f('column_name');
!                               $attrib['input_name']                           
= $this->db->f('input_name');
                                $attrib['statustext']                           
= $this->db->f('statustext');
                                $attrib['column_info']['precision']     = 
$this->db->f('precision_');
--- 410,414 ----
                                $attrib['id']                                   
        = $this->db->f('id');
                                $attrib['column_name']                          
= $this->db->f('column_name');
!                               $attrib['input_text']                           
= $this->db->f('input_text');
                                $attrib['statustext']                           
= $this->db->f('statustext');
                                $attrib['column_info']['precision']     = 
$this->db->f('precision_');
***************
*** 420,424 ****
  
                        $attrib['column_name'] = 
$this->db->db_addslashes($attrib['column_name']);
!                       $attrib['input_name'] = 
$this->db->db_addslashes($attrib['input_name']);
                        $attrib['statustext'] = 
$this->db->db_addslashes($attrib['statustext']);
                        $attrib['default'] = 
$this->db->db_addslashes($attrib['default']);
--- 429,433 ----
  
                        $attrib['column_name'] = 
$this->db->db_addslashes($attrib['column_name']);
!                       $attrib['input_text'] = 
$this->db->db_addslashes($attrib['input_text']);
                        $attrib['statustext'] = 
$this->db->db_addslashes($attrib['statustext']);
                        $attrib['default'] = 
$this->db->db_addslashes($attrib['default']);
***************
*** 427,435 ****
                        $this->db->transaction_begin();
  
!                       $this->db->query("INSERT INTO fm_location_type_column 
(id,column_name, input_name, statustext, type_id, 
datatype,precision_,scale,default_value,nullable) "
                                . "VALUES ('" .
                                $attrib['id'] . "','" .
                                $attrib['column_name'] . "','" .
!                               $attrib['input_name'] . "','" .
                                $attrib['statustext'] . "','" .
                                $attrib['type_id'] . "','" .
--- 436,444 ----
                        $this->db->transaction_begin();
  
!                       $this->db->query("INSERT INTO fm_location_type_column 
(id,column_name, input_text, statustext, type_id, 
datatype,precision_,scale,default_value,nullable) "
                                . "VALUES ('" .
                                $attrib['id'] . "','" .
                                $attrib['column_name'] . "','" .
!                               $attrib['input_text'] . "','" .
                                $attrib['statustext'] . "','" .
                                $attrib['type_id'] . "','" .
***************
*** 444,447 ****
--- 453,462 ----
                        $this->init_process();
  
+                       if($attrib['column_info']['type']=='date')
+                       {
+                               $attrib['column_info']['type']='int';
+                               $attrib['column_info']['precision']=4;
+                       }
+ 
                        
if($this->oProc->AddColumn('fm_location'.$attrib['type_id'],$attrib['column_name'],
 $attrib['column_info']))
                        {
***************
*** 523,527 ****
  
                        $attrib['column_name'] = 
$this->db->db_addslashes($attrib['column_name']);
!                       $attrib['input_name'] = 
$this->db->db_addslashes($attrib['input_name']);
                        $attrib['statustext'] = 
$this->db->db_addslashes($attrib['statustext']);
                        $attrib['default'] = 
$this->db->db_addslashes($attrib['default']);
--- 538,542 ----
  
                        $attrib['column_name'] = 
$this->db->db_addslashes($attrib['column_name']);
!                       $attrib['input_text'] = 
$this->db->db_addslashes($attrib['input_text']);
                        $attrib['statustext'] = 
$this->db->db_addslashes($attrib['statustext']);
                        $attrib['default'] = 
$this->db->db_addslashes($attrib['default']);
***************
*** 533,537 ****
                        $this->db->query("UPDATE fm_location_type_column set
                                column_name             = '". 
$attrib['column_name'] . "',
!                               input_name              = '". 
$attrib['input_name'] . "',
                                statustext              = '". 
$attrib['statustext'] . "',
                                type_id                 = '". 
$attrib['type_id'] . "',
--- 548,552 ----
                        $this->db->query("UPDATE fm_location_type_column set
                                column_name             = '". 
$attrib['column_name'] . "',
!                               input_text              = '". 
$attrib['input_text'] . "',
                                statustext              = '". 
$attrib['statustext'] . "',
                                type_id                 = '". 
$attrib['type_id'] . "',
***************
*** 545,553 ****
                        $this->init_process();
  
!                       
$this->oProc->RenameColumn('fm_location'.$attrib['type_id'], $OldColumnName, 
$attrib['column_name']);
  
                        
$this->oProc->AlterColumn('fm_location'.$attrib['type_id'],$attrib['column_name'],$attrib['column_info']);
- 
- 
  
                        $receipt['message'][] = array('msg'     => 
lang('Attribute has been edited'));
--- 560,571 ----
                        $this->init_process();
  
!                       if($attrib['column_info']['type']=='date')
!                       {
!                               $attrib['column_info']['type']='int';
!                               $attrib['column_info']['precision']=4;
!                       }
  
+                       
$this->oProc->RenameColumn('fm_location'.$attrib['type_id'], $OldColumnName, 
$attrib['column_name']);
                        
$this->oProc->AlterColumn('fm_location'.$attrib['type_id'],$attrib['column_name'],$attrib['column_info']);
  
                        $receipt['message'][] = array('msg'     => 
lang('Attribute has been edited'));

Index: class.soapartment.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/property/inc/class.soapartment.inc.php,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -r1.5 -r1.6
*** class.soapartment.inc.php   23 May 2003 16:24:08 -0000      1.5
--- class.soapartment.inc.php   13 Jun 2003 11:05:29 -0000      1.6
***************
*** 89,93 ****
                                . "     FROM (fm_apartment $this->join"
                                . " fm_property ON fm_apartment.property_id = 
fm_property.property_id $this->join"
!                               . " fm_part_of_town ON 
fm_property.part_of_town_id = fm_part_of_town.id $this->join"
                                . " fm_streetaddress ON fm_apartment.street_id 
= fm_streetaddress.street_id $this->join"
                                . " fm_apartment_category ON 
fm_apartment.cat_id = fm_apartment_category.id) $this->join fm_owner on 
fm_property.owner_id = fm_owner.owner_id  "
--- 89,93 ----
                                . "     FROM (fm_apartment $this->join"
                                . " fm_property ON fm_apartment.property_id = 
fm_property.property_id $this->join"
!                               . " fm_part_of_town ON 
fm_property.part_of_town_id = fm_part_of_town.part_of_town_id $this->join"
                                . " fm_streetaddress ON fm_apartment.street_id 
= fm_streetaddress.street_id $this->join"
                                . " fm_apartment_category ON 
fm_apartment.cat_id = fm_apartment_category.id) $this->join fm_owner on 
fm_property.owner_id = fm_owner.owner_id  "
***************
*** 128,132 ****
                                . "     FROM fm_apartment $this->join"
                                . " fm_property ON fm_apartment.property_id = 
fm_property.property_id $this->join"
!                               . " fm_part_of_town ON 
fm_property.part_of_town_id = fm_part_of_town.id $this->join"
                                . " fm_streetaddress ON fm_apartment.street_id 
= fm_streetaddress.street_id"
                                . " where 
fm_apartment.location_code='$location_code'";
--- 128,132 ----
                                . "     FROM fm_apartment $this->join"
                                . " fm_property ON fm_apartment.property_id = 
fm_property.property_id $this->join"
!                               . " fm_part_of_town ON 
fm_property.part_of_town_id = fm_part_of_town.part_of_town_id $this->join"
                                . " fm_streetaddress ON fm_apartment.street_id 
= fm_streetaddress.street_id"
                                . " where 
fm_apartment.location_code='$location_code'";

Index: class.socommon.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/property/inc/class.socommon.inc.php,v
retrieving revision 1.21
retrieving revision 1.22
diff -C2 -r1.21 -r1.22
*** class.socommon.inc.php      22 May 2003 09:54:11 -0000      1.21
--- class.socommon.inc.php      13 Jun 2003 11:05:30 -0000      1.22
***************
*** 18,21 ****
--- 18,23 ----
                        $this->account  = 
$GLOBALS['phpgw_info']['user']['account_id'];
                        $this->acl2     = 
CreateObject($this->currentapp.'.acl2','##DEFAULT##','##DEFAULT##');
+                       $this->soadmin_location = 
CreateObject($this->currentapp.'.soadmin_location');
+ 
  
                        if 
($GLOBALS['phpgw_info']['server']['db_type']=='pgsql')
***************
*** 31,34 ****
--- 33,150 ----
                }
  
+ 
+               function 
generate_sql($entity_table='',$cols='',$cols_return='',$uicols='',$joinmethod='',$paranthesis='',$query='')
+               {
+ 
+                       $location_types = 
$this->soadmin_location->select_location_type();
+ 
+                       for ($i=0; $i<count($location_types); $i++)
+                       {
+ 
+                               $uicols['input_type'][]         = 'text';
+                               $uicols['name'][]                       = 'loc' 
. $location_types[$i]['id'];
+                               $uicols['descr'][]                      = 
$location_types[$i]['name'];
+                               $uicols['statustext'][]         = 
$location_types[$i]['descr'];
+                               $cols .= ",$entity_table" . ".loc" . 
$location_types[$i]['id'];
+                               $cols_return[] = 'loc' . 
$location_types[$i]['id'];
+                       }
+ 
+                       $cols.= ',fm_location1.loc1_name as loc1_name';
+                       $cols_return[]                          = 'loc1_name';
+                       $uicols['input_type'][]         = 'text';
+                       $uicols['name'][]                       = 'loc1_name';
+                       $uicols['descr'][]                      = 
lang('Property Name');
+                       $uicols['statustext'][]         = lang('Property Name');
+ 
+ 
+                       $first_join     = False;
+ 
+                       for ($j=count($location_types); $j>0; $j--)
+                       {
+                               $joinmethod .= " $this->join fm_location". ($j);
+ 
+                               $paranthesis .='(';
+ 
+ 
+                               $on = 'ON';
+                               for ($i=($j); $i>0; $i--)
+                               {
+                                       if(!$first_join)
+                                       {
+                                               $joinmethod .= " $on 
($entity_table" . ".loc" . ($i). " = fm_location" . ($j) . ".loc" . ($i) . ")";
+                                       }
+                                       else
+                                       {
+                                               $joinmethod .= " $on 
(fm_location" . ($j+1) .".loc" . ($i). " = fm_location" . ($j) . ".loc" . ($i) 
. ")";
+                                       }
+                                       $on = 'AND';
+                                       if($i==1)
+                                       {
+                                               $joinmethod .= ")";
+                                       }
+                               }
+ 
+                               $first_join     = True;
+                       }
+ 
+ 
+                       $type_id        = count($location_types);
+ 
+                       $config = $this->soadmin_location->read_config('');
+ 
+                       for ($i=0;$i<count($config);$i++)
+                       {
+                               if (($config[$i]['location_type'] <= $type_id) 
&& ($config[$i]['f_key'] ==1))
+                               {
+                                       $joinmethod .= " $this->join  " . 
$config[$i]['reference_table'] . " ON ( fm_location" . 
$config[$i]['location_type'] . "." . $config[$i]['column_name'] . "=" . 
$config[$i]['reference_table'] . ".".$config[$i]['column_name']."))";
+ 
+                                       $paranthesis .='(';
+                               }
+ 
+                               if (($config[$i]['location_type'] <= $type_id) 
&& ($config[$i]['query_value'] ==1))
+                               {
+ 
+                                       
if($config[$i]['column_name']=='street_number')
+                                       {
+                                               $this->sub_query= "or 
street_name LIKE '%$query%'";
+ 
+                                               $cols.= 
',fm_streetaddress.street_name';
+                                               $cols_return[]                  
        = 'street_name';
+                                               $uicols['input_type'][]         
= 'text';
+                                               $uicols['name'][]               
        = 'street_name';
+                                               $uicols['descr'][]              
        = lang('street name');
+                                               $uicols['statustext'][]         
= lang('street name');
+ 
+                                               $cols.= ',' . 
$config[$i]['column_name'];
+                                               $cols_return[]                  
        = $config[$i]['column_name'];
+                                               $uicols['input_type'][]         
= 'text';
+                                               $uicols['name'][]               
        = $config[$i]['column_name'];
+                                               $uicols['descr'][]              
        = lang($config[$i]['input_text']);
+                                               $uicols['statustext'][]         
= lang($config[$i]['input_text']);
+ 
+                                       }
+                                       else
+                                       {
+                                               $cols.= ',' . 
$config[$i]['column_name'];
+                                               $cols_return[]                  
        = $config[$i]['column_name'];
+                                               $uicols['input_type'][]         
= 'text';
+                                               $uicols['name'][]               
        = $config[$i]['column_name'];
+                                               $uicols['descr'][]              
        = $config[$i]['input_text'];
+                                               $uicols['statustext'][]         
= $config[$i]['input_text'];
+                                       }
+                               }
+                       }
+ 
+                       $this->uicols           = $uicols;
+                       $this->cols_return      = $cols_return;
+ 
+                       $from .= " FROM $paranthesis $entity_table ";
+ 
+                       $sql = "SELECT $cols $from $joinmethod";
+                       return $sql;
+ 
+               }
+ 
+ 
                function get_user_list_right($right='',$acl_location='')
                {
***************
*** 272,281 ****
                {
  
!                       $this->db->query("SELECT name, id FROM fm_part_of_town 
ORDER BY name ");
  
                        $i = 0;
                        while ($this->db->next_record())
                        {
!                               $part_of_town[$i]['id']         = 
$this->db->f('id');
                                $part_of_town[$i]['name']       = 
stripslashes($this->db->f('name'));
                                $i++;
--- 388,397 ----
                {
  
!                       $this->db->query("SELECT name, part_of_town_id FROM 
fm_part_of_town ORDER BY name ");
  
                        $i = 0;
                        while ($this->db->next_record())
                        {
!                               $part_of_town[$i]['id']         = 
$this->db->f('part_of_town_id');
                                $part_of_town[$i]['name']       = 
stripslashes($this->db->f('name'));
                                $i++;

Index: class.soequipment.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/property/inc/class.soequipment.inc.php,v
retrieving revision 1.12
retrieving revision 1.13
diff -C2 -r1.12 -r1.13
*** class.soequipment.inc.php   11 May 2003 15:55:09 -0000      1.12
--- class.soequipment.inc.php   13 Jun 2003 11:05:30 -0000      1.13
***************
*** 130,134 ****
                        . "     FROM fm_equipment $this->join"
                        . " fm_property ON fm_equipment.property_id = 
fm_property.property_id $this->join"
!                       . " fm_part_of_town ON fm_property.part_of_town_id = 
fm_part_of_town.id $this->join"
                        . " fm_equipment_type ON fm_equipment.equipment_type_id 
= fm_equipment_type.id "
                        . " WHERE  $filtermethod $querymethod  ";
--- 130,134 ----
                        . "     FROM fm_equipment $this->join"
                        . " fm_property ON fm_equipment.property_id = 
fm_property.property_id $this->join"
!                       . " fm_part_of_town ON fm_property.part_of_town_id = 
fm_part_of_town.part_of_town_id $this->join"
                        . " fm_equipment_type ON fm_equipment.equipment_type_id 
= fm_equipment_type.id "
                        . " WHERE  $filtermethod $querymethod  ";

Index: class.soinvestment.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/property/inc/class.soinvestment.inc.php,v
retrieving revision 1.12
retrieving revision 1.13
diff -C2 -r1.12 -r1.13
*** class.soinvestment.inc.php  21 May 2003 12:46:39 -0000      1.12
--- class.soinvestment.inc.php  13 Jun 2003 11:05:30 -0000      1.13
***************
*** 79,83 ****
                        if ($part_of_town_id)
                        {
!                               $filtermethod = "and fm_part_of_town.id 
='$part_of_town_id'";
                        }
  
--- 79,83 ----
                        if ($part_of_town_id)
                        {
!                               $filtermethod = "and 
fm_part_of_town.part_of_town_id ='$part_of_town_id'";
                        }
  
***************
*** 97,101 ****
                                . " fm_investment_value.index_count"
                                . " FROM fm_property $this->join "
!                               . " fm_part_of_town ON 
fm_property.part_of_town_id = fm_part_of_town.id $this->join "
                                . " fm_investment_value ON 
fm_property.property_id = left(fm_investment_value.entity_id,4) $this->join "
                                . " fm_investment ON 
fm_investment_value.entity_id = fm_investment.entity_id AND "
--- 97,101 ----
                                . " fm_investment_value.index_count"
                                . " FROM fm_property $this->join "
!                               . " fm_part_of_town ON 
fm_property.part_of_town_id = fm_part_of_town.part_of_town_id $this->join "
                                . " fm_investment_value ON 
fm_property.property_id = left(fm_investment_value.entity_id,4) $this->join "
                                . " fm_investment ON 
fm_investment_value.entity_id = fm_investment.entity_id AND "
***************
*** 174,178 ****
                                        $property_id = 
substr($investment[$i]['location_code'],0,4);
  
!                                       $this->db->query("select 
fm_part_of_town.name as part_of_town,district_id from fm_property $this->join 
fm_part_of_town on fm_property.part_of_town_id=fm_part_of_town.id Where 
property_id= '$property_id'");
                                        $this->db->next_record();
                                        $investment[$i]['district_id'] = 
$this->db->f('district_id');
--- 174,178 ----
                                        $property_id = 
substr($investment[$i]['location_code'],0,4);
  
!                                       $this->db->query("select 
fm_part_of_town.name as part_of_town,district_id from fm_property $this->join 
fm_part_of_town on fm_property.part_of_town_id=fm_part_of_town.part_of_town_id 
Where property_id= '$property_id'");
                                        $this->db->next_record();
                                        $investment[$i]['district_id'] = 
$this->db->f('district_id');

Index: class.soinvoice.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/property/inc/class.soinvoice.inc.php,v
retrieving revision 1.21
retrieving revision 1.22
diff -C2 -r1.21 -r1.22
*** class.soinvoice.inc.php     21 May 2003 12:46:39 -0000      1.21
--- class.soinvoice.inc.php     13 Jun 2003 11:05:30 -0000      1.22
***************
*** 487,491 ****
                        $sql = "SELECT district_id,periode,sum(godkjentbelop) 
as consume $select_account_class "
                                . " FROM  fm_ecobilagoverf  $this->join 
fm_property ON left(fm_ecobilagoverf.dima,4) = fm_property.property_id 
$this->join "
!                       . " fm_part_of_town ON fm_property.fm_part_of_town_id = 
fm_part_of_town.id "
                        . " $filtermethod group by district_id,periode 
$group_account_class";
  //echo $sql;
--- 487,491 ----
                        $sql = "SELECT district_id,periode,sum(godkjentbelop) 
as consume $select_account_class "
                                . " FROM  fm_ecobilagoverf  $this->join 
fm_property ON left(fm_ecobilagoverf.dima,4) = fm_property.property_id 
$this->join "
!                       . " fm_part_of_town ON fm_property.fm_part_of_town_id = 
fm_part_of_town.part_of_town_id "
                        . " $filtermethod group by district_id,periode 
$group_account_class";
  //echo $sql;

Index: class.solocation.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/property/inc/class.solocation.inc.php,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -r1.3 -r1.4
*** class.solocation.inc.php    4 Jun 2003 12:24:40 -0000       1.3
--- class.solocation.inc.php    13 Jun 2003 11:05:30 -0000      1.4
***************
*** 37,41 ****
                }
  
!               function select_category_location_list($type_id='')
                {
                        if (!$type_id)
--- 37,57 ----
                }
  
!               function get_owner_list()
!               {
!                       $this->db->query("SELECT fm_owner.* 
,fm_owner_category.descr as category FROM fm_owner $this->join 
fm_owner_category on fm_owner.category=fm_owner_category.id  ORDER BY descr ");
! 
!                       $i = 0;
!                       while ($this->db->next_record())
!                       {
!                               $owners[$i]['id']                       = 
$this->db->f('owner_id');
!                               $owners[$i]['name']             = 
stripslashes($this->db->f('org_name')) . ' ['. $this->db->f('category') . ']';
!                               $i++;
!                       }
!                       return $owners;
!               }
! 
! 
! 
!               function select_category_list($type_id='')
                {
                        if (!$type_id)
***************
*** 45,49 ****
  
                        $table= 'fm_location'. $type_id . '_category';
!                       $this->db->query("SELECT id, descr FROM $table where id 
>'0' ORDER BY descr ");
  
                        $i = 0;
--- 61,65 ----
  
                        $table= 'fm_location'. $type_id . '_category';
!                       $this->db->query("SELECT id, descr FROM $table where id 
>'0' ORDER BY id asc ");
  
                        $i = 0;
***************
*** 51,55 ****
                        {
                                $categories[$i]['id']                           
= $this->db->f('id');
!                               $categories[$i]['name']                         
= stripslashes($this->db->f('descr'));
                                $i++;
                        }
--- 67,71 ----
                        {
                                $categories[$i]['id']                           
= $this->db->f('id');
!                               $categories[$i]['name']                         
= stripslashes($this->db->f('descr')) . ' [' . $this->db->f('id') . ']';
                                $i++;
                        }
***************
*** 76,79 ****
--- 92,96 ----
                                $cat_id = 
(isset($data['cat_id'])?$data['cat_id']:0);
                                $type_id = 
(isset($data['type_id'])?$data['type_id']:'');
+                               $lookup_tenant = 
(isset($data['lookup_tenant'])?$data['lookup_tenant']:'');
                        }
  
***************
*** 82,115 ****
                                return;
                        }
-                       $cols = "fm_location" . ($type_id) .".location_code";
-                       $cols_return[] = 'location_code';
  
                        $location_types = 
$this->soadmin_location->select_location_type();
  
                        for ($i=0; $i<($type_id); $i++)
                        {
  
!                               $uicols['name'][]               ='loc' . 
$location_types[$i]['id'];
!                               $uicols['descr'][]              
=$location_types[$i]['name'];
!                               $uicols['statustext'][] 
=$location_types[$i]['descr'];
                                $cols .= ",fm_location" . ($type_id) .".loc" . 
$location_types[$i]['id'];
                                $cols_return[] = 'loc' . 
$location_types[$i]['id'];
                        }
  
!                       $fm_location_colst = 
$this->soadmin_location->read_attrib(array('type_id'=>$type_id));
  
!                       for ($i=0;$i<count($fm_location_colst);$i++)
                        {
!                               if($fm_location_colst[$i]['list']==1)
                                {
!                                       $cols .= ",fm_location" . ($type_id) 
.".".$fm_location_colst[$i]['name'];
!                                       $cols_return[]                  = 
$fm_location_colst[$i]['name'];
!                                       $uicols['name'][]               = 
$fm_location_colst[$i]['name'];
!                                       $uicols['descr'][]              = 
$fm_location_colst[$i]['descr'];
!                                       $uicols['statustext'][] = 
$fm_location_colst[$i]['descr'];
                                }
                        }
  
! //_debug_array($fm_location_colst);
  
                        for ($j=($type_id-1); $j>0; $j--)
--- 99,134 ----
                                return;
                        }
  
                        $location_types = 
$this->soadmin_location->select_location_type();
  
+                       $cols = "fm_location" . ($type_id) .".location_code";
+                       $cols_return[] = 'location_code';
                        for ($i=0; $i<($type_id); $i++)
                        {
  
!                               $uicols['input_type'][]         = 'text';
!                               $uicols['name'][]                       = 'loc' 
. $location_types[$i]['id'];
!                               $uicols['descr'][]                      = 
$location_types[$i]['name'];
!                               $uicols['statustext'][]         = 
$location_types[$i]['descr'];
                                $cols .= ",fm_location" . ($type_id) .".loc" . 
$location_types[$i]['id'];
                                $cols_return[] = 'loc' . 
$location_types[$i]['id'];
                        }
  
!                       $fm_location_cols = 
$this->soadmin_location->read_attrib(array('type_id'=>$type_id));
  
!                       for ($i=0;$i<count($fm_location_cols);$i++)
                        {
!                               if($fm_location_cols[$i]['list']==1)
                                {
!                                       $cols .= ",fm_location" . ($type_id) 
.".".$fm_location_cols[$i]['column_name'];
!                                       $cols_return[]                          
= $fm_location_cols[$i]['column_name'];
!                                       $uicols['input_type'][]         = 
'text';
!                                       $uicols['name'][]                       
= $fm_location_cols[$i]['column_name'];
!                                       $uicols['descr'][]                      
= $fm_location_cols[$i]['input_text'];
!                                       $uicols['statustext'][]         = 
$fm_location_cols[$i]['statustext'];
                                }
                        }
  
! //_debug_array($fm_location_cols);
  
                        for ($j=($type_id-1); $j>0; $j--)
***************
*** 137,146 ****
  //_debug_array($config);
  
!                       $cols.= ',fm_location1.name as property_name';
!                       $cols_return[]                  = 'property_name';
!                       $uicols['name'][]               = 'property_name';
!                       $uicols['descr'][]              = lang('Property Name');
!                       $uicols['statustext'][] = lang('Property Name');
! 
  
                        for ($i=0;$i<count($config);$i++)
--- 156,195 ----
  //_debug_array($config);
  
!                       $cols.= ',fm_location1.loc1_name as loc1_name';
!                       $cols_return[]                          = 'loc1_name';
!                       $uicols['input_type'][]         = 'text';
!                       $uicols['name'][]                       = 'loc1_name';
!                       $uicols['descr'][]                      = 
lang('Property Name');
!                       $uicols['statustext'][]         = lang('Property Name');
! 
! 
!                       if($lookup_tenant)
!                       {
!                               $cols.= ',fm_tenant.tenant_id';
!                               $cols_return[]                          = 
'tenant_id';
!                               $uicols['input_type'][]         = 'hidden';
!                               $uicols['name'][]                       = 
'tenant_id';
! 
!                               $cols.= ',fm_tenant.last_name';
!                               $cols_return[]                          = 
'last_name';
!                               $uicols['input_type'][]         = 'text';
!                               $uicols['name'][]                       = 
'last_name';
!                               $uicols['descr'][]                      = 
lang('last name');
!                               $uicols['statustext'][]         = lang('last 
name');
! 
!                               $cols.= ',fm_tenant.last_name';
!                               $cols_return[]                          = 
'first_name';
!                               $uicols['input_type'][]         = 'text';
!                               $uicols['name'][]                       = 
'first_name';
!                               $uicols['descr'][]                      = 
lang('first name');
!                               $uicols['statustext'][]         = lang('first 
name');
! 
!                               $cols.= ',fm_tenant.last_name';
!                               $cols_return[]                          = 
'contact_phone';
!                               $uicols['input_type'][]         = 'text';
!                               $uicols['name'][]                       = 
'contact_phone';
!                               $uicols['descr'][]                      = 
lang('contact phone');
!                               $uicols['statustext'][]         = lang('contact 
phone');
!                       }
  
                        for ($i=0;$i<count($config);$i++)
***************
*** 161,174 ****
  
                                                $cols.= 
',fm_streetaddress.street_name';
!                                               $cols_return[]                  
= 'street_name';
!                                               $uicols['name'][]               
= 'street_name';
!                                               $uicols['descr'][]              
= lang('street name');
!                                               $uicols['statustext'][] = 
lang('street name');
  
                                                $cols.= ',' . 
$config[$i]['column_name'];
!                                               $cols_return[]                  
= $config[$i]['column_name'];
!                                               $uicols['name'][]               
= $config[$i]['column_name'];
!                                               $uicols['descr'][]              
= lang($config[$i]['input_name']);
!                                               $uicols['statustext'][] = 
lang($config[$i]['input_name']);
  
                                        }
--- 210,225 ----
  
                                                $cols.= 
',fm_streetaddress.street_name';
!                                               $cols_return[]                  
        = 'street_name';
!                                               $uicols['input_type'][]         
= 'text';
!                                               $uicols['name'][]               
        = 'street_name';
!                                               $uicols['descr'][]              
        = lang('street name');
!                                               $uicols['statustext'][]         
= lang('street name');
  
                                                $cols.= ',' . 
$config[$i]['column_name'];
!                                               $cols_return[]                  
        = $config[$i]['column_name'];
!                                               $uicols['input_type'][]         
= 'text';
!                                               $uicols['name'][]               
        = $config[$i]['column_name'];
!                                               $uicols['descr'][]              
        = lang($config[$i]['input_text']);
!                                               $uicols['statustext'][]         
= lang($config[$i]['input_text']);
  
                                        }
***************
*** 176,183 ****
                                        {
                                                $cols.= ',' . 
$config[$i]['column_name'];
!                                               $cols_return[]                  
= $config[$i]['column_name'];
!                                               $uicols['name'][]               
= $config[$i]['column_name'];
!                                               $uicols['descr'][]              
= $config[$i]['input_name'];
!                                               $uicols['statustext'][] = 
$config[$i]['input_name'];
                                        }
                                }
--- 227,235 ----
                                        {
                                                $cols.= ',' . 
$config[$i]['column_name'];
!                                               $cols_return[]                  
        = $config[$i]['column_name'];
!                                               $uicols['input_type'][]         
= 'text';
!                                               $uicols['name'][]               
        = $config[$i]['column_name'];
!                                               $uicols['descr'][]              
        = $config[$i]['input_text'];
!                                               $uicols['statustext'][]         
= $config[$i]['input_text'];
                                        }
                                }
***************
*** 195,199 ****
                        if ($order)
                        {
!                               $ordermethod = ' order by fm_location' . 
($type_id) .'.' . $order ." $sort";
                        }
                        else
--- 247,251 ----
                        if ($order)
                        {
!                               $ordermethod = " order by $order $sort";
                        }
                        else
***************
*** 232,236 ****
  //_debug_array($cols_return);
  
-                       $test='location_code';
                        $j=0;
                        while ($this->db->next_record())
--- 284,287 ----
***************
*** 243,246 ****
--- 294,298 ----
                        }
  
+ //_debug_array($location);
                        return $location;
                }
***************
*** 251,255 ****
                                . "     FROM fm_apartment $this->join"
                                . " fm_property ON fm_apartment.property_id = 
fm_property.property_id $this->join"
!                               . " fm_part_of_town ON 
fm_property.part_of_town_id = fm_part_of_town.id $this->join"
                                . " fm_streetaddress ON fm_apartment.street_id 
= fm_streetaddress.street_id"
                                . " where 
fm_apartment.location_code='$location_code'";
--- 303,307 ----
                                . "     FROM fm_apartment $this->join"
                                . " fm_property ON fm_apartment.property_id = 
fm_property.property_id $this->join"
!                               . " fm_part_of_town ON 
fm_property.part_of_town_id = fm_part_of_town.part_of_town_id $this->join"
                                . " fm_streetaddress ON fm_apartment.street_id 
= fm_streetaddress.street_id"
                                . " where 
fm_apartment.location_code='$location_code'";

Index: class.solookup.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/property/inc/class.solookup.inc.php,v
retrieving revision 1.17
retrieving revision 1.18
diff -C2 -r1.17 -r1.18
*** class.solookup.inc.php      15 May 2003 09:08:02 -0000      1.17
--- class.solookup.inc.php      13 Jun 2003 11:05:30 -0000      1.18
***************
*** 18,21 ****
--- 18,23 ----
                        $this->grants   = 
$GLOBALS['phpgw']->acl->get_grants($this->currentapp);
                        $this->account  = 
$GLOBALS['phpgw_info']['user']['account_id'];
+                       $this->soadmin_location         = 
CreateObject($this->currentapp.'.soadmin_location');
+                       $this->socommon                 = 
CreateObject($this->currentapp.'.socommon');
  
                        if 
($GLOBALS['phpgw_info']['server']['db_type']=='pgsql')
***************
*** 257,261 ****
                        . "     FROM fm_apartment $this->join"
                        . " fm_property ON fm_apartment.property_id = 
fm_property.property_id $this->join"
!                       . " fm_part_of_town ON fm_property.part_of_town_id = 
fm_part_of_town.id $this->join"
                        . " fm_tenant ON fm_apartment.tenant_id = 
fm_tenant.tenant_id $this->join"
                        . " fm_streetaddress ON fm_apartment.street_id = 
fm_streetaddress.street_id $this->join"
--- 259,263 ----
                        . "     FROM fm_apartment $this->join"
                        . " fm_property ON fm_apartment.property_id = 
fm_property.property_id $this->join"
!                       . " fm_part_of_town ON fm_property.part_of_town_id = 
fm_part_of_town.part_of_town_id $this->join"
                        . " fm_tenant ON fm_apartment.tenant_id = 
fm_tenant.tenant_id $this->join"
                        . " fm_streetaddress ON fm_apartment.street_id = 
fm_streetaddress.street_id $this->join"
***************
*** 343,346 ****
--- 345,403 ----
                }
  
+               function read_tenant($data)
+               {
+                       if(is_array($data))
+                       {
+                               if ($data['start'])
+                               {
+                                       $start=$data['start'];
+                               }
+                               else
+                               {
+                                       $start=0;
+                               }
+                               $filter = 
(isset($data['filter'])?$data['filter']:'none');
+                               $query = 
(isset($data['query'])?$data['query']:'');
+                               $sort = 
(isset($data['sort'])?$data['sort']:'DESC');
+                               $order = 
(isset($data['order'])?$data['order']:'');
+                               $cat_id = 
(isset($data['cat_id'])?$data['cat_id']:0);
+                       }
+ 
+                       if ($order)
+                       {
+                               $ordermethod = " order by $order $sort";
+                       }
+                       else
+                       {
+                               $ordermethod = ' order by last_name DESC';
+                       }
+ 
+                       if($query)
+                       {
+                               $query = ereg_replace("'",'',$query);
+                               $query = ereg_replace('"','',$query);
+ 
+                               $querymethod = " where ( last_name LIKE 
'%$query%' or first_name LIKE '%$query%')";
+                       }
+ 
+                       $sql = "SELECT * FROM fm_tenant $querymethod  ";
+ 
+                       $this->db2->query($sql,__LINE__,__FILE__);
+                       $this->total_records = $this->db2->num_rows();
+                       $this->db->limit_query($sql . 
$ordermethod,$start,__LINE__,__FILE__);
+ 
+                       while ($this->db->next_record())
+                       {
+                               $tenant[] = array
+                               (
+                                       'id'                    => 
$this->db->f('tenant_id'),
+                                       'last_name'     => 
$this->db->f('last_name'),
+                                       'first_name'    => 
$this->db->f('first_name')
+                                       );
+                       }
+ 
+                       return $tenant;
+               }
+ 
                function read_ns3420($data)
                {
***************
*** 475,479 ****
                        }
  
!                       $sql = "SELECT fm_property.* FROM fm_property 
$this->join fm_part_of_town on fm_property.part_of_town_id = fm_part_of_town.id 
"
                        . " WHERE  $filtermethod $querymethod  ";
  
--- 532,536 ----
                        }
  
!                       $sql = "SELECT fm_property.* FROM fm_property 
$this->join fm_part_of_town on fm_property.part_of_town_id = 
fm_part_of_town.part_of_town_id "
                        . " WHERE  $filtermethod $querymethod  ";
  
***************
*** 576,580 ****
                        . "     FROM fm_building $this->join"
                        . " fm_property ON fm_building.property_id = 
fm_property.property_id $this->join"
!                       . " fm_part_of_town ON fm_property.part_of_town_id = 
fm_part_of_town.id "
                        . " WHERE  $filtermethod $querymethod  ";
  
--- 633,637 ----
                        . "     FROM fm_building $this->join"
                        . " fm_property ON fm_building.property_id = 
fm_property.property_id $this->join"
!                       . " fm_part_of_town ON fm_property.part_of_town_id = 
fm_part_of_town.part_of_town_id "
                        . " WHERE  $filtermethod $querymethod  ";
  
***************
*** 679,683 ****
                        . "     FROM fm_entrance $this->join"
                        . " fm_property ON fm_entrance.property_id = 
fm_property.property_id $this->join"
!                       . " fm_part_of_town ON fm_property.part_of_town_id = 
fm_part_of_town.id "
                        . " WHERE  $filtermethod $querymethod  ";
  
--- 736,740 ----
                        . "     FROM fm_entrance $this->join"
                        . " fm_property ON fm_entrance.property_id = 
fm_property.property_id $this->join"
!                       . " fm_part_of_town ON fm_property.part_of_town_id = 
fm_part_of_town.part_of_town_id "
                        . " WHERE  $filtermethod $querymethod  ";
  
***************
*** 784,788 ****
                        . "     FROM fm_apartment $this->join"
                        . " fm_property ON fm_apartment.property_id = 
fm_property.property_id $this->join"
!                       . " fm_part_of_town ON fm_property.part_of_town_id = 
fm_part_of_town.id $this->join"
                        . " fm_streetaddress ON fm_apartment.street_id = 
fm_streetaddress.street_id $this->join"
                        . " fm_apartment_category ON fm_apartment.cat_id = 
fm_apartment_category.id "
--- 841,845 ----
                        . "     FROM fm_apartment $this->join"
                        . " fm_property ON fm_apartment.property_id = 
fm_property.property_id $this->join"
!                       . " fm_part_of_town ON fm_property.part_of_town_id = 
fm_part_of_town.part_of_town_id $this->join"
                        . " fm_streetaddress ON fm_apartment.street_id = 
fm_streetaddress.street_id $this->join"
                        . " fm_apartment_category ON fm_apartment.cat_id = 
fm_apartment_category.id "
***************
*** 813,817 ****
                }
  
!               function read_tenant($data)
                {
  //_debug_array($data);
--- 870,874 ----
                }
  
!               function read_tenant_old($data)
                {
  //_debug_array($data);
***************
*** 895,899 ****
                        . "     FROM fm_apartment $this->join"
                        . " fm_property ON fm_apartment.property_id = 
fm_property.property_id $this->join"
!                       . " fm_part_of_town ON fm_property.part_of_town_id = 
fm_part_of_town.id $this->join"
                        . " fm_tenant ON fm_apartment.tenant_id = 
fm_tenant.tenant_id $this->join"
                        . " fm_streetaddress ON fm_apartment.street_id = 
fm_streetaddress.street_id $this->join"
--- 952,956 ----
                        . "     FROM fm_apartment $this->join"
                        . " fm_property ON fm_apartment.property_id = 
fm_property.property_id $this->join"
!                       . " fm_part_of_town ON fm_property.part_of_town_id = 
fm_part_of_town.part_of_town_id $this->join"
                        . " fm_tenant ON fm_apartment.tenant_id = 
fm_tenant.tenant_id $this->join"
                        . " fm_streetaddress ON fm_apartment.street_id = 
fm_streetaddress.street_id $this->join"
***************
*** 929,933 ****
                }
  
!               function read_equipment($data)
                {
                        if(is_array($data))
--- 986,990 ----
                }
  
!               function read_equipment_old($data)
                {
                        if(is_array($data))
***************
*** 949,952 ****
--- 1006,1013 ----
                        }
  
+ //                    $input_name = 
$GLOBALS['phpgw']->session->appsession('lookup_fields',$this->currentapp);
+ 
+ 
+ //_debug_array($input_name);
  
                        if ($order)
***************
*** 956,997 ****
                        else
                        {
!                               $ordermethod = ' order by 
fm_equipment.property_id DESC';
                        }
  
!                       if ($filter == 'none')
                        {
!                               $filtermethod = ' ( fm_equipment.owner=' . 
$this->account;
!                               if (is_array($this->grants))
                                {
!                                       $grants = $this->grants;
!                                       while (list($user) = each($grants))
!                                       {
!                                               $public_user_list[] = $user;
!                                       }
!                                       reset($public_user_list);
!                                       $filtermethod .= " OR 
(fm_equipment.access='public' OR fm_equipment.owner IN(" . 
implode(',',$public_user_list) . ")))";
                                }
                                else
                                {
!                                       $filtermethod .= ' )';
                                }
                        }
!                       elseif ($filter == 'yours')
                        {
!                               $filtermethod = " fm_equipment.owner='" . 
$this->account . "'";
                        }
                        else
                        {
!                               $filtermethod = " fm_equipment.owner='" . 
$this->account . "' AND fm_equipment.access='private'";
                        }
  
                        if ($cat_id > 0)
                        {
!                               $filtermethod .= " AND fm_equipment. 
equipment_type_id='$cat_id' ";
                        }
  
                        if ($district_id > 0)
                        {
!                               $filtermethod .= " AND  
district_id='$district_id' ";
                        }
                        if($query)
--- 1017,1153 ----
                        else
                        {
!                               $ordermethod = ' order by fm_equipment.loc1 
DESC';
                        }
  
!                       $where = 'WHERE';
!                       if ($cat_id > 0)
                        {
!                               $filtermethod .= " $where fm_equipment. 
equipment_type_id='$cat_id' ";
!                               $where = 'AND';
!                       }
! 
!                       if ($district_id > 0)
!                       {
!                               $filtermethod .= " $where  
district_id='$district_id' ";
!                               $where = 'AND';
!                       }
!                       if($query)
!                       {
!                               $query = ereg_replace("'",'',$query);
!                               $query = ereg_replace('"','',$query);
! 
!                               $querymethod = " $where ( fm_equipment.descr 
LIKE '%$query%' OR street_name LIKE '%$query%' OR fm_equipment.location_code 
LIKE '%$query%' OR equipment_id LIKE '%$query%' )";
!                               $where = 'AND';
!                       }
! 
! 
!                       $sql = "SELECT 
equipment_id,fm_equipment.descr,fm_equipment.location_code,fm_equipment.floor 
as floor,fm_equipment.address as address ,fm_equipment_type.name as category"
!                       . "     FROM (((fm_equipment "
!                       . " $this->join fm_location1 ON (fm_equipment.loc1 = 
fm_location1.loc1)) "
!                       . " $this->join fm_part_of_town ON 
(fm_location1.part_of_town_id = fm_part_of_town.part_of_town_id)) "
!                       . " $this->join fm_equipment_type ON 
(fm_equipment.equipment_type_id = fm_equipment_type.id))"
!                       . " $filtermethod $querymethod  ";
! 
! //echo $sql;
!                       $this->db2->query($sql,__LINE__,__FILE__);
!                       $this->total_records = $this->db2->num_rows();
!                       $this->db->limit_query($sql . 
$ordermethod,$start,__LINE__,__FILE__);
! 
!                       while ($this->db->next_record())
!                       {
!                               $equipment[] = array
!                               (
!                                       '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'),
!                                       'descr'                 => 
$this->db->f('descr'),
!                                       );
!                       }
! 
! //_debug_array($equipment);
! 
!                       return $equipment;
!               }
! 
!               function read_equipment($data)
!               {
!                       if(is_array($data))
!                       {
!                               if ($data['start'])
                                {
!                                       $start=$data['start'];
                                }
                                else
                                {
!                                       $start=0;
                                }
+                               $filter = 
(isset($data['filter'])?$data['filter']:'none');
+                               $query = 
(isset($data['query'])?$data['query']:'');
+                               $sort = 
(isset($data['sort'])?$data['sort']:'DESC');
+                               $order = 
(isset($data['order'])?$data['order']:'');
+                               $cat_id = 
(isset($data['cat_id'])?$data['cat_id']:0);
+                               $district_id = 
(isset($data['district_id'])?$data['district_id']:0);
                        }
! 
! //                    $input_name = 
$GLOBALS['phpgw']->session->appsession('lookup_fields',$this->currentapp);
! 
! 
! //_debug_array($input_name);
! 
! 
!                       $entity_table = 'fm_equipment';
! 
!                       $cols = $entity_table . '.location_code';
!                       $cols_return[] = 'location_code';
! 
!                       $cols.= ',equipment_id';
!                       $cols_return[]                          = 
'equipment_id';
!                       $uicols['input_type'][]         = 'text';
!                       $uicols['name'][]                       = 
'equipment_id';
!                       $uicols['descr'][]                      = 
lang('Equipment');
!                       $uicols['statustext'][]         = lang('Equipment ID');
! 
!                       $cols.= ",$entity_table.descr";
!                       $cols_return[]                          = 'descr';
!                       $uicols['input_type'][]         = 'text';
!                       $uicols['name'][]                       = 'descr';
!                       $uicols['descr'][]                      = lang('descr');
!                       $uicols['statustext'][]         = lang('descr');
! 
!                       $cols.= ",fm_equipment_type.name as equipment_type";
!                       $cols_return[]                          = 
'equipment_type';
!                       $uicols['input_type'][]         = 'hidden';
!                       $uicols['name'][]                       = 
'equipment_type';
!                       $uicols['descr'][]                      = 
lang('equipment type');
!                       $uicols['statustext'][]         = lang('equipment 
type');
! 
!                       $joinmethod .= " $this->join  fm_equipment_type ON 
(fm_equipment.equipment_type_id = fm_equipment_type.id))";
! 
!                       $paranthesis .='(';
! 
!                       $sql    = 
$this->socommon->generate_sql($entity_table,$cols,$cols_return,$uicols,$joinmethod,$paranthesis,$query);
! 
!                       if ($order)
                        {
!                               $ordermethod = " order by $order $sort";
                        }
                        else
                        {
!                               $ordermethod = ' order by fm_equipment.loc1 
DESC';
                        }
  
+                       $where = 'WHERE';
                        if ($cat_id > 0)
                        {
!                               $filtermethod .= " $where fm_equipment. 
equipment_type_id='$cat_id' ";
!                               $where = 'AND';
                        }
  
                        if ($district_id > 0)
                        {
!                               $filtermethod .= " $where  
district_id='$district_id' ";
!                               $where = 'AND';
                        }
                        if($query)
***************
*** 1000,1030 ****
                                $query = ereg_replace('"','',$query);
  
!                               $querymethod = " AND ( fm_equipment.descr LIKE 
'%$query%' OR street_name LIKE '%$query%' OR fm_equipment.location_code LIKE 
'%$query%' OR equipment_id LIKE '%$query%' )";
                        }
  
  
!                       $sql = "SELECT 
equipment_id,fm_equipment.descr,fm_equipment.location_code,fm_equipment.floor 
as floor,fm_equipment.address as address ,fm_equipment_type.name as category"
!                       . "     FROM fm_equipment $this->join"
!                       . " fm_property ON fm_equipment.property_id = 
fm_property.property_id $this->join"
!                       . " fm_part_of_town ON fm_property.part_of_town_id = 
fm_part_of_town.id $this->join"
!                       . " fm_equipment_type ON fm_equipment.equipment_type_id 
= fm_equipment_type.id "
!                       . " WHERE  $filtermethod $querymethod  ";
  
  //echo $sql;
                        $this->db2->query($sql,__LINE__,__FILE__);
                        $this->total_records = $this->db2->num_rows();
                        $this->db->limit_query($sql . 
$ordermethod,$start,__LINE__,__FILE__);
  
                        while ($this->db->next_record())
                        {
!                               $equipment[] = array
!                               (
!                                       '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'),
!                                       'descr'                 => 
$this->db->f('descr'),
!                                       );
                        }
  
--- 1156,1183 ----
                                $query = ereg_replace('"','',$query);
  
!                               $sub_query      = $this->socommon->sub_query;
!                               $querymethod = " $where ( fm_equipment.descr 
LIKE '%$query%' OR fm_equipment.location_code LIKE '%$query%' OR equipment_id 
LIKE '%$query%'  $sub_query)";
!                               $where = 'AND';
                        }
  
  
!                       $sql .= " $filtermethod $querymethod";
  
  //echo $sql;
+                       $this->uicols   = $this->socommon->uicols;
+                       $cols_return    = $this->socommon->cols_return;
+ 
                        $this->db2->query($sql,__LINE__,__FILE__);
                        $this->total_records = $this->db2->num_rows();
                        $this->db->limit_query($sql . 
$ordermethod,$start,__LINE__,__FILE__);
  
+                       $j=0;
                        while ($this->db->next_record())
                        {
!                               for ($i=0;$i<count($cols_return);$i++)
!                               {
!                                       $equipment[$j][$cols_return[$i]] = 
$this->db->f($cols_return[$i]);
!                               }
!                               $j++;
                        }
  

Index: class.soproperty.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/property/inc/class.soproperty.inc.php,v
retrieving revision 1.17
retrieving revision 1.18
diff -C2 -r1.17 -r1.18
*** class.soproperty.inc.php    23 May 2003 16:24:09 -0000      1.17
--- class.soproperty.inc.php    13 Jun 2003 11:05:30 -0000      1.18
***************
*** 61,65 ****
                function get_district($property_id)
                {
!                       $this->db->query("select district_id from 
fm_part_of_town $this->join fm_property on 
fm_part_of_town.id=fm_property.part_of_town_id where fm_property.property_id 
='$property_id'");
                        $this->db->next_record();
                        return  $this->db->f('district_id');
--- 61,65 ----
                function get_district($property_id)
                {
!                       $this->db->query("select district_id from 
fm_part_of_town $this->join fm_property on 
fm_part_of_town.part_of_town_id=fm_property.part_of_town_id where 
fm_property.property_id ='$property_id'");
                        $this->db->next_record();
                        return  $this->db->f('district_id');
***************
*** 124,128 ****
                        }
  
!                       $sql = "SELECT fm_property.* , fm_part_of_town.name as 
part_of_town, fm_part_of_town.district_id FROM fm_property $this->join 
fm_part_of_town on fm_property.part_of_town_id = fm_part_of_town.id "
                                . " $this->join fm_owner on 
fm_property.owner_id = fm_owner.owner_id $filtermethod $querymethod";
  
--- 124,128 ----
                        }
  
!                       $sql = "SELECT fm_property.* , fm_part_of_town.name as 
part_of_town, fm_part_of_town.district_id FROM fm_property $this->join 
fm_part_of_town on fm_property.part_of_town_id = 
fm_part_of_town.part_of_town_id "
                                . " $this->join fm_owner on 
fm_property.owner_id = fm_owner.owner_id $filtermethod $querymethod";
  
***************
*** 152,156 ****
                function read_single($property_id)
                {
!                       $sql = "SELECT fm_property.*,fm_part_of_town.name as 
part_of_town ,fm_part_of_town.id as part_of_town_id, 
fm_part_of_town.district_id FROM fm_property $this->join fm_part_of_town on 
fm_property.part_of_town_id = fm_part_of_town.id where 
property_id='$property_id'";
  
                        $this->db->query($sql,__LINE__,__FILE__);
--- 152,156 ----
                function read_single($property_id)
                {
!                       $sql = "SELECT fm_property.*,fm_part_of_town.name as 
part_of_town ,fm_part_of_town.id as part_of_town_id, 
fm_part_of_town.district_id FROM fm_property $this->join fm_part_of_town on 
fm_property.part_of_town_id = fm_part_of_town.part_of_town_id where 
property_id='$property_id'";
  
                        $this->db->query($sql,__LINE__,__FILE__);

Index: class.soreport.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/property/inc/class.soreport.inc.php,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -r1.1 -r1.2
*** class.soreport.inc.php      13 May 2003 21:12:50 -0000      1.1
--- class.soreport.inc.php      13 Jun 2003 11:05:30 -0000      1.2
***************
*** 130,134 ****
                        . "     FROM fm_report $this->join"
                        . " fm_property ON fm_report.property_id = 
fm_property.property_id $this->join"
!                       . " fm_part_of_town ON fm_property.part_of_town_id = 
fm_part_of_town.id $this->join"
                        . " fm_report_type ON fm_report.report_type_id = 
fm_report_type.id "
                        . " WHERE  $filtermethod $querymethod  ";
--- 130,134 ----
                        . "     FROM fm_report $this->join"
                        . " fm_property ON fm_report.property_id = 
fm_property.property_id $this->join"
!                       . " fm_part_of_town ON fm_property.part_of_town_id = 
fm_part_of_town.part_of_town_id $this->join"
                        . " fm_report_type ON fm_report.report_type_id = 
fm_report_type.id "
                        . " WHERE  $filtermethod $querymethod  ";

Index: class.soXport.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/property/inc/class.soXport.inc.php,v
retrieving revision 1.23
retrieving revision 1.24
diff -C2 -r1.23 -r1.24
*** class.soXport.inc.php       15 May 2003 09:08:02 -0000      1.23
--- class.soXport.inc.php       13 Jun 2003 11:05:30 -0000      1.24
***************
*** 71,75 ****
                        $this->db->query("select 
fm_meter.name,fm_meter.location_code,fm_part_of_town.district_id "
                        . " from fm_meter $this->join fm_property ON 
fm_meter.property_id = fm_property.property_id $this->join "
!             . " fm_part_of_town ON fm_property.part_of_town_id = 
fm_part_of_town.id where fm_meter.id='$anleggsnr'");
  
                        $this->db->next_record();
--- 71,75 ----
                        $this->db->query("select 
fm_meter.name,fm_meter.location_code,fm_part_of_town.district_id "
                        . " from fm_meter $this->join fm_property ON 
fm_meter.property_id = fm_property.property_id $this->join "
!             . " fm_part_of_town ON fm_property.part_of_town_id = 
fm_part_of_town.part_of_town_id where fm_meter.id='$anleggsnr'");
  
                        $this->db->next_record();

Index: class.uilocation.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/property/inc/class.uilocation.inc.php,v
retrieving revision 1.6
retrieving revision 1.7
diff -C2 -r1.6 -r1.7
*** class.uilocation.inc.php    6 Jun 2003 11:38:17 -0000       1.6
--- class.uilocation.inc.php    13 Jun 2003 11:05:30 -0000      1.7
***************
*** 39,42 ****
--- 39,43 ----
                        $this->bocommon                                 = 
CreateObject($this->currentapp.'.bocommon');
                        $this->socommon                                 = 
CreateObject($this->currentapp.'.socommon');
+                       $this->soadmin_location                 = 
CreateObject($this->currentapp.'.soadmin_location');
  
                        $this->start                            = 
$this->bo->start;
***************
*** 75,79 ****
--- 76,85 ----
                        $type_id                = 
get_var('type_id',array('GET'));
                        $lookup                 = 
get_var('lookup',array('POST','GET'));
+                       $lookup_name    = 
get_var('lookup_name',array('POST','GET'));
  
+                       if($lookup)
+                       {
+                               
$GLOBALS['phpgw_info']['flags']['headonly']=true;
+                       }
                        $links = $this->bocommon->menu();
  
***************
*** 89,95 ****
                                for ($i=0;$i<count($uicols['name']);$i++)
                                {
!                                       $content[$j]['row'][$i]['value']        
                = $location[$uicols['name'][$i]];
!                                       $content[$j]['row'][$i]['name_hidden']  
        = $uicols['name'][$i];
!                                       $content[$j]['row'][$i]['lookup']       
                = $lookup;
                                }
  
--- 95,108 ----
                                for ($i=0;$i<count($uicols['name']);$i++)
                                {
!                                       if($uicols['input_type'][$i]!='hidden')
!                                       {
!                                               
$content[$j]['row'][$i]['value']                        = 
$location[$uicols['name'][$i]];
!                                               $content[$j]['row'][$i]['name'] 
                        = $uicols['name'][$i];
!                                               
$content[$j]['row'][$i]['lookup']                       = $lookup;
!                                       }
! 
!                                       $content[$j]['hidden'][$i]['value']     
                = $location[$uicols['name'][$i]];
!                                       $content[$j]['hidden'][$i]['name']      
                        = $uicols['name'][$i];
! 
                                }
  
***************
*** 112,122 ****
                        for ($i=0;$i<count($uicols['descr']);$i++)
                        {
!                               $table_header[$i]['header']     = 
$uicols['descr'][$i];
!                               $table_header[$i]['width']              = '5%';
!                               $table_header[$i]['align']              = 
'center';
!                               if($uicols['descr'][$i]=='loc1')
                                {
!                                       $table_header[$i]['sort_link']  =true;
!                                       $table_header[$i]['sort']               
= $this->nextmatchs->show_sort_order(array
                                                                                
(
                                                                                
        'sort'  => $this->sort,
--- 125,137 ----
                        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,
***************
*** 128,134 ****
                                                                                
                                                        'lookup'        
=>$lookup,
                                                                                
                                                        'cat_id'        
=>$this->cat_id)
- 
                                                                                
));
! 
                                }
                        }
--- 143,163 ----
                                                                                
                                                        'lookup'        
=>$lookup,
                                                                                
                                                        'cat_id'        
=>$this->cat_id)
                                                                                
));
!                                       }
!                                       if($uicols['name'][$i]=='street_name')
!                                       {
!                                               $table_header[$i]['sort_link']  
=true;
!                                               $table_header[$i]['sort']       
        = $this->nextmatchs->show_sort_order(array
!                                                                               
(
!                                                                               
        'sort'  => $this->sort,
!                                                                               
        'var'   =>      'street_name',
!                                                                               
        'order' =>      $this->order,
!                                                                               
        'extra'         => array('menuaction'   => 
$this->currentapp.'.uilocation.index',
!                                                                               
                                                        'type_id'       
=>$type_id,
!                                                                               
                                                        'query'         
=>$this->query,
!                                                                               
                                                        'lookup'        
=>$lookup,
!                                                                               
                                                        'cat_id'        
=>$this->cat_id)
!                                                                               
));
!                                       }
                                }
                        }
***************
*** 154,157 ****
--- 183,187 ----
  
  //_debug_array($table_header);
+ //_debug_array($uicols);
  
  
***************
*** 177,186 ****
  
  
!                               for ($i=0;$i<$type_id;$i++)
!                               {
!                                       $function_exchange_values .= 
'opener.document.form.loc' . ($i+1) .'.value = thisform.elements[' . $i . 
'].value;' ."\r\n";
!                               }
  
!                               $function_exchange_values .='window.close()';
  
  
--- 207,216 ----
  
  
!                       for ($i=0;$i<count($uicols['name']);$i++)
!                       {
!                               $function_exchange_values .= 
'opener.document.form.' . $uicols['name'][$i] .'.value = thisform.elements[' . 
$i . '].value;' ."\r\n";
!                       }
  
!                       $function_exchange_values .='window.close()';
  
  
***************
*** 204,208 ****
                                'lang_cat_statustext'                   => 
lang('Select the category the location belongs to. To do not use a category 
select NO CATEGORY'),
                                'select_name'                                   
=> 'cat_id',
!                               'cat_list'                                      
        => 
$this->bo->select_category_location_list('filter',$this->cat_id,$type_id),
                                'select_action'                                 
=> $GLOBALS['phpgw']->link('/index.php',$link_data),
                                'filter_name'                                   
=> 'filter',
--- 234,238 ----
                                'lang_cat_statustext'                   => 
lang('Select the category the location belongs to. To do not use a category 
select NO CATEGORY'),
                                'select_name'                                   
=> 'cat_id',
!                               'cat_list'                                      
        => $this->bo->select_category_list('filter',$this->cat_id,$type_id),
                                'select_action'                                 
=> $GLOBALS['phpgw']->link('/index.php',$link_data),
                                'filter_name'                                   
=> 'filter',
***************
*** 220,224 ****
  
                        $appname                                                
= lang('location');
!                       $function_msg                                   = 
lang('list location');
  
                        $GLOBALS['phpgw_info']['flags']['app_header'] = 
lang($this->currentapp) . ' - ' . $appname . ': ' . $function_msg;
--- 250,265 ----
  
                        $appname                                                
= lang('location');
! 
!                       if($lookup)
!                       {
!                               $lookup_list    = 
$GLOBALS['phpgw']->session->appsession('lookup_name',$this->currentapp);
! //_debug_array($lookup_list);
! 
!                               $function_msg                                   
= $lookup_list[$lookup_name];
!                       }
!                       else
!                       {
!                               $function_msg                                   
= $uicols['descr'][($type_id-1)];
!                       }
  
                        $GLOBALS['phpgw_info']['flags']['app_header'] = 
lang($this->currentapp) . ' - ' . $appname . ': ' . $function_msg;
***************
*** 231,256 ****
                        $location_code                  = 
get_var('location_code',array('POST','GET'));
                        $location = split('-',$location_code);
-                       $property_id = $location[0];
-                       $building_id = $location[1];
-                       $entrance_id = $location[2];
-                       $apartment_id = $location[3];
  
! //    _debug_array($_POST);
  
!                       $type_id                = 
get_var('type_id',array('GET'));
! 
! 
!                       $values                                 = 
get_var('values',array('POST','GET'));
!                       if($values)
                        {
!                               $values = $values + 
$this->bocommon->get_location();
                        }
  
!                       $values['street_idd']   = 
get_var('street_idd',array('POST'));
  
! //echo 'location_code :' .$location_code. '<br>';
! //_debug_array($values);
! //_debug_array($location);
!                       $values_attribute               = 
get_var('values_attribute',array('POST','GET'));
  
                        $GLOBALS['phpgw']->xslttpl->add_file(array('location'));
--- 272,294 ----
                        $location_code                  = 
get_var('location_code',array('POST','GET'));
                        $location = split('-',$location_code);
  
!       _debug_array($_POST);
  
!                       while (is_array($_POST) && list($input_name,$value) = 
each($_POST))
                        {
!                               $values[] = array(
!                               'input_name'    => $input_name,
!                               'value'                 => $value
!                               );
                        }
  
!       _debug_array($values);
! 
!                       $type_id                = 
get_var('type_id',array('GET'));
  
!                       if($location_code)
!                       {
!                               $type_id = count($location);
!                       }
  
                        $GLOBALS['phpgw']->xslttpl->add_file(array('location'));
***************
*** 328,340 ****
                        }
  
-                       if ($location_id)
-                       {
-                               $function_msg = lang('edit location');
-                       }
-                       else
-                       {
-                               $function_msg = lang('add location');
-                       }
- 
                        if ($values['cat_id'] > 0)
                        {
--- 366,369 ----
***************
*** 377,384 ****
                        $location_data=$this->bo->initiate_ui_location(array(
                                                'values'                => 
$_POST,
!                                               'type_id'               => 
$type_id,
                                                'location_type' => 
$location_type
                                                ));
  
  
                        $dateformat = 
strtolower($GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat']);
--- 406,497 ----
                        $location_data=$this->bo->initiate_ui_location(array(
                                                'values'                => 
$_POST,
!                                               'type_id'               => 
($type_id-1),
!                                               'no_link'               => 
($type_id), // disable lookup links for location type less than type_id
!                                               'tenant'                => True,
!               //                              'equipment'             => True,
                                                'location_type' => 
$location_type
                                                ));
  
+                       $location_types = $this->bo->location_types;
+                       $config                 = $this->bo->config;
+ 
+                       if ($location_id)
+                       {
+                               $function_msg = lang('edit');
+                       }
+                       else
+                       {
+                               $function_msg = lang('add');
+                       }
+ 
+                       $function_msg .= ' ' 
.$location_types[($type_id-1)]['name'];
+ 
+ //    _debug_array($config);
+                       $custom_fields  = 
$this->soadmin_location->read_attrib(array(type_id=>$type_id));
+ 
+                       $j=0;
+                       $additional_fields[$j]['input_text']    = 
$location_types[($type_id-1)]['name'];
+                       $additional_fields[$j]['statustext']    = 
$location_types[($type_id-1)]['descr'];
+                       $additional_fields[$j]['datatype']              = 
'varchar';
+                       $additional_fields[$j]['input_name']    = 'loc' . 
$type_id;
+                       $additional_fields[$j]['class']                 = 
'th_text';
+                       $j++;
+                       $additional_fields[$j]['input_text']    = lang('name');
+                       $additional_fields[$j]['statustext']    = lang('enter 
the name for this location');
+                       $additional_fields[$j]['datatype']              = 
'varchar';
+                       $additional_fields[$j]['input_name']    = 'loc' . 
$type_id . '_name';
+                       $j++;
+ 
+                       while (is_array($custom_fields) && list(,$custom) = 
each($custom_fields))
+                       {
+                               $additional_fields[$j]['input_text']    = 
$custom['input_text'];
+                               $additional_fields[$j]['statustext']    = 
$custom['statustext'];
+                               $additional_fields[$j]['datatype']              
= $custom['datatype'];
+                               $additional_fields[$j]['input_name']    = 
$custom['column_name'];
+ 
+                               $j++;
+                       }
+ 
+                       $additional_fields[$j]['input_text']    = 
lang('remark');
+                       $additional_fields[$j]['statustext']    = lang('enter 
any remark for this location');
+                       $additional_fields[$j]['datatype']              = 
'text';
+                       $additional_fields[$j]['input_name']    = 'remark';
+ 
+ 
+ //    _debug_array($custom_fields);
+ 
+                       for ($j=0;$j<count($config);$j++)
+                       {
+                               if($config[$j]['location_type'] == $type_id)
+                               {
+ 
+                                       
if($config[$j]['column_name']=='street_id')
+                                       {
+                                               $edit_street=True;
+                                       }
+ 
+                                       
if($config[$j]['column_name']=='tenant_id')
+                                       {
+                                               $edit_tenant=True;
+                                       }
+ 
+                                       
if($config[$j]['column_name']=='part_of_town_id')
+                                       {
+                                               $edit_part_of_town=True;
+                                               $select_name_part_of_town       
        = 'part_of_town_id';
+                                               $part_of_town_list              
                = 
$this->bocommon->select_part_of_town('select',$this->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');
+                                       }
+                                       
if($config[$j]['column_name']=='owner_id')
+                                       {
+                                               $edit_owner=True;
+                                               $lang_owner                     
                        = lang('Owner');
+                                               $owner_list                     
                        = $this->bo->get_owner_list($property['owner_id']);
+                                               $lang_select_owner              
                = lang('Select owner');
+                                               $lang_owner_statustext          
        = lang('Select the owner');
+                                       }
+                               }
+                       }
+ 
  
                        $dateformat = 
strtolower($GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat']);
***************
*** 412,417 ****
--- 525,550 ----
                        $msgbox_data = $this->bocommon->msgbox_data($receipt);
  
+ 
+                                               $lang_owner                     
                        = lang('Owner');
+                                               $owner_list                     
                        = $this->bo->get_owner_list($property['owner_id']);
+                                               $lang_select_owner              
                = lang('Select owner');
+                                               $lang_owner_statustext          
        = lang('Select the owner');
+ 
                        $data = array
                        (
+                               'edit_street'                                   
=> $edit_street,
+                               'edit_tenant'                                   
=> $edit_tenant,
+                               'edit_part_of_town'                             
=> $edit_part_of_town,
+                               'edit_owner'                                    
=> $edit_owner,
+                               'select_name_part_of_town'              => 
$select_name_part_of_town,
+                               'part_of_town_list'                             
=> $part_of_town_list,
+                               'lang_town_statustext'                  => 
$lang_town_statustext,
+                               'lang_part_of_town'                             
=> lang('Part of town'),
+                               'lang_no_part_of_town'                  => 
lang('No part of town'),
+                               'lang_owner'                                    
=> $lang_owner,
+                               'owner_list'                                    
=> $owner_list,
+                               'lang_select_owner'                             
=> $lang_select_owner,
+                               'lang_owner_statustext'                 => 
$lang_owner_statustext,
+                               'additional_fields'                             
=> $additional_fields,
                                'msgbox_data'                                   
=> $GLOBALS['phpgw']->common->msgbox($msgbox_data),
                                'lang_dateformat'                               
=> lang(strtolower($dateformat)),
***************
*** 421,424 ****
--- 554,565 ----
                                'dateformat_source'                             
=> './'.$this->currentapp.'/inc/dateformat.js',
                                'street_link'                                   
=> 
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uilookup.street'),
+ 
+                               'tenant_link'                                   
=> 
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uilookup.tenant'),
+                               'lang_tenant'                                   
=> lang('tenant'),
+                               'value_tenant_id'                               
=> $values['tenant_id'],
+                               'value_tenant_last_name'                => 
$values['tenant_last_name'],
+                               'value_tenant_first_name'               => 
$values['tenant_first_name'],
+                               'lang_tenant_statustext'                => 
lang('Select a tenant'),
+ 
                                'location_type'                                 
=> $location_type,
                                'location_data'                                 
=> $location_data,
***************
*** 427,431 ****
                                'attributes_values'                             
=> $attributes_values,
                                'form_action'                                   
=> $GLOBALS['phpgw']->link('/index.php',$link_data),
!                               'done_action'                                   
=> 
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uilocation.index'),
                                'lang_location_id'                              
=> lang('location ID'),
                                'lang_floor'                                    
=> lang('floor'),
--- 568,572 ----
                                'attributes_values'                             
=> $attributes_values,
                                'form_action'                                   
=> $GLOBALS['phpgw']->link('/index.php',$link_data),
!                               'done_action'                                   
=> 
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uilocation.index&type_id='
 . $type_id),
                                'lang_location_id'                              
=> lang('location ID'),
                                'lang_floor'                                    
=> lang('floor'),
***************
*** 441,445 ****
                                'value_floor'                                   
=> $values['floor'],
                                'value_street'                                  
=> $values['street_name'],
!                               'value_street_idd'                              
=> $values['street_id'],
                                'value_street_number'                   => 
$values['street_number'],
                                'value_name'                                    
=> $values['name'],
--- 582,586 ----
                                'value_floor'                                   
=> $values['floor'],
                                'value_street'                                  
=> $values['street_name'],
!                               'value_street_id'                               
=> $values['street_id'],
                                'value_street_number'                   => 
$values['street_number'],
                                'value_name'                                    
=> $values['name'],
***************
*** 461,467 ****
                                'lang_no_cat'                                   
=> lang('no category'),
                                'lang_cat_statustext'                   => 
lang('Select the category the location belongs to. To do not use a category 
select NO CATEGORY'),
!                               'select_name'                                   
=> 'values[cat_id]',
                                'lang_remark_statustext'                => 
lang('Enter any remarks regarding this location'),
!                               'cat_list'                                      
        => $this->bo->select_category_location_list('select',$values['cat_id'])
                        );
  
--- 602,608 ----
                                'lang_no_cat'                                   
=> lang('no category'),
                                'lang_cat_statustext'                   => 
lang('Select the category the location belongs to. To do not use a category 
select NO CATEGORY'),
!                               'select_name'                                   
=> 'cat_id',
                                'lang_remark_statustext'                => 
lang('Enter any remarks regarding this location'),
!                               'cat_list'                                      
        => $this->bo->select_category_list('select',$values['cat_id'],$type_id)
                        );
  

Index: class.uilookup.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/property/inc/class.uilookup.inc.php,v
retrieving revision 1.19
retrieving revision 1.20
diff -C2 -r1.19 -r1.20
*** class.uilookup.inc.php      23 May 2003 08:40:19 -0000      1.19
--- class.uilookup.inc.php      13 Jun 2003 11:05:30 -0000      1.20
***************
*** 23,32 ****
                var $public_functions = array
                (
!                       'addressbook'  => True,
!                       'b_account'  => True,
!                       'location'   => True,
!                       'equipment'   => True,
!                       'ns3420'   => True,
!                       'street'   => True
                );
  
--- 23,33 ----
                var $public_functions = array
                (
!                       'addressbook'   => True,
!                       'b_account'             => True,
!                       'location'              => True,
!                       'equipment'             => True,
!                       'ns3420'                => True,
!                       'street'                => True,
!                       'tenant'                => True
                );
  
***************
*** 45,48 ****
--- 46,50 ----
                        $this->bo                                       = 
CreateObject($this->currentapp.'.bolookup',True);
                        $this->bocommon                                 = 
CreateObject($this->currentapp.'.bocommon');
+                       $this->soadmin_location         = 
CreateObject($this->currentapp.'.soadmin_location');
  
                        $this->start                            = 
$this->bo->start;
***************
*** 371,374 ****
--- 373,480 ----
                }
  
+               function tenant()
+               {
+ 
+                       $GLOBALS['phpgw']->xslttpl->add_file(array('lookup',
+                                                                               
'nextmatchs',
+                                                                               
'search_field'));
+ 
+                       $tenant_list = $this->bo->read_tenant();
+ 
+                       while (is_array($tenant_list) && list(,$tenant_entry) = 
each($tenant_list))
+                       {
+                               $content[] = array
+                               (
+                                       'id'                            => 
$tenant_entry['id'],
+                                       'last_name'                     => 
$tenant_entry['last_name'],
+                                       'first_name'            => 
$tenant_entry['first_name'],
+                                       'lang_select'           => 
lang('Select'),
+                                       'lang_select_statustext' => 
lang('Select this tenant')
+                               );
+                       }
+ 
+                       $table_header[] = array
+                       (
+                               'sort_last_name'        => 
$this->nextmatchs->show_sort_order(array
+                                                                               
(
+                                                                               
        'sort'  => $this->sort,
+                                                                               
        'var'   =>      'last_name',
+                                                                               
        'order' =>      $this->order,
+                                                                               
        'extra'         => array('menuaction'   => 
$this->currentapp.'.uilookup.tenant',
+                                                                               
                                                        'cat_id'        
=>$this->cat_id)
+                                                                               
)),
+                               'sort_first_name'       => 
$this->nextmatchs->show_sort_order(array
+                                                                               
(
+                                                                               
        'sort'  => $this->sort,
+                                                                               
        'var'   =>      'first_name',
+                                                                               
        'order' =>      $this->order,
+                                                                               
        'extra'         => array('menuaction'   => 
$this->currentapp.'.uilookup.tenant',
+                                                                               
                                                        'cat_id'        
=>$this->cat_id)
+                                                                               
)),
+                               'lang_last_name'                => lang('last 
name'),
+                               'lang_first_name'               => lang('first 
name'),
+                               'sort_id'       => 
$this->nextmatchs->show_sort_order(array
+                                                                               
(
+                                                                               
        'sort'  => $this->sort,
+                                                                               
        'var'   =>      'tenant_id',
+                                                                               
        'order' =>      $this->order,
+                                                                               
        'extra'         => array('menuaction'   => 
$this->currentapp.'.uilookup.tenant',
+                                                                               
                                                        'cat_id'        
=>$this->cat_id)
+                                                                               
)),
+                               'lang_id'               => lang('ID'),
+                               'lang_select'           => lang('Select')
+                       );
+ 
+                       $table_done[] = array
+                       (
+                               'lang_done'                             => 
lang('Done'),
+                               'lang_done_statustext'  => lang('Close this 
window')
+                       );
+ 
+                       $link_select = array
+                       (
+                               'menuaction'            => 
$this->currentapp.'.uilookup.tenant',
+                               'second_display'        => true,
+                               'order'                         => $this->order,
+                               'sort'                          => $this->sort,
+                               'cat_id'                        => 
$this->cat_id,
+                               'query'                         => $this->query,
+                               'filter'                        => $this->filter
+                       );
+ 
+ 
+                       $data = array
+                       (
+                               'allow_allrows'                                 
=> false,
+                               'start_record'                                  
=> $this->start,
+                               'record_limit'                                  
=> $GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs'],
+                               'num_records'                                   
=> count($tenant_list),
+                               'all_records'                                   
=> $this->bo->total_records,
+                               'link_url'                                      
        => $GLOBALS['phpgw']->link('/index.php',$link_select),
+                               'img_path'                                      
        => $GLOBALS['phpgw']->common->get_image_path('phpgwapi'),
+                               'lang_no_cat'                                   
=> lang('no category'),
+                               'lang_cat_statustext'                   => 
lang('Select the category the building belongs to. To do not use a category 
select NO CATEGORY'),
+                               'select_name'                                   
=> 'cat_id',
+                               'cat_list'                                      
        => $this->cats->formatted_xslt_list(array('selected' => 
$this->cat_id,'globals' => True)),
+                               'select_action'                                 
=> $GLOBALS['phpgw']->link('/index.php',$link_select),
+ //                            'filter_list'                                   
=> $this->nextmatchs->xslt_filter(array('filter' => $this->filter,'yours' => 
'yes')),
+                               'lang_filter_statustext'                => 
lang('Select the filter. To show all entries select SHOW ALL'),
+                               'lang_searchfield_statustext'   => lang('Enter 
the search string. To show all entries, empty this field and press the SUBMIT 
button again'),
+                               'lang_searchbutton_statustext'  => lang('Submit 
the search string'),
+                               'query'                                         
        => $this->query,
+                               'lang_search'                                   
=> lang('search'),
+                               'table_header_tenant_new'               => 
$table_header,
+                               'values_tenant_new'                     => 
$content,
+                               'table_done'                                    
=> $table_done
+                       );
+ 
+                       $appname                                                
= lang('tenant');
+                       $function_msg                                   = 
lang('list tenant');
+ 
+                       $GLOBALS['phpgw_info']['flags']['app_header'] = 
lang($this->currentapp) . ' - ' . $appname . ': ' . $function_msg;
+                       
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('list_tenant_new' => $data));
+                       $this->save_sessiondata();
+               }
+ 
                function ns3420()
                {
***************
*** 497,501 ****
                                        break;
                                        case 'tenant':
!                                               $location_list = 
$this->bo->read_tenant();
                                                $cat_list = 
$this->bocommon->select_category_apartment_list('filter',$this->cat_id);
                                                $function_msg = lang('list 
tenant');
--- 603,607 ----
                                        break;
                                        case 'tenant':
!                                               $location_list = 
$this->bo->read_tenant_old();
                                                $cat_list = 
$this->bocommon->select_category_apartment_list('filter',$this->cat_id);
                                                $function_msg = lang('list 
tenant');
***************
*** 644,707 ****
  
  
                        $equipment_list = $this->bo->read_equipment();
  
                        while (is_array($equipment_list) && 
list(,$equipment_entry) = each($equipment_list))
                        {
!                               $location       = split("-", 
$equipment_entry['location_code']);
  
!                               $content[] = array
!                               (
!                                       'equipment_id'                          
=> $equipment_entry['equipment_id'],
!                                       'descr'                                 
        => $equipment_entry['descr'],
!                                       'property_id'                           
=> $location[0],
!                                       'building_id'                           
=> $location[1],
!                                       'entrance_id'                           
=> $location[2],
!                                       'floor'                                 
        => $equipment_entry['floor'],
!                                       'apartment_id'                          
=> $location[3],
!                                       'address'                               
        => $equipment_entry['address'],
!                                       'category'                              
        => $equipment_entry['category']
!                               );
                        }
  
! //_debug_array($equipment_list);
!                       $table_header[] = array
!                       (
!                               'sort_equipment'        => 
$this->nextmatchs->show_sort_order(array
                                                                                
(
                                                                                
        'sort'  => $this->sort,
!                                                                               
        'var'   =>      'equipment_id',
!                                                                               
        'order' =>      $this->order,
!                                                                               
        'extra' => array('menuaction'           => 
$this->currentapp.'.uilookup.equipment',
!                                                                               
                                                        'cat_id'                
=>$this->cat_id,
!                                                                               
                                                        'district_id'   => 
$this->district_id)
!                                                                               
)),
!                               'lang_equipment'        => lang('Equipment'),
!                               'lang_descr'            => lang('Descr'),
!                               'sort_property' => 
$this->nextmatchs->show_sort_order(array
                                                                                
(
                                                                                
        'sort'  => $this->sort,
!                                                                               
        'var'   =>      'property_id',
                                                                                
        'order' =>      $this->order,
!                                                                               
        'extra'         => array('menuaction'           => 
$this->currentapp.'.uilookup.equipment',
!                                                                               
                                                        'cat_id'                
=>$this->cat_id,
!                                                                               
                                                        'district_id'   => 
$this->district_id)
!                                                                               
)),
!                               'lang_property'         => lang('Property'),
!                               'lang_building'         => lang('Building'),
!                               'lang_entrance'         => lang('Entrance'),
!                               'lang_floor'            => lang('Floor'),
!                               'lang_apartment'        => lang('Apartment'),
!                               'sort_address'  => 
$this->nextmatchs->show_sort_order(array
                                                                                
(
                                                                                
        'sort'  => $this->sort,
!                                                                               
        'var'   =>      'fm_equipment.address',
                                                                                
        'order' =>      $this->order,
!                                                                               
        'extra'         => array('menuaction'           => 
$this->currentapp.'.uilookup.equipment',
!                                                                               
                                                        'cat_id'                
=>$this->cat_id,
!                                                                               
                                                        'district_id'   => 
$this->district_id)
!                                                                               
)),
!                               'lang_address'          => lang('Address'),
!                               'lang_category'         => lang('Category')
!                       );
  
                        $table_done[] = array
--- 750,850 ----
  
  
+ //                    $location_types = 
$this->soadmin_location->select_location_type();
+ //_debug_array($location_types);
+ //                    $location_type = 
get_var('location_type',array('POST','GET'));
+ 
                        $equipment_list = $this->bo->read_equipment();
  
+                       $input_name = 
$GLOBALS['phpgw']->session->appsession('lookup_fields',$this->currentapp);
+ //_debug_array($input_name);
+ 
+                       $uicols = $this->bo->uicols;
+ 
+ //_debug_array($uicols);
+ 
+                       $j=0;
                        while (is_array($equipment_list) && 
list(,$equipment_entry) = each($equipment_list))
                        {
!                               for ($i=0;$i<count($uicols['name']);$i++)
!                               {
!                                       if($uicols['input_type'][$i]!='hidden')
!                                       {
!                                               
$content[$j]['row'][$i]['value']                        = 
$equipment_entry[$uicols['name'][$i]];
!                                               $content[$j]['row'][$i]['name'] 
                        = $uicols['name'][$i];
!                                       }
!                               }
  
!                               for ($i=0;$i<count($input_name);$i++)
!                               {
!                                       $content[$j]['hidden'][$i]['value']     
                = $equipment_entry[$input_name[$i]];
!                                       $content[$j]['hidden'][$i]['name']      
                = $input_name[$i];
!                               }
! 
!                               $j++;
                        }
  
! //_debug_array($content);
!                       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'   =>      'loc1',
!                                                                               
        'order' =>      $this->order,
!                                                                               
        'extra'         => array('menuaction'   => 
$this->currentapp.'.uilookup.equipment',
!                                                                               
                                                        'type_id'       
=>$type_id,
!                                                                               
                                                        'query'         
=>$this->query,
!                                                                               
                                                        'lookup'        
=>$lookup,
!                                                                               
                                                        'cat_id'        
=>$this->cat_id)
!                                                                               
));
!                                       }
!                                       if($uicols['name'][$i]=='equipment_id')
!                                       {
!                                               $table_header[$i]['sort_link']  
=true;
!                                               $table_header[$i]['sort']       
        = $this->nextmatchs->show_sort_order(array
                                                                                
(
                                                                                
        'sort'  => $this->sort,
!                                                                               
        'var'   =>      'equipment_id',
                                                                                
        'order' =>      $this->order,
!                                                                               
        'extra'         => array('menuaction'   => 
$this->currentapp.'.uilookup.equipment',
!                                                                               
                                                        'type_id'       
=>$type_id,
!                                                                               
                                                        'query'         
=>$this->query,
!                                                                               
                                                        'lookup'        
=>$lookup,
!                                                                               
                                                        'cat_id'        
=>$this->cat_id)
!                                                                               
));
!                                       }
!                                       if($uicols['name'][$i]=='street_name')
!                                       {
!                                               $table_header[$i]['sort_link']  
=true;
!                                               $table_header[$i]['sort']       
        = $this->nextmatchs->show_sort_order(array
                                                                                
(
                                                                                
        'sort'  => $this->sort,
!                                                                               
        'var'   =>      'street_name',
                                                                                
        'order' =>      $this->order,
!                                                                               
        'extra'         => array('menuaction'   => 
$this->currentapp.'.uilookup.equipment',
!                                                                               
                                                        'type_id'       
=>$type_id,
!                                                                               
                                                        'query'         
=>$this->query,
!                                                                               
                                                        'lookup'        
=>$lookup,
!                                                                               
                                                        'cat_id'        
=>$this->cat_id)
!                                                                               
));
!                                       }
!                               }
!                       }
! 
!                       $table_header[$i]['width']                      = '5%';
!                       $table_header[$i]['align']                      = 
'center';
!                       $table_header[$i]['header']             = 
lang('select');
! 
! 
! //_debug_array($table_header);
! //_debug_array($uicols);
  
                        $table_done[] = array
***************
*** 722,727 ****
--- 865,883 ----
                        );
  
+ 
+                       for ($i=0;$i<count($input_name);$i++)
+                       {
+                               $function_exchange_values .= 
'opener.document.form.' . $input_name[$i] .'.value = thisform.elements[' . $i . 
'].value;' ."\r\n";
+                       }
+ 
+                       $function_exchange_values .='window.close()';
+ 
+ 
                        $data = array
                        (
+                               'exchange_values'                               
=> 'Exchange_values(this.form);',
+                               'function_exchange_values'              => 
$function_exchange_values,
+                               'lang_select'                                   
=> lang('select'),
+                               'lookup'                                        
        => 1,//$lookup,
                                'allow_allrows'                                 
=> false,
                                'start_record'                                  
=> $this->start,





reply via email to

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