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.53,1.54 cl


From: Sigurd Nes <address@hidden>
Subject: [Phpgroupware-cvs] CVS: property/inc class.bocommon.inc.php,1.53,1.54 class.boequipment.inc.php,1.11,1.12 class.bolocation.inc.php,1.10,1.11 class.socommon.inc.php,1.25,1.26 class.soequipment.inc.php,1.14,1.15class.solocation.inc.php,1.8,1.9 class.uiequipment.inc.php,1.23,1.24class.uilocation.inc.php,1.12,1.13
Date: Wed, 18 Jun 2003 07:21:19 -0400

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

Modified Files:
        class.bocommon.inc.php class.boequipment.inc.php 
        class.bolocation.inc.php class.socommon.inc.php 
        class.soequipment.inc.php class.solocation.inc.php 
        class.uiequipment.inc.php class.uilocation.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.53
retrieving revision 1.54
diff -C2 -r1.53 -r1.54
*** class.bocommon.inc.php      16 Jun 2003 12:44:48 -0000      1.53
--- class.bocommon.inc.php      18 Jun 2003 11:21:17 -0000      1.54
***************
*** 740,744 ****
  
  
- 
                function 
location_code($property_id='',$building_id='',$entrance_id='',$apartment='')
                {
--- 740,743 ----
***************
*** 764,771 ****
  
  
- 
                function read_location_data($location_code)
                {
!                       return 
$this->socommon->read_location_data($location_code);
                }
  
--- 763,771 ----
  
  
                function read_location_data($location_code)
                {
!                       $location_types = 
$this->soadmin_location->select_location_type();
! 
!                       return 
$this->socommon->read_location_data($location_code,$location_types);
                }
  
***************
*** 782,788 ****
                function generate_sql($data)
                {
!                       $sql= $this->socommon->generate_sql($data);
!                       $this->uicols   = $this->socommon->uicols;
!                       $this->cols_return      = $this->socommon->cols_return;
                        return $sql;
                }
--- 782,791 ----
                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;
                }

Index: class.boequipment.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/property/inc/class.boequipment.inc.php,v
retrieving revision 1.11
retrieving revision 1.12
diff -C2 -r1.11 -r1.12
*** class.boequipment.inc.php   16 Jun 2003 15:30:26 -0000      1.11
--- class.boequipment.inc.php   18 Jun 2003 11:21:17 -0000      1.12
***************
*** 48,51 ****
--- 48,52 ----
                        $this->currentapp       = 
$GLOBALS['phpgw_info']['flags']['currentapp'];
                        $this->so               = 
CreateObject($this->currentapp.'.soequipment');
+                       $this->solocation = 
CreateObject($this->currentapp.'.solocation');
                        $this->socommon = 
CreateObject($this->currentapp.'.socommon');
                        $this->bocommon = 
CreateObject($this->currentapp.'.bocommon');
***************
*** 217,224 ****
                        $equipment['date']  = 
$GLOBALS['phpgw']->common->show_date($equipment['date'],$dateformat);
  
!                       
$location_data=$this->socommon->read_location_data($equipment['location_code']);
! 
!                       $equipment=$equipment + $location_data;
  
                        return $equipment;
                }
--- 218,228 ----
                        $equipment['date']  = 
$GLOBALS['phpgw']->common->show_date($equipment['date'],$dateformat);
  
!                       if($equipment['location_code'])
!                       {
!                               
$location_data=$this->solocation->read_single($equipment['location_code']);
!                               $equipment['location_data'] = $location_data;
!                       }
  
+ //_debug_array($equipment);
                        return $equipment;
                }
