phpgroupware-cvs
[Top][All Lists]
Advanced

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

[Phpgroupware-cvs] CVS: property/inc class.uimeter.inc.php,1.12,1.13 cla


From: Sigurd Nes <address@hidden>
Subject: [Phpgroupware-cvs] CVS: property/inc class.uimeter.inc.php,1.12,1.13 class.sorequest.inc.php,1.13,1.14 class.soproject.inc.php,1.22,1.23 class.someter.inc.php,1.3,1.4 class.soinvestment.inc.php,1.13,1.14 class.soequipment.inc.php,1.19,1.20 class.soadmin_location.inc.php,1.10,1.11 class.bometer.inc.php,1.3,1.4 class.boinvestment.inc.php,1.10,1.11
Date: Tue, 24 Jun 2003 09:07:43 -0400

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

Modified Files:
        class.uimeter.inc.php class.sorequest.inc.php 
        class.soproject.inc.php class.someter.inc.php 
        class.soinvestment.inc.php class.soequipment.inc.php 
        class.soadmin_location.inc.php class.bometer.inc.php 
        class.boinvestment.inc.php 
Log Message:
no message

Index: class.uimeter.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/property/inc/class.uimeter.inc.php,v
retrieving revision 1.12
retrieving revision 1.13
diff -C2 -r1.12 -r1.13
*** class.uimeter.inc.php       24 Jun 2003 10:26:40 -0000      1.12
--- class.uimeter.inc.php       24 Jun 2003 13:07:40 -0000      1.13
***************
*** 238,307 ****
                        }
  
- 
- /*                    while (is_array($meter_list) && list(,$meter) = 
each($meter_list))
-                       {
- 
-                               $content[] = array
-                               (
-                                       'meter_id'                              
        => $meter['meter_id'],
-                                       'name'                                  
        => $meter['name'],
-                                       'type'                                  
        => $meter['type'],
-                                       'location_type'                         
=> lang($meter['location_type']),
-                                       'type'                                  
        => $meter['type'],
-                                       'address'                               
        => $meter['address'],
-                                       'entry_date'                            
=> $meter['entry_date'],
-                                       'owner'                                 
        => $meter['owner'],
-                                       'link_view'                             
        => 
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uimeter.view&meter_id='
 . $meter['meter_id']),
-                                       'link_edit'                             
        => 
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uimeter.edit&meter_id='
 . $meter['meter_id']),
-                                       'link_delete'                           
=> 
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uimeter.delete&meter_id='
 . $meter['meter_id']),
-                                       'lang_view_statustext'          => 
lang('view the meter'),
-                                       'lang_edit_statustext'          => 
lang('edit the meter'),
-                                       'lang_delete_statustext'        => 
lang('delete the meter'),
-                                       'text_view'                             
        => lang('view'),
-                                       'text_edit'                             
        => lang('edit'),
-                                       'text_delete'                           
=> lang('delete')
-                               );
-                       }
- 
-                       $table_header[] = array
-                       (
- 
-                               'sort_address'  => 
$this->nextmatchs->show_sort_order(array
-                                                                               
(
-                                                                               
        'sort'  => $this->sort,
-                                                                               
        'var'   =>      'address',
-                                                                               
        'order' =>      $this->order,
-                                                                               
        'extra'         => array('menuaction'   => 
$this->currentapp.'.uimeter.index',
-                                                                               
                                                        'query'         
=>$this->query,
-                                                                               
                                                        'cat_id'        
=>$this->cat_id)
-                                                                               
)),
- 
-                               'lang_address'          => lang('Address'),
-                               'lang_name'                     => lang('Name'),
-                               'lang_location_type'=> lang('Location type'),
-                               'lang_meter_type'       => lang('Meter type'),
-                               'lang_view'                     => lang('view'),
-                               'lang_edit'                     => lang('edit'),
-                               'lang_delete'           => lang('delete'),
-                               'sort_meter_id' => 
$this->nextmatchs->show_sort_order(array
-                                                                               
(
-                                                                               
        'sort'  => $this->sort,
-                                                                               
        'var'   =>      'id',
-                                                                               
        'order' =>      $this->order,
-                                                                               
        'extra'         => array('menuaction'   => 
$this->currentapp.'.uimeter.index',
-                                                                               
                                                        'query'         
=>$this->query,
-                                                                               
                                                        'cat_id'        
=>$this->cat_id)
-                                                                               
)),
-                               'lang_meter_id' => lang('meter id'),
-                               'lang_owner'            => lang('owner')
-                       );
- 
-                       $table_add[] = array
-                       (
-                               'lang_add'                              => 
lang('add'),
-                               'lang_add_statustext'   => lang('add a meter'),
-                               'add_action'                    => 
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uimeter.edit')
-                       );
- */
                        $link_data = array
                        (
--- 238,241 ----
***************
*** 357,375 ****
                        }
  
