phpgroupware-cvs
[Top][All Lists]
Advanced

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

[Phpgroupware-cvs] CVS: property/inc class.bolocation.inc.php,1.7,1.8 cl


From: Sigurd Nes <address@hidden>
Subject: [Phpgroupware-cvs] CVS: property/inc class.bolocation.inc.php,1.7,1.8 class.socommon.inc.php,1.23,1.24 class.solocation.inc.php,1.5,1.6 class.uilocation.inc.php,1.9,1.10
Date: Sun, 15 Jun 2003 15:41:29 -0400

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

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

Index: class.bolocation.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/property/inc/class.bolocation.inc.php,v
retrieving revision 1.7
retrieving revision 1.8
diff -C2 -r1.7 -r1.8
*** class.bolocation.inc.php    14 Jun 2003 21:41:30 -0000      1.7
--- class.bolocation.inc.php    15 Jun 2003 19:41:26 -0000      1.8
***************
*** 229,232 ****
--- 229,233 ----
                                        
$location['location'][$i]['lookup_function_call']       = 'lookup_loc' . 
$fm_location_cols[$j]['location_type'] . '()';
                                        
$location['location'][$i]['lookup_link']                        = True;
+                                       $location['location'][$i]['readonly']   
                        = True;
                                        $location['location'][$i]['name']       
                                = $fm_location_cols[$j]['input_text'];
                                        $location['location'][$i]['value']      
                                = 
$data['values'][$fm_location_cols[$j]['column_name']];
***************
*** 242,257 ****
                                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'];
!                                       $insert_record[]                        
                                                = 
$location['location'][$i]['input_name'];
!                                       $location['location'][$i]['size']       
                                = 5;
!                                       $location['location'][$i]['value']      
                                = 
$data['location']['value'][$config[$j]['column_name']];
!                                       
$location['location'][$i]['lookup_function_call']       = 'lookup_loc' . 
$fm_location_cols[$j]['location_type'] . '()';
!                                       
$location['location'][$i]['lookup_link']                        = True;
!                                       $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_cols[$j]['location_type']-1)]['name'];
!                                       $location['location'][$i]['input_type'] 
                        = 'text';
! 
  
                                        
if($config[$j]['column_name']=='street_id')
--- 243,260 ----
                                if($config[$j]['location_type'] <= 
$data['type_id'] && $config[$j]['lookup_form'] )
                                {
!                                       
if($config[$j]['column_name']!='tenant_id')
!                                       {
!                                               
$location['location'][$i]['input_name']                         = 
$config[$j]['column_name'];
!                                               $input_name[]                   
                                                        = 
$location['location'][$i]['input_name'];
!                                               $insert_record[]                
                                                        = 
$location['location'][$i]['input_name'];
!                                               
$location['location'][$i]['size']                                       = 5;
!                                               
$location['location'][$i]['value']                                      = 
$data['location']['value'][$config[$j]['column_name']];
!                                               
$location['location'][$i]['lookup_function_call']       = 'lookup_loc' . 
$fm_location_cols[$j]['location_type'] . '()';
!                                               
$location['location'][$i]['lookup_link']                        = True;
!                                               
$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_cols[$j]['location_type']-1)]['name'];
!                                               
$location['location'][$i]['input_type']                         = 'text';
!                                       }
  
                                        
if($config[$j]['column_name']=='street_id')
***************
*** 263,276 ****
                                                
$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) . '()';
                                                
$location['location'][$i]['extra'][0]['value']                                  
= $data['values']['street_name'];
  
                                                
$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) . '()';
                                                
$location['location'][$i]['extra'][1]['value']                                  
= $data['values']['street_number'];
                                        }
--- 266,281 ----
                                                
$location['location'][$i]['extra'][0]['input_type']                             
= 'text';
                                                
$location['location'][$i]['extra'][0]['input_name']                             
= 'street_name';
+                                               
$location['location'][$i]['extra'][0]['readonly']                               
= True;
                                                $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' 
. $fm_location_cols[$j]['location_type'] . '()';
                                                
$location['location'][$i]['extra'][0]['value']                                  
= $data['values']['street_name'];
  
                                                
$location['location'][$i]['extra'][1]['input_type']                             
= 'text';
                                                