***************
*** 231,235 ****
                function save($equipment,$action='')
                {
!                       
$equipment['location_code']=$this->bocommon->location_code($equipment['property_id'],$equipment['building_id'],$equipment['entrance_id'],$equipment['apartment_id']);
                        $date   = 
$this->bocommon->date_array($equipment['date']);
  
--- 235,247 ----
                function save($equipment,$action='')
                {
!                       while (is_array($equipment['location']) && 
list(,$value) = each($equipment['location']))
!                       {
!                               if($value)
!                               {
!                                       $location[] = $value;
!                               }
!                       }
! 
!                       $equipment['location_code']=implode("-", $location);
                        $date   = 
$this->bocommon->date_array($equipment['date']);
  

Index: class.bolocation.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/property/inc/class.bolocation.inc.php,v
retrieving revision 1.10
retrieving revision 1.11
diff -C2 -r1.10 -r1.11
*** class.bolocation.inc.php    16 Jun 2003 12:44:48 -0000      1.10
--- class.bolocation.inc.php    18 Jun 2003 11:21:17 -0000      1.11
***************
*** 168,180 ****
                function initiate_ui_location($data)
                {
- //_debug_array($data);
  
!                       switch($data['location_type'])
                        {
                                case 'form':
!                                       
$GLOBALS['phpgw']->xslttpl->add_file(array('location_form_2'));
                                        break;
                                case 'view':
!                                       
$GLOBALS['phpgw']->xslttpl->add_file(array('location_view_2'));
                                        break;
                        }
--- 168,180 ----
                function initiate_ui_location($data)
                {
  
! //_debug_array($data);
!                       switch($data['lookup_type'])
                        {
                                case 'form':
!                                       
$GLOBALS['phpgw']->xslttpl->add_file(array('location_form'));
                                        break;
                                case 'view':
!                                       
$GLOBALS['phpgw']->xslttpl->add_file(array('location_view'));
                                        break;
                        }
***************
*** 188,193 ****
                        $location_types = 
$this->soadmin_location->select_location_type();
                        $this->location_types   = $location_types;
  //_debug_array($location_types);
!                       $fm_location_cols = 
$this->soadmin_location->read_attrib(array('type_id'=>$data['type_id']));
  //_debug_array($fm_location_cols);
  
--- 188,197 ----
                        $location_types = 
$this->soadmin_location->select_location_type();
                        $this->location_types   = $location_types;
+                       if(!isset($data['type_id']))
+                       {
+                               $data['type_id'] = count($location_types);
+                       }
  //_debug_array($location_types);
!                       $fm_location_cols = 
$this->soadmin_location->read_attrib(array('type_id'=>$data['type_id'],'lookup_type'=>$data['type_id']));
  //_debug_array($fm_location_cols);
  
***************
*** 230,237 ****
                        }
  
  
                        for ($j=0;$j<count($fm_location_cols);$j++)
                        {
!                               if($fm_location_cols[$j]['location_type'] <= 
$data['type_id'] && $fm_location_cols[$j]['lookup_form'])
                                {
                                        $location['location'][$i]['input_type'] 
                        = 'text';
--- 234,243 ----
                        }
  
+ //_debug_array($fm_location_cols);
+ //_debug_array($data);
  
                        for ($j=0;$j<count($fm_location_cols);$j++)
                        {
!                               if(($fm_location_cols[$j]['location_type'] <= 
$data['type_id']) && $fm_location_cols[$j]['lookup_form'])
                                {
                                        $location['location'][$i]['input_type'] 
                        = 'text';
***************
*** 246,250 ****
                                        $location['location'][$i]['statustext'] 
                        = lang('Klick this link to select') . ' ' . 
$location_types[($fm_location_cols[$j]['location_type']-1)]['name'];
                                        $i++;
- //echo 'i :' . $i . '<br>';
  
                                }
--- 252,255 ----

Index: class.socommon.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/property/inc/class.socommon.inc.php,v
retrieving revision 1.25
retrieving revision 1.26
diff -C2 -r1.25 -r1.26
*** class.socommon.inc.php      16 Jun 2003 12:44:48 -0000      1.25
--- class.socommon.inc.php      18 Jun 2003 11:21:17 -0000      1.26
***************
*** 46,49 ****
--- 46,61 ----
  
                        $location_types = 
$this->soadmin_location->select_location_type();
+                       $config = $this->soadmin_location->read_config('');
+ 
+                       for ($i=0;$i<count($config);$i++)
+                       {
+                               
if($config[$i]['location_type']>$max_location_join)
+                               {
+                                       $max_location_join = 
$config[$i]['location_type'];
+                               }
+                       }
+ 
+                       $this->max_location_join        = $max_location_join;
+                       $this->type_id  = count($location_types);
  
                        for ($i=0; $i<count($location_types); $i++)
***************
*** 54,57 ****
--- 66,73 ----
                                $uicols['descr'][]                      = 
$location_types[$i]['name'];
                                $uicols['statustext'][]         = 
$location_types[$i]['descr'];
+                       }
+ 
+                       for ($i=0; $i<$max_location_join; $i++)
+                       {
                                $cols .= ",$entity_table" . ".loc" . 
$location_types[$i]['id'];
                                $cols_return[] = 'loc' . 
$location_types[$i]['id'];
***************
*** 68,72 ****
                        $first_join     = False;
  
!                       for ($j=count($location_types); $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);
***************
*** 99,103 ****
                        $type_id        = count($location_types);
  
-                       $config = $this->soadmin_location->read_config('');
  
                        for ($i=0;$i<count($config);$i++)
--- 115,118 ----
***************
*** 162,165 ****
--- 177,181 ----
  
  
+ 
                function get_user_list_right($right='',$acl_location='')
                {
***************
*** 190,246 ****
                        $this->db->next_record();
                        return $this->db->f('name');
-               }
- 
-               function read_location_data($location_code)
-               {
- 
-                       $location['location_code']      = $location_code;
- 
-                       $location_key   = split("-", $location_code);
-                       $sql    =       array(
-                               0 => "select name from fm_property where  
property_id='" .$location_key[0] . "'",
-                               1 => "select name from fm_building where 
property_id='" .$location_key[0] . "' and building_id='" .$location_key[1] . 
"'",
-                               2 => "select descr from fm_entrance where 
property_id='" .$location_key[0] . "' and building_id='" .$location_key[1] . "' 
and entrance_id='" .$location_key[2] . "'",
-                               3 => "select 
floor,fm_apartment.street_id,street_number,street_name from fm_apartment 
$this->join fm_streetaddress on fm_apartment.street_id = 
fm_streetaddress.street_id where property_id='" .$location_key[0] . "' and 
building_id='" .$location_key[1] . "' and entrance_id='" .$location_key[2] . "' 
and apartment_id='" .$location_key[3] . "'"
-                       );
- 
-                       $this->db->query($sql[0],__LINE__,__FILE__);
- 
-                       $this->db->next_record();
-                       $location['property_id']        = $location_key[0];
-                       $location['property_name']      = $this->db->f('name');
- 
-                       if($location_key[1])
-                       {
-                               $this->db->query($sql[1],__LINE__,__FILE__);
- 
-                               $this->db->next_record();
-                               $location['building_id']        = 
$location_key[1];
-                               $location['building_name']      = 
$this->db->f('name');
-                       }
- 
-                       if($location_key[2])
-                       {
-                               $this->db->query($sql[2],__LINE__,__FILE__);
- 
-                               $this->db->next_record();
-                               $location['entrance_id']        = 
$location_key[2];
-                               $location['street_name']        = 
$this->db->f('descr');
-                       }
- 
-                       if($location_key[3])
-                       {
-                               $this->db->query($sql[3],__LINE__,__FILE__);
- 
-                               $this->db->next_record();
-                               $location['apartment_id']       = 
$location_key[3];
-                               $location['floor']                      = 
$this->db->f('floor');
-                               $location['street_id']          = 
$this->db->f('street_id');
-                               $location['street_name']        = 
$this->db->f('street_name');
-                               $location['street_number']      = 
$this->db->f('street_number');
-                       }
- 
-                       unset($sql);
-                       return $location;
                }
  
--- 206,209 ----

Index: class.soequipment.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/property/inc/class.soequipment.inc.php,v
retrieving revision 1.14
retrieving revision 1.15
diff -C2 -r1.14 -r1.15
*** class.soequipment.inc.php   16 Jun 2003 12:44:48 -0000      1.14
--- class.soequipment.inc.php   18 Jun 2003 11:21:17 -0000      1.15
***************
*** 163,168 ****
  
  //echo $sql;
!                       $uicols = $this->bocommon->uicols;
!                       $cols_return    = $this->bocommon->cols_return;
  
                        if($filter)
--- 163,170 ----
  
  //echo $sql;
!                       $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)
***************
*** 198,201 ****
--- 200,215 ----
                                        
$equipment_list[$j]['attribute']=$attribute;
                                }
+                               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++)
+                                       {
+                                               $equipment_list[$j]['loc' . 
$next] = $location[($next-1)];
+                                               $next++;
+                                       }
+                               }
  
                                $j++;
***************
*** 274,289 ****
                {
  
!                       if($equipment['street_number'])
!                       {
!                               $address= $equipment['street_name'] . ' ' . 
$equipment['street_number'];
!                       }
!                       else
                        {
!                               $address= $equipment['street_name'];
                        }
  
                        $equipment['descr'] = 
$this->db->db_addslashes($equipment['descr']);
  //_debug_array($equipment);
!                       $this->db->query("INSERT INTO fm_equipment 
(equipment_id,lifetime,status,equipment_type_id,cost,date,descr,location_code,property_id,address,vendor_id,owner)
 "
                                . "VALUES ('"
                                . $equipment['equipment_id']. "','"
--- 288,306 ----
                {
  
!                       while (is_array($equipment['location']) && 
list($input_name,$value) = each($equipment['location']))
                        {
!                               if($value)
!                               {
!                                       $cols[] = $input_name;
!                                       $vals[] = $value;
!                               }
                        }
  
+                       $cols   = "," . implode(",", $cols);
+                       $vals   = ",'" . implode("','", $vals) . "'";
+ 
                        $equipment['descr'] = 
$this->db->db_addslashes($equipment['descr']);
  //_debug_array($equipment);
!                       $this->db->query("INSERT INTO fm_equipment 
(equipment_id,lifetime,status,equipment_type_id,cost,date,descr,location_code,vendor_id,user_id
 $cols) "
                                . "VALUES ('"
                                . $equipment['equipment_id']. "','"
***************
*** 295,302 ****
                                . $equipment['descr']. "','"
                                . $equipment['location_code']. "','"
-                               . $equipment['property_id']. "','"
-                               . $address . "','"
                                . $equipment['vendor_id'] . "','"
!                               . $this->account. "')",__LINE__,__FILE__);
  
                        $receipt['message'][] = array('msg'=>lang('Equipment %1 
has been saved',$equipment['equipment_id']));
--- 312,317 ----
                                . $equipment['descr']. "','"
                                . $equipment['location_code']. "','"
                                . $equipment['vendor_id'] . "','"
!                               . $this->account. "' $vals)",__LINE__,__FILE__);
  
                        $receipt['message'][] = array('msg'=>lang('Equipment %1 
has been saved',$equipment['equipment_id']));
***************
*** 307,319 ****
                {
  //_debug_array($equipment);
!                       if($equipment['street_number'])
!                       {
!                               $address= $equipment['street_name'] . ' ' . 
$equipment['street_number'];
!                       }
!                       else
                        {
!                               $address= $equipment['street_name'];
                        }
  
                        $equipment['descr'] = 
$this->db->db_addslashes($equipment['descr']);
  
--- 322,333 ----
                {
  //_debug_array($equipment);
! 
!                       while (is_array($equipment['location']) && 
list($input_name,$value) = each($equipment['location']))
                        {
!                               $vals[] = "$input_name = '$value'";
                        }
  
+                       $vals   = "," . implode(",",$vals);
+ 
                        $equipment['descr'] = 
$this->db->db_addslashes($equipment['descr']);
  
***************
*** 326,333 ****
                                descr='" . $equipment['descr'] . "',
                                location_code='" . $equipment['location_code'] 
. "',
-                               property_id='" . $equipment['property_id'] . "',
-                               address='" . $address . "',
                                vendor_id='" . $equipment['vendor_id']
!                               . "' WHERE equipment_id= '" . 
$equipment['equipment_id'] ."'",__LINE__,__FILE__);
  
                        $receipt['message'][] = array('msg'=>lang('equipment %1 
has been edited',$equipment['equipment_id']));
--- 340,345 ----
                                descr='" . $equipment['descr'] . "',
                                location_code='" . $equipment['location_code'] 
. "',
                                vendor_id='" . $equipment['vendor_id']
!                               . "' $vals WHERE equipment_id= '" . 
$equipment['equipment_id'] ."'",__LINE__,__FILE__);
  
                        $receipt['message'][] = array('msg'=>lang('equipment %1 
has been edited',$equipment['equipment_id']));

Index: class.solocation.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/property/inc/class.solocation.inc.php,v
retrieving revision 1.8
retrieving revision 1.9
diff -C2 -r1.8 -r1.9
*** class.solocation.inc.php    16 Jun 2003 12:44:48 -0000      1.8
--- class.solocation.inc.php    18 Jun 2003 11:21:17 -0000      1.9
***************
*** 127,131 ****
                        }
  
!                       $fm_location_cols = 
$this->soadmin_location->read_attrib(array('type_id'=>$type_id));
  
                        for ($i=0;$i<count($fm_location_cols);$i++)
--- 127,131 ----
                        }
  
!                       $fm_location_cols = 
$this->soadmin_location->read_attrib(array('type_id'=>$type_id,'lookup_type'=>$type_id));
  
                        for ($i=0;$i<count($fm_location_cols);$i++)
***************
*** 133,137 ****
                                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';
--- 133,137 ----
                                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';

Index: class.uiequipment.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/property/inc/class.uiequipment.inc.php,v
retrieving revision 1.23
retrieving revision 1.24
diff -C2 -r1.23 -r1.24
*** class.uiequipment.inc.php   16 Jun 2003 15:30:26 -0000      1.23
--- class.uiequipment.inc.php   18 Jun 2003 11:21:17 -0000      1.24
***************
*** 39,43 ****
                        $this->bo                                       = 
CreateObject($this->currentapp.'.boequipment',True);
                        $this->so                                       = 
CreateObject($this->currentapp.'.soequipment');
!                       $this->bocommon                                 = 
CreateObject($this->currentapp.'.bocommon');
  
                        $this->start                            = 
$this->bo->start;
--- 39,45 ----
                        $this->bo                                       = 
CreateObject($this->currentapp.'.boequipment',True);
                        $this->so                                       = 
CreateObject($this->currentapp.'.soequipment');
!                       $this->bocommon                         = 
CreateObject($this->currentapp.'.bocommon');
!                       $this->bolocation                       = 
CreateObject($this->currentapp.'.bolocation');
! 
  
                        $this->start                            = 
$this->bo->start;
***************
*** 69,72 ****
--- 71,75 ----
                }
  
+ 
                function index()
                {
***************
*** 185,189 ****
                                'lang_add'                              => 
lang('add'),
                                'lang_add_statustext'   => lang('add a 
equipment'),
!                               'add_action'                    => 
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uiequipment.edit')
                        );
  
--- 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')
                        );
  
***************
*** 247,258 ****
                        $values_attribute       = 
get_var('values_attribute',array('POST','GET'));
  
!                       
$GLOBALS['phpgw']->xslttpl->add_file(array('equipment'));
! 
!                       if($values)
!                       {
!                               $values = $values + 
$this->bocommon->get_location();
!                       }
  
!                       $values['equipment_id']         = 
get_var('equipment_idd',array('POST'));
  
                        $values['vendor_id']            = 
get_var('vendor_id',array('POST'));
--- 250,256 ----
                        $values_attribute       = 
get_var('values_attribute',array('POST','GET'));
  
!                       $insert_record = 
$GLOBALS['phpgw']->session->appsession('insert_record',$this->currentapp);
  
!                       
$GLOBALS['phpgw']->xslttpl->add_file(array('equipment'));
  
                        $values['vendor_id']            = 
get_var('vendor_id',array('POST'));
***************
*** 262,265 ****
--- 260,269 ----
                        if ($values['save'])
                        {
+ 
+                               for ($i=0; $i<count($insert_record); $i++)
+                               {
+                                       
$values['location'][$insert_record[$i]]= $_POST[$insert_record[$i]];
+                               }
+ 
                                if(!$values['generate_id'] && 
!$values['equipment_id'] && !$id)
                                {
***************
*** 302,315 ****
                                        }
                                }
!                       }
!                       else
!                       {
!                               if ($id)
                                {
!                                       $values = $this->bo->read_single($id);
                                }
                        }
  
!                       $location_type='form';
  
                        if ($id)
--- 306,326 ----
                                        }
                                }
!                               else
                                {
!                                       if($values['location'])
!                                       {
!                                               $location_code=implode("-", 
$values['location']);
!                                               $values['location_data'] = 
$this->bolocation->read_single($location_code);
!                                       }
! 
                                }
                        }
  
!                       if ($id)
!                       {
!                               $values = $this->bo->read_single($id);
!                       }
! 
!                       $lookup_type='form';
  
                        if ($id)
***************
*** 328,344 ****
  
  
!                       
$location_data=$this->bocommon->initiate_ui_location(array(
!                                               'location_type' => 
$location_type,
!                                               'equipment'             => 
false,
!                                               'apartment'             => true,
!                                               'address'               => true,
!                                               'property_id'   => 
$values['property_id'],
!                                               'property_name' => 
$values['property_name'],
!                                               'building_id'   => 
$values['building_id'],
!                                               'entrance_id'   => 
$values['entrance_id'],
!                                               'floor'                 => 
$values['floor'],
!                                               'street_name'   => 
$values['street_name'],
!                                               'street_number' => 
$values['street_number'],
!                                               'apartment_id'  => 
$values['apartment_id']));
  
                        
$vendor_data=$this->bocommon->initiate_ui_vendorlookup(array(
--- 339,351 ----
  
  
!                       
$location_data=$this->bolocation->initiate_ui_location(array(
!                                               'values'                => 
$values['location_data'],
!                                               'type_id'               => 
False, // calculated from location_types
!                                               'no_link'               => 
False, // disable lookup links for location type less than type_id
!                       //                      'tenant'                => True,
!                       //                      'equipment'             => True,
!                                               'lookup_type'   => $lookup_type
!                                               ));
! 
  
                        
$vendor_data=$this->bocommon->initiate_ui_vendorlookup(array(
***************
*** 428,432 ****
                                'vendor_data'                                   
=> $vendor_data,
                                'location_data'                                 
=> $location_data,
!                               'location_type'                                 
=> $location_type,
                                'form_action'                                   
=> $GLOBALS['phpgw']->link('/index.php',$link_data),
                                'done_action'                                   
=> 
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uiequipment.index'),
--- 435,439 ----
                                'vendor_data'                                   
=> $vendor_data,
                                'location_data'                                 
=> $location_data,
!                               'lookup_type'                                   
=> $lookup_type,
                                'form_action'                                   
=> $GLOBALS['phpgw']->link('/index.php',$link_data),
                                'done_action'                                   
=> 
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uiequipment.index'),
***************
*** 514,529 ****
                        
$GLOBALS['phpgw']->xslttpl->add_file(array('equipment'));
  
!                       
$location_data=$this->bocommon->initiate_ui_location(array(
!                                               'location_type' => 'view',
!                                               'apartment'             => true,
!                                               'address'               => true,
!                                               'property_id'   => 
$values['property_id'],
!                                               'property_name' => 
$values['property_name'],
!                                               'building_id'   => 
$values['building_id'],
!                                               'entrance_id'   => 
$values['entrance_id'],
!                                               'floor'                 => 
$values['floor'],
!                                               'street_name'   => 
$values['street_name'],
!                                               'street_number' => 
$values['street_number'],
!                                               'apartment_id'  => 
$values['apartment_id']));
  
                                $cat_text                               = 
$this->bo->read_single_equipment_type($values['cat_id']);
--- 521,532 ----
                        
$GLOBALS['phpgw']->xslttpl->add_file(array('equipment'));
  
!                       
$location_data=$this->bolocation->initiate_ui_location(array(
!                                               'values'                => 
$values['location_data'],
!                                               'type_id'               => 
False, // calculated from location_types
!                                               'no_link'               => 
False, // disable lookup links for location type less than type_id
!                       //                      'tenant'                => True,
!                       //                      'equipment'             => True,
!                                               'lookup_type'   => 'view'
!                                               ));
  
                                $cat_text                               = 
$this->bo->read_single_equipment_type($values['cat_id']);

Index: class.uilocation.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/property/inc/class.uilocation.inc.php,v
retrieving revision 1.12
retrieving revision 1.13
diff -C2 -r1.12 -r1.13
*** class.uilocation.inc.php    16 Jun 2003 12:44:48 -0000      1.12
--- class.uilocation.inc.php    18 Jun 2003 11:21:17 -0000      1.13
***************
*** 121,125 ****
                                        $content[$j]['row'][$i]['statustext']   
                = lang('delete the location');
                                        $content[$j]['row'][$i]['text']         
                        = lang('delete');
!                                       $content[$j]['row'][$i++]['link']       
                        = 
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uilocation.delete&location_code='
 . $location['location_code']);
                                }
                                $j++;
--- 121,125 ----
                                        $content[$j]['row'][$i]['statustext']   
                = lang('delete the location');
                                        $content[$j]['row'][$i]['text']         
                        = lang('delete');
!                                       $content[$j]['row'][$i++]['link']       
                        = 
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uilocation.delete&location_code='
 . $location['location_code'] . '&type_id=' . $type_id);
                                }
                                $j++;
***************
*** 386,394 ****
                        if($values['location_code'])
                        {
!                               $location_type='form';
                        }
                        else
                        {
!                               $location_type='form';
                        }
  
--- 386,394 ----
                        if($values['location_code'])
                        {
!                               $lookup_type='form';
                        }
                        else
                        {
!                               $lookup_type='form';
                        }
  
***************
*** 398,403 ****
                                                'no_link'               => 
($type_id), // disable lookup links for location type less than type_id
                        //                      'tenant'                => True,
!                                               'equipment'             => True,
!                                               'location_type' => 
$location_type
                                                ));
  
--- 398,403 ----
                                                'no_link'               => 
($type_id), // disable lookup links for location type less than type_id
                        //                      'tenant'                => True,
!                       //                      'equipment'             => True,
!                                               'lookup_type'   => $lookup_type
                                                ));
  