!                       $meter_id                                       = 
get_var('meter_id',array('POST','GET'));
!                       $values                                         = 
get_var('values',array('POST'));
  
                        $GLOBALS['phpgw']->xslttpl->add_file(array('meter'));
  
!                       if($values)
!                       {
!                               $values = $values + 
$this->bocommon->get_location();
!                       }
  
                        if ($values['save'])
                        {
!                               if($meter_id)
                                {
!                                       $values['meter_id']=$meter_id;
                                        $action='edit';
                                }
--- 291,328 ----
                        }
  
!                       $id                                     = 
get_var('id',array('POST','GET'));
!                       $values                         = 
get_var('values',array('POST'));
! 
! //_debug_array($_POST);
  
                        $GLOBALS['phpgw']->xslttpl->add_file(array('meter'));
  
!                       $insert_record = 
$GLOBALS['phpgw']->session->appsession('insert_record',$this->currentapp);
  
                        if ($values['save'])
                        {
!                               for ($i=0; 
$i<count($insert_record['location']); $i++)
!                               {
!                                       
if($_POST[$insert_record['location'][$i]])
!                                       {
!                                               
$values['location'][$insert_record['location'][$i]]= 
$_POST[$insert_record['location'][$i]];
!                                       }
!                               }
! 
!                               while (is_array($insert_record['extra']) && 
list($key,) = each($insert_record['extra']))
                                {
!                                       if($_POST[$key])
!                                       {
!                                               $values['extra'][$key]  = 
$_POST[$key];
!                                       }
!                               }
! 
!                               $values['street_name']          = 
$_POST['street_name'];
!                               $values['street_number']        = 
$_POST['street_number'];
!                               $values['location_name']        = $_POST['loc' 
. (count($values['location'])).'_name']; // if not address - get the parent 
name as address
! 
!                               if($id)
!                               {
!                                       $values['meter_id']=$id;
                                        $action='edit';
                                }
***************
*** 383,391 ****
                                        else
                                        {
!                                               $meter_id =     
$values['meter_id'];
                                        }
                                }
  
!                               if(!$values['property_id'])
                                {
                                        
$receipt['error'][]=array('msg'=>lang('Please select a location !'));
--- 336,344 ----
                                        else
                                        {
!                                               $id =   $values['meter_id'];
                                        }
                                }
  
!                               if(!$values['location'])
                                {
                                        
$receipt['error'][]=array('msg'=>lang('Please select a location !'));
***************
*** 402,411 ****
                                {
                                        $receipt = 
$this->bo->save($values,$action);
                                }
                        }
  
!                       if ($meter_id)
                        {
!                               $values = $this->bo->read_single($meter_id);
  //                    _debug_array($meter);
                                $function_msg = lang('edit meter');
--- 355,373 ----
                                {
                                        $receipt = 
$this->bo->save($values,$action);
+                                       $id = $values['meter_id'];
+                               }
+                               else
+                               {
+                                       if($values['location'])
+                                       {
+                                               $location_code=implode("-", 
$values['location']);
+                                               $values['location_data'] = 
$this->bolocation->read_single($location_code,$values['extra']);
+                                       }
                                }
                        }
  
!                       if ($id)
                        {
!                               $values = $this->bo->read_single($id);
  //                    _debug_array($meter);
                                $function_msg = lang('edit meter');
***************
*** 426,449 ****
                        (
                                'menuaction'    => 
$this->currentapp.'.uimeter.edit',
!                               'meter_id'      => $meter_id
                        );
  
!                       
$location_data=$this->bocommon->initiate_ui_location(array(
!                                               'location_type' => 'form',
!                                               'equipment'             => 
false,
!                                               'apartment'             => true,
!                                               'address'               => 
false,
!                                               'equipment_id'  => 
$values['equipment_id'],
!                                               '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'],
!                                               'tenant_id'             => 
$values['tenant_id'],
!                                               'tenant_name'   => 
$values['tenant_name'],
!                                               'contact_phone' => 
$values['contact_phone'],
!                                               'apartment_id'  => 
$values['apartment_id']));
  
  
--- 388,402 ----
                        (
                                'menuaction'    => 
$this->currentapp.'.uimeter.edit',
!                               'id'    => $id
                        );
  