$location['location'][$i]['extra'][1]['input_name']                             
= 'street_number';
+                                               
$location['location'][$i]['extra'][1]['readonly']                               
= True;
                                                $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' 
. $fm_location_cols[$j]['location_type'] . '()';
                                                
$location['location'][$i]['extra'][1]['value']                                  
= $data['values']['street_number'];
                                        }
***************
*** 282,285 ****
--- 287,291 ----
                                                $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]['lookup_link']                        = True;
                                                
$location['location'][$i]['name']                                               
                = lang('Tenant');
                                                
$location['location'][$i]['input_type']                                         
        = 'hidden';
***************
*** 375,380 ****
                }
  
- 
- 
                function 
select_category_list($format='',$selected='',$type_id='')
                {
--- 381,384 ----
***************
*** 479,483 ****
                        }
  
!       _debug_array($location);
  
                        if ($action=='edit')
--- 483,487 ----
                        }
  
! //    _debug_array($location);
  
                        if ($action=='edit')

Index: class.socommon.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/property/inc/class.socommon.inc.php,v
retrieving revision 1.23
retrieving revision 1.24
diff -C2 -r1.23 -r1.24
*** class.socommon.inc.php      13 Jun 2003 13:15:47 -0000      1.23
--- class.socommon.inc.php      15 Jun 2003 19:41:26 -0000      1.24
***************
*** 105,109 ****
                                {
  
!                                       
if($config[$i]['column_name']=='street_number')
                                        {
                                                $this->sub_query= "or 
street_name LIKE '%$query%'";
--- 105,109 ----
                                {
  
!                                       
if($config[$i]['column_name']=='street_id')
                                        {
                                                $this->sub_query= "or 
street_name LIKE '%$query%'";
***************
*** 116,122 ****
                                                $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']);
--- 116,129 ----
                                                $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']);

Index: class.solocation.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/property/inc/class.solocation.inc.php,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -r1.5 -r1.6
*** class.solocation.inc.php    14 Jun 2003 21:41:30 -0000      1.5
--- class.solocation.inc.php    15 Jun 2003 19:41:26 -0000      1.6
***************
*** 142,145 ****
--- 142,155 ----
  //_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 ($j=($type_id-1); $j>0; $j--)
                        {
***************
*** 166,177 ****
  //_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)
                        {
--- 176,179 ----
***************
*** 180,183 ****
--- 182,187 ----
                                $uicols['input_type'][]         = 'hidden';
                                $uicols['name'][]                       = 
'tenant_id';
+                               $uicols['descr'][]                      = 
'dummy';
+                               $uicols['statustext'][]         = 'dummy';
  
                                $cols.= ',fm_tenant.last_name';
***************
*** 188,192 ****
                                $uicols['statustext'][]         = lang('last 
name');
  
!                               $cols.= ',fm_tenant.last_name';
                                $cols_return[]                          = 
'first_name';
                                $uicols['input_type'][]         = 'text';
--- 192,196 ----
                                $uicols['statustext'][]         = lang('last 
name');
  
!                               $cols.= ',fm_tenant.first_name';
                                $cols_return[]                          = 
'first_name';
                                $uicols['input_type'][]         = 'text';
***************
*** 201,204 ****
--- 205,211 ----
                                $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%'";
+ 
                        }
  
***************
*** 212,222 ****
                                }
  
!                               if (($config[$i]['location_type'] <= $type_id) 
&& ($config[$i]['query_value'] ==1))
                                {
  
!                                       
if($config[$i]['column_name']=='street_number')
                                        {
!                                               $sub_query= "or street_name 
LIKE '%$query%'";
! 
                                                $cols.= 
',fm_streetaddress.street_name';
                                                $cols_return[]                  
        = 'street_name';
--- 219,228 ----
                                }
  
!                               if (($config[$i]['location_type'] <= $type_id)  
&& ($config[$i]['query_value'] ==1))
                                {
  
!                                       
if($config[$i]['column_name']=='street_id')
                                        {
!                                               $sub_query .= "or street_name 
LIKE '%$query%'";
                                                $cols.= 
',fm_streetaddress.street_name';
                                                $cols_return[]                  
        = 'street_name';
***************
*** 226,232 ****
                                                $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']);
--- 232,245 ----
                                                $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']);
***************
*** 236,242 ****
                                        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'];
--- 249,255 ----
                                        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'];
***************
*** 308,324 ****
                }
  
!               function read_single($location_code='')
                {
-                       $location_array = split('-',$location_code);
-                       $type_id= count($location_array);
  
!                       if (!$type_id)
!                       {
!                               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++)
--- 321,335 ----
                }
  
! 
!               function 
generate_sql($type_id='',$cols='',$cols_return='',$uicols='',$read_single='')
                {
  
!                       $joinmethod .= " fm_location" . ($type_id);
! 
! //                    $paranthesis .='(';
  
                        $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++)
***************
*** 333,340 ****
  
                        $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'];
--- 344,353 ----
  
                        $fm_location_cols = 
$this->soadmin_location->read_attrib(array('type_id'=>$type_id));
+ //_debug_array($fm_location_cols);
  
                        for ($i=0;$i<count($fm_location_cols);$i++)
                        {
! 
!                               if($read_single)
                                {
                                        $cols .= ",fm_location" . ($type_id) 
.".".$fm_location_cols[$i]['column_name'];
***************
*** 344,351 ****
                                        $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--)
--- 357,388 ----
                                        $uicols['descr'][]                      
= $fm_location_cols[$i]['input_text'];
                                        $uicols['statustext'][]         = 
$fm_location_cols[$i]['statustext'];
+ 
+                                       $cols .= ",fm_location" . ($type_id) 
.".category as cat_id";
+                                       $cols_return[]                          
= 'cat_id';
+ 
+                               }
+                               else
+                               {
+                                       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'];
+                                       }
                                }
                        }
  
!                       if($type!=1)
!                       {
!                               $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 ($j=($type_id-1); $j>0; $j--)
***************
*** 368,413 ****
                        }
  
- 
                        $config = $this->soadmin_location->read_config('');
  
  //_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++)
                        {
--- 405,411 ----
***************
*** 419,429 ****
                                }
  
!                               if (($config[$i]['location_type'] <= $type_id) 
&& ($config[$i]['query_value'] ==1))
                                {
  
!                                       
if($config[$i]['column_name']=='street_number')
                                        {
-                                               $sub_query= "or street_name 
LIKE '%$query%'";
- 
                                                $cols.= 
',fm_streetaddress.street_name';
                                                $cols_return[]                  
        = 'street_name';
--- 417,425 ----
                                }
  
!                               if ($config[$i]['location_type'] <= $type_id)
                                {
  
!                                       
if($config[$i]['column_name']=='street_id'):
                                        {
                                                $cols.= 
',fm_streetaddress.street_name';
                                                $cols_return[]                  
        = 'street_name';
***************
*** 433,439 ****
                                                $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']);
--- 429,442 ----
                                                $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']);
***************
*** 441,447 ****
  
                                        }
!                                       else
                                        {
!                                               $cols.= ',' . 
$config[$i]['column_name'];
                                                $cols_return[]                  
        = $config[$i]['column_name'];
                                                $uicols['input_type'][]         
= 'text';
--- 444,480 ----
  
                                        }
!                                       
elseif($config[$i]['column_name']=='tenant_id'):
!                                       {
!                                               $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 
as tenant_last_name';
!                                               $cols_return[]                  
        = 'tenant_last_name';
!                                               $uicols['input_type'][]         
= 'text';
!                                               $uicols['name'][]               
        = 'tenant_last_name';
!                                               $uicols['descr'][]              
        = lang('last name');
!                                               $uicols['statustext'][]         
= lang('last name');
! 
!                                               $cols.= ',fm_tenant.first_name 
as tenant_first_name';
!                                               $cols_return[]                  
        = 'tenant_first_name';
!                                               $uicols['input_type'][]         
= 'text';
!                                               $uicols['name'][]               
        = 'tenant_first_name';
!                                               $uicols['descr'][]              
        = lang('first name');
!                                               $uicols['statustext'][]         
= lang('first name');
! 
!                                               $cols.= ',contact_phone';
!                                               $cols_return[]                  
        = 'contact_phone';
!                                               $uicols['input_type'][]         
= 'text';
!                                               $uicols['name'][]               
        = 'contact_phone';
!                                               $uicols['descr'][]              
        = lang('contact phone');
!                                               $uicols['statustext'][]         
= lang('contact phone');
!                                       }
!                                       else:
                                        {
!                                               $cols.= ',fm_location' . 
$config[$i]['location_type'] . '.' . $config[$i]['column_name'];
                                                $cols_return[]                  
        = $config[$i]['column_name'];
                                                $uicols['input_type'][]         
= 'text';
***************
*** 450,502 ****
                                                $uicols['statustext'][]         
= $config[$i]['input_text'];
                                        }
                                }
                        }
  
!                       $this->uicols = $uicols;
  
!                       $from .= " FROM $paranthesis fm_location$type_id ";
  
  
! //_debug_array($config);
  
  
  
!                       $sql = "SELECT $cols $from $joinmethod WHERE 
fm_location$type_id.location_code='$location_code' ";
  
! echo $sql;
  
! /*                    $sql = "SELECT 
fm_apartment.property_id,fm_property.name,building_id,entrance_id,floor,apartment_id,fm_apartment.street_id,street_name,street_number,descr,fm_apartment.cat_id,fm_apartment.remark"
!                               . "     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'";
! 
! */
! //                    $this->db->query($sql,__LINE__,__FILE__);
! 
!                       if ($this->db->next_record())
!                       {
!                               $apartment['location_code']             = 
$this->db->f('location_code');
!                               $apartment['property_id']               = 
$this->db->f('property_id');
!                               $apartment['property_name']             = 
$this->db->f('name');
!                               $apartment['building_id']               = 
$this->db->f('building_id');
!                               $apartment['entrance_id']               = 
$this->db->f('entrance_id');
!                               $apartment['floor']                             
= $this->db->f('floor');
!                               $apartment['apartment_id']              = 
$this->db->f('apartment_id');
!                               $apartment['street_id']                 = 
$this->db->f('street_id');
!                               $apartment['street_name']               = 
$this->db->f('street_name');
!                               $apartment['street_number']             = 
$this->db->f('street_number');
!                               $apartment['owner']                             
= $this->db->f('owner');
!                               $apartment['descr']                             
= stripslashes($this->db->f('descr'));
!                               $apartment['access']                    = 
$this->db->f('access');
!                               $apartment['date']                              
= $this->db->f('entry_date');
!                               $apartment['cat_id']                    = 
(int)$this->db->f('cat_id');
!                               $apartment['remark']                    = 
$this->db->f('remark');
  
!                               return $apartment;
                        }
                }
  
                function add($location='',$type_id='')
                {
--- 483,545 ----
                                                $uicols['statustext'][]         
= $config[$i]['input_text'];
                                        }
+                                       endif;
                                }
                        }
  
!                       $this->uicols           = $uicols;
!                       $this->cols_return      = $cols_return;
  
!                       $from .= " FROM $paranthesis $entity_table ";
  
+                       $sql = "SELECT $cols $from $joinmethod";
+                       return $sql;
  
!               }
  
+               function read_single($location_code='')
+               {
+                       $location_array = split('-',$location_code);
+                       $type_id= count($location_array);
  
+                       if (!$type_id)
+                       {
+                               return;
+                       }
+ 
+                       $cols.= 'loc' . $type_id .'_name';
+                       $cols_return[]                          = 'loc' . 
$type_id .'_name';
+                       $uicols['input_type'][]         = 'text';
+                       $uicols['name'][]                       = 'loc' . 
$type_id .'_name';
+                       $uicols['descr'][]                      = lang('name');
+                       $uicols['statustext'][]         = lang('name');
+ 
+                       $cols.= ',fm_location' . $type_id .'.remark as remark,';
+                       $cols_return[]                          = 'remark';
+                       $uicols['input_type'][]         = 'text';
+                       $uicols['name'][]                       = 'descr';
+                       $uicols['descr'][]                      = 
lang('remark');
+                       $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' ";
  
!                       $this->db->query($sql,__LINE__,__FILE__);
  
! //echo $sql;
!                       $cols_return    = $this->cols_return;
  
!                       $this->db->next_record();
!                       for ($i=0;$i<count($cols_return);$i++)
!                       {
!                               $location[$cols_return[$i]] = 
$this->db->f($cols_return[$i]);
                        }
+ 
+ //_debug_array($location);
+ 
+                       return $location;
                }
  
+ 
                function add($location='',$type_id='')
                {
***************
*** 525,543 ****
                }
  
!               function edit($apartment)
                {
-                       $apartment['remark'] = 
$this->db->db_addslashes($apartment['remark']);
  
!                       $this->db->query("UPDATE fm_apartment set
!                                       cat_id='"       . $apartment['cat_id'] 
. "',
!                                       floor='" . $apartment['floor'] . "',
!                                       street_id='" . $apartment['street_idd'] 
. "',
!                                       street_number='" . 
$apartment['street_number'] . "',
!                                       descr='" . $apartment['descr']  . "',
!                                       access='" . $apartment['access'] . "',
!                                       remark='" . $apartment['remark']
!                                       . "' WHERE location_code= '" . 
$apartment['location_code'] ."'",__LINE__,__FILE__);
  
!                       $receipt['message'][] = array('msg'=>lang('Apartment 
has been edited'));
                        return $receipt;
                }
--- 568,595 ----
                }
  
!               function edit($location='',$type_id='')
                {
  
!                       $location['remark'] = 
$this->db->db_addslashes($location['remark']);
  
!                       $sql    = "UPDATE fm_location$type_id SET ";
! 
!                       while (is_array($location) && list($input_name,$value) 
= each($location))
!                       {
!                               if($value)
!                               {
!                                       $vals[] = "$input_name = '$value'";
!                               }
!                       }
! 
!                       $vals   =implode(",",$vals);
! 
!                       $sql    .= " $vals WHERE location_code='" . 
$location['location_code'] . "'";
! 
!                       $this->db->query($sql,__LINE__,__FILE__);
! 
! //echo $sql;
! 
!                       $receipt['message'][] = array('msg'=>lang('Location %1 
has been edited',$location['location_code']));
                        return $receipt;
                }
***************
*** 545,549 ****
                function delete($location_code )
                {
!                       $this->db->query("DELETE FROM fm_apartment WHERE 
location_code='" . $location_code ."'",__LINE__,__FILE__);
                        $this->db->query("DELETE FROM fm_location WHERE 
location_code='" . $location_code ."'",__LINE__,__FILE__);
                }
--- 597,604 ----
                function delete($location_code )
                {
!                       $location_array = split('-',$location_code);
!                       $type_id= count($location_array);
! 
!                       $this->db->query("DELETE FROM fm_location$type_id WHERE 
location_code='" . $location_code ."'",__LINE__,__FILE__);
                        $this->db->query("DELETE FROM fm_location WHERE 
location_code='" . $location_code ."'",__LINE__,__FILE__);
                }

Index: class.uilocation.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/property/inc/class.uilocation.inc.php,v
retrieving revision 1.9
retrieving revision 1.10
diff -C2 -r1.9 -r1.10
*** class.uilocation.inc.php    14 Jun 2003 21:41:30 -0000      1.9
--- class.uilocation.inc.php    15 Jun 2003 19:41:26 -0000      1.10
***************
*** 77,80 ****
--- 77,81 ----
                        $lookup                 = 
get_var('lookup',array('POST','GET'));
                        $lookup_name    = 
get_var('lookup_name',array('POST','GET'));
+                       $lookup_tenant  = 
get_var('lookup_tenant',array('POST','GET'));
  
                        if($lookup)
***************
*** 138,146 ****
                                                                                
        'var'   =>      'loc1',
                                                                                
        'order' =>      $this->order,
!                                                                               
        'extra'         => array('menuaction'   => 
$this->currentapp.'.uilocation.index',
!                                                                               
                                                        'type_id'       
=>$type_id,
!                                                                               
                                                        'query'         
=>$this->query,
!                                                                               
                                                        'lookup'        
=>$lookup,
!                                                                               
                                                        'cat_id'        
=>$this->cat_id)
                                                                                
));
                                        }
--- 139,151 ----
                                                                                
        'var'   =>      'loc1',
                                                                                
        'order' =>      $this->order,
!                                                                               
        'extra'         => array('menuaction'                   => 
$this->currentapp.'.uilocation.index',
!                                                                               
                                                        'type_id'               
        =>$type_id,
!                                                                               
                                                        'query'                 
        =>$this->query,
!                                                                               
                                                        'district_id'           
=>$this->district_id,
!                                                                               
                                                        'part_of_town_id'       
=>$this->part_of_town_id,
!                                                                               
                                                        'lookup'                
        =>$lookup,
!                                                                               
                                                        'lookup_tenant'         
=>$lookup_tenant,
!                                                                               
                                                        'lookup_name'           
=>$lookup_name,
!                                                                               
                                                        'cat_id'                
        =>$this->cat_id)
                                                                                
));
                                        }
***************
*** 154,161 ****
                                                                                
        'order' =>      $this->order,
                                                                                
        'extra'         => array('menuaction'   => 
$this->currentapp.'.uilocation.index',
!                                                                               
                                                        'type_id'       
=>$type_id,
!                                                                               
                                                        'query'         
=>$this->query,
!                                                                               
                                                        'lookup'        
=>$lookup,
!                                                                               
                                                        'cat_id'        
=>$this->cat_id)
                                                                                
));
                                        }
