phpgroupware-cvs
[Top][All Lists]
Advanced

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

[Phpgroupware-cvs] CVS: property/inc class.solocation.inc.php, 1.25, 1.


From: Sigurd Nes <address@hidden>
Subject: [Phpgroupware-cvs] CVS: property/inc class.solocation.inc.php, 1.25, 1.26
Date: Mon, 04 Aug 2003 06:02:43 -0400

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

Modified Files:
        class.solocation.inc.php 
Log Message:
no message

Index: class.solocation.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/property/inc/class.solocation.inc.php,v
retrieving revision 1.25
retrieving revision 1.26
diff -C2 -r1.25 -r1.26
*** class.solocation.inc.php    27 Jul 2003 15:53:24 -0000      1.25
--- class.solocation.inc.php    4 Aug 2003 10:02:40 -0000       1.26
***************
*** 117,288 ****
                        }
  
!                       $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,'lookup_type'=>$type_id));
! 
!                       $location_cols_count    = count($fm_location_cols);
  
!                       for ($i=0;$i<$location_cols_count;$i++)
!                       {
!                               if($fm_location_cols[$i]['list']==1)
                                {
-                                       $cols .= ",fm_location" . 
$fm_location_cols[$i]['location_type'] 
.".".$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);
  
  
!                       $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');
! 
!                       for ($i=2;$i<($type_id+1);$i++)
!                       {
!                               $cols.= ',fm_location' . $i . '.loc' . $i . 
'_name';
!                               $cols_return[]                          = 'loc' 
. $i . '_name';
!                               $uicols['input_type'][]         = 'hidden';
!                               $uicols['name'][]                       = 'loc' 
. $i . '_name';
!                               $uicols['descr'][]                      = '';
!                               $uicols['statustext'][]         = '';
!                       }
  
  
!                       for ($j=($type_id-1); $j>0; $j--)
!                       {
!                               $joinmethod .= " $this->join fm_location". ($j);
  
!                               $paranthesis .='(';
  
  
!                               $on = 'ON';
!                               for ($i=($j); $i>0; $i--)
                                {
!                                       $joinmethod .= " $on (fm_location" . 
($j+1) .".loc" . ($i). " = fm_location" . ($j) . ".loc" . ($i) . ")";
!                                       $on = 'AND';
!                                       if($i==1)
                                        {
!                                               $joinmethod .= ")";
                                        }
                                }
-                       }
- 
  
!                       $config = $this->soadmin_location->read_config('');
  
  //_debug_array($config);
  
!                       if($lookup_tenant)
!                       {
!                               $cols.= ',fm_tenant.tenant_id';
!                               $cols_return[]                          = 
'tenant_id';
!                               $uicols['input_type'][]         = 'hidden';
!                               $uicols['name'][]                       = 
'tenant_id';
!                               $uicols['descr'][]                      = 
'dummy';
!                               $uicols['statustext'][]         = 'dummy';
! 
!                               $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.first_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.contact_phone';
!                               $cols_return[]                          = 
'contact_phone';
!                               $uicols['input_type'][]         = 'text';
!                               $uicols['name'][]                       = 
'contact_phone';
!                               $uicols['descr'][]                      = 
lang('contact phone');
!                               $uicols['statustext'][]         = lang('contact 
phone');
  
!                               $sub_query .= "OR fm_tenant.last_name LIKE 
'%$query%' OR fm_tenant.first_name LIKE '%$query%'";
  
!                       }
  
!                       $config_count   = count($config);
!                       for ($i=0;$i<$config_count;$i++)
!                       {
!                               if (($config[$i]['location_type'] <= $type_id) 
&& ($config[$i]['f_key'] ==1))
!                               {
!                                       $joinmethod .= " $this->left_join  " . 
$config[$i]['reference_table'] . " ON ( fm_location" . 
$config[$i]['location_type'] . "." . $config[$i]['column_name'] . "=" . 
$config[$i]['reference_table'] . ".".$config[$i]['reference_id']."))";
  
!                                       $paranthesis .='(';
                                }
  
!                               if (($config[$i]['location_type'] <= $type_id)  
&& ($config[$i]['query_value'] ==1))
                                {
  
!                                       
if($config[$i]['column_name']=='street_id')
                                        {
-                                               $sub_query .= "or 
fm_streetaddress.descr LIKE '%$query%'";
-                                               $cols.= 
',fm_streetaddress.descr as 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.= ',street_number';
!                                               $cols_return[]                  
        = 'street_number';
!                                               $uicols['input_type'][]         
= 'text';
!                                               $uicols['name'][]               
        = 'street_number';
!                                               $uicols['descr'][]              
        = lang('street number');
!                                               $uicols['statustext'][]         
= lang('street number');
  
!                                               $cols.= ',fm_location' . 
$config[$i]['location_type'] . '.' . $config[$i]['column_name'];
!                                               $cols_return[]                  
        = $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.= ',fm_location' . 
$config[$i]['location_type'] . '.' . $config[$i]['column_name'];
!                                               $cols_return[]                  
        = $config[$i]['column_name'];
!                                               $uicols['input_type'][]         
= 'hidden';
!                                               $uicols['name'][]               
        = $config[$i]['column_name'];
!                                               $uicols['descr'][]              
        = $config[$i]['input_text'];
!                                               $uicols['statustext'][]         
= $config[$i]['input_text'];
                                        }
                                }
-                       }
  
!                       $this->uicols = $uicols;
  
!                       $from .= " FROM $paranthesis fm_location$type_id ";
  
  
! //_debug_array($config);
! 
  
  
                        if ($order)
--- 117,302 ----
                        }
  
!                       $sql = $GLOBALS['phpgw']->session->appsession('sql_'. 
$type_id ,$this->currentapp);
  
!                       if(!$sql)
                        {
!                               $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,'lookup_type'=>$type_id));
  