!                       
$location_data=$this->bolocation->initiate_ui_location(array(
!                                               'values'                => 
$values['location_data'],
!                                               'type_id'               => -1, 
// calculated from location_types
!                                               'no_link'               => 
False, // disable lookup links for location type less than type_id
!                                               'tenant'                => 
False,
!                                               'equipment'             => 
False,
!                                               'lookup_type'   => 'form'
!                                               ));
  
  
***************
*** 463,467 ****
                                'lang_save'                                     
        => lang('save'),
                                'lang_done'                                     
        => lang('done'),
!                               'value_meter_id'                                
=> $meter_id,
                                'value_name'                                    
=> $values['name'],
                                'value_remark'                                  
=> $values['remark'],
--- 416,420 ----
                                'lang_save'                                     
        => lang('save'),
                                'lang_done'                                     
        => lang('done'),
!                               'value_meter_id'                                
=> $id,
                                'value_name'                                    
=> $values['name'],
                                'value_remark'                                  
=> $values['remark'],
***************
*** 531,540 ****
                        }
  
!                       $meter_id                                       = 
get_var('meter_id',array('POST','GET'));
  
                        $GLOBALS['phpgw']->xslttpl->add_file(array('meter'));
  
  
!                       $values = $this->bo->read_single($meter_id);
                        $function_msg = lang('View meter');
  
--- 484,493 ----
                        }
  
!                       $id                                     = 
get_var('id',array('POST','GET'));
  
                        $GLOBALS['phpgw']->xslttpl->add_file(array('meter'));
  
  
!                       $values = $this->bo->read_single($id);
                        $function_msg = lang('View meter');
  
***************
*** 547,572 ****
                        (
                                'menuaction'    => 
$this->currentapp.'.uimeter.edit',
!                               'meter_id'      => $meter_id
                        );
  
!                       
$location_data=$this->bocommon->initiate_ui_location(array(
!                                               'location_type' => 'view',
!                                               'equipment'             => 
false,
!                                               'apartment'             => true,
!                                               'address'               => 
false,
!                                               'equipment_id'  => 
$values['equipment_id'],
!                                               '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'],
!                                               'tenant_id'             => 
$values['tenant_id'],
!                                               'tenant_name'   => 
$values['tenant_name'],
!                                               'contact_phone' => 
$values['contact_phone'],
!                                               'apartment_id'  => 
$values['apartment_id']
!                                               )
!                                       );
  
                        $data = array
--- 500,514 ----
                        (
                                'menuaction'    => 
$this->currentapp.'.uimeter.edit',
!                               'id'    => $id
                        );
  
!                       
$location_data=$this->bolocation->initiate_ui_location(array(
!                                               'values'                => 
$values['location_data'],
!                                               'type_id'               => 
count(explode('-',$values['location_data']['location_code'])),
!                                               'no_link'               => 
False, // disable lookup links for location type less than type_id
!                                               'tenant'                => 
False,
!                                               'equipment'             => 
False,
!                                               'lookup_type'   => 'view'
!                                               ));
  
                        $data = array
***************
*** 574,578 ****
                                'location_data'                                 
=> $location_data,
                                'done_action'                                   
=> 
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uimeter.index'),
!                               'edit_action'                                   
=> 
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uimeter.edit&meter_id='
 . $meter_id),
                                'lang_done_statustext'                  => 
lang('Back to the list'),
                                'lang_edit_statustext'                  => 
lang('Edit this meter'),
--- 516,520 ----
                                'location_data'                                 
=> $location_data,
                                'done_action'                                   
=> 
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uimeter.index'),
!                               'edit_action'                                   
=> 
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uimeter.edit&id='
 . $id),
                                'lang_done_statustext'                  => 
lang('Back to the list'),
                                'lang_edit_statustext'                  => 