--- 159,170 ----
                                                                                
        'order' =>      $this->order,
                                                                                
        'extra'         => array('menuaction'   => 
$this->currentapp.'.uilocation.index',
!                                                                               
                                                        'type_id'               
        =>$type_id,
!                                                                               
                                                        'query'                 
        =>$this->query,
!                                                                               
                                                        'district_id'           
=>$this->district_id,
!                                                                               
                                                        'part_of_town_id'       
=>$this->part_of_town_id,
!                                                                               
                                                        'lookup'                
        =>$lookup,
!                                                                               
                                                        'lookup_tenant'         
=>$lookup_tenant,
!                                                                               
                                                        'lookup_name'           
=>$lookup_name,
!                                                                               
                                                        'cat_id'                
        =>$this->cat_id)
                                                                                
));
                                        }
***************
*** 196,210 ****
                        (
                                'menuaction'    => 
$this->currentapp.'.uilocation.index',
!                                               'sort'                  
=>$this->sort,
!                                               'order'                 
=>$this->order,
!                                               'cat_id'                
=>$this->cat_id,
!                                               'district_id'   
=>$this->district_id,
!                                               'filter'                
=>$this->filter,
!                                               'query'                 
=>$this->query,
!                                               'lookup'                
=>$lookup,
!                                               'type_id'               
=>$type_id
                        );
  
