phpgroupware-cvs
[Top][All Lists]
Advanced

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

[Phpgroupware-cvs] CVS: property/inc class.bocommon.inc.php,1.54,1.55 cl


From: Sigurd Nes <address@hidden>
Subject: [Phpgroupware-cvs] CVS: property/inc class.bocommon.inc.php,1.54,1.55 class.boequipment.inc.php,1.12,1.13 class.bolookup.inc.php,1.8,1.9 class.boproject.inc.php,1.5,1.6 class.socommon.inc.php,1.26,1.27 class.soequipment.inc.php,1.15,1.16 class.solookup.inc.php,1.19,1.20 class.soproject.inc.php,1.14,1.15 class.uiequipment.inc.php,1.25,1.26 class.uilookup.inc.php,1.21,1.22 class.uiproject.inc.php,1.24,1.25
Date: Thu, 19 Jun 2003 08:10:01 -0400

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

Modified Files:
        class.bocommon.inc.php class.boequipment.inc.php 
        class.bolookup.inc.php class.boproject.inc.php 
        class.socommon.inc.php class.soequipment.inc.php 
        class.solookup.inc.php class.soproject.inc.php 
        class.uiequipment.inc.php class.uilookup.inc.php 
        class.uiproject.inc.php 
Log Message:
no message

Index: class.bocommon.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/property/inc/class.bocommon.inc.php,v
retrieving revision 1.54
retrieving revision 1.55
diff -C2 -r1.54 -r1.55
*** class.bocommon.inc.php      18 Jun 2003 11:21:17 -0000      1.54
--- class.bocommon.inc.php      19 Jun 2003 12:09:58 -0000      1.55
***************
*** 780,793 ****
                }
  
                function generate_sql($data)
                {
!                       $sql                                            = 
$this->socommon->generate_sql($data);
!                       $this->uicols                           = 
$this->socommon->uicols;
!                       $this->cols_return                      = 
$this->socommon->cols_return;
!                       $this->max_location_join        = 
$this->socommon->max_location_join;
!                       $this->type_id                          = 
$this->socommon->type_id;
  
                        return $sql;
                }
  
                function select_part_of_town($format='',$selected='')
--- 780,909 ----
                }
  