lang('Edit this meter'),
***************
*** 584,588 ****
                                'lang_category'                                 
=> lang('category'),
                                'lang_access'                                   
=> lang('private'),
!                               'value_meter_id'                                
=> $meter_id,
                                'value_name'                                    
=> $values['name'],
                                'value_remark'                                  
=> $values['remark'],
--- 526,530 ----
                                'lang_category'                                 
=> lang('category'),
                                'lang_access'                                   
=> lang('private'),
!                               'value_meter_id'                                
=> $id,
                                'value_name'                                    
=> $values['name'],
                                'value_remark'                                  
=> $values['remark'],

Index: class.sorequest.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/property/inc/class.sorequest.inc.php,v
retrieving revision 1.13
retrieving revision 1.14
diff -C2 -r1.13 -r1.14
*** class.sorequest.inc.php     23 Jun 2003 12:26:43 -0000      1.13
--- class.sorequest.inc.php     24 Jun 2003 13:07:40 -0000      1.14
***************
*** 432,436 ****
                function add($request)
                {
! /*                    while (is_array($project['location']) && 
list($input_name,$value) = each($project['location']))
                        {
                                if($value)
--- 432,436 ----
                function add($request)
                {
!                       while (is_array($project['location']) && 
list($input_name,$value) = each($project['location']))
                        {
                                if($value)
***************
*** 441,445 ****
                        }
  
! */
                        while (is_array($project['extra']) && 
list($input_name,$value) = each($project['extra']))
                        {
--- 441,445 ----
                        }
  
! 
                        while (is_array($project['extra']) && 
list($input_name,$value) = each($project['extra']))
                        {
***************
*** 568,576 ****
                        }
  
! /*                    while (is_array($request['location']) && 
list($input_name,$value) = each($request['location']))
                        {
                                $vals[] = "$input_name = '$value'";
                        }
! */
                        while (is_array($request['extra']) && 
list($input_name,$value) = each($request['extra']))
                        {
--- 568,576 ----
                        }
  
!                       while (is_array($request['location']) && 
list($input_name,$value) = each($request['location']))
                        {
                                $vals[] = "$input_name = '$value'";
                        }
! 
                        while (is_array($request['extra']) && 
list($input_name,$value) = each($request['extra']))
                        {

Index: class.soproject.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/property/inc/class.soproject.inc.php,v
retrieving revision 1.22
retrieving revision 1.23
diff -C2 -r1.22 -r1.23
*** class.soproject.inc.php     24 Jun 2003 10:26:40 -0000      1.22
--- class.soproject.inc.php     24 Jun 2003 13:07:40 -0000      1.23
***************
*** 368,372 ****
                {
  
! /*                    while (is_array($project['location']) && 
list($input_name,$value) = each($project['location']))
                        {
                                if($value)
--- 368,372 ----
                {
  
!                       while (is_array($project['location']) && 
list($input_name,$value) = each($project['location']))
                        {
                                if($value)
***************
*** 377,381 ****
                        }
  
! */
                        while (is_array($project['extra']) && 
list($input_name,$value) = each($project['extra']))
                        {
--- 377,381 ----
                        }
  
! 
                        while (is_array($project['extra']) && 
list($input_name,$value) = each($project['extra']))
                        {

Index: class.someter.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/property/inc/class.someter.inc.php,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -r1.3 -r1.4
*** class.someter.inc.php       24 Jun 2003 10:26:40 -0000      1.3
--- class.someter.inc.php       24 Jun 2003 13:07:40 -0000      1.4
***************
*** 187,204 ****
                function add($meter)
                {
-                       $meter['remark'] = 
$this->db->db_addslashes($meter['remark']);
  
!                       if($meter['street_number'])
                        {
!                               $address= $meter['street_name'] . ' ' . 
$meter['street_number'];
                        }
!                       else
                        {
!                               $address= $meter['street_name'];
                        }
  
!                       $this->db->query("INSERT INTO fm_meter (location_code, 
id,owner,entry_date,name,address,type,remark) "
                                . "VALUES ('" . $meter['location_code'] . "','" 
. $meter['meter_id'] . "','" . $this->account . "','" . time() . "','" . 
$meter['name']
!                               . "','" . $address ."','" . $meter['cat_id'] 
."','" . $meter['remark']. "')",__LINE__,__FILE__);
  
                        $receipt['message'][]=array('msg'=>lang('Meter %1 has 
been saved',$meter['meter_id']));
--- 187,224 ----
                function add($meter)
                {
  
!                       while (is_array($meter['location']) && 
list($input_name,$value) = each($meter['location']))
!                       {
!                               if($value)
!                               {
!                                       $cols[] = $input_name;
!                                       $vals[] = $value;
!                               }
!                       }
! 
! 
!                       if($cols)
                        {
!                               $cols   = "," . implode(",", $cols);
!                               $vals   = ",'" . implode("','", $vals) . "'";
                        }
! 
!                       if($meter['street_name'])
                        {
!                               $address[]= $meter['street_name'];
!                               $address[]= $meter['street_number'];
!                               $address        = implode(" ", $address);
                        }
  
!                       if(!$address)
!                       {
!                               $address = $meter['location_name'];
!                       }
! 
!                       $meter['remark'] = 
$this->db->db_addslashes($meter['remark']);
! 
!                       $this->db->query("INSERT INTO fm_meter (location_code, 
id,user_id,entry_date,name,address,type,remark $cols ) "
                                . "VALUES ('" . $meter['location_code'] . "','" 
. $meter['meter_id'] . "','" . $this->account . "','" . time() . "','" . 
$meter['name']
!                               . "','" . $address ."','" . $meter['cat_id'] 
."','" . $meter['remark']. "' $vals )",__LINE__,__FILE__);
  
                        $receipt['message'][]=array('msg'=>lang('Meter %1 has 
been saved',$meter['meter_id']));
***************
*** 208,225 ****
                function edit($meter)
                {
-                       $meter['remark'] = 
$this->db->db_addslashes($meter['remark']);
  
!                       if($meter['street_number'])
                        {
!                               $address= $meter['street_name'] . ' ' . 
$meter['street_number'];
                        }
!                       else
                        {
!                               $address= $meter['street_name'];
                        }
  
                        $this->db->query("UPDATE fm_meter set name='" . 
$meter['name'] . "', entry_date='" . time() . "', type='"
                                                        . $meter['cat_id'] . 
"', location_code='" . $meter['location_code'] . "', address='" . $address . 
"', remark='" . $meter['remark']
!                                                       . "' WHERE id='" . 
$meter['meter_id'] . "'",__LINE__,__FILE__);
  
                        $receipt['message'][]=array('msg'=>lang('Meter %1 has 
been edited',$meter['meter_id']));
--- 228,260 ----
                function edit($meter)
                {
  
!                       while (is_array($meter['location']) && 
list($input_name,$value) = each($meter['location']))
!                       {
!                               $vals[] = "$input_name = '$value'";
!                       }
! 
!                       if($vals)
                        {
!                               $vals   = "," . implode(",",$vals);
                        }
! 
!                       if($meter['street_name'])
                        {
!                               $address[]= $meter['street_name'];
!                               $address[]= $meter['street_number'];
!                               $address        = implode(" ", $address);
                        }
  
+                       if(!$address)
+                       {
+                               $address = $meter['location_name'];
+                       }
+ 
+                       $meter['remark'] = 
$this->db->db_addslashes($meter['remark']);
+ 
+ 
                        $this->db->query("UPDATE fm_meter set name='" . 
$meter['name'] . "', entry_date='" . time() . "', type='"
                                                        . $meter['cat_id'] . 
"', location_code='" . $meter['location_code'] . "', address='" . $address . 
"', remark='" . $meter['remark']
!                                                       . "' $vals WHERE id='" 
. $meter['meter_id'] . "'",__LINE__,__FILE__);
  
                        $receipt['message'][]=array('msg'=>lang('Meter %1 has 
been edited',$meter['meter_id']));

Index: class.soinvestment.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/property/inc/class.soinvestment.inc.php,v
retrieving revision 1.13
retrieving revision 1.14
diff -C2 -r1.13 -r1.14
*** class.soinvestment.inc.php  13 Jun 2003 11:05:30 -0000      1.13
--- class.soinvestment.inc.php  24 Jun 2003 13:07:40 -0000      1.14
***************
*** 18,32 ****
                        $this->grants   = 
$GLOBALS['phpgw']->acl->get_grants($this->currentapp);
                        $this->account  = 
$GLOBALS['phpgw_info']['user']['account_id'];
  
!                       if 
($GLOBALS['phpgw_info']['server']['db_type']=='pgsql')
!                       {
!                               $this->join = " JOIN ";
!                       }
!                       else
!                       {
!                               $this->join = " LEFT JOIN ";
!                       }
! 
! 
                }
  
--- 18,24 ----
                        $this->grants   = 
$GLOBALS['phpgw']->acl->get_grants($this->currentapp);
                        $this->account  = 
$GLOBALS['phpgw_info']['user']['account_id'];
+                       $this->socommon         = 
CreateObject($this->currentapp.'.socommon');
  
!                       $this->join                     = $this->socommon->join;
                }
  
***************
*** 74,78 ****
                        else
                        {
!       //                      $ordermethod = ' order by entity_id DESC';
                        }
  
--- 66,79 ----
                        else
                        {
!                               if ($cat_id=='property')
!                               {
!                                       $ordermethod = ' order by 
fm_part_of_town.name ,fm_location1.loc1 DESC';
!                               }
!                               if ($cat_id=='equipment')
!                               {
!                                       $ordermethod = ' order by 
fm_investment.entity_id  DESC';
!                               }
! 
! 
                        }
  
***************
*** 91,127 ****
                        }
  
!                       if ($cat_id=='property')
                        {
!                               $sql = "SELECT fm_investment.entity_id as 
entity_id, fm_investment.descr as descr, 
fm_investment_value.invest_id,initial_value, fm_property.name, 
fm_part_of_town.district_id, fm_part_of_town.name as part_of_town,"
                                . " fm_investment_value.value, 
fm_investment_value.date, fm_investment_value.this_index, "
                                . " fm_investment_value.index_count"
!                               . " FROM fm_property $this->join "
!                               . " fm_part_of_town ON 
fm_property.part_of_town_id = fm_part_of_town.part_of_town_id $this->join "
!                               . " fm_investment_value ON 
fm_property.property_id = left(fm_investment_value.entity_id,4) $this->join "
!                               . " fm_investment ON 
fm_investment_value.entity_id = fm_investment.entity_id AND "
!                               . " fm_investment_value.invest_id = 
fm_investment.invest_id "
!                               . " WHERE ( current_index = '1'  or (this_index 
= NULL and index_count= '1')) $filtermethod "
!                               . " ORDER BY 
fm_part_of_town.name,fm_property.property_id ";
  
                        }
!                       if ($cat_id=='equipment')
                        {
!                               $sql = "SELECT 
fm_investment.location_code,fm_investment.entity_id, fm_investment.descr as 
descr, fm_investment_value.invest_id,initial_value,"
                                . " fm_investment_value.value, 
fm_investment_value.date, fm_investment_value.this_index,fm_equipment.descr as 
equipment_descr, fm_equipment_type.name as equipment_name, "
                                . " fm_investment_value.index_count "
!                               . " FROM fm_investment $this->join "
!                               . " fm_equipment ON fm_investment.entity_id = 
fm_equipment.equipment_id $this->join "
!                               . " fm_equipment_type ON 
fm_equipment.equipment_type_id = fm_equipment_type.id $this->join "
!                               . " fm_investment_value ON 
fm_investment_value.entity_id = fm_investment.entity_id AND "
!                               . " fm_investment_value.invest_id = 
fm_investment.invest_id "
!                               . " WHERE ( current_index = '1'  or (this_index 
= NULL and index_count= '1')) and (fm_investment.entity_type='equipment') "
!                               . " ORDER BY fm_investment.entity_id ";
! 
! 
! 
  
                        }
  
!                       if($cat_id)
                        {
                                $this->db2->query($sql,__LINE__,__FILE__);
--- 92,126 ----
                        }
  
!                       if ($cat_id=='property'):
                        {
!                               $sql = "SELECT fm_investment.entity_id as 
entity_id, fm_investment.descr as descr, 
fm_investment_value.invest_id,initial_value, fm_location1.loc1_name as name, 
fm_part_of_town.district_id, fm_part_of_town.name as part_of_town,"
                                . " fm_investment_value.value, 
fm_investment_value.date, fm_investment_value.this_index, "
                                . " fm_investment_value.index_count"
!                               . " FROM (((fm_investment $this->join 
fm_investment_value ON ( fm_investment.entity_id = 
fm_investment_value.entity_id) AND "
!                               . " (fm_investment.invest_id = 
fm_investment_value.invest_id )) "
!                               . " $this->join fm_location1 ON 
(fm_investment.loc1 = fm_location1.loc1)) "
!                               . " $this->join fm_part_of_town ON 
(fm_location1.part_of_town_id = fm_part_of_town.part_of_town_id)) "
!                               . " WHERE ( current_index = '1'  or (this_index 
= NULL and index_count= '1'))  AND entity_type ='$cat_id' $filtermethod ";
  
                        }
!                       elseif ($cat_id=='equipment'):
                        {
!                               $sql = "SELECT 
fm_investment.location_code,fm_investment.entity_id, fm_investment.descr as 
descr, fm_investment_value.invest_id,initial_value, 
fm_part_of_town.district_id, fm_part_of_town.name as part_of_town,"
                                . " fm_investment_value.value, 
fm_investment_value.date, fm_investment_value.this_index,fm_equipment.descr as 
equipment_descr, fm_equipment_type.name as equipment_name, "
                                . " fm_investment_value.index_count "
!                               . " FROM (((((fm_investment $this->join "
!                               . " fm_equipment ON (fm_investment.entity_id = 
fm_equipment.equipment_id)) $this->join "
!                               . " fm_equipment_type ON 
(fm_equipment.equipment_type_id = fm_equipment_type.id)) $this->join "
!                               . " fm_investment_value ON 
(fm_investment_value.entity_id = fm_investment.entity_id) AND "
!                               . " (fm_investment_value.invest_id = 
fm_investment.invest_id)) "
!                               . " $this->join fm_location1 ON 
(fm_investment.loc1 = fm_location1.loc1)) "
!                               . " $this->join fm_part_of_town ON 
(fm_location1.part_of_town_id = fm_part_of_town.part_of_town_id)) "
!                               . " WHERE ( current_index = '1'  or (this_index 
= NULL and index_count= '1'))  AND entity_type ='$cat_id' $filtermethod ";
  
                        }