- 
                        for ($i=0;$i<count($uicols['name']);$i++)
                        {
--- 205,221 ----
                        (
                                'menuaction'    => 
$this->currentapp.'.uilocation.index',
!                                               'sort'                          
=>$this->sort,
!                                               'order'                         
=>$this->order,
!                                               'cat_id'                        
=>$this->cat_id,
!                                               'district_id'           
=>$this->district_id,
!                                               'part_of_town_id'       
=>$this->part_of_town_id,
!                                               'filter'                        
=>$this->filter,
!                                               'query'                         
=>$this->query,
!                                               'lookup'                        
=>$lookup,
!                                               'lookup_tenant'         
=>$lookup_tenant,
!                                               'lookup_name'           
=>$lookup_name,
!                                               'type_id'                       
=>$type_id
                        );
  
                        for ($i=0;$i<count($uicols['name']);$i++)
                        {
***************
*** 276,280 ****
  
  
!       _debug_array($insert_record);
  
                        if($_POST['save'])
--- 287,291 ----
  
  
! //    _debug_array($insert_record);
  
                        if($_POST['save'])
***************
*** 318,322 ****
  //                            $location_code_parent=implode("-", 
$location_code_parent);
  
!                               if($values['location_code'])
                                {
                                        
if($this->bo->check_location($values['location_code'],$type_id))
--- 329,333 ----
  //                            $location_code_parent=implode("-", 
$location_code_parent);
  
!                               if($values['location_code'] && !$location_code)
                                {
                                        
if($this->bo->check_location($values['location_code'],$type_id))
***************
*** 343,347 ****
                        }
  
!                       if(!$error_id)
                        {
                                $values = 
$this->bo->read_single($location_code);
--- 354,358 ----
                        }
  
!                       if(!$error_id && $location_code)
                        {
                                $values = 
$this->bo->read_single($location_code);
***************
*** 366,370 ****
                        if($values['location_code'])
                        {
!                               $location_type='view';
                        }
                        else
--- 377,381 ----
                        if($values['location_code'])
                        {
!                               $location_type='form';
                        }
                        else
***************
*** 377,385 ****
                                                '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;
--- 388,397 ----
                                                '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
                                                ));
  