+ 
                function generate_sql($data)
                {
! //_debug_array($data);
! 
!                       $cols                           = 
(isset($data['cols'])?$data['cols']:'');
!                       $entity_table           = 
(isset($data['entity_table'])?$data['entity_table']:'');
!                       $cols_return            = 
(isset($data['cols_return'])?$data['cols_return']:'');
!                       $uicols                         = 
(isset($data['uicols'])?$data['uicols']:'');
!                       $joinmethod             = 
(isset($data['joinmethod'])?$data['joinmethod']:'');
!                       $paranthesis            = 
(isset($data['paranthesis'])?$data['paranthesis']:'');
! 
!                       $this->join = $this->socommon->join;
! 
!                       $joinmethod .= " $this->join  fm_location1 ON 
($entity_table.loc1 = fm_location1.loc1))";
!                       $paranthesis .='(';
!                       $joinmethod .= " $this->join  fm_part_of_town ON 
(fm_location1.part_of_town_id = fm_part_of_town.part_of_town_id))";
!                       $paranthesis .='(';
!                       $joinmethod .= " $this->join  fm_owner ON 
(fm_location1.owner_id = fm_owner.owner_id))";
!                       $paranthesis .='(';
! 
! 
!                       $location_types = 
$this->soadmin_location->select_location_type();
!                       $config = $this->soadmin_location->read_config('');
! 
! 
!                       $type_id        = count($location_types);
!                       $this->type_id  = $type_id;
! 
!                       $fm_location_cols = 
$this->soadmin_location->read_attrib(array('type_id'=>$type_id,'lookup_type'=>$type_id));
! 
! 
! 
!                       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'];
!                       }
! 
!                       for ($i=0;$i<count($fm_location_cols);$i++)
!                       {
!                               if($fm_location_cols[$i]['list']==1)
!                               {
!                                       $cols_extra[]                           
= $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'];
!                               }
!                       }
! 
! 
!                       for ($i=0; $i< $this->type_id; $i++)
!                       {
!                               $cols_return[] = 'loc' . 
$location_types[$i]['id'];
!                       }
! 
!                       $cols_return[]                          = 'loc1_name';
!                       $cols_extra[]                           = 'loc1_name';
!                       $uicols['input_type'][]         = 'text';
!                       $uicols['name'][]                       = 'loc1_name';
!                       $uicols['descr'][]                      = 
lang('Property Name');
!                       $uicols['statustext'][]         = lang('Property Name');
! 
! 
! 
!                       for ($i=0;$i<count($config);$i++)
!                       {
! 
!                               if (($config[$i]['location_type'] <= $type_id) 
&& ($config[$i]['query_value'] ==1))
!                               {
! 
!                                       
if($config[$i]['column_name']=='street_id')
!                                       {
! 
!                                               $cols_return[]                  
        = 'street_name';
!                                               $cols_extra[]                   
        = 'street_name';
!                                               $uicols['input_type'][]         
= 'text';
!                                               $uicols['name'][]               
        = 'street_name';
!                                               $uicols['descr'][]              
        = lang('street name');
!                                               $uicols['statustext'][]         
= lang('street name');
! 
!                                               $cols_return[]                  
        = 'street_number';
!                                               $cols_extra[]                   
        = 'street_number';
!                                               $uicols['input_type'][]         
= 'text';
!                                               $uicols['name'][]               
        = 'street_number';
!                                               $uicols['descr'][]              
        = lang('street number');
!                                               $uicols['statustext'][]         
= lang('street number');
! 
!                                               $cols_return[]                  
        = $config[$i]['column_name'];
!                                               $cols_extra[]                   
        = $config[$i]['column_name'];
!                                               $uicols['input_type'][]         
= 'hidden';
!                                               $uicols['name'][]               
        = $config[$i]['column_name'];
!                                               $uicols['descr'][]              
        = lang($config[$i]['input_text']);
!                                               $uicols['statustext'][]         
= lang($config[$i]['input_text']);
!                                       }
!                                       else
!                                       {
!                                               $cols_return[]                  
        = $config[$i]['column_name'];
!                                               $cols_extra[]                   
        = $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;
!                       $this->cols_extra       = $cols_extra;
! //_debug_array($uicols);
!                       $from .= " FROM $paranthesis $entity_table ";
! 
!                       $sql = "SELECT $cols $from $joinmethod";
  
                        return $sql;
+ 
                }
+ 
+ 
+ 
  
                function select_part_of_town($format='',$selected='')

Index: class.boequipment.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/property/inc/class.boequipment.inc.php,v
retrieving revision 1.12
retrieving revision 1.13
diff -C2 -r1.12 -r1.13
*** class.boequipment.inc.php   18 Jun 2003 11:21:17 -0000      1.12
--- class.boequipment.inc.php   19 Jun 2003 12:09:59 -0000      1.13
***************
*** 209,212 ****
--- 209,225 ----
  
                        $this->uicols   = $this->so->uicols;
+                       $cols_extra             = $this->so->cols_extra;
+ 
+ //_debug_array($cols_extra);
+                       for ($i=0;$i<count($equipment);$i++)
+                       {
+                               
$location_data=$this->solocation->read_single($equipment[$i]['location_code']);
+ 
+                               for ($j=0;$j<count($cols_extra);$j++)
+                               {
+                                       $equipment[$i][$cols_extra[$j]] = 
$location_data[$cols_extra[$j]];
+                               }
+ 
+                       }
                        return $equipment;
                }

Index: class.bolookup.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/property/inc/class.bolookup.inc.php,v
retrieving revision 1.8
retrieving revision 1.9
diff -C2 -r1.8 -r1.9
*** class.bolookup.inc.php      13 Jun 2003 11:05:29 -0000      1.8
--- class.bolookup.inc.php      19 Jun 2003 12:09:59 -0000      1.9
***************
*** 48,52 ****
                        $this->currentapp       = 
$GLOBALS['phpgw_info']['flags']['currentapp'];
                        $this->so               = 
CreateObject($this->currentapp.'.solookup');
!                       $this->socommon = 
CreateObject($this->currentapp.'.socommon');
  
                        if ($session)
--- 48,53 ----
                        $this->currentapp       = 
$GLOBALS['phpgw_info']['flags']['currentapp'];
                        $this->so               = 
CreateObject($this->currentapp.'.solookup');
!                       $this->solocation = 
CreateObject($this->currentapp.'.solocation');
! 
  
                        if ($session)
***************
*** 230,240 ****
                        $this->uicols   = $this->so->uicols;
  
!                       return $equipment;
!               }
  
  
!               function select_part_of_town($part_of_town_id)
!               {
!                       return 
$this->socommon->select_part_of_town($part_of_town_id);
                }
  