+                       endif;
  
! 
!                       if($sql)
                        {
                                $this->db2->query($sql,__LINE__,__FILE__);
***************
*** 166,188 ****
                                $i++;
                        }
- 
-                       if($investment && $cat_id=='equipment')
-                       {
-                               for ($i=0; $i<count($investment); $i++)
-                               {
- 
-                                       $property_id = 
substr($investment[$i]['location_code'],0,4);
- 
-                                       $this->db->query("select 
fm_part_of_town.name as part_of_town,district_id from fm_property $this->join 
fm_part_of_town on fm_property.part_of_town_id=fm_part_of_town.part_of_town_id 
Where property_id= '$property_id'");
-                                       $this->db->next_record();
-                                       $investment[$i]['district_id'] = 
$this->db->f('district_id');
-                                       $investment[$i]['part_of_town'] = 
$this->db->f('part_of_town');
- 
-                               }
- 
- 
-                       }
- 
- 
  
  //_debug_array($investment);
--- 165,168 ----

Index: class.soequipment.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/property/inc/class.soequipment.inc.php,v
retrieving revision 1.19
retrieving revision 1.20
diff -C2 -r1.19 -r1.20
*** class.soequipment.inc.php   24 Jun 2003 10:26:40 -0000      1.19
--- class.soequipment.inc.php   24 Jun 2003 13:07:40 -0000      1.20
***************
*** 18,30 ****
                        $this->account          = 
$GLOBALS['phpgw_info']['user']['account_id'];
                        $this->bocommon         = 
CreateObject($this->currentapp.'.bocommon');
  
!                       if 
($GLOBALS['phpgw_info']['server']['db_type']=='pgsql')
!                       {
!                               $this->join = " JOIN ";
!                       }
!                       else
!                       {
!                               $this->join = " LEFT JOIN ";
!                       }
                }
  