+ //_debug_array($location_data);
                        $location_types = $this->bo->location_types;
                        $config                 = $this->bo->config;
***************
*** 405,408 ****
--- 417,421 ----
                        $additional_fields[$j]['datatype']              = 
'varchar';
                        $additional_fields[$j]['input_name']    = 'loc' . 
$type_id;
+                       $additional_fields[$j]['value']                 = 
$values[$additional_fields[$j]['input_name']];
                        $additional_fields[$j]['class']                 = 
'th_text';
                        $insert_record[]                                        
        = $additional_fields[$j]['input_name'];
***************
*** 413,416 ****
--- 426,430 ----
                        $additional_fields[$j]['datatype']              = 
'varchar';
                        $additional_fields[$j]['input_name']    = 'loc' . 
$type_id . '_name';
+                       $additional_fields[$j]['value']                 = 
$values[$additional_fields[$j]['input_name']];
                        $insert_record[]                                        
        = $additional_fields[$j]['input_name'];
                        $j++;
***************
*** 422,425 ****
--- 436,440 ----
                                $additional_fields[$j]['datatype']              
= $custom['datatype'];
                                $additional_fields[$j]['input_name']    = 
$custom['column_name'];
+                               $additional_fields[$j]['value']                 
= $values[$additional_fields[$j]['input_name']];
                                $insert_record[]                                
                = $additional_fields[$j]['input_name'];
  