--- 231,245 ----
                        $this->uicols   = $this->so->uicols;
  
!                       for ($i=0;$i<count($equipment);$i++)
!                       {
!                               
$location_data=$this->solocation->read_single($equipment[$i]['location_code']);
!                               $equipment[$i]['loc1_name'] = 
$location_data['loc1_name'];
!                               $equipment[$i]['street_id'] = 
$location_data['street_id'];
!                               $equipment[$i]['street_name'] = 
$location_data['street_name'];
!                               $equipment[$i]['street_number'] = 
$location_data['street_number'];
  
+                       }
  
!                       return $equipment;
                }
  

Index: class.boproject.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/property/inc/class.boproject.inc.php,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -r1.5 -r1.6
*** class.boproject.inc.php     26 May 2003 12:15:20 -0000      1.5
--- class.boproject.inc.php     19 Jun 2003 12:09:59 -0000      1.6
***************
*** 29,36 ****
                        $this->currentapp       = 
$GLOBALS['phpgw_info']['flags']['currentapp'];
                        $this->so                       = 
CreateObject($this->currentapp.'.soproject');
-                       $this->socommon         = 
CreateObject($this->currentapp.'.socommon');
                        $this->bocommon         = 
CreateObject($this->currentapp.'.bocommon');
                        $this->historylog       = 
CreateObject($this->currentapp.'.historylog','project');
                        $this->contacts         = 
CreateObject('phpgwapi.contacts');
  
                        if ($session)
--- 29,36 ----
                        $this->currentapp       = 
$GLOBALS['phpgw_info']['flags']['currentapp'];
                        $this->so                       = 
CreateObject($this->currentapp.'.soproject');
                        $this->bocommon         = 
CreateObject($this->currentapp.'.bocommon');
                        $this->historylog       = 
CreateObject($this->currentapp.'.historylog','project');
                        $this->contacts         = 
CreateObject('phpgwapi.contacts');
+                       $this->solocation = 
CreateObject($this->currentapp.'.solocation');
  
                        if ($session)
***************
*** 293,302 ****
--- 293,313 ----
                        $dateformat = 
$GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat'];
  
+                       $this->uicols   = $this->so->uicols;
+                       $cols_extra             = $this->so->cols_extra;
+ 
                        for ($i=0; $i<count($project); $i++)
                        {
                                $project[$i]['coordinator'] = 
$GLOBALS['phpgw']->accounts->id2name($project[$i]['coordinator']);
                                $project[$i]['start_date'] = 
$GLOBALS['phpgw']->common->show_date($project[$i]['start_date'],$dateformat);
+                               
$location_data=$this->solocation->read_single($project[$i]['location_code']);
+ 
+                               for ($j=0;$j<count($cols_extra);$j++)
+                               {
+                                       $project[$i][$cols_extra[$j]] = 
$location_data[$cols_extra[$j]];
+                               }
                        }
  
+ //_debug_array($project);
+ 
                        return $project;
                }