--- 18,24 ----
                        $this->account          = 
$GLOBALS['phpgw_info']['user']['account_id'];
                        $this->bocommon         = 
CreateObject($this->currentapp.'.bocommon');
+                       $this->socommon         = 
CreateObject($this->currentapp.'.socommon');
  
!                       $this->join                     = $this->socommon->join;
                }
  

Index: class.soadmin_location.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/property/inc/class.soadmin_location.inc.php,v
retrieving revision 1.10
retrieving revision 1.11
diff -C2 -r1.10 -r1.11
*** class.soadmin_location.inc.php      24 Jun 2003 10:26:40 -0000      1.10
--- class.soadmin_location.inc.php      24 Jun 2003 13:07:40 -0000      1.11
***************
*** 229,233 ****
                        $fd['remark'] = array('type' => 'text', 'nullable' => 
True);
  
!                       
$add_columns_in_tables=array('fm_report','fm_equipment','fm_meter','fm_project','fm_tts_tickets','fm_request',fm_document);
  
                        if($this->oProc->CreateTable('fm_location'. 
$standard['id'],array('fd' => $fd,'pk' => $pk,'fk' => $fk,'ix' => 
array('location_code'),'uc' => array())))
--- 229,233 ----
                        $fd['remark'] = array('type' => 'text', 'nullable' => 
True);
  