***************
*** 427,430 ****
--- 442,459 ----
                                        'datatype'              => 
$custom['datatype']
                                        );
+ 
+                               if($custom['datatype']=='date')
+                               {
+                                       $dateformat = 
$GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat'];
+                                       $sep = '/';
+                                       $dlarr[strpos($dateformat,'Y')] = 'Y';
+                                       $dlarr[strpos($dateformat,'m')] = 'm';
+                                       $dlarr[strpos($dateformat,'d')] = 'd';
+                                       ksort($dlarr);
+ 
+                                       $dateformat= (implode($sep,$dlarr));
+                                       $additional_fields[$j]['value'] = 
$GLOBALS['phpgw']->common->show_date($additional_fields[$j]['value'],$dateformat);
+                               }
+ 
                                $j++;
                        }
***************
*** 437,440 ****
--- 466,470 ----
                        $additional_fields[$j]['datatype']              = 
'text';
                        $additional_fields[$j]['input_name']    = 'remark';
+                       $additional_fields[$j]['value']                 = 
$values[$additional_fields[$j]['input_name']];
                        $insert_record[]                                        
        = $additional_fields[$j]['input_name'];
  
***************
*** 538,541 ****
--- 568,574 ----
                                'lang_select_street_help'               => 
lang('Select the street name'),
                                'lang_street_num_statustext'    => lang('Enter 
the street number'),
+                               'value_street_id'                               
=> $values['street_id'],
+                               'value_street_name'                             
=> $values['street_name'],
+                               'value_street_number'                   => 
$values['street_number'],
  
                                'tenant_link'                                   
=> 
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uilookup.tenant'),
***************
*** 545,549 ****
                                'value_tenant_first_name'               => 
$values['tenant_first_name'],
                                'lang_tenant_statustext'                => 
lang('Select a tenant'),
! 
                                'location_type'                                 
=> $location_type,
                                'location_data'                                 
=> $location_data,
--- 578,583 ----
                                'value_tenant_first_name'               => 
$values['tenant_first_name'],
                                'lang_tenant_statustext'                => 
lang('Select a tenant'),
!                               'size_last_name'                                
=> strlen($values['tenant_last_name']),
!                               'size_first_name'                               
=> strlen($values['tenant_first_name']),
                                'location_type'                                 
=> $location_type,
                                'location_data'                                 
=> $location_data,





reply via email to

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