***************
*** 325,329 ****
                        if($project['tenant_id'])
                        {
!                               
$tenant_data=$this->socommon->read_single_tenant($project['tenant_id']);
                                $project['tenant_phone']= 
$tenant_data['tenant_phone'];
                                $project['tenant_name']= 
$tenant_data['last_name'] . ', ' . $tenant_data['first_name'];
--- 336,340 ----
                        if($project['tenant_id'])
                        {
!                               
$tenant_data=$this->bocommon->read_single_tenant($project['tenant_id']);
                                $project['tenant_phone']= 
$tenant_data['tenant_phone'];
                                $project['tenant_name']= 
$tenant_data['last_name'] . ', ' . $tenant_data['first_name'];

Index: class.socommon.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/property/inc/class.socommon.inc.php,v
retrieving revision 1.26
retrieving revision 1.27
diff -C2 -r1.26 -r1.27
*** class.socommon.inc.php      18 Jun 2003 11:21:17 -0000      1.26
--- class.socommon.inc.php      19 Jun 2003 12:09:59 -0000      1.27
***************
*** 34,38 ****
  
  
!               function generate_sql($data)
                {
  
--- 34,38 ----
  
  
!               function generate_sql_old($data)
                {
  
***************
*** 84,88 ****
                        $first_join     = False;
  
!                       for ($j=$max_location_join; $j>0; $j--)
                        {
                                $joinmethod .= " $this->join fm_location". ($j);
--- 84,88 ----
                        $first_join     = False;
  
! /*                    for ($j=$max_location_join; $j>0; $j--)
                        {
                                $joinmethod .= " $this->join fm_location". ($j);
***************
*** 111,117 ****
                                $first_join     = True;
                        }
  
  
-                       $type_id        = count($location_types);
  
  
--- 111,139 ----
                                $first_join     = True;
                        }
+ */
+                       $type_id        = count($location_types);
+ 
+                       for ($j=$type_id; $j>0; $j--)
+                       {
+                               $joinmethod .= " INNER JOIN fm_location". ($j);
+ 
+                               $paranthesis .='(';
+ 
+ 
+                               $on = 'ON';
+                               for ($i=($j); $i>0; $i--)
+                               {
+                                       $joinmethod .= " $on ($entity_table" . 
".loc" . ($i). " = fm_location" . ($j) . ".loc" . ($i) . ")";
+ 
+                                       $on = 'AND';
+                                       if($i==1)
+                                       {
+                                               $joinmethod .= ")";
+                                       }
+                               }
+ 
+                       }
  
  
  
  
***************
*** 120,124 ****
                                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 .='(';
--- 142,146 ----
                                if (($config[$i]['location_type'] <= $type_id) 
&& ($config[$i]['f_key'] ==1))
                                {
!                                       $joinmethod .= " INNER 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 .='(';

Index: class.soequipment.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/property/inc/class.soequipment.inc.php,v
retrieving revision 1.15
retrieving revision 1.16
diff -C2 -r1.15 -r1.16
*** class.soequipment.inc.php   18 Jun 2003 11:21:17 -0000      1.15
--- class.soequipment.inc.php   19 Jun 2003 12:09:59 -0000      1.16
***************
*** 121,126 ****
                        }
  
!                       $sql    = 
$this->bocommon->generate_sql(array('entity_table'=>$entity_table,'cols'=>$cols,'cols_return'=>$cols_return,
                                                                                
                                        
'uicols'=>$uicols,'joinmethod'=>$joinmethod,'paranthesis'=>$paranthesis,'query'=>$query));
                        if ($order)
                        {
--- 121,128 ----
                        }
  
!                       $sql = 
$this->bocommon->generate_sql(array('entity_table'=>$entity_table,'cols_return'=>$cols_return,'cols'=>$cols,
                                                                                
                                        
'uicols'=>$uicols,'joinmethod'=>$joinmethod,'paranthesis'=>$paranthesis,'query'=>$query));
+ 
+ 
                        if ($order)
                        {
***************
*** 155,160 ****
                                $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';
                        }
--- 157,161 ----
                                $query = ereg_replace('"','',$query);
  
!                               $querymethod = " $where ( fm_equipment.descr 
LIKE '%$query%' OR fm_equipment.location_code LIKE '%$query%' OR equipment_id 
LIKE '%$query%'  OR loc1_name LIKE '%$query%')";
                                $where = 'AND';
                        }
***************
*** 165,170 ****
                        $uicols                         = 
$this->bocommon->uicols;
                        $cols_return            = $this->bocommon->cols_return;
!                       $max_location_join      = 
$this->bocommon->max_location_join;
                        $type_id                        = 
$this->bocommon->type_id;
  
                        if($filter)
--- 166,172 ----
                        $uicols                         = 
$this->bocommon->uicols;
                        $cols_return            = $this->bocommon->cols_return;
!       //              $max_location_join      = 
$this->bocommon->max_location_join;
                        $type_id                        = 
$this->bocommon->type_id;
+                       $this->cols_extra       = $this->bocommon->cols_extra;
  
                        if($filter)
***************
*** 177,180 ****
--- 179,183 ----
  
                        $this->uicols   = $uicols;
+ 
  
                        $this->db2->query($sql,__LINE__,__FILE__);

Index: class.solookup.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/property/inc/class.solookup.inc.php,v
retrieving revision 1.19
retrieving revision 1.20
diff -C2 -r1.19 -r1.20
*** class.solookup.inc.php      16 Jun 2003 12:44:48 -0000      1.19
--- class.solookup.inc.php      19 Jun 2003 12:09:59 -0000      1.20
***************
*** 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')
--- 18,21 ----
***************
*** 984,1189 ****
  
                        return $location;
-               }
- 
-               function read_equipment_old($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);
- 
-                       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)
-                       {
-                               $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(array('entity_table'=>$entity_table,'cols'=>$cols,'cols_return'=>$cols_return,
-                                                                               
                                        
'uicols'=>$uicols,'joinmethod'=>$joinmethod,'paranthesis'=>$paranthesis,'query'=>$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)
-                       {
-                               $query = ereg_replace("'",'',$query);
-                               $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++;
-                       }
- 
- //_debug_array($equipment);
- 
-                       return $equipment;
                }
  
--- 982,985 ----

Index: class.soproject.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/property/inc/class.soproject.inc.php,v
retrieving revision 1.14
retrieving revision 1.15
diff -C2 -r1.14 -r1.15
*** class.soproject.inc.php     26 May 2003 18:18:17 -0000      1.14
--- class.soproject.inc.php     19 Jun 2003 12:09:59 -0000      1.15
***************
*** 117,120 ****
--- 117,157 ----
                        }
  
+ 
+                       $entity_table = 'fm_project';
+ 
+                       $cols .= $entity_table . '.location_code';
+                       $cols_return[] = 'location_code';
+ 
+                       $cols .= ",$entity_table.id as project_id";
+                       $cols_return[]                          = 'project_id';
+                       $uicols['input_type'][]         = 'text';
+                       $uicols['name'][]                       = 'project_id';
+                       $uicols['descr'][]                      = 
lang('Project');
+                       $uicols['statustext'][]         = lang('Project ID');
+ 
+                       $cols.= ",$entity_table.start_date";
+                       $cols_return[]                          = 'start_date';
+                       $uicols['input_type'][]         = 'text';
+                       $uicols['name'][]                       = 'start_date';
+                       $uicols['descr'][]                      = lang('start 
date');
+                       $uicols['statustext'][]         = lang('Project start 
date');
+ 
+                       $cols.= ",$entity_table.name as name";
+                       $cols_return[]                          = 'name';
+                       $uicols['input_type'][]         = 'text';
+                       $uicols['name'][]                       = 'name';
+                       $uicols['descr'][]                      = lang('name');
+                       $uicols['statustext'][]         = lang('Project name');
+ 
+                       $cols.= ",$entity_table.coordinator";
+                       $cols_return[]                          = 'coordinator';
+                       $uicols['input_type'][]         = 'text';
+                       $uicols['name'][]                       = 'coordinator';
+                       $uicols['descr'][]                      = 
lang('Coordinator');
+                       $uicols['statustext'][]         = lang('Project 
coordinator');
+ 
+                       $sql    = 
$this->bocommon->generate_sql(array('entity_table'=>$entity_table,'cols'=>$cols,'cols_return'=>$cols_return,
+                                                                               
                                        
'uicols'=>$uicols,'joinmethod'=>$joinmethod,'paranthesis'=>$paranthesis,'query'=>$query));
+ 
                        if ($order)
                        {
***************
*** 162,169 ****
                                $query = ereg_replace('"','',$query);
  
!                               $querymethod = " AND fm_project.name LIKE 
'%$query%' or fm_project.descr LIKE '%$query%' or fm_project.address LIKE 
'%$query%' or fm_project.location_code LIKE '%$query%'";
                        }
  
!                       $sql = "SELECT * FROM fm_project WHERE  $filtermethod 
$querymethod";
  
                        $this->db2->query($sql,__LINE__,__FILE__);
--- 199,213 ----
                                $query = ereg_replace('"','',$query);
  
!                               $sub_query      = $this->socommon->sub_query;
! 
!                               $querymethod = " AND (fm_project.name LIKE 
'%$query%' or fm_project.descr LIKE '%$query%' or fm_project.location_code LIKE 
'%$query%' $sub_query)";
                        }
  
!                       $sql .= " WHERE $filtermethod $querymethod";
! //echo $sql;
!                       $this->uicols           = $this->bocommon->uicols;
!                       $cols_return            = $this->bocommon->cols_return;
!                       $type_id                        = 
$this->bocommon->type_id;
!                       $this->cols_extra       = $this->bocommon->cols_extra;
  
                        $this->db2->query($sql,__LINE__,__FILE__);
***************
*** 171,192 ****
                        $this->db->limit_query($sql . 
$ordermethod,$start,__LINE__,__FILE__);
  
                        while ($this->db->next_record())
                        {
!                               $ngrants = 
(int)$this->grants[$this->db->f('fm_project.owner')];
!                               $project_list[] = array
!                               (
!                                       'project_id'    => $this->db->f('id'),
!                                       'name'                  => 
stripslashes($this->db->f('name')),
!                                       'start_date'    => 
$this->db->f('start_date'),
!                                       'coordinator'   => 
$this->db->f('coordinator'),
!                                       'equipment_id'  => 
$this->db->f('equipment_id'),
!                                       'location_code' => 
$this->db->f('location_code'),
!                                       'floor'                 => 
$this->db->f('floor'),
!                                       'address'               => 
$this->db->f('address'),
!                                       'category'              => 
$this->db->f('category'),
!                                       'title'                 => 
$this->db->f('title'),
!                                       'grants'                => $ngrants
!                                       );
                        }
  //_debug_array($project_list);
                        return $project_list;
--- 215,243 ----
                        $this->db->limit_query($sql . 
$ordermethod,$start,__LINE__,__FILE__);
  
+ 
+                       $j=0;
                        while ($this->db->next_record())
                        {
!                               for ($i=0;$i<count($cols_return);$i++)
!                               {
!                                       $project_list[$j][$cols_return[$i]] = 
$this->db->f($cols_return[$i]);
!                               }
! 
!                               if($max_location_join<$type_id)
!                               {
!                                       $location_code= 
$this->db->f('location_code');
!                                       $location = split('-',$location_code);
!                                       $diff   = $type_id - $max_location_join;
!                                       $next   = $type_id - $diff + 1;
!                                       for ($m=0;$m<$diff;$m++)
!                                       {
!                                               $project_list[$j]['loc' . 
$next] = $location[($next-1)];
!                                               $next++;
!                                       }
!                               }
! 
!                               $j++;
                        }
+ 
  //_debug_array($project_list);
                        return $project_list;

Index: class.uiequipment.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/property/inc/class.uiequipment.inc.php,v
retrieving revision 1.25
retrieving revision 1.26
diff -C2 -r1.25 -r1.26
*** class.uiequipment.inc.php   18 Jun 2003 11:55:17 -0000      1.25
--- class.uiequipment.inc.php   19 Jun 2003 12:09:59 -0000      1.26
***************
*** 188,192 ****
                                'lang_add'                              => 
lang('add'),
                                'lang_add_statustext'   => lang('add a 
equipment'),
!                               'add_action'                    => 
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uiequipment.test')
                        );
  
--- 188,192 ----
                                'lang_add'                              => 
lang('add'),
                                'lang_add_statustext'   => lang('add a 
equipment'),
!                               'add_action'                    => 
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uiequipment.edit')
                        );
  

Index: class.uilookup.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/property/inc/class.uilookup.inc.php,v
retrieving revision 1.21
retrieving revision 1.22
diff -C2 -r1.21 -r1.22
*** class.uilookup.inc.php      16 Jun 2003 15:30:26 -0000      1.21
--- class.uilookup.inc.php      19 Jun 2003 12:09:59 -0000      1.22
***************
*** 47,50 ****
--- 47,52 ----
                        $this->bocommon                                 = 
CreateObject($this->currentapp.'.bocommon');
                        $this->soadmin_location         = 
CreateObject($this->currentapp.'.soadmin_location');
+                       $this->boequipment              = 
CreateObject($this->currentapp.'.boequipment');
+ 
  
                        $this->start                            = 
$this->bo->start;
***************
*** 745,748 ****
--- 747,759 ----
                {
  
+                       $this->start                            = 
$this->boequipment->start;
+                       $this->query                            = 
$this->boequipment->query;
+                       $this->sort                                     = 
$this->boequipment->sort;
+                       $this->order                            = 
$this->boequipment->order;
+                       $this->filter                           = 
$this->boequipment->filter;
+                       $this->cat_id                           = 
$this->boequipment->cat_id;
+                       $this->part_of_town_id          = 
$this->boequipment->part_of_town_id;
+                       $this->district_id                      = 
$this->boequipment->district_id;
+ 
                        $GLOBALS['phpgw']->xslttpl->add_file(array('lookup',
                                                                                
'nextmatchs',
***************
*** 754,763 ****
  //                    $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);
--- 765,774 ----
  //                    $location_type = 
get_var('location_type',array('POST','GET'));
  
!                       $equipment_list = $this->boequipment->read();
  
                        $input_name = 
$GLOBALS['phpgw']->session->appsession('lookup_fields',$this->currentapp);
  //_debug_array($input_name);
  
!                       $uicols = $this->boequipment->uicols;
  
  //_debug_array($uicols);
***************
*** 815,834 ****
                                                                                
        '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,
-                                                                               
                                                        'district_id'   => 
$this->district_id,
-                                                                               
                                                        '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',
--- 826,829 ----

Index: class.uiproject.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/property/inc/class.uiproject.inc.php,v
retrieving revision 1.24
retrieving revision 1.25
diff -C2 -r1.24 -r1.25
*** class.uiproject.inc.php     12 Jun 2003 20:51:13 -0000      1.24
--- class.uiproject.inc.php     19 Jun 2003 12:09:59 -0000      1.25
***************
*** 72,76 ****
                {
  
!                       $GLOBALS['phpgw']->xslttpl->add_file(array('project',
                                                                                
'menu',
                                                                                
'nextmatchs',
--- 72,76 ----
                {
  
!                       
$GLOBALS['phpgw']->xslttpl->add_file(array('project','values','table_header',
                                                                                
'menu',
                                                                                
'nextmatchs',
***************
*** 85,89 ****
  //_debug_array($project_list);
  
!                       while (is_array($project_list) && list(,$project) = 
each($project_list))
                        {
                                $location       = split("-", 
$project['location_code']);
--- 85,89 ----
  //_debug_array($project_list);
  
! /*                    while (is_array($project_list) && list(,$project) = 
each($project_list))
                        {
                                $location       = split("-", 
$project['location_code']);
***************
*** 169,172 ****
--- 169,274 ----
                                );
  
+ 
+ */
+ 
+                       $uicols = $this->bo->uicols;
+ //_debug_array($uicols);
+                       $j=0;
+                       while (is_array($project_list) && list(,$project_entry) 
= each($project_list))
+                       {
+                               for ($i=0;$i<count($uicols['name']);$i++)
+                               {
+                                       if($uicols['input_type'][$i]!='hidden')
+                                       {
+                                               
$content[$j]['row'][$i]['value']                        = 
$project_entry[$uicols['name'][$i]];
+                                               $content[$j]['row'][$i]['name'] 
                        = $uicols['name'][$i];
+                                       }
+                               }
+ 
+                               $content[$j]['row'][$i]['statustext']           
        = lang('view the project');
+                               $content[$j]['row'][$i]['text']                 
                = lang('view');
+                               $content[$j]['row'][$i++]['link']               
                = 
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uiproject.view&id='
 . $project_entry['project_id']);
+                               $content[$j]['row'][$i]['statustext']           
        = lang('edit the project');
+                               $content[$j]['row'][$i]['text']                 
                = lang('edit');
+                               $content[$j]['row'][$i++]['link']               
                = 
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uiproject.edit&id='
 . $project_entry['project_id']);
+                               $content[$j]['row'][$i]['statustext']           
        = lang('delete the project');
+                               $content[$j]['row'][$i]['text']                 
                = lang('delete');
+                               $content[$j]['row'][$i++]['link']               
                = 
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uiproject.delete&id='
 . $project_entry['project_id']);
+ 
+                               $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.'.uiproject.index',
+                                                                               
                                                        'type_id'       
=>$type_id,
+                                                                               
                                                        'query'         
=>$this->query,
+                                                                               
                                                        'lookup'        
=>$lookup,
+                                                                               
                                                        'district_id'   => 
$this->district_id,
+                                                                               
                                                        'cat_id'        
=>$this->cat_id)
+                                                                               
));
+                                       }
+                                       if($uicols['name'][$i]=='project_id')
+                                       {
+                                               $table_header[$i]['sort_link']  
=true;
+                                               $table_header[$i]['sort']       
        = $this->nextmatchs->show_sort_order(array
+                                                                               
(
+                                                                               
        'sort'  => $this->sort,
+                                                                               
        'var'   =>      'project_id',
+                                                                               
        'order' =>      $this->order,
+                                                                               
        'extra'         => array('menuaction'   => 
$this->currentapp.'.uiproject.index',
+                                                                               
                                                        'type_id'       
=>$type_id,
+                                                                               
                                                        'query'         
=>$this->query,
+                                                                               
                                                        'lookup'        
=>$lookup,
+                                                                               
                                                        'district_id'   => 
$this->district_id,
+                                                                               
                                                        '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.'.uiproject.index',
+                                                                               
                                                        'type_id'       
=>$type_id,
+                                                                               
                                                        'query'         
=>$this->query,
+                                                                               
                                                        'lookup'        
=>$lookup,
+                                                                               
                                                        'district_id'   => 
$this->district_id,
+                                                                               
                                                        'cat_id'        
=>$this->cat_id)
+                                                                               
));
+                                       }
+                               }
+                       }
+ 
+                       $table_header[$i]['width']                      = '5%';
+                       $table_header[$i]['align']                      = 
'center';
+                       $table_header[$i]['header']             = lang('view');
+                       $i++;
+                       $table_header[$i]['width']                      = '5%';
+                       $table_header[$i]['align']                      = 
'center';
+                       $table_header[$i]['header']             = lang('edit');
+                       $i++;
+                       $table_header[$i]['width']                      = '5%';
+                       $table_header[$i]['align']                      = 
'center';
+                       $table_header[$i]['header']             = 
lang('delete');
+                       $i++;
+ 
                        $table_add[] = array
                        (
***************
*** 228,233 ****
                                'query'                                         
        => $this->query,
                                'lang_search'                                   
=> lang('search'),
!                               'table_header_project'                  => 
$table_header,
!                               'values_project'                                
=> $content,
                                'table_add'                                     
        => $table_add
                        );
--- 330,335 ----
                                'query'                                         
        => $this->query,
                                'lang_search'                                   
=> lang('search'),
!                               'table_header'                                  
=> $table_header,
!                               'values'                                        
        => $content,
                                'table_add'                                     
        => $table_add
                        );





reply via email to

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