!                       
$add_columns_in_tables=array('fm_report','fm_equipment','fm_meter','fm_project','fm_tts_tickets','fm_request',fm_document,'fm_investment');
  
                        if($this->oProc->CreateTable('fm_location'. 
$standard['id'],array('fd' => $fd,'pk' => $pk,'fk' => $fk,'ix' => 
array('location_code'),'uc' => array())))

Index: class.bometer.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/property/inc/class.bometer.inc.php,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -r1.3 -r1.4
*** class.bometer.inc.php       24 Jun 2003 10:26:40 -0000      1.3
--- class.bometer.inc.php       24 Jun 2003 13:07:40 -0000      1.4
***************
*** 50,54 ****
                        $this->solocation = 
CreateObject($this->currentapp.'.solocation');
                        $this->bocommon = 
CreateObject($this->currentapp.'.bocommon');
-                       $this->socommon = 
CreateObject($this->currentapp.'.socommon');
  
                        if ($session)
--- 50,53 ----
***************
*** 187,193 ****
                        $meter= $this->so->read_single($meter_id);
  
-                       
$location_data=$this->socommon->read_location_data($meter['location_code']);
  
!                       $meter=$meter + $location_data;
  
  //_debug_array($meter);
--- 186,194 ----
                        $meter= $this->so->read_single($meter_id);
  
  