+                               $location_cols_count    = 
count($fm_location_cols);
  
!                               for ($i=0;$i<$location_cols_count;$i++)
!                               {
!                                       if($fm_location_cols[$i]['list']==1)
!                                       {
!                                               $cols .= ",fm_location" . 
$fm_location_cols[$i]['location_type'] 
.".".$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);
  
!                               $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');
  
!                               for ($i=2;$i<($type_id+1);$i++)
!                               {
!                                       $cols.= ',fm_location' . $i . '.loc' . 
$i . '_name';
!                                       $cols_return[]                          
= 'loc' . $i . '_name';
!                                       $uicols['input_type'][]         = 
'hidden';
!                                       $uicols['name'][]                       
= 'loc' . $i . '_name';
!                                       $uicols['descr'][]                      
= '';
!                                       $uicols['statustext'][]         = '';
!                               }
  
  
!                               for ($j=($type_id-1); $j>0; $j--)
                                {
!                                       $joinmethod .= " $this->join 
fm_location". ($j);
! 
!                                       $paranthesis .='(';
! 
!                                       $on = 'ON';
!                                       for ($i=($j); $i>0; $i--)
                                        {
!                                               $joinmethod .= " $on 
(fm_location" . ($j+1) .".loc" . ($i). " = fm_location" . ($j) . ".loc" . ($i) 
. ")";
!                                               $on = 'AND';
!                                               if($i==1)
!                                               {
!                                                       $joinmethod .= ")";
!                                               }
                                        }
                                }
  
!                               $config = 
$this->soadmin_location->read_config('');
  
  //_debug_array($config);
  
!                               if($lookup_tenant)
!                               {
!                                       $cols.= ',fm_tenant.tenant_id';
!                                       $cols_return[]                          
= 'tenant_id';
!                                       $uicols['input_type'][]         = 
'hidden';
!                                       $uicols['name'][]                       
= 'tenant_id';
!                                       $uicols['descr'][]                      
= 'dummy';
!                                       $uicols['statustext'][]         = 
'dummy';
  
!                                       $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.first_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.contact_phone';
!                                       $cols_return[]                          
= 'contact_phone';
!                                       $uicols['input_type'][]         = 
'text';
!                                       $uicols['name'][]                       
= 'contact_phone';
!                                       $uicols['descr'][]                      
= lang('contact phone');
!                                       $uicols['statustext'][]         = 
lang('contact phone');
  
!                                       $sub_query_tenant=1;
!                                       
$GLOBALS['phpgw']->session->appsession('sub_query_tenant_'. $type_id 
,$this->currentapp,$sub_query_tenant);
                                }
  
!                               $config_count   = count($config);
!                               for ($i=0;$i<$config_count;$i++)
                                {
+                                       if (($config[$i]['location_type'] <= 
$type_id) && ($config[$i]['f_key'] ==1))
+                                       {
+                                               $joinmethod .= " 
$this->left_join  " . $config[$i]['reference_table'] . " ON ( fm_location" . 
$config[$i]['location_type'] . "." . $config[$i]['column_name'] . "=" . 
$config[$i]['reference_table'] . ".".$config[$i]['reference_id']."))";
+ 
+                                               $paranthesis .='(';
+                                       }
  
!                                       if (($config[$i]['location_type'] <= 
$type_id)  && ($config[$i]['query_value'] ==1))
                                        {
  
!                                               
if($config[$i]['column_name']=='street_id')
!                                               {
  
!                                                       $sub_query_street=1;
!                                                       
$GLOBALS['phpgw']->session->appsession('sub_query_street_'. $type_id 
,$this->currentapp,$sub_query_street);
  
!                                                       $cols.= 
',fm_streetaddress.descr as 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.= 
',street_number';
!                                                       $cols_return[]          
                = 'street_number';
!                                                       $uicols['input_type'][] 
        = 'text';
!                                                       $uicols['name'][]       
                = 'street_number';
!                                                       $uicols['descr'][]      
                = lang('street number');
!                                                       $uicols['statustext'][] 
        = lang('street number');
! 
!                                                       $cols.= ',fm_location' 
. $config[$i]['location_type'] . '.' . $config[$i]['column_name'];
!                                                       $cols_return[]          
                = $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.= ',fm_location' 
. $config[$i]['location_type'] . '.' . $config[$i]['column_name'];
!                                                       $cols_return[]          
                = $config[$i]['column_name'];
!                                                       $uicols['input_type'][] 
        = 'hidden';
!                                                       $uicols['name'][]       
                = $config[$i]['column_name'];
!                                                       $uicols['descr'][]      
                = $config[$i]['input_text'];
!                                                       $uicols['statustext'][] 
        = $config[$i]['input_text'];
!                                               }
                                        }
                                }
  
!                               $this->uicols = $uicols;
  
!                               $from .= " FROM $paranthesis 
fm_location$type_id ";
  
+                               $sql = "SELECT $cols $from $joinmethod";
  
!                               $GLOBALS['phpgw']->session->appsession('sql_'. 
$type_id ,$this->currentapp,$sql);
!                               
$GLOBALS['phpgw']->session->appsession('uicols_'. $type_id 
,$this->currentapp,$uicols);
!                               
$GLOBALS['phpgw']->session->appsession('cols_return_'. $type_id 
,$this->currentapp,$cols_return);
!                       }
!                       else
!                       {
!                               $uicols = 
$GLOBALS['phpgw']->session->appsession('uicols_'. $type_id ,$this->currentapp);
!                               $cols_return = 
$GLOBALS['phpgw']->session->appsession('cols_return_'. $type_id 
,$this->currentapp);
  
+                               $this->uicols = $uicols;
+                               $sub_query_tenant       = 
$GLOBALS['phpgw']->session->appsession('sub_query_tenant_'. $type_id 
,$this->currentapp);
+                               $sub_query_street       = 
$GLOBALS['phpgw']->session->appsession('sub_query_street_'. $type_id 
,$this->currentapp);
+                       }
  
                        if ($order)
***************
*** 314,319 ****
                        }
  
- 
- 
                        if($query)
                        {
--- 328,331 ----
***************
*** 321,334 ****
                                $query = ereg_replace('"','',$query);
  
!                               $querymethod = " AND (fm_location" . 
($type_id).".loc1 LIKE '%$query%' $sub_query or fm_location" . 
($type_id).".location_code LIKE '%$query%')";
                        }
  
!                       $sql = "SELECT $cols $from $joinmethod $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__);
- //_debug_array($cols_return);
  
                        $j=0;
--- 333,354 ----
                                $query = ereg_replace('"','',$query);
  
!                               if($sub_query_tenant)
!                               {
!                                       $sub_query = "OR fm_tenant.last_name 
LIKE '%$query%' OR fm_tenant.first_name LIKE '%$query%'";
!                               }
! 
!                               if($sub_query_street)
!                               {
!                                       $sub_query .= "OR 
fm_streetaddress.descr LIKE '%$query%'";
!                               }
! 
!                               $querymethod = " AND (fm_location" . 
($type_id).".loc1 LIKE '%$query%' $sub_query OR fm_location" . 
($type_id).".location_code LIKE '%$query%' OR loc" . ($type_id)."_name LIKE 
'%$query%')";
                        }
  