***************
*** 503,507 ****
                                                $edit_part_of_town=True;
                                                $select_name_part_of_town       
        = 'part_of_town_id';
!                                               $part_of_town_list              
                = 
$this->bocommon->select_part_of_town('select',$this->part_of_town_id);
                                                $lang_town_statustext           
        = lang('Select the part of town the property belongs to. To do not use 
a part of town -  select NO PART OF TOWN');
                                                $insert_record[]        = 
'part_of_town_id';
--- 503,507 ----
                                                $edit_part_of_town=True;
                                                $select_name_part_of_town       
        = 'part_of_town_id';
!                                               $part_of_town_list              
                = 
$this->bocommon->select_part_of_town('select',$values['part_of_town_id']);
                                                $lang_town_statustext           
        = lang('Select the part of town the property belongs to. To do not use 
a part of town -  select NO PART OF TOWN');
                                                $insert_record[]        = 
'part_of_town_id';
***************
*** 511,515 ****
                                                $edit_owner=True;
                                                $lang_owner                     
                        = lang('Owner');
!                                               $owner_list                     
                        = $this->bo->get_owner_list($property['owner_id']);
                                                $lang_select_owner              
                = lang('Select owner');
                                                $lang_owner_statustext          
        = lang('Select the owner');
--- 511,515 ----
                                                $edit_owner=True;
                                                $lang_owner                     
                        = lang('Owner');
!                                               $owner_list                     
                        = $this->bo->get_owner_list($values['owner_id']);
                                                $lang_select_owner              
                = lang('Select owner');
                                                $lang_owner_statustext          
        = lang('Select the owner');
***************
*** 590,594 ****
                                'size_last_name'                                
=> strlen($values['tenant_last_name']),
                                'size_first_name'                               
=> strlen($values['tenant_first_name']),
!                               'location_type'                                 
=> $location_type,
                                'location_data'                                 
=> $location_data,
                                'form_action'                                   
=> $GLOBALS['phpgw']->link('/index.php',$link_data),
--- 590,594 ----
                                'size_last_name'                                
=> strlen($values['tenant_last_name']),
                                'size_first_name'                               
=> strlen($values['tenant_first_name']),
!                               'lookup_type'                                   
=> $lookup_type,
                                'location_data'                                 
=> $location_data,
                                'form_action'                                   
=> $GLOBALS['phpgw']->link('/index.php',$link_data),
***************
*** 614,617 ****
--- 614,619 ----
                {
                        $location_code          = 
get_var('location_code',array('GET'));
+                       $type_id                = 
get_var('type_id',array('GET',POST));
+ 
  
                        $confirm        = get_var('confirm',array('POST'));
***************
*** 619,623 ****
                        $link_data = array
                        (
!                               'menuaction' => 
$this->currentapp.'.uilocation.index'
                        );
  
--- 621,626 ----
                        $link_data = array
                        (
!                               'menuaction' => 
$this->currentapp.'.uilocation.index',
!                               'type_id'       =>$type_id
                        );
  
***************
*** 633,637 ****
                        (
                                'done_action'                   => 
$GLOBALS['phpgw']->link('/index.php',$link_data),
!                               'delete_action'                 => 
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uilocation.delete&location_code='
 . $location_code),
                                'lang_confirm_msg'              => lang('do you 
really want to delete this entry'),
                                'lang_yes'                              => 
lang('yes'),
--- 636,640 ----
                        (
                                'done_action'                   => 
$GLOBALS['phpgw']->link('/index.php',$link_data),
!                               'delete_action'                 => 
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uilocation.delete&location_code='
 . $location_code . '&type_id=' . $type_id),
                                'lang_confirm_msg'              => lang('do you 
really want to delete this entry'),
                                'lang_yes'                              => 
lang('yes'),
***************
*** 650,659 ****
                function view()
                {
!                       $location_code          = 
get_var('location_code',array('GET'));
!                       $location                       = 
split('-',$location_code);
!                       $property_id            = $location[0];
!                       $building_id            = $location[1];
!                       $entrance_id            = $location[2];
!                       $apartment_id           = $location[3];
  
                        $GLOBALS['phpgw']->xslttpl->add_file(array('location'));
--- 653,665 ----
                function view()
                {
!                       $location_code                  = 
get_var('location_code',array('POST','GET'));
!                       $location = split('-',$location_code);
! 
!                       $type_id                = 
get_var('type_id',array('GET'));
! 
!                       if($location_code)
!                       {
!                               $type_id = count($location);
!                       }
  
                        $GLOBALS['phpgw']->xslttpl->add_file(array('location'));
***************
*** 661,712 ****
                        $values = $this->bo->read_single($location_code);
  
!                       $attributes_values              = 
$this->bocommon->read_attibutes(array('form'=>false,'type'=>location,'type_id'=>4,'id'=>$location_code));
!                       $attributes_header[]    = array
!                               (
!                                       'lang_name'             => lang('Name'),
!                                       'lang_descr'    => lang('Description'),
!                                       'lang_datatype' => lang('Datatype'),
!                                       'lang_value'    => lang('Value')
!                                       );
!                       $location_type='view';
  
!                       
$location_data=$this->bocommon->initiate_ui_location(array(
!                                               'location_type' => 
$location_type,
!                                               'apartment'     => True,
!                                               'property_id'   => 
$values['property_id'],
!                                               'property_name' => 
$values['property_name'],
!                                               'building_id'   => 
$values['building_id'],
!                                               'entrance_id'   => 
$values['entrance_id'],
!                                               'floor'                 => 
$values['floor'],
!                                               'apartment_id'  => 
$values['apartment_id'],
!                                               'street_name'   => 
$values['street_name'],
!                                               'street_number' => 
$values['street_number']));
  
                        $data = array
                        (
!                               'location_type'                                 
=> $location_type,
                                'location_data'                                 
=> $location_data,
!                               'lang_attributes'                               
=> lang('Attributes'),
!                               'attributes_header'                             
=> $attributes_header,
!                               'attributes_values'                             
=> $attributes_values,
!                               'value_name'                                    
=> $values['name'],
!                               'value_descr'                                   
=> $values['descr'],
!                               'value_access'                                  
=> $values['access'],
!                               'value_remark'                                  
=> $values['remark'],
!                               'lang_remark'                                   
=> lang('remark'),
!                               'value_category'                                
=> $this->bo->read_category_name($values['cat_id']),
!                               'lang_name'                                     
        => lang('name'),
!                               'lang_descr'                                    
=> lang('Description'),
!                               'lang_category'                                 
=> lang('category'),
!                               'lang_done'                                     
=> lang('done'),
                                'lang_edit'                                     
=> lang('Edit'),
                                'edit_action'                           => 
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uilocation.edit&location_code='
 . $location_code),
-                               'done_action'                                   
=> 
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uilocation.index'),
-                               'lang_done_statustext'          => lang('Back 
to the list'),
                                'lang_edit_statustext'          => lang('Edit 
this entry equipment'),
                        );
  
                        $appname                                                
= lang('location');
-                       $function_msg                                   = 
lang('view location');
  
                        $GLOBALS['phpgw_info']['flags']['app_header'] = 
lang($this->currentapp) . ' - ' . $appname . ': ' . $function_msg;
--- 667,819 ----
                        $values = $this->bo->read_single($location_code);
  
!                       $lookup_type='view';
! 
!                       $location_data=$this->bo->initiate_ui_location(array(
!                                               'values'                => 
$values,
!                                               'type_id'               => 
($type_id-1),
!                       //                      'tenant'                => True,
!                                               'lookup_type'   => $lookup_type
!                                               ));
! 
!                       $location_types = $this->bo->location_types;
!                       $config                 = $this->bo->config;
! 
!                       $function_msg = lang('view');
! 
!                       $function_msg .= ' ' 
.$location_types[($type_id-1)]['name'];
! 
! //    _debug_array($config);
!                       $custom_fields  = 
$this->soadmin_location->read_attrib(array(type_id=>$type_id));
! 
!                       $j=0;
!                       $additional_fields[$j]['input_text']    = 
$location_types[($type_id-1)]['name'];
!                       $additional_fields[$j]['input_name']    = 'loc' . 
$type_id;
!                       $additional_fields[$j]['datatype']              = 
'varchar';
!                       $additional_fields[$j]['value']                 = 
$values[$additional_fields[$j]['input_name']];
!                       $additional_fields[$j]['class']                 = 
'th_text';
! 
!                       $j++;
!                       $additional_fields[$j]['input_text']    = lang('name');
!                       $additional_fields[$j]['input_name']    = 'loc' . 
$type_id . '_name';
!                       $additional_fields[$j]['datatype']              = 
'varchar';
!                       $additional_fields[$j]['value']                 = 
$values[$additional_fields[$j]['input_name']];
!                       $j++;
! 
!                       while (is_array($custom_fields) && list(,$custom) = 
each($custom_fields))
!                       {
!                               $additional_fields[$j]['input_text']    = 
$custom['input_text'];
!                               $additional_fields[$j]['input_name']    = 
$custom['column_name'];
!                               $additional_fields[$j]['datatype']              
= $custom['datatype'];
!                               $additional_fields[$j]['value']                 
= $values[$additional_fields[$j]['input_name']];
! 
!                               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++;
!                       }
! 
! 
!                       $additional_fields[$j]['input_text']    = 
lang('remark');
!                       $additional_fields[$j]['datatype']              = 
'text';
!                       $additional_fields[$j]['value']                 = 
$values['remark'];
! 
! 
! //    _debug_array($custom_fields);
! 
!                       for ($j=0;$j<count($config);$j++)
!                       {
!                               if($config[$j]['location_type'] == $type_id)
!                               {
! 
!                                       
if($config[$j]['column_name']=='street_id')
!                                       {
!                                               $edit_street=True;
!                                               $insert_record[]        = 
'street_id';
!                                       }
  
!                                       
if($config[$j]['column_name']=='tenant_id')
!                                       {
!                                               $edit_tenant=True;
!                                               $insert_record[]        = 
'tenant_id';
!                                       }
! 
!                                       
if($config[$j]['column_name']=='part_of_town_id')
!                                       {
!                                               $edit_part_of_town=True;
!                                               $select_name_part_of_town       
        = 'part_of_town_id';
!                                               $part_of_town_list              
                = 
$this->bocommon->select_part_of_town('select',$values['part_of_town_id']);
!                                               $lang_town_statustext           
        = lang('Select the part of town the property belongs to. To do not use 
a part of town -  select NO PART OF TOWN');
!                                               $insert_record[]        = 
'part_of_town_id';
!                                       }
!                                       
if($config[$j]['column_name']=='owner_id')
!                                       {
!                                               $edit_owner=True;
!                                               $lang_owner                     
                        = lang('Owner');
!                                               $owner_list                     
                        = $this->bo->get_owner_list($values['owner_id']);
!                                               $lang_select_owner              
                = lang('Select owner');
!                                               $lang_owner_statustext          
        = lang('Select the owner');
!                                               $insert_record[]        = 
'owner_id';
!                                       }
!                               }
!                       }
  
                        $data = array
                        (
!                               'edit_street'                                   
=> $edit_street,
!                               'edit_tenant'                                   
=> $edit_tenant,
!                               'edit_part_of_town'                             
=> $edit_part_of_town,
!                               'edit_owner'                                    
=> $edit_owner,
!                               'select_name_part_of_town'              => 
$select_name_part_of_town,
!                               'part_of_town_list'                             
=> $part_of_town_list,
!                               'lang_town_statustext'                  => 
$lang_town_statustext,
!                               'lang_part_of_town'                             
=> lang('Part of town'),
!                               'lang_no_part_of_town'                  => 
lang('No part of town'),
!                               'lang_owner'                                    
=> $lang_owner,
!                               'owner_list'                                    
=> $owner_list,
!                               'lang_select_owner'                             
=> $lang_select_owner,
!                               'lang_owner_statustext'                 => 
$lang_owner_statustext,
!                               'additional_fields'                             
=> $additional_fields,
!                               'lang_street'                                   
=> lang('Street'),
!                               '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'],
! 
!                               'lang_tenant'                                   
=> lang('tenant'),
!                               'value_tenant_id'                               
=> $values['tenant_id'],
!                               'value_tenant_last_name'                => 
$values['tenant_last_name'],
!                               'value_tenant_first_name'               => 
$values['tenant_first_name'],
!                               'lang_tenant_statustext'                => 
lang('Select a tenant'),
!                               'size_last_name'                                
=> strlen($values['tenant_last_name']),
!                               'size_first_name'                               
=> strlen($values['tenant_first_name']),
!                               'lookup_type'                                   
=> $lookup_type,
                                'location_data'                                 
=> $location_data,
!                               'done_action'                                   
=> 
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uilocation.index&type_id='
 . $type_id),
!                               'lang_save'                                     
        => lang('save'),
!                               'lang_done'                                     
        => lang('done'),
!                               'lang_done_statustext'                  => 
lang('Back to the list'),
!                               'lang_save_statustext'                  => 
lang('Save the location'),
                                'lang_edit'                                     
=> lang('Edit'),
                                'edit_action'                           => 
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uilocation.edit&location_code='
 . $location_code),
                                'lang_edit_statustext'          => lang('Edit 
this entry equipment'),
+                               'lang_category'                                 
=> lang('category'),
+                               'lang_no_cat'                                   
=> lang('no category'),
+                               'lang_cat_statustext'                   => 
lang('Select the category the location belongs to. To do not use a category 
select NO CATEGORY'),
+                               'select_name'                                   
=> 'cat_id',
+                               'cat_list'                                      
        => $this->bo->select_category_list('select',$values['cat_id'],$type_id)
                        );
  
                        $appname                                                
= lang('location');
  
                        $GLOBALS['phpgw_info']['flags']['app_header'] = 
lang($this->currentapp) . ' - ' . $appname . ': ' . $function_msg;





reply via email to

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