!                       if($meter['location_code'])
!                       {
!                               $meter['location_data'] 
=$this->solocation->read_single($meter['location_code']);
!                       }
  
  //_debug_array($meter);
***************
*** 203,207 ****
                function save($values,$action='')
                {
!                       $values['location_code'] = 
$this->bocommon->location_code($values['property_id'],$values['building_id'],$values['entrance_id'],$values['apartment_id']);
  
                        if ($action=='edit')
--- 204,216 ----
                function save($values,$action='')
                {
!                       while (is_array($values['location']) && list(,$value) = 
each($values['location']))
!                       {
!                               if($value)
!                               {
!                                       $location[] = $value;
!                               }
!                       }
! 
!                       $values['location_code']=implode("-", $location);
  
                        if ($action=='edit')

Index: class.boinvestment.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/property/inc/class.boinvestment.inc.php,v
retrieving revision 1.10
retrieving revision 1.11
diff -C2 -r1.10 -r1.11
*** class.boinvestment.inc.php  21 Jun 2003 22:32:31 -0000      1.10
--- class.boinvestment.inc.php  24 Jun 2003 13:07:40 -0000      1.11
***************
*** 80,84 ****
                                $this->query = $query;
                        }
!                       if(!empty($filter))
                        {
                                $this->filter = $filter;
--- 80,84 ----
                                $this->query = $query;
                        }
!                       if(isset($filter))
                        {
                                $this->filter = $filter;
***************
*** 92,100 ****
                                $this->order = $order;
                        }
!                       if(!empty($cat_id))
                        {
                                $this->cat_id = $cat_id;
                        }
!                       if(!empty($part_of_town_id))
                        {
                                $this->part_of_town_id = $part_of_town_id;
--- 92,100 ----
                                $this->order = $order;
                        }
!                       if(isset($cat_id))
                        {
                                $this->cat_id = $cat_id;
                        }
!                       if(isset($part_of_town_id))
                        {
                                $this->part_of_town_id = $part_of_town_id;





reply via email to

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