!                       $sql .= "$filtermethod $querymethod";
  
                        $this->db2->query($sql,__LINE__,__FILE__);
                        $this->total_records = $this->db2->num_rows();
                        $this->db->limit_query($sql . 
$ordermethod,$start,__LINE__,__FILE__);
  
                        $j=0;
***************
*** 532,535 ****
--- 552,560 ----
  
                        $sql = "SELECT $cols $from $joinmethod";
+ 
+                       $GLOBALS['phpgw']->session->appsession('sql_single_'. 
$type_id ,$this->currentapp,$sql);
+                       
$GLOBALS['phpgw']->session->appsession('uicols_single_'. $type_id 
,$this->currentapp,$uicols);
+                       
$GLOBALS['phpgw']->session->appsession('cols_return_single_'. $type_id 
,$this->currentapp,$cols_return);
+ 
                        return $sql;
  
***************
*** 570,575 ****
                        $uicols['statustext'][]         = lang('remark');
  
  
!                       $sql    = 
$this->generate_sql($type_id,$cols,$cols_return,$uicols,True);
  
                        $sql .= " WHERE 
fm_location$type_id.location_code='$location_code' ";
--- 595,610 ----
                        $uicols['statustext'][]         = lang('remark');
  
+                       $sql = 
$GLOBALS['phpgw']->session->appsession('sql_single_'. $type_id 
,$this->currentapp);
+ 
+                       if(!$sql)
+                       {
+                               $sql    = 
$this->generate_sql($type_id,$cols,$cols_return,$uicols,True);
+                       }
+                       else
+                       {
  
!                               $this->uicols   = 
$GLOBALS['phpgw']->session->appsession('uicols_single_'. $type_id 
,$this->currentapp);
!                               $this->cols_return      = 
$GLOBALS['phpgw']->session->appsession('cols_return_single_'. $type_id 
,$this->currentapp);
!                       }
  
                        $sql .= " WHERE 
fm_location$type_id.location_code='$location_code' ";





reply via email to

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