phpgroupware-cvs
[Top][All Lists]
Advanced

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

[Phpgroupware-cvs] [21027] Improvements / fixes and new features for pro


From: Sigurd Nes
Subject: [Phpgroupware-cvs] [21027] Improvements / fixes and new features for property 4686:4746
Date: Sun, 07 Feb 2010 10:47:13 +0000

Revision: 21027
          
http://svn.sv.gnu.org/viewvc/?view=rev&root=phpgroupware&revision=21027
Author:   sigurdne
Date:     2010-02-07 10:47:13 +0000 (Sun, 07 Feb 2010)
Log Message:
-----------
Improvements / fixes and new features for property 4686:4746

Modified Paths:
--------------
    people/sigurdne/modules/property/trunk/inc/class.bocommon.inc.php
    people/sigurdne/modules/property/trunk/inc/class.bomigrate.inc.php
    people/sigurdne/modules/property/trunk/inc/class.botts.inc.php
    people/sigurdne/modules/property/trunk/inc/class.custom_fields.inc.php
    people/sigurdne/modules/property/trunk/inc/class.menu.inc.php
    people/sigurdne/modules/property/trunk/inc/class.soXport.inc.php
    people/sigurdne/modules/property/trunk/inc/class.soactor.inc.php
    people/sigurdne/modules/property/trunk/inc/class.soagreement.inc.php
    people/sigurdne/modules/property/trunk/inc/class.socategory.inc.php
    people/sigurdne/modules/property/trunk/inc/class.socommon.inc.php
    people/sigurdne/modules/property/trunk/inc/class.sodocument.inc.php
    people/sigurdne/modules/property/trunk/inc/class.soentity.inc.php
    people/sigurdne/modules/property/trunk/inc/class.soevent.inc.php
    people/sigurdne/modules/property/trunk/inc/class.sogab.inc.php
    people/sigurdne/modules/property/trunk/inc/class.soinvestment.inc.php
    people/sigurdne/modules/property/trunk/inc/class.soinvoice.inc.php
    people/sigurdne/modules/property/trunk/inc/class.solocation.inc.php
    people/sigurdne/modules/property/trunk/inc/class.sopricebook.inc.php
    people/sigurdne/modules/property/trunk/inc/class.soproject.inc.php
    people/sigurdne/modules/property/trunk/inc/class.soresponsible.inc.php
    people/sigurdne/modules/property/trunk/inc/class.sostandard_3.inc.php
    people/sigurdne/modules/property/trunk/inc/class.sotemplate.inc.php
    people/sigurdne/modules/property/trunk/inc/class.sotenant_claim.inc.php
    people/sigurdne/modules/property/trunk/inc/class.sotts.inc.php
    people/sigurdne/modules/property/trunk/inc/class.soworkorder.inc.php
    people/sigurdne/modules/property/trunk/inc/class.uievent.inc.php
    people/sigurdne/modules/property/trunk/inc/class.uiproject.inc.php
    people/sigurdne/modules/property/trunk/inc/class.uitts.inc.php
    
people/sigurdne/modules/property/trunk/inc/cron/default/export_info_as_files.php
    people/sigurdne/modules/property/trunk/inc/cron/default/import_files.php
    
people/sigurdne/modules/property/trunk/inc/cron/default/import_from_scanner.php
    
people/sigurdne/modules/property/trunk/inc/cron/default/oppdater_antall_leieobjekt.php
    
people/sigurdne/modules/property/trunk/inc/cron/default/oppdater_namssakstatus_pr_leietaker.php
    people/sigurdne/modules/property/trunk/inc/cron/default/organize_drawing.php
    people/sigurdne/modules/property/trunk/inc/cron/default/update_googlemap.php
    people/sigurdne/modules/property/trunk/inc/hook_home.inc.php
    people/sigurdne/modules/property/trunk/setup/phpgw_no.lang
    people/sigurdne/modules/property/trunk/setup/setup.inc.php
    people/sigurdne/modules/property/trunk/setup/tables_current.inc.php
    people/sigurdne/modules/property/trunk/setup/tables_update.inc.php
    people/sigurdne/modules/property/trunk/templates/base/event_form.xsl
    people/sigurdne/modules/property/trunk/templates/base/tts.xsl
    
people/sigurdne/modules/property/trunk/tutorials/property/examples/install.apache.sh

Modified: people/sigurdne/modules/property/trunk/inc/class.bocommon.inc.php
===================================================================
--- people/sigurdne/modules/property/trunk/inc/class.bocommon.inc.php   
2010-02-07 10:45:18 UTC (rev 21026)
+++ people/sigurdne/modules/property/trunk/inc/class.bocommon.inc.php   
2010-02-07 10:47:13 UTC (rev 21027)
@@ -889,6 +889,13 @@
                                'id'                    => 
isset($event['value']) && $event['value'] ? $event['value'] : '')
                        );
 
+                       $event['event_link'] = 
"{menuaction:'property.uievent.edit',"
+                                                                       
."location:'{$data['location']}',"
+                                                                       
."attrib_id:'{$event['name']}'";
+                       $event['event_link'] .= isset($event['item_id']) ? 
",item_id:{$event['item_id']}" : '';         
+                       $event['event_link'] .= isset($event['value']) ? 
",id:{$event['value']}" : '';          
+                       $event['event_link'] .= '}';
+
                        $event['function_name'] = 'lookup_'. $event['name'] 
.'()';
 
                        return $event;
@@ -1504,9 +1511,7 @@
 
                        $socategory = CreateObject('property.socategory');
 
-                       $categories= 
$socategory->select_category_list(array('type'=>$data['type'],
-                                                                               
'type_id'=>(isset($data['type_id'])?$data['type_id']:''),
-                                                                               
'order' =>$data['order']));
+                       $categories= $socategory->get_list($data);
 
                        return 
$this->select_list($data['selected'],$categories);
                }

Modified: people/sigurdne/modules/property/trunk/inc/class.bomigrate.inc.php
===================================================================
--- people/sigurdne/modules/property/trunk/inc/class.bomigrate.inc.php  
2010-02-07 10:45:18 UTC (rev 21026)
+++ people/sigurdne/modules/property/trunk/inc/class.bomigrate.inc.php  
2010-02-07 10:47:13 UTC (rev 21027)
@@ -156,7 +156,7 @@
                function copy_data($table_def = array())
                {
                        $db = $GLOBALS['phpgw']->db;
-                       $db->fetchmode = 'ASSOC';
+
                        foreach ($table_def as $table => $fd)
                        {
                                if($table=='fm_ecobilagoverf' || $table== 
'phpgw_lang')

Modified: people/sigurdne/modules/property/trunk/inc/class.botts.inc.php
===================================================================
--- people/sigurdne/modules/property/trunk/inc/class.botts.inc.php      
2010-02-07 10:45:18 UTC (rev 21026)
+++ people/sigurdne/modules/property/trunk/inc/class.botts.inc.php      
2010-02-07 10:47:13 UTC (rev 21027)
@@ -281,8 +281,9 @@
 
                function read($start_date='',$end_date='', 
$external='',$dry_run = '', $download = '')
                {
-                       $category_name = array();
-                       $account = array();
+                       static $category_name = array();
+                       static $account = array();
+                       static $vendor_cache = array();
                        
                        $interlink      = CreateObject('property.interlink');
                        $start_date     = 
$this->bocommon->date_to_timestamp($start_date);
@@ -296,7 +297,10 @@
                        if(!$external)
                        {
                                $entity = $this->get_origin_entity_type();
-//                             $this->uicols_related = 
$this->so->uicols_related;
+                               $contacts       = 
CreateObject('property.soactor');
+                               $contacts->role='vendor';
+                               $custom                 = 
createObject('property.custom_fields');
+                               $vendor_data['attributes'] = 
$custom->find('property','.vendor', 0, '', 'ASC', 'attrib_sort', true, true);
                        }
                        else
                        {
@@ -383,6 +387,29 @@
                                                        
$ticket['child_date'][$j]['statustext'] = 
$interlink->get_relation_info(array('location' => $entity[$j]['type']), 
$ticket['child_date'][$j]['date_info'][0]['target_id']);
                                        }
                                }
+                               if( $ticket['vendor_id'])
+                               {
+                                       
if(isset($vendor_cache[$ticket['vendor_id']]))
+                                       {
+                                               $ticket['vendor'] = 
$vendor_cache[$ticket['vendor_id']];
+                                       }
+                                       else
+                                       {
+                                               $vendor_data    = 
$contacts->read_single($ticket['vendor_id'],$vendor_data);
+                                               if($vendor_data)
+                                               {
+                                                       
foreach($vendor_data['attributes'] as $attribute)
+                                                       {
+                                                               
if($attribute['name']=='org_name')
+                                                               {
+                                                                       
$vendor_cache[$ticket['vendor_id']]=$attribute['value'];
+                                                                       
$ticket['vendor'] = $attribute['value'];
+                                                                       break;
+                                                               }
+                                                       }
+                                               }
+                                       }
+                               }
                        }
                        }
 

Modified: people/sigurdne/modules/property/trunk/inc/class.custom_fields.inc.php
===================================================================
--- people/sigurdne/modules/property/trunk/inc/class.custom_fields.inc.php      
2010-02-07 10:45:18 UTC (rev 21026)
+++ people/sigurdne/modules/property/trunk/inc/class.custom_fields.inc.php      
2010-02-07 10:47:13 UTC (rev 21027)
@@ -229,16 +229,23 @@
                                                unset($id);
                                                unset($job);
                                        }
+
                                        $insert_record_values[]                 
= $attributes['name'];
-                                       $lookup_link                            
        = $GLOBALS['phpgw']->link('/index.php',array(
-                                               'menuaction'    => 
$this->_appname.'.uievent.edit',
-                                               'location'              => 
$location,
-                                               'attrib_id'             => 
$attributes['id'],
-                                               'item_id'               => 
isset($attributes['item_id']) ? $attributes['item_id'] : '',
-                                               'id'                    => 
isset($attributes['value']) && $attributes['value'] ? $attributes['value'] : 
''));
 
                                        $lookup_functions[$m]['name']   = 
'lookup_'. $attributes['name'] .'()';
-                                       $lookup_functions[$m]['action'] = 
'Window1=window.open('."'" . $lookup_link ."'" 
.',"Search","width=800,height=500,toolbar=no,scrollbars=yes,resizable=yes");';
+
+                                       $lookup_functions[$m]['action'] = "var 
oArgs = {menuaction:'{$this->_appname}.uievent.edit',"
+                                                                       
."location:'{$location}',"
+                                                                       
."attrib_id:'{$attributes['id']}'";
+                                       $lookup_functions[$m]['action'] .=      
isset($attributes['item_id']) && $attributes['item_id'] ? 
",item_id:{$attributes['item_id']}" : '';             
+                                       $lookup_functions[$m]['action'] .=      
isset($attributes['value']) && $attributes['value'] ? 
",id:{$attributes['value']}" : '';                
+                                       $lookup_functions[$m]['action'] .= 
"};\n";
+                                       $lookup_functions[$m]['action'] .= 
"if(document.form.{$attributes['name']}.value)\n";
+                                       $lookup_functions[$m]['action'] .= 
"{\n";
+                                       $lookup_functions[$m]['action'] .= 
"oArgs['id'] = document.form.{$attributes['name']}.value;";
+                                       $lookup_functions[$m]['action'] .= 
"}\n";
+                                       $lookup_functions[$m]['action'] .= "var 
strURL = phpGWLink('index.php', oArgs);\n";
+                                       $lookup_functions[$m]['action'] .= 
'Window1=window.open(strURL,"Search","width=800,height=500,toolbar=no,scrollbars=yes,resizable=yes");';
                                        $m++;
                                }
                                else if (isset($entity['attributes'][$i]) && 
$entity['attributes'][$i]['datatype']!='I' && 
$entity['attributes'][$i]['value'])

Modified: people/sigurdne/modules/property/trunk/inc/class.menu.inc.php
===================================================================
--- people/sigurdne/modules/property/trunk/inc/class.menu.inc.php       
2010-02-07 10:45:18 UTC (rev 21026)
+++ people/sigurdne/modules/property/trunk/inc/class.menu.inc.php       
2010-02-07 10:47:13 UTC (rev 21027)
@@ -394,6 +394,11 @@
                                                'text'  => lang('Request 
condition_type'),
                                                'url'   => 
$GLOBALS['phpgw']->link('/index.php', array('menuaction' => 
'property.uicategory.index', 'type' => 'r_condition_type') )
                                        ),
+                                       'order_dim1'    => array
+                                       (
+                                               'text'  => 
lang('order_dim1'),//translation have to refeflect the (local) meaning
+                                               'url'   => 
$GLOBALS['phpgw']->link('/index.php', array('menuaction' => 
'property.uicategory.index', 'type' => 'order_dim1') )
+                                       ),
                                        'workorder_status'      => array
                                        (
                                                'text'  => lang('Workorders 
status'),

Modified: people/sigurdne/modules/property/trunk/inc/class.soXport.inc.php
===================================================================
--- people/sigurdne/modules/property/trunk/inc/class.soXport.inc.php    
2010-02-07 10:45:18 UTC (rev 21026)
+++ people/sigurdne/modules/property/trunk/inc/class.soXport.inc.php    
2010-02-07 10:47:13 UTC (rev 21027)
@@ -197,9 +197,9 @@
                function check_spbudact_code($id)
                {
 
-                       $this->db->query("select count(*) from fm_b_account 
where id='$id'");
+                       $this->db->query("select count(*) as cnt from 
fm_b_account where id='$id'");
                        $this->db->next_record();
-                       return $this->db->f(0);
+                       return $this->db->f('cnt');
                }
 
                function add($buffer)

Modified: people/sigurdne/modules/property/trunk/inc/class.soactor.inc.php
===================================================================
--- people/sigurdne/modules/property/trunk/inc/class.soactor.inc.php    
2010-02-07 10:45:18 UTC (rev 21026)
+++ people/sigurdne/modules/property/trunk/inc/class.soactor.inc.php    
2010-02-07 10:47:13 UTC (rev 21027)
@@ -1,57 +1,56 @@
-<?php
-       /**
-       * phpGroupWare - property: a Facilities Management System.
-       *
-       * @author Sigurd Nes <address@hidden>
-       * @copyright Copyright (C) 2003,2004,2005,2006,2007 Free Software 
Foundation, Inc. http://www.fsf.org/
-       * This file is part of phpGroupWare.
-       *
-       * phpGroupWare is free software; you can redistribute it and/or modify
-       * it under the terms of the GNU General Public License as published by
-       * the Free Software Foundation; either version 2 of the License, or
-       * (at your option) any later version.
-       *
-       * phpGroupWare is distributed in the hope that it will be useful,
-       * but WITHOUT ANY WARRANTY; without even the implied warranty of
-       * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-       * GNU General Public License for more details.
-       *
-       * You should have received a copy of the GNU General Public License
-       * along with phpGroupWare; if not, write to the Free Software
-       * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301 
 USA
-       *
-       * @license http://www.gnu.org/licenses/gpl.html GNU General Public 
License
-       * @internal Development of this application was funded by 
http://www.bergen.kommune.no/bbb_/ekstern/
-       * @package property
-       * @subpackage admin
+<?php
+       /**
+       * phpGroupWare - property: a Facilities Management System.
+       *
+       * @author Sigurd Nes <address@hidden>
+       * @copyright Copyright (C) 2003,2004,2005,2006,2007 Free Software 
Foundation, Inc. http://www.fsf.org/
+       * This file is part of phpGroupWare.
+       *
+       * phpGroupWare is free software; you can redistribute it and/or modify
+       * it under the terms of the GNU General Public License as published by
+       * the Free Software Foundation; either version 2 of the License, or
+       * (at your option) any later version.
+       *
+       * phpGroupWare is distributed in the hope that it will be useful,
+       * but WITHOUT ANY WARRANTY; without even the implied warranty of
+       * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+       * GNU General Public License for more details.
+       *
+       * You should have received a copy of the GNU General Public License
+       * along with phpGroupWare; if not, write to the Free Software
+       * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301 
 USA
+       *
+       * @license http://www.gnu.org/licenses/gpl.html GNU General Public 
License
+       * @internal Development of this application was funded by 
http://www.bergen.kommune.no/bbb_/ekstern/
+       * @package property
+       * @subpackage admin
        * @version $Id$
-       */
-
-       /**
-        * Description
-        * @package property
-        */
-
-       class property_soactor
-       {
-               var $role;
-
-               function property_soactor()
-               {
-                       $this->account          = 
$GLOBALS['phpgw_info']['user']['account_id'];
-                       $this->bocommon         = 
CreateObject('property.bocommon');
+       */
+
+       /**
+        * Description
+        * @package property
+        */
+
+       class property_soactor
+       {
+               var $role;
+
+               function property_soactor()
+               {
+                       $this->account          = 
$GLOBALS['phpgw_info']['user']['account_id'];
+                       $this->bocommon         = 
CreateObject('property.bocommon');
                        $this->custom           = 
createObject('property.custom_fields');
                        $this->db           = & $GLOBALS['phpgw']->db;
-
                        $this->join                     = & $this->db->join;
                        $this->left_join        = & $this->db->left_join;
                        $this->like                     = & $this->db->like;
-               }
-
-               function read($data)
-               {
-                       if(is_array($data))
-                       {
+               }
+
+               function read($data)
+               {
+                       if(is_array($data))
+                       {
                                $start          = 
isset($data['start'])?$data['start']:0;
                                $filter         = isset($data['filter']) && 
$data['filter'] ?$data['filter']:'none';
                                $query          = 
isset($data['query'])?$data['query']:'';
@@ -61,150 +60,150 @@
                                $allrows        = 
isset($data['allrows'])?$data['allrows']:'';
                                $member_id      = isset($data['member_id']) && 
$data['member_id'] ? $data['member_id']:0;
                                $dry_run        = isset($data['dry_run']) ? 
$data['dry_run'] : '';
-                       }
-
-                       $sql = $this->bocommon->fm_cache('sql_actor_' . 
$this->role);
-
-                       $entity_table = 'fm_' . $this->role;
-                       $category_table = 'fm_' . $this->role . '_category';
-                       $choice_table = 'phpgw_cust_choice';
-                       $attribute_table = 'phpgw_cust_attribute';
-                       $location_id = 
$GLOBALS['phpgw']->locations->get_id('property', ".{$this->role}");
-                       $attribute_filter = " location_id = {$location_id}";
-
-                       if(!$sql)
-                       {
+                       }
+
+                       $sql = $this->bocommon->fm_cache('sql_actor_' . 
$this->role);
+
+                       $entity_table = 'fm_' . $this->role;
+                       $category_table = 'fm_' . $this->role . '_category';
+                       $choice_table = 'phpgw_cust_choice';
+                       $attribute_table = 'phpgw_cust_attribute';
+                       $location_id = 
$GLOBALS['phpgw']->locations->get_id('property', ".{$this->role}");
+                       $attribute_filter = " location_id = {$location_id}";
+
+                       if(!$sql)
+                       {
                                $cols_return = array();
                                $uicols = array();
-                               $cols = $entity_table . 
".*,$category_table.descr as category";
-
-                               $cols_return[]                          = 'id';
-                               $uicols['input_type'][]         = 'text';
-                               $uicols['name'][]                       = 'id';
-                               $uicols['descr'][]                      = 
lang('ID');
-                               $uicols['statustext'][]         = lang('ID');
+                               $cols = $entity_table . 
".*,$category_table.descr as category";
+
+                               $cols_return[]                          = 'id';
+                               $uicols['input_type'][]         = 'text';
+                               $uicols['name'][]                       = 'id';
+                               $uicols['descr'][]                      = 
lang('ID');
+                               $uicols['statustext'][]         = lang('ID');
                                $uicols['datatype'][]           = false;
                                $uicols['attib_id'][]           = false;
-
-                               $cols_return[]                          = 'id';
-                               $uicols['input_type'][]         = 'hidden';
-                               $uicols['name'][]                       = 'id';
-                               $uicols['descr'][]                      = false;
-                               $uicols['statustext'][]         = false;
+
+                               $cols_return[]                          = 'id';
+                               $uicols['input_type'][]         = 'hidden';
+                               $uicols['name'][]                       = 'id';
+                               $uicols['descr'][]                      = false;
+                               $uicols['statustext'][]         = false;
                                $uicols['datatype'][]           = false;
                                $uicols['attib_id'][]           = false;
-
-                               $cols_return[]                          = 
'category';
-                               $uicols['input_type'][]         = 'text';
-                               $uicols['name'][]                       = 
'category';
-                               $uicols['descr'][]                      = 
lang('category');
-                               $uicols['statustext'][]         = 
lang('category');
+
+                               $cols_return[]                          = 
'category';
+                               $uicols['input_type'][]         = 'text';
+                               $uicols['name'][]                       = 
'category';
+                               $uicols['descr'][]                      = 
lang('category');
+                               $uicols['statustext'][]         = 
lang('category');
                                $uicols['datatype'][]           = false;
                                $uicols['attib_id'][]           = false;
-
-                               $cols_return[]                          = 
'entry_date';
-                               $uicols['input_type'][]         = 'text';
-                               $uicols['name'][]                       = 
'entry_date';
-                               $uicols['descr'][]                      = 
lang('entry date');
-                               $uicols['statustext'][]         = lang('entry 
date');
+
+                               $cols_return[]                          = 
'entry_date';
+                               $uicols['input_type'][]         = 'text';
+                               $uicols['name'][]                       = 
'entry_date';
+                               $uicols['descr'][]                      = 
lang('entry date');
+                               $uicols['statustext'][]         = lang('entry 
date');
                                $uicols['datatype'][]           = false;
                                $uicols['attib_id'][]           = false;
-
-                               $paranthesis .='(';
-
-                               $joinmethod .= " $this->join  " . $entity_table 
. "_category ON ( $entity_table" . ".category =" .$entity_table . 
"_category.id))";
-
-                               $from .= " FROM $paranthesis $entity_table ";
-
-                               $sql = "SELECT $cols $from $joinmethod";
-
-                               $this->bocommon->fm_cache('sql_actor_' . 
$this->role,$sql);
-                               $this->bocommon->fm_cache('uicols_actor_' . 
$this->role,$uicols);
-                               $this->bocommon->fm_cache('cols_return_actor_' 
. $this->role,$cols_return);
-
-                       }
-                       else
-                       {
-                               $uicols                                         
        = $this->bocommon->fm_cache('uicols_actor_'. $this->role);
-                               $cols_return                                    
= $this->bocommon->fm_cache('cols_return_actor_' . $this->role);
-                       }
-
-                       
$user_columns=isset($GLOBALS['phpgw_info']['user']['preferences']['property']['actor_columns_'
 . 
$this->role])?$GLOBALS['phpgw_info']['user']['preferences']['property']['actor_columns_'
 . $this->role]:'';
-                       $user_column_filter = '';
-                       if (isset($user_columns) AND is_array($user_columns) 
AND $user_columns[0])
-                       {
-                               $user_column_filter = " OR ($attribute_filter 
AND id IN (" . implode(',',$user_columns) .'))';
-                       }
-
-                       $this->db->query("SELECT * FROM $attribute_table WHERE 
list=1 AND $attribute_filter $user_column_filter ORDER BY attrib_sort ASC");
-
-                       while ($this->db->next_record())
-                       {
-                               $uicols['input_type'][]         = 'text';
-                               $uicols['name'][]                       = 
$this->db->f('column_name');
-                               $uicols['descr'][]                      = 
$this->db->f('input_text');
-                               $uicols['statustext'][]         = 
$this->db->f('statustext');
+
+                               $paranthesis .='(';
+
+                               $joinmethod .= " $this->join  " . $entity_table 
. "_category ON ( $entity_table" . ".category =" .$entity_table . 
"_category.id))";
+
+                               $from .= " FROM $paranthesis $entity_table ";
+
+                               $sql = "SELECT $cols $from $joinmethod";
+
+                               $this->bocommon->fm_cache('sql_actor_' . 
$this->role,$sql);
+                               $this->bocommon->fm_cache('uicols_actor_' . 
$this->role,$uicols);
+                               $this->bocommon->fm_cache('cols_return_actor_' 
. $this->role,$cols_return);
+
+                       }
+                       else
+                       {
+                               $uicols                                         
        = $this->bocommon->fm_cache('uicols_actor_'. $this->role);
+                               $cols_return                                    
= $this->bocommon->fm_cache('cols_return_actor_' . $this->role);
+                       }
+
+                       
$user_columns=isset($GLOBALS['phpgw_info']['user']['preferences']['property']['actor_columns_'
 . 
$this->role])?$GLOBALS['phpgw_info']['user']['preferences']['property']['actor_columns_'
 . $this->role]:'';
+                       $user_column_filter = '';
+                       if (isset($user_columns) AND is_array($user_columns) 
AND $user_columns[0])
+                       {
+                               $user_column_filter = " OR ($attribute_filter 
AND id IN (" . implode(',',$user_columns) .'))';
+                       }
+
+                       $this->db->query("SELECT * FROM $attribute_table WHERE 
list=1 AND $attribute_filter $user_column_filter ORDER BY attrib_sort ASC");
+
+                       while ($this->db->next_record())
+                       {
+                               $uicols['input_type'][]         = 'text';
+                               $uicols['name'][]                       = 
$this->db->f('column_name');
+                               $uicols['descr'][]                      = 
$this->db->f('input_text');
+                               $uicols['statustext'][]         = 
$this->db->f('statustext');
                                $uicols['datatype'][]           = 
$this->db->f('datatype');
                                $uicols['attib_id'][]           = 
$this->db->f('id');
-                       }
-
-                       $this->uicols   = $uicols;
-
-                       if ($order)
-                       {
-                               $ordermethod = " order by $entity_table.$order 
$sort";
-                       }
-                       else
-                       {
-                               $ordermethod = " order by $entity_table.id 
DESC";
-                       }
-
-                       $where= 'WHERE';
-
-                       $grants         = 
$GLOBALS['phpgw']->session->appsession('grants_' . $this->role ,'property');
-
-                       if(!$grants)
-                       {
-                               $this->acl              = & 
$GLOBALS['phpgw']->acl;
-                               $grants = $this->acl->get_grants('property','.' 
. $this->role);
-                               
$GLOBALS['phpgw']->session->appsession('grants_' . 
$this->role,'property',$grants);
-                       }
-
-                       $filtermethod = '';
-                       if (is_array($grants))
-                       {
-                               foreach($grants as $user => $right)
-                               {
-                                       $public_user_list[] = $user;
-                               }
-                               reset($public_user_list);
-                               $filtermethod .= " $where ( 
$entity_table.owner_id IN(" . implode(',',$public_user_list) . "))";
-                               $where= 'AND';
-                       }
-
-                       if ($cat_id)
-                       {
-                               $filtermethod .= " $where 
$entity_table.category='$cat_id' ";
-                               $where= 'AND';
-                       }
-
-                       if ($member_id>0)
-                       {
-                               $filtermethod .= " $where 
$entity_table.member_of $this->like '%,$member_id,%' ";
-                               $where= 'AND';
-                       }
-
-/*                     if ($status)
-                       {
-                               $filtermethod .= " $where 
$entity_table.status='$status' ";
-                               $where= 'AND';
-                       }
-*/
-
-                       $querymethod = '';
-                       $_querymethod = array();
-                       if($query)
-                       {
+                       }
+
+                       $this->uicols   = $uicols;
+
+                       if ($order)
+                       {
+                               $ordermethod = " order by $entity_table.$order 
$sort";
+                       }
+                       else
+                       {
+                               $ordermethod = " order by $entity_table.id 
DESC";
+                       }
+
+                       $where= 'WHERE';
+
+                       $grants         = 
$GLOBALS['phpgw']->session->appsession('grants_' . $this->role ,'property');
+
+                       if(!$grants)
+                       {
+                               $this->acl              = & 
$GLOBALS['phpgw']->acl;
+                               $grants = $this->acl->get_grants('property','.' 
. $this->role);
+                               
$GLOBALS['phpgw']->session->appsession('grants_' . 
$this->role,'property',$grants);
+                       }
+
+                       $filtermethod = '';
+                       if (is_array($grants))
+                       {
+                               foreach($grants as $user => $right)
+                               {
+                                       $public_user_list[] = $user;
+                               }
+                               reset($public_user_list);
+                               $filtermethod .= " $where ( 
$entity_table.owner_id IN(" . implode(',',$public_user_list) . "))";
+                               $where= 'AND';
+                       }
+
+                       if ($cat_id)
+                       {
+                               $filtermethod .= " $where 
$entity_table.category='$cat_id' ";
+                               $where= 'AND';
+                       }
+
+                       if ($member_id>0)
+                       {
+                               $filtermethod .= " $where 
$entity_table.member_of $this->like '%,$member_id,%' ";
+                               $where= 'AND';
+                       }
+
+/*                     if ($status)
+                       {
+                               $filtermethod .= " $where 
$entity_table.status='$status' ";
+                               $where= 'AND';
+                       }
+*/
+
+                       $querymethod = '';
+                       $_querymethod = array();
+                       if($query)
+                       {
                                $query = $this->db->db_addslashes($query);
 
                                if(ctype_digit($query))
@@ -212,282 +211,282 @@
                                        $_querymethod[]= "$entity_table.id =" . 
(int)$query;
                                }
 
-                               $where= 'AND';
-
-                               $this->db->query("SELECT * FROM 
$attribute_table WHERE $attribute_filter AND search='1'");
-
-                               while ($this->db->next_record())
-                               {
-                                       if($this->db->f('datatype')=='V' || 
$this->db->f('datatype')=='email' || $this->db->f('datatype')=='CH'):
-                                       {
-                                               $_querymethod[]= 
"$entity_table." . $this->db->f('column_name') . " $this->like '%$query%'";
-                                       }
-                                       elseif($this->db->f('datatype')=='I'):
-                                       {
-                                               if(ctype_digit($query))
-                                               {
+                               $where= 'AND';
+
+                               $this->db->query("SELECT * FROM 
$attribute_table WHERE $attribute_filter AND search='1'");
+
+                               while ($this->db->next_record())
+                               {
+                                       if($this->db->f('datatype')=='V' || 
$this->db->f('datatype')=='email' || $this->db->f('datatype')=='CH'):
+                                       {
+                                               $_querymethod[]= 
"$entity_table." . $this->db->f('column_name') . " $this->like '%$query%'";
+                                       }
+                                       elseif($this->db->f('datatype')=='I'):
+                                       {
+                                               if(ctype_digit($query))
+                                               {
                                                        $_querymethod[]= 
"$entity_table." . $this->db->f('column_name') . '=' . (int)$query;
-                                               }
-                                       }
-                                       else:
-                                       {
-                                               $_querymethod[]= 
"$entity_table." . $this->db->f('column_name') . " = '$query'";
-                                       }
-                                       endif;
-                               }
-
-                               if (isset($_querymethod) AND 
is_array($_querymethod))
-                               {
-                                       $querymethod = " $where (" . implode (' 
OR ',$_querymethod) . ')';
-                               }
-                       }
-
-                       $sql .= " $filtermethod $querymethod";
-//echo $sql;
+                                               }
+                                       }
+                                       else:
+                                       {
+                                               $_querymethod[]= 
"$entity_table." . $this->db->f('column_name') . " = '$query'";
+                                       }
+                                       endif;
+                               }
+
+                               if (isset($_querymethod) AND 
is_array($_querymethod))
+                               {
+                                       $querymethod = " $where (" . implode (' 
OR ',$_querymethod) . ')';
+                               }
+                       }
+
+                       $sql .= " $filtermethod $querymethod";
+//echo $sql;
                        $values = array();
 
                        if(!$dry_run)
                        {
-                               $this->db->query('SELECT count(*)' . 
substr($sql,strripos($sql,'from')),__LINE__,__FILE__);
+                               $this->db->query('SELECT count(*) as cnt ' . 
substr($sql,strripos($sql,'from')),__LINE__,__FILE__);
                                $this->db->next_record();
-                               $this->total_records = $this->db->f(0);
-                       if(!$allrows)
-                       {
-                               $this->db->limit_query($sql . 
$ordermethod,$start,__LINE__,__FILE__);
-                       }
-                       else
-                       {
-                               $this->db->query($sql . 
$ordermethod,__LINE__,__FILE__);
-                       }
-
+                               $this->total_records = $this->db->f('cnt');
+                               if(!$allrows)
+                               {
+                                       $this->db->limit_query($sql . 
$ordermethod,$start,__LINE__,__FILE__);
+                               }
+                               else
+                               {
+                                       $this->db->query($sql . 
$ordermethod,__LINE__,__FILE__);
+                               }
+
                                $cols_return = $uicols['name'];
-                       $j=0;
+                               $j=0;
 
                                $dataset = array();
-                       while ($this->db->next_record())
-                       {
-                                       foreach($cols_return as $key => $field)
+                               while ($this->db->next_record())
                                {
+                                       foreach($cols_return as $key => $field)
+                                       {
                                                $dataset[$j][$field] = array
                                                (
                                                        'value'         => 
$this->db->f($field),
                                                        'datatype'      => 
$uicols['datatype'][$key],
                                                        'attrib_id'     => 
$uicols['attib_id'][$key]
                                                );
-                               }
-                                       $j++;                           
                                        }
+                                       $j++;                           
+                               }
 
                                $values = 
$this->custom->translate_value($dataset, $location_id);
 
                                return $values;
-                       }
+                       }
                        return $values;
-               }
-
-               function read_single($actor_id, $values = array())
-               {
-                       if(is_array($actor_id))
-                       {
-                               $actor_id = $actor_id['actor_id'];
-                               $bt = debug_backtrace();
-                               echo "<b>wrong call to soactor::" . 
$bt[0]['function'] . "<br/>Called from file: " . $bt[0]['file'] . "<br/> line: 
" . $bt[0]['line'] . '<br/>args: ' . print_r($bt[0]['args'][0],true) . '</b>';
-                               unset($bt);
-                       }
-                       $table = 'fm_' . $this->role;
-
-                       $this->db->query("SELECT * from $table where 
id='$actor_id'");
-
-                       if($this->db->next_record())
-                       {
-                               $values['id']                   = 
(int)$this->db->f('id');
-                               $values['entry_date']           = 
$this->db->f('entry_date');
-                               $values['cat_id']                       = 
$this->db->f('category');
-                               $values['member_of']                    = 
explode(',',$this->db->f('member_of'));
-
-                               if ( isset($values['attributes']) && 
is_array($values['attributes']) )
-                               {
-                                       foreach ( $values['attributes'] as 
&$attr )
-                                       {
-                                               $attr['value']  = 
$this->db->f($attr['column_name']);
-                                       }
-                               }
-                       }
-                       return $values;
-               }
-
-               function add($actor,$values_attribute='')
-               {
-                       $table = 'fm_' . $this->role;
-
-                       if($actor['member_of'])
-                       {
-                               $actor['member_of']=',' . 
implode(',',$actor['member_of']) . ',';
-                       }
-
-                       if(isset($actor['extra']) && is_array($actor['extra']))
-                       {
-                               foreach ($actor['extra'] as $input_name => 
$value)
-                               {
-                                       if(isset($value) && $value)
-                                       {
-                                               $cols[] = $input_name;
-                                               $vals[] = $value;
-                                       }
-                               }
-                       }
-
-                       if (isset($values_attribute) AND 
is_array($values_attribute))
-                       {
-                               foreach($values_attribute as $entry)
-                               {
-                                       if($entry['value'])
-                                       {
-                                               if($entry['datatype']!='AB' && 
$entry['datatype']!='VENDOR' && $entry['datatype']!='user')
-                                               {
-                                                       if($entry['datatype'] 
== 'C' || $entry['datatype'] == 'T' || $entry['datatype'] == 'V' || 
$entry['datatype'] == 'link')
-                                                       {
-                                                               $entry['value'] 
= $this->db->db_addslashes($entry['value']);
-                                                       }
-
-                                                       if($entry['datatype'] 
== 'pwd' && $entry['value'] && $entry['value2'])
-                                                       {
-                                                               
if($entry['value'] == $entry['value2'])
-                                                               {
-                                                                       $cols[] 
= $entry['name'];
-                                                                       $vals[] 
= md5($entry['value']);
-                                                               }
-                                                               else
-                                                               {
-                                                                       
$receipt['error'][]=array('msg'=>lang('Passwords do not match!'));
-                                                               }
-                                                       }
-                                                       else
-                                                       {
-                                                               $cols[] = 
$entry['name'];
-                                                               $vals[] = 
$entry['value'];
-                                                       }
-
-                                                       if($entry['history'] == 
1)
-                                                       {
-                                                               
$history_set[$entry['attrib_id']] = $entry['value'];
-                                                       }
-                                               }
-                                       }
-                               }
-                       }
-
-                       if($this->role == 'vendor')
-                       {
-                               $cols[] = 'member_of';
-                               $vals[] = $actor['member_of'];
-                       }
-
-                       $cols[] = 'owner_id';
-                       $vals[] = $this->account;
-
-                       if($cols)
-                       {
-                               $cols   = "," . implode(",", $cols);
-                               $vals   = "," . 
$this->bocommon->validate_db_insert($vals);
-                       }
-
-                       $this->db->transaction_begin();
-                       if($actor['new_actor_id'])
-                       {
-                               $id = $actor['new_actor_id'];
-                       }
-                       else
-                       {
-                               $id = $this->bocommon->next_id($table);
-                       }
-
-                       $this->db->query("INSERT INTO $table 
(id,entry_date,category $cols) "
-                               . "VALUES ($id,'" . time() . "','" . 
$actor['cat_id'] . "' $vals)");
-
-                       $receipt['actor_id']= 
$id;//$this->db->get_last_insert_id($table,'id');
-
-                       $receipt['message'][] = array('msg'=>lang('actor %1 has 
been saved',$receipt['actor_id']));
-
-                       $this->db->transaction_commit();
-                       return $receipt;
-               }
-
-               function edit($actor,$values_attribute='')
-               {
-//_debug_array($actor);
-//_debug_array($values_attribute);
-                       $table = 'fm_' . $this->role;
-
-                       if($actor['member_of'])
-                       {
-                               $actor['member_of']=',' . 
implode(',',$actor['member_of']) . ',';
-                       }
-
-                       if(isset($actor['extra']) && is_array($actor['extra']))
-                       {
-                               foreach ($actor['extra'] as $column => $value)
-                               {
-                                       $value_set[$column]     = $value;
-                               }
-                       }
-
-                       if (isset($values_attribute) AND 
is_array($values_attribute))
-                       {
-                               foreach($values_attribute as $entry)
-                               {
-                                       if($entry['datatype']!='AB' && 
$entry['datatype']!='VENDOR' && $entry['datatype']!='user')
-                                       {
-                                               if($entry['datatype'] == 'C' || 
$entry['datatype'] == 'T' || $entry['datatype'] == 'V' || $entry['datatype'] == 
'link')
-                                               {
-                                                       $entry['value'] = 
$this->db->db_addslashes($entry['value']);
-                                               }
-                                               if($entry['datatype'] == 'pwd')
-                                               {
-                                                       if($entry['value'] || 
$entry['value2'])
-                                                       {
-                                                               
if($entry['value'] == $entry['value2'])
-                                                               {
-                                                                       
$value_set[$entry['name']]      = md5($entry['value']);
-                                                               }
-                                                               else
-                                                               {
-                                                                       
$receipt['error'][]=array('msg'=>lang('Passwords do not match!'));
-                                                               }
-                                                       }
-                                               }
-                                               else
-                                               {
-                                                       
$value_set[$entry['name']]      = $entry['value'];
-                                               }
-                                       }
-                               }
-                       }
-
-                       $value_set['entry_date']        = time();
-                       $value_set['category']  = $actor['cat_id'];
-
-                       if($this->role == 'vendor')
-                       {
-                               $value_set['member_of'] = $actor['member_of'];
-                       }
-
-                       if($value_set)
-                       {
-                               $value_set      = 
$this->bocommon->validate_db_update($value_set);
-                       }
-
-                       $this->db->query("UPDATE $table set $value_set WHERE 
id=" . intval($actor['actor_id']));
-
-                       $receipt['actor_id']= $actor['actor_id'];
-                       $receipt['message'][] = array('msg'=>lang('actor %1 has 
been edited',$actor['actor_id']));
-                       return $receipt;
-               }
-
-               function delete($actor_id)
-               {
-                       $table = 'fm_' . $this->role;
-                       $this->db->query("DELETE FROM $table WHERE id=" . 
intval($actor_id));
-               }
-       }
-
+               }
+
+               function read_single($actor_id, $values = array())
+               {
+                       if(is_array($actor_id))
+                       {
+                               $actor_id = $actor_id['actor_id'];
+                               $bt = debug_backtrace();
+                               echo "<b>wrong call to soactor::" . 
$bt[0]['function'] . "<br/>Called from file: " . $bt[0]['file'] . "<br/> line: 
" . $bt[0]['line'] . '<br/>args: ' . print_r($bt[0]['args'][0],true) . '</b>';
+                               unset($bt);
+                       }
+                       $table = 'fm_' . $this->role;
+
+                       $this->db->query("SELECT * from $table where 
id='$actor_id'");
+
+                       if($this->db->next_record())
+                       {
+                               $values['id']                   = 
(int)$this->db->f('id');
+                               $values['entry_date']   = 
$this->db->f('entry_date');
+                               $values['cat_id']               = 
$this->db->f('category');
+                               $values['member_of']    = 
explode(',',$this->db->f('member_of'));
+
+                               if ( isset($values['attributes']) && 
is_array($values['attributes']) )
+                               {
+                                       foreach ( $values['attributes'] as 
&$attr )
+                                       {
+                                               $attr['value']  = 
$this->db->f($attr['column_name']);
+                                       }
+                               }
+                       }
+                       return $values;
+               }
+
+               function add($actor,$values_attribute='')
+               {
+                       $table = 'fm_' . $this->role;
+
+                       if($actor['member_of'])
+                       {
+                               $actor['member_of']=',' . 
implode(',',$actor['member_of']) . ',';
+                       }
+
+                       if(isset($actor['extra']) && is_array($actor['extra']))
+                       {
+                               foreach ($actor['extra'] as $input_name => 
$value)
+                               {
+                                       if(isset($value) && $value)
+                                       {
+                                               $cols[] = $input_name;
+                                               $vals[] = $value;
+                                       }
+                               }
+                       }
+
+                       if (isset($values_attribute) AND 
is_array($values_attribute))
+                       {
+                               foreach($values_attribute as $entry)
+                               {
+                                       if($entry['value'])
+                                       {
+                                               if($entry['datatype']!='AB' && 
$entry['datatype']!='VENDOR' && $entry['datatype']!='user')
+                                               {
+                                                       if($entry['datatype'] 
== 'C' || $entry['datatype'] == 'T' || $entry['datatype'] == 'V' || 
$entry['datatype'] == 'link')
+                                                       {
+                                                               $entry['value'] 
= $this->db->db_addslashes($entry['value']);
+                                                       }
+
+                                                       if($entry['datatype'] 
== 'pwd' && $entry['value'] && $entry['value2'])
+                                                       {
+                                                               
if($entry['value'] == $entry['value2'])
+                                                               {
+                                                                       $cols[] 
= $entry['name'];
+                                                                       $vals[] 
= md5($entry['value']);
+                                                               }
+                                                               else
+                                                               {
+                                                                       
$receipt['error'][]=array('msg'=>lang('Passwords do not match!'));
+                                                               }
+                                                       }
+                                                       else
+                                                       {
+                                                               $cols[] = 
$entry['name'];
+                                                               $vals[] = 
$entry['value'];
+                                                       }
+
+                                                       if($entry['history'] == 
1)
+                                                       {
+                                                               
$history_set[$entry['attrib_id']] = $entry['value'];
+                                                       }
+                                               }
+                                       }
+                               }
+                       }
+
+                       if($this->role == 'vendor')
+                       {
+                               $cols[] = 'member_of';
+                               $vals[] = $actor['member_of'];
+                       }
+
+                       $cols[] = 'owner_id';
+                       $vals[] = $this->account;
+
+                       if($cols)
+                       {
+                               $cols   = "," . implode(",", $cols);
+                               $vals   = "," . 
$this->bocommon->validate_db_insert($vals);
+                       }
+
+                       $this->db->transaction_begin();
+                       if($actor['new_actor_id'])
+                       {
+                               $id = $actor['new_actor_id'];
+                       }
+                       else
+                       {
+                               $id = $this->bocommon->next_id($table);
+                       }
+
+                       $this->db->query("INSERT INTO $table 
(id,entry_date,category $cols) "
+                               . "VALUES ($id,'" . time() . "','" . 
$actor['cat_id'] . "' $vals)");
+
+                       $receipt['actor_id']= 
$id;//$this->db->get_last_insert_id($table,'id');
+
+                       $receipt['message'][] = array('msg'=>lang('actor %1 has 
been saved',$receipt['actor_id']));
+
+                       $this->db->transaction_commit();
+                       return $receipt;
+               }
+
+               function edit($actor,$values_attribute='')
+               {
+//_debug_array($actor);
+//_debug_array($values_attribute);
+                       $table = 'fm_' . $this->role;
+
+                       if($actor['member_of'])
+                       {
+                               $actor['member_of']=',' . 
implode(',',$actor['member_of']) . ',';
+                       }
+
+                       if(isset($actor['extra']) && is_array($actor['extra']))
+                       {
+                               foreach ($actor['extra'] as $column => $value)
+                               {
+                                       $value_set[$column]     = $value;
+                               }
+                       }
+
+                       if (isset($values_attribute) AND 
is_array($values_attribute))
+                       {
+                               foreach($values_attribute as $entry)
+                               {
+                                       if($entry['datatype']!='AB' && 
$entry['datatype']!='VENDOR' && $entry['datatype']!='user')
+                                       {
+                                               if($entry['datatype'] == 'C' || 
$entry['datatype'] == 'T' || $entry['datatype'] == 'V' || $entry['datatype'] == 
'link')
+                                               {
+                                                       $entry['value'] = 
$this->db->db_addslashes($entry['value']);
+                                               }
+                                               if($entry['datatype'] == 'pwd')
+                                               {
+                                                       if($entry['value'] || 
$entry['value2'])
+                                                       {
+                                                               
if($entry['value'] == $entry['value2'])
+                                                               {
+                                                                       
$value_set[$entry['name']]      = md5($entry['value']);
+                                                               }
+                                                               else
+                                                               {
+                                                                       
$receipt['error'][]=array('msg'=>lang('Passwords do not match!'));
+                                                               }
+                                                       }
+                                               }
+                                               else
+                                               {
+                                                       
$value_set[$entry['name']]      = $entry['value'];
+                                               }
+                                       }
+                               }
+                       }
+
+                       $value_set['entry_date']        = time();
+                       $value_set['category']  = $actor['cat_id'];
+
+                       if($this->role == 'vendor')
+                       {
+                               $value_set['member_of'] = $actor['member_of'];
+                       }
+
+                       if($value_set)
+                       {
+                               $value_set      = 
$this->bocommon->validate_db_update($value_set);
+                       }
+
+                       $this->db->query("UPDATE $table set $value_set WHERE 
id=" . intval($actor['actor_id']));
+
+                       $receipt['actor_id']= $actor['actor_id'];
+                       $receipt['message'][] = array('msg'=>lang('actor %1 has 
been edited',$actor['actor_id']));
+                       return $receipt;
+               }
+
+               function delete($actor_id)
+               {
+                       $table = 'fm_' . $this->role;
+                       $this->db->query("DELETE FROM $table WHERE id=" . 
intval($actor_id));
+               }
+       }
+

Modified: people/sigurdne/modules/property/trunk/inc/class.soagreement.inc.php
===================================================================
--- people/sigurdne/modules/property/trunk/inc/class.soagreement.inc.php        
2010-02-07 10:45:18 UTC (rev 21026)
+++ people/sigurdne/modules/property/trunk/inc/class.soagreement.inc.php        
2010-02-07 10:47:13 UTC (rev 21027)
@@ -42,7 +42,6 @@
                        $this->bocommon         = 
CreateObject('property.bocommon');
                        $this->db           = clone($GLOBALS['phpgw']->db);
                        $this->db2          = clone($this->db);
-
                        $this->join                     = $this->bocommon->join;
                        $this->left_join        = $this->bocommon->left_join;
                        $this->like                     = $this->bocommon->like;

Modified: people/sigurdne/modules/property/trunk/inc/class.socategory.inc.php
===================================================================
--- people/sigurdne/modules/property/trunk/inc/class.socategory.inc.php 
2010-02-07 10:45:18 UTC (rev 21026)
+++ people/sigurdne/modules/property/trunk/inc/class.socategory.inc.php 
2010-02-07 10:47:13 UTC (rev 21027)
@@ -779,6 +779,34 @@
                                        );
                                        break;
 //-------- ID type auto
+                               case 'order_dim1':
+                                       $info = array
+                                       (
+                                               'table'                         
=> 'fm_order_dim1',
+                                               'id'                            
=> array('name' => 'id', 'type' => 'auto'),
+                                               'fields'                        
=> array
+                                               (
+                                                       array
+                                                       (
+                                                               'name' => 'num',
+                                                               'descr' => 
lang('name'),
+                                                               'type' => 
'varchar'
+                                                       ),
+                                                       array
+                                                       (
+                                                               'name' => 
'descr',
+                                                               'descr' => 
lang('descr'),
+                                                               'type' => 
'varchar',
+                                                               'nullable' => 
false
+                                                       ),
+                                               ),
+                                               'edit_msg'                      
=> lang('edit'),
+                                               'add_msg'                       
=> lang('add'),
+                                               'name'                          
=> lang('order_dim1'),
+                                               'acl_location'          => 
'.admin',
+                                               'menu_selection'        => 
'admin::property::order_dim1'
+                                       );
+                                       break;
                                case 'branch':
                                        $info = array
                                        (
@@ -1059,8 +1087,14 @@
                }
 
 
+               //deprecated
                function select_category_list($data)
                {
+                       return $this->get_entity_list($data);
+               }
+
+               function get_list($data)
+               {
                        $values = array();
 
                        $this->get_location_info($data['type'], 
$data['type_id']);
@@ -1069,22 +1103,48 @@
                        {
                                return $values;
                        }
+
                        $order          = isset($data['order']) && 
$data['order'] == 'id' ? 'id' :'descr';
 
-                       $this->_db->query("SELECT id, descr FROM $table ORDER 
BY $order");
+                       foreach ($this->location_info['fields'] as $field)
+                       {
+                               $fields[] = $field['name'];
+                       }
 
+                       // Add extra info to name
+                       if(isset($data['id_in_name']) && $data['id_in_name'])
+                       {
+                               $id_in_name = 'id';     
+                               if (in_array($data['id_in_name'], $fields))
+                               {
+                                       $id_in_name = $data['id_in_name'];
+                               }
+                       }
+
+                       $fields = implode(',', $fields);
+
+                       $this->_db->query("SELECT id, {$fields} FROM {$table} 
ORDER BY {$order}");
+
                        while ($this->_db->next_record())
                        {
+                               $_extra = $this->_db->f($id_in_name);
+                               $id             = $this->_db->f('id');
+                               $name   = $this->_db->f('descr', true);
+                               
+                               if($_extra)
+                               {
+                                       $name = "{$_extra} - {$name}";
+                               }
+
                                $values[] = array
                                (
-                                       'id'    => $this->_db->f('id'),
-                                       'name'  => $this->_db->f('descr', true)
+                                       'id'    => $id,
+                                       'name'  => $name
                                        );
                        }
                        return $values;
                }
 
-
                function add($data,$values_attribute)
                {
                        $receipt = array();

Modified: people/sigurdne/modules/property/trunk/inc/class.socommon.inc.php
===================================================================
--- people/sigurdne/modules/property/trunk/inc/class.socommon.inc.php   
2010-02-07 10:45:18 UTC (rev 21026)
+++ people/sigurdne/modules/property/trunk/inc/class.socommon.inc.php   
2010-02-07 10:47:13 UTC (rev 21027)
@@ -53,12 +53,11 @@
                        if(is_object($GLOBALS['phpgw']->db))
                        {
                                $this->db = & $GLOBALS['phpgw']->db;
-                               //$this->db = CreateObject('phpgwapi.db');
                        }
                        else // for setup
                        {
                                $this->db = CreateObject('phpgwapi.db');
-
+                               $this->db->fetchmode= 'ASSOC';
                                
if(isset($GLOBALS['phpgw_info']['server']['db_name']) && 
$GLOBALS['phpgw_info']['server']['db_name'])
                                {
                                        $this->db->Host = 
$GLOBALS['phpgw_info']['server']['db_host'];
@@ -199,10 +198,10 @@
 
                function check_location($location_code='',$type_id='')
                {
-                       $this->db->query("SELECT count(*) FROM 
fm_location$type_id where location_code='$location_code'");
+                       $this->db->query("SELECT count(*) as cnt FROM 
fm_location$type_id where location_code='$location_code'");
                        $this->db->next_record();
 
-                       if ( $this->db->f(0))
+                       if ( $this->db->f('cnt'))
                        {
                                return true;
                        }

Modified: people/sigurdne/modules/property/trunk/inc/class.sodocument.inc.php
===================================================================
--- people/sigurdne/modules/property/trunk/inc/class.sodocument.inc.php 
2010-02-07 10:45:18 UTC (rev 21026)
+++ people/sigurdne/modules/property/trunk/inc/class.sodocument.inc.php 
2010-02-07 10:47:13 UTC (rev 21027)
@@ -47,7 +47,6 @@
                        $this->cats->app_name           = 'property.document';
                        $this->cats->supress_info       = true;
 
-
                        $this->db               = & $GLOBALS['phpgw']->db;
                        $this->join                             = & 
$this->db->join;
                        $this->like                             = & 
$this->db->like;

Modified: people/sigurdne/modules/property/trunk/inc/class.soentity.inc.php
===================================================================
--- people/sigurdne/modules/property/trunk/inc/class.soentity.inc.php   
2010-02-07 10:45:18 UTC (rev 21026)
+++ people/sigurdne/modules/property/trunk/inc/class.soentity.inc.php   
2010-02-07 10:47:13 UTC (rev 21027)
@@ -49,7 +49,6 @@
                        $this->bocommon         = 
CreateObject('property.bocommon');
                        $this->custom           = 
createObject('property.custom_fields');
                        $this->db           = & $GLOBALS['phpgw']->db;
-
                        $this->join                     = & $this->db->join;
                        $this->left_join        = & $this->db->left_join;
                        $this->like                     = & $this->db->like;
@@ -408,9 +407,9 @@
                        $sql .= " $filtermethod $querymethod";
 
 //_debug_array($sql);
-                       $this->db->query('SELECT count(*)' . 
substr($sql,strripos($sql,'from')),__LINE__,__FILE__);
+                       $this->db->query('SELECT count(*) as cnt ' . 
substr($sql,strripos($sql,'from')),__LINE__,__FILE__);
                        $this->db->next_record();
-                       $this->total_records = $this->db->f(0);
+                       $this->total_records = $this->db->f('cnt');
 
                        if($dry_run)
                        {
@@ -509,11 +508,11 @@
                function check_entity($entity_id,$cat_id,$num)
                {
                        $table = "fm_{$this->type}_{$entity_id}_{$cat_id}";
-                       $this->db->query("SELECT count(*) FROM $table where 
num='$num'");
+                       $this->db->query("SELECT count(*) as cnt FROM $table 
where num='$num'");
 
                        $this->db->next_record();
 
-                       if ( $this->db->f(0))
+                       if ( $this->db->f('cnt'))
                        {
                                return true;
                        }

Modified: people/sigurdne/modules/property/trunk/inc/class.soevent.inc.php
===================================================================
--- people/sigurdne/modules/property/trunk/inc/class.soevent.inc.php    
2010-02-07 10:45:18 UTC (rev 21026)
+++ people/sigurdne/modules/property/trunk/inc/class.soevent.inc.php    
2010-02-07 10:47:13 UTC (rev 21027)
@@ -63,7 +63,7 @@
                                $location_id = (int) $data['location_id'];
                        }
 
-                       $location_item_id       = 
isset($data['location_item_id']) && $data['location_item_id'] ? 
(int)$data['location_item_id'] : '';
+                       $location_item_id       = 
isset($data['location_item_id']) && $data['location_item_id'] ? 
$data['location_item_id'] : '';
                        $start                          = isset($data['start']) 
&& $data['start'] ? $data['start'] : 0;
                        $query                          = isset($data['query']) 
? $data['query'] : '';
                        $sort                           = isset($data['sort']) 
&& $data['sort'] ? $data['sort']:'DESC';
@@ -353,7 +353,7 @@
                        $tz_offset                      = $data['tz_offset'] ? 
$data['tz_offset'] : 0;
                        $owner_id                       = $data['owner_id'] ? 
$data['owner_id'] : 0;
                        $location_id            = (int) $data['location_id'];
-                       $location_item_id       = (int) 
$data['location_item_id'];
+                       $location_item_id       = $data['location_item_id'];
 
                        if(!$startYear || !$startMonth || !$startDay || 
!$location_id || !$location_item_id)
                        {
@@ -415,7 +415,7 @@
                        $eday                           = $data['eday'];
                        $owner_id                       = $data['owner_id'] ? 
$data['owner_id'] : 0;
                        $location_id            = (int) $data['location_id'];
-                       $location_item_id       = (int) 
$data['location_item_id'];
+                       $location_item_id       = $data['location_item_id'];
                        if(!$syear || !$smonth || !$sday || !$eyear || !$emonth 
|| !$eday || !$location_id || !$location_item_id)
                        {
                                throw new 
Exception("property_soevent::list_repeated_events - Missing date info");

Modified: people/sigurdne/modules/property/trunk/inc/class.sogab.inc.php
===================================================================
--- people/sigurdne/modules/property/trunk/inc/class.sogab.inc.php      
2010-02-07 10:45:18 UTC (rev 21026)
+++ people/sigurdne/modules/property/trunk/inc/class.sogab.inc.php      
2010-02-07 10:47:13 UTC (rev 21027)
@@ -404,11 +404,11 @@
 
                function exist_gab_location($gab_id='',$location_code='')
                {
-                       $this->db2->query("SELECT count(*) FROM fm_gab_location 
where gab_id='$gab_id' and location_code='$location_code'");
+                       $this->db2->query("SELECT count(*) as cnt FROM 
fm_gab_location where gab_id='$gab_id' and location_code='$location_code'");
 
                        $this->db2->next_record();
 
-                       if ( $this->db2->f(0))
+                       if ( $this->db2->f('cnt'))
                        {
                                return true;
                        }

Modified: people/sigurdne/modules/property/trunk/inc/class.soinvestment.inc.php
===================================================================
--- people/sigurdne/modules/property/trunk/inc/class.soinvestment.inc.php       
2010-02-07 10:45:18 UTC (rev 21026)
+++ people/sigurdne/modules/property/trunk/inc/class.soinvestment.inc.php       
2010-02-07 10:47:13 UTC (rev 21027)
@@ -34,9 +34,8 @@
 
        class property_soinvestment
        {
-               function property_soinvestment()
+               function __construct()
                {
-               //      $this->currentapp       = 
$GLOBALS['phpgw_info']['flags']['currentapp'];
                        $this->account  = 
$GLOBALS['phpgw_info']['user']['account_id'];
                        $this->db           = & $GLOBALS['phpgw']->db;
                        $this->join                     = & $this->db->join;

Modified: people/sigurdne/modules/property/trunk/inc/class.soinvoice.inc.php
===================================================================
--- people/sigurdne/modules/property/trunk/inc/class.soinvoice.inc.php  
2010-02-07 10:45:18 UTC (rev 21026)
+++ people/sigurdne/modules/property/trunk/inc/class.soinvoice.inc.php  
2010-02-07 10:47:13 UTC (rev 21027)
@@ -555,9 +555,9 @@
                                {
                                        
$budget_account=$values['budget_account'][$n];
 
-                                       $GLOBALS['phpgw']->db->query("select 
count(*) from fm_b_account  where id ='{$budget_account}'");
+                                       $GLOBALS['phpgw']->db->query("select 
count(*) as cnt from fm_b_account  where id ='{$budget_account}'");
                                        $GLOBALS['phpgw']->db->next_record();
-                                       if ($GLOBALS['phpgw']->db->f(0) == 0)
+                                       if ($GLOBALS['phpgw']->db->f('cnt') == 
0)
                                        {
                                                $receipt['error'][] = 
array('msg'=> lang('This account is not valid:'). " ".$budget_account);
                                                $local_error= true;
@@ -576,9 +576,9 @@
                                else
                                {
                                        $dimd=$values['dimd'][$n];
-                                       $GLOBALS['phpgw']->db->query("select 
count(*) from fm_ecodimd where id ='$dimd'");
+                                       $GLOBALS['phpgw']->db->query("select 
count(*) as cnt from fm_ecodimd where id ='$dimd'");
                                        $GLOBALS['phpgw']->db->next_record();
-                                       if ($GLOBALS['phpgw']->db->f(0) == 0)
+                                       if ($GLOBALS['phpgw']->db->f('cnt') == 
0)
                                        {
                                                $receipt['error'][] = 
array('msg'=>lang('This Dim D is not valid:'). " ".$dimd);
                                                $local_error= true;
@@ -758,18 +758,15 @@
 
                function increment_bilagsnr()
                {
-
                        $this->db->query("UPDATE fm_idgenerator set value = 
value + 1 where name = 'Bilagsnummer'");
                        $this->db->query("select value from fm_idgenerator 
where name = 'Bilagsnummer'");
                        $this->db->next_record();
                        $bilagsnr = $this->db->f('value');
                        return $bilagsnr;
-
                }
 
                function next_bilagsnr()
                {
-
                        $this->db->query("select value from fm_idgenerator 
where name = 'Bilagsnummer'");
                        $this->db->next_record();
                        $bilagsnr = $this->db->f('value')+1;
@@ -779,10 +776,9 @@
 
                function check_vendor($vendor_id)
                {
-
-                       $this->db->query("select count(*) from fm_vendor where 
id='$vendor_id'");
+                       $this->db->query("select count(*) as cnt from fm_vendor 
where id='$vendor_id'");
                        $this->db->next_record();
-                       return $this->db->f(0);
+                       return $this->db->f('cnt');
                }
 
 
@@ -1177,11 +1173,11 @@
 
                function check_claim($voucher_id='')
                {
-                       $sql = "SELECT count(*) FROM fm_ecobilag 
$this->left_join fm_workorder on fm_ecobilag.pmwrkord_code = fm_workorder.id "
+                       $sql = "SELECT count(*) as cnt FROM fm_ecobilag 
$this->left_join fm_workorder on fm_ecobilag.pmwrkord_code = fm_workorder.id "
                        . " WHERE bilagsnr='$voucher_id' AND 
fm_workorder.charge_tenant=1 AND fm_workorder.claim_issued IS NULL";
                        $this->db->query($sql,__LINE__,__FILE__);
                        $this->db->next_record();
-                       return $this->db->f(0);
+                       return $this->db->f('cnt');
                }
        }
 

Modified: people/sigurdne/modules/property/trunk/inc/class.solocation.inc.php
===================================================================
--- people/sigurdne/modules/property/trunk/inc/class.solocation.inc.php 
2010-02-07 10:45:18 UTC (rev 21026)
+++ people/sigurdne/modules/property/trunk/inc/class.solocation.inc.php 
2010-02-07 10:47:13 UTC (rev 21027)
@@ -44,7 +44,7 @@
                        $this->soadmin_location = 
CreateObject('property.soadmin_location');
                        if(!$bocommon || !is_object($bocommon))
                        {
-                       $this->bocommon                 = 
CreateObject('property.bocommon');
+                               $this->bocommon                 = 
CreateObject('property.bocommon');
                        }
                        else
                        {
@@ -222,11 +222,11 @@
 
                function check_location($location_code='',$type_id='')
                {
-                       $this->db->query("SELECT count(*) FROM 
fm_location$type_id where location_code='$location_code'");
+                       $this->db->query("SELECT count(*) AS cnt FROM 
fm_location$type_id where location_code='$location_code'");
 
                        $this->db->next_record();
 
-                       if ( $this->db->f(0))
+                       if ( $this->db->f('cnt'))
                        {
                                return true;
                        }
@@ -523,7 +523,7 @@
                                                'datatype'      => 
$this->db->f('datatype'),
                                                'attrib_id'     => 
$this->db->f('id')
                                        );
-                                       
+
                                        //TODO: move alignment to ui
                                        switch ($this->db->f('datatype'))
                                        {
@@ -675,38 +675,38 @@
                        $values = array();
                        if(!$dry_run)
                        {
-                       $this->db->query('SELECT count(*)' . 
substr($sql,strripos($sql,'from')),__LINE__,__FILE__);
-                       $this->db->next_record();
-                       $this->total_records = $this->db->f(0);
+                               $this->db->query('SELECT count(*) AS cnt ' . 
substr($sql,strripos($sql,'from')),__LINE__,__FILE__);
+                               $this->db->next_record();
+                               $this->total_records = $this->db->f('cnt');
 
-                       if(!$allrows)
-                       {
-                               $this->db->limit_query($sql . 
$ordermethod,$start,__LINE__,__FILE__);
-                       }
-                       else
-                       {
-                               $this->db->query($sql . 
$ordermethod,__LINE__,__FILE__);
-                       }
+                               if(!$allrows)
+                               {
+                                       $this->db->limit_query($sql . 
$ordermethod,$start,__LINE__,__FILE__);
+                               }
+                               else
+                               {
+                                       $this->db->query($sql . 
$ordermethod,__LINE__,__FILE__);
+                               }
 
-                       $j=0;
+                               $j=0;
 
-                       $location_count         = $type_id-1;
+                               $location_count         = $type_id-1;
 
                                $cols_return = $uicols['name'];
                                $dataset = array();
-                       while ($this->db->next_record())
-                       {
+                               while ($this->db->next_record())
+                               {
                                        foreach($cols_return as $key => $field)
-                                               {
+                                       {
                                                $dataset[$j][$field] = array
                                                (
                                                        'value'         => 
$this->db->f($field),
                                                        'datatype'      => 
$uicols['datatype'][$key],
                                                        'attrib_id'     => 
isset($uicols['cols_return_extra'][$key]['attrib_id']) ? 
$uicols['cols_return_extra'][$key]['attrib_id']:''
                                                );
+                                       }
+                                       $j++;                           
                                }
-                               $j++;
-                       }
 
                                $values = 
$this->custom->translate_value($dataset, $location_id, $location_count);
                        }
@@ -1408,13 +1408,13 @@
 
                        $table = 'fm_location' . $type_id . '_history';
 
-                       $sql = "SELECT count(*) FROM $table WHERE 
location_code='$location_code'";
+                       $sql = "SELECT count(*) AS cnt FROM $table WHERE 
location_code='$location_code'";
 
                        $this->db->query($sql,__LINE__,__FILE__);
 
                        $this->db->next_record();
 
-                       if($this->db->f('0')>0)
+                       if($this->db->f('cnt')>0)
                        {
                                return true;
                        }
@@ -1468,8 +1468,8 @@
 
                        $attrib[] = array
                        (
-                               'column_name' => 'exp_date',
-                               'input_text' => 'exp date',
+                               'column_name'   => 'exp_date',
+                               'input_text'    => 'exp date',
                                'datatype'              => 'D',
                                'attrib_id'             => 0
                        );
@@ -1483,7 +1483,7 @@
                        while ($this->db->next_record())
                        {
                                foreach($attrib as $key => $field)
-                                       {
+                               {
                                        $dataset[$j][$field['column_name']] = 
array
                                        (
                                                'value'         => 
$this->db->f($field['column_name']),
@@ -1491,7 +1491,7 @@
                                                'attrib_id'     => 
$field['attib_id']
                                        );
                                }
-                               $j++;
+                               $j++;                           
                        }
 
                        $values = $this->custom->translate_value($dataset, 
$location_id);

Modified: people/sigurdne/modules/property/trunk/inc/class.sopricebook.inc.php
===================================================================
--- people/sigurdne/modules/property/trunk/inc/class.sopricebook.inc.php        
2010-02-07 10:45:18 UTC (rev 21026)
+++ people/sigurdne/modules/property/trunk/inc/class.sopricebook.inc.php        
2010-02-07 10:47:13 UTC (rev 21027)
@@ -161,11 +161,11 @@
 
                function check_activity_num($num='',$agreement_group_id='')
                {
-                       $this->db->query("SELECT count(*) FROM fm_activities 
where num='$num' and agreement_group_id ='$agreement_group_id'");
+                       $this->db->query("SELECT count(*) as cnt FROM 
fm_activities where num='$num' and agreement_group_id ='$agreement_group_id'");
 
                        $this->db->next_record();
 
-                       if ( $this->db->f(0))
+                       if ( $this->db->f('cnt'))
                        {
                                return true;
                        }
@@ -173,11 +173,11 @@
 
                function check_agreement_group_num($num='')
                {
-                       $this->db->query("SELECT count(*) FROM 
fm_agreement_group where num='$num'");
+                       $this->db->query("SELECT count(*) as cnt FROM 
fm_agreement_group where num='$num'");
 
                        $this->db->next_record();
 
-                       if ( $this->db->f(0))
+                       if ( $this->db->f('cnt'))
                        {
                                return true;
                        }
@@ -776,11 +776,11 @@
 
                function add_activity_vendor($values)
                {
-                       $this->db->query("SELECT count(*) FROM 
fm_activity_price_index WHERE activity_id='" . $values['activity_id'] . "' and 
agreement_id='" . $values['agreement_id'] . "'",__LINE__,__FILE__);
+                       $this->db->query("SELECT count(*) as cnt FROM 
fm_activity_price_index WHERE activity_id='" . $values['activity_id'] . "' and 
agreement_id='" . $values['agreement_id'] . "'",__LINE__,__FILE__);
 
                        $this->db->next_record();
 
-                       if ( $this->db->f(0))
+                       if ( $this->db->f('cnt'))
                        {
                                $receipt['error'][] = array('msg'=>lang('This 
Vendor is already registered for this activity'));
                        }

Modified: people/sigurdne/modules/property/trunk/inc/class.soproject.inc.php
===================================================================
--- people/sigurdne/modules/property/trunk/inc/class.soproject.inc.php  
2010-02-07 10:45:18 UTC (rev 21026)
+++ people/sigurdne/modules/property/trunk/inc/class.soproject.inc.php  
2010-02-07 10:47:13 UTC (rev 21027)
@@ -55,44 +55,47 @@
                function select_status_list()
                {
                        $this->db->query("SELECT id, descr FROM 
fm_project_status ORDER BY id ");
-
-                       $i = 0;
+                       $status = array();
                        while ($this->db->next_record())
                        {
-                               $status_entries[$i]['id']                       
        = $this->db->f('id');
-                               $status_entries[$i]['name']                     
        = stripslashes($this->db->f('descr'));
-                               $i++;
+                               $status[] = array
+                               (
+                                       'id'    => $this->db->f('id'),
+                                       'name'  => $this->db->f('descr',true)
+                               );
                        }
-                       return $status_entries;
+                       return $status;
                }
 
                function select_branch_list()
                {
                        $this->db->query("SELECT id, descr FROM fm_branch ORDER 
BY id ");
 
-                       $i = 0;
+                       $branch = array();
                        while ($this->db->next_record())
                        {
-                               $branch_entries[$i]['id']                       
        = $this->db->f('id');
-                               $branch_entries[$i]['name']                     
        = stripslashes($this->db->f('descr'));
-                               $i++;
+                               $branch[] = array
+                               ( 
+                                       'id' => $this->db->f('id'),
+                                       'name'  => $this->db->f('descr',true)
+                               );
                        }
-                       return $branch_entries;
+                       return $branch;
                }
 
                function select_key_location_list()
                {
                        $this->db->query("SELECT id, descr FROM fm_key_loc 
ORDER BY descr ");
-
-                       $key_location_entries = '';
-                       $i = 0;
+                       $location = array();
                        while ($this->db->next_record())
                        {
-                               $key_location_entries[$i]['id']                 
        = $this->db->f('id');
-                               $key_location_entries[$i]['name']               
        = stripslashes($this->db->f('descr'));
-                               $i++;
+                               $location[] = array
+                               ( 
+                                       'id' => $this->db->f('id'),
+                                       'name'  => $this->db->f('descr',true)
+                               );
                        }
-                       return $key_location_entries;
+                       return $location;
                }
 
                function read($data)
@@ -802,11 +805,11 @@
                        }
 
 
-                       $this->db->query("SELECT count(*) FROM $meter_table 
where location_code='$location_code' and category=1",__LINE__,__FILE__);
+                       $this->db->query("SELECT count(*) as cnt FROM 
$meter_table where location_code='$location_code' and 
category=1",__LINE__,__FILE__);
 
                        $this->db->next_record();
 
-                       if ( $this->db->f(0))
+                       if ( $this->db->f('cnt'))
                        {
                                $this->db->query("update $meter_table set 
ext_meter_id='$power_meter',address='$address' where 
location_code='$location_code' and category='1'",__LINE__,__FILE__);
                        }
@@ -830,10 +833,10 @@
                {
                        $prefix = 'meter';
                        $pos    = strlen($prefix);
-                       $this->db->query("select max(num) from $meter_table 
where num $this->like ('$prefix%')");
+                       $this->db->query("select max(num) as current from 
$meter_table where num $this->like ('$prefix%')");
                        $this->db->next_record();
 
-                       $max = 
$this->bocommon->add_leading_zero(substr($this->db->f(0),$pos));
+                       $max = 
$this->bocommon->add_leading_zero(substr($this->db->f('current'),$pos));
 
                        $meter_id= $prefix . $max;
                        return $meter_id;

Modified: people/sigurdne/modules/property/trunk/inc/class.soresponsible.inc.php
===================================================================
--- people/sigurdne/modules/property/trunk/inc/class.soresponsible.inc.php      
2010-02-07 10:45:18 UTC (rev 21026)
+++ people/sigurdne/modules/property/trunk/inc/class.soresponsible.inc.php      
2010-02-07 10:47:13 UTC (rev 21027)
@@ -57,7 +57,6 @@
                {
                        $this->account                  =& 
$GLOBALS['phpgw_info']['user']['account_id'];
                        $this->db                               =& 
$GLOBALS['phpgw']->db;
-
                        $this->like                     =& $this->db->like;
                        $this->join                     =& $this->db->join;
                        $this->left_join                =& $this->db->left_join;

Modified: people/sigurdne/modules/property/trunk/inc/class.sostandard_3.inc.php
===================================================================
--- people/sigurdne/modules/property/trunk/inc/class.sostandard_3.inc.php       
2010-02-07 10:45:18 UTC (rev 21026)
+++ people/sigurdne/modules/property/trunk/inc/class.sostandard_3.inc.php       
2010-02-07 10:47:13 UTC (rev 21027)
@@ -39,7 +39,6 @@
                        $this->account          = 
$GLOBALS['phpgw_info']['user']['account_id'];
                        $this->socommon         = 
CreateObject('property.socommon');
                        $this->_db                      = & 
$GLOBALS['phpgw']->db;
-
                        $this->_join            = & $this->_db->join;
                        $this->_like            = & $this->_db->like;
                }

Modified: people/sigurdne/modules/property/trunk/inc/class.sotemplate.inc.php
===================================================================
--- people/sigurdne/modules/property/trunk/inc/class.sotemplate.inc.php 
2010-02-07 10:45:18 UTC (rev 21026)
+++ people/sigurdne/modules/property/trunk/inc/class.sotemplate.inc.php 
2010-02-07 10:47:13 UTC (rev 21027)
@@ -34,16 +34,13 @@
 
        class property_sotemplate
        {
-               function property_sotemplate()
+               function __construct()
                {
-               //      $this->currentapp       = 
$GLOBALS['phpgw_info']['flags']['currentapp'];
                        $this->account          = 
$GLOBALS['phpgw_info']['user']['account_id'];
-                       $this->bocommon         = 
CreateObject('property.bocommon');
                        $this->db           = & $GLOBALS['phpgw']->db;
-
-                       $this->join                     = $this->bocommon->join;
-                       $this->left_join        = $this->bocommon->left_join;
-                       $this->like                     = $this->bocommon->like;
+                       $this->join                     = & $this->db->join;
+                       $this->left_join        = & $this->db->left_join;
+                       $this->like                     = & $this->db->like;
                }
 
                function read($data)
@@ -313,7 +310,7 @@
                                $template_id);
 
 
-                       $values = $this->bocommon->validate_db_insert($values);
+                       $values = $this->db->validate_insert($values);
 
 
                        $this->db->query("INSERT INTO fm_template_hours 
(owner,hours_descr,unit,cost,quantity,billperae,ns3420_id,dim_d,"
@@ -416,7 +413,7 @@
                                'grouping_descr'        => 
$hour['grouping_descr']
                                );
 
-                       $value_set      = 
$this->bocommon->validate_db_update($value_set);
+                       $value_set      = 
$this->db->validate_update($value_set);
 
                        $this->db->query("UPDATE fm_template_hours set 
$value_set WHERE id= '" . $hour['hour_id'] ."'",__LINE__,__FILE__);
 
@@ -456,7 +453,7 @@
                                time()
                                );
 
-                       $values = $this->bocommon->validate_db_insert($values);
+                       $values = $this->db->validate_insert($values);
 
                        $this->db->query("INSERT INTO fm_template 
(owner,name,descr,chapter_id,entry_date) "
                                . " VALUES ($values)",__LINE__,__FILE__);
@@ -483,7 +480,7 @@
                                'chapter_id'    =>$values['chapter_id']
                                );
 
-                       $value_set      = 
$this->bocommon->validate_db_update($value_set);
+                       $value_set      = 
$this->db->validate_update($value_set);
 
                        $this->db->query("UPDATE fm_template set $value_set 
WHERE id='" . $values['template_id'] . "'",__LINE__,__FILE__);
 

Modified: 
people/sigurdne/modules/property/trunk/inc/class.sotenant_claim.inc.php
===================================================================
--- people/sigurdne/modules/property/trunk/inc/class.sotenant_claim.inc.php     
2010-02-07 10:45:18 UTC (rev 21026)
+++ people/sigurdne/modules/property/trunk/inc/class.sotenant_claim.inc.php     
2010-02-07 10:47:13 UTC (rev 21027)
@@ -34,7 +34,7 @@
 
        class property_sotenant_claim
        {
-               function property_sotenant_claim()
+               function __construct()
                {
                        $this->account  = 
$GLOBALS['phpgw_info']['user']['account_id'];
                        $this->db           = & $GLOBALS['phpgw']->db;

Modified: people/sigurdne/modules/property/trunk/inc/class.sotts.inc.php
===================================================================
--- people/sigurdne/modules/property/trunk/inc/class.sotts.inc.php      
2010-02-07 10:45:18 UTC (rev 21026)
+++ people/sigurdne/modules/property/trunk/inc/class.sotts.inc.php      
2010-02-07 10:47:13 UTC (rev 21027)
@@ -46,11 +46,12 @@
 
                function __construct()
                {
-                       $this->account          = 
$GLOBALS['phpgw_info']['user']['account_id'];
+                       $this->account          = 
(int)$GLOBALS['phpgw_info']['user']['account_id'];
                        $this->historylog       = 
CreateObject('property.historylog','tts');
                        $this->db                       = & 
$GLOBALS['phpgw']->db;
                        $this->like             = & $this->db->like;
                        $this->join             = & $this->db->join;
+                       $this->left_join        = & $this->db->left_join;
                        $this->dateformat       = 
$GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat'];
                }
 
@@ -63,20 +64,21 @@
 
                function read($data)
                {
-                               $start                  = isset($data['start']) 
&& $data['start'] ? $data['start']:0;
+                       $start                  = isset($data['start']) && 
$data['start'] ? $data['start']:0;
                        $status_id              = isset($data['status_id']) && 
$data['status_id'] ? $data['status_id']:'O'; //O='Open'
                        $user_id                = isset($data['user_id']) && 
$data['user_id'] ? (int)$data['user_id']: 0;
                        $owner_id               = 
isset($data['owner_id'])?$data['owner_id']:'';
-                               $query                  = 
isset($data['query'])?$data['query']:'';
-                               $sort                   = isset($data['sort']) 
&& $data['sort'] ? $data['sort']:'DESC';
-                               $order                  = 
isset($data['order'])?$data['order']:'';
-                               $cat_id                 = 
isset($data['cat_id']) && $data['cat_id'] ? $data['cat_id']:0;
-                               $district_id    = isset($data['district_id']) 
&& $data['district_id'] ? $data['district_id']:0;
-                               $allrows                = 
isset($data['allrows'])?$data['allrows']:'';
-                               $start_date             = 
isset($data['start_date'])?$data['start_date']:'';
-                               $end_date               = 
isset($data['end_date'])?$data['end_date']:'';
-                               $external               = 
isset($data['external'])?$data['external']:'';
+                       $query                  = 
isset($data['query'])?$data['query']:'';
+                       $sort                   = isset($data['sort']) && 
$data['sort'] ? $data['sort']:'DESC';
+                       $order                  = 
isset($data['order'])?$data['order']:'';
+                       $cat_id                 = isset($data['cat_id']) && 
$data['cat_id'] ? $data['cat_id']:0;
+                       $district_id    = isset($data['district_id']) && 
$data['district_id'] ? $data['district_id']:0;
+                       $allrows                = 
isset($data['allrows'])?$data['allrows']:'';
+                       $start_date             = 
isset($data['start_date'])?$data['start_date']:'';
+                       $end_date               = 
isset($data['end_date'])?$data['end_date']:'';
+                       $external               = 
isset($data['external'])?$data['external']:'';
                        $dry_run                = isset($data['dry_run']) ? 
$data['dry_run'] : '';
+                       $new                    = isset($data['new']) ? 
$data['new'] : '';
 
                        $this->grants   = 
$GLOBALS['phpgw']->session->appsession('grants_ticket','property');
 
@@ -119,10 +121,10 @@
                                $access_location = 
execMethod('property.socommon.get_location_list', PHPGW_ACL_READ);
                                if($access_location)
                                {
-                               $filtermethod = " WHERE fm_tts_tickets.loc1 in 
('" . implode("','", $access_location) . "')";
-                               $where= 'AND';
+                                       $filtermethod = " WHERE 
fm_tts_tickets.loc1 in ('" . implode("','", $access_location) . "')";
+                                       $where= 'AND';
+                               }
                        }
-                       }
 
                        if (is_array($this->grants))
                        {
@@ -144,7 +146,7 @@
 
                        if ($status_id == 'X')
                        {
-                               $filtermethod .= " $where 
fm_tts_tickets.status='X'";
+                               $filtermethod .= " $where ( 
fm_tts_tickets.status='X'";
                                $where = 'AND';
                        }
                        else if($status_id == 'O')
@@ -153,30 +155,32 @@
                                $this->db->query('SELECT * from 
fm_tts_status',__LINE__,__FILE__);
 
                                while ($this->db->next_record())
-                       {
+                               {
                                        if( ! $this->db->f('closed'))
                                        {
                                                $open .= " OR 
fm_tts_tickets.status = 'C" . $this->db->f('id') . "'";
                                        }
                                }
 
-                               $filtermethod .= " $where 
(fm_tts_tickets.status='O'{$open})";
+                               $filtermethod .= " $where ( 
(fm_tts_tickets.status='O'{$open})";
                                $where = 'AND';
                        }
                        else if($status_id == 'all')
                        {
-                               //nothing
+                               $filtermethod .= "{$where} (1=1";//nothing
                        }
                        else if(is_array($status_id) && count($status_id))
                        {
                                $or = '';
-                               $filtermethod .= "{$where} (";
+                               $filtermethod .= "{$where} ((";
                                
                                foreach ($status_id as $value)
                                {
-                                       $value = trim($value,'C');
-                                       $filtermethod .= "{$or} 
fm_tts_tickets.status = '{$value}'";                                    
-                                       $or = ' OR';
+                                       if($value)
+                                       {
+                                               $filtermethod .= "{$or} 
fm_tts_tickets.status = '{$value}'";                                    
+                                               $or = ' OR';
+                                       }
                                }
 
                                $filtermethod .= ')';
@@ -185,10 +189,19 @@
                        }
                        else
                        {
-                               $filtermethod .= " $where 
fm_tts_tickets.status='{$status_id}'";
+                               $filtermethod .= " $where 
(fm_tts_tickets.status='{$status_id}'";
                                $where = 'AND';
                        }
 
+                       if($new)
+                       {
+                               $filtermethod .= " OR fm_tts_views.id IS NULL 
)";
+                       }
+                       else
+                       {
+                               $filtermethod .= ')';
+                       }
+
                        if ($cat_id > 0)
                        {
                                $filtermethod .= " $where cat_id=" . 
(int)$cat_id;
@@ -234,30 +247,45 @@
                                }
                                else
                                {
-                                       $querymethod = " $where (subject 
$this->like '%$query%' OR address $this->like '%$query%' OR 
fm_tts_tickets.location_code $this->like '%$query%' OR fm_tts_tickets.order_id 
= '$query')";
+                                       $querymethod = " $where (subject 
$this->like '%$query%'"
+                                       . " OR address $this->like '%$query%' "
+                                       . " OR fm_location1.loc1_name 
$this->like '%$query%'"
+                                       . " OR fm_tts_tickets.location_code 
$this->like '%$query%'"
+                                       . " OR fm_tts_tickets.order_id =" . 
(int)$query . ')';
                                }
                        }
 
-                       $sql = "SELECT fm_tts_tickets.* ,fm_location1.loc1_name 
FROM fm_tts_tickets"
+                       $sql = "SELECT DISTINCT fm_tts_tickets.* 
,fm_location1.loc1_name, fm_tts_views.id as view FROM fm_tts_tickets"
                        . " $this->join fm_location1 ON 
fm_tts_tickets.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"
                        . " $order_join"
+                       . " LEFT OUTER JOIN fm_tts_views ON fm_tts_tickets.id = 
fm_tts_views.id"
                        . " $filtermethod $querymethod";
 
                        if(!$dry_run)
                        {
-                               $this->db->query('SELECT count(*) as hits ' . 
substr($sql,strripos($sql,'from')),__LINE__,__FILE__);
+/*
+                               $sql2 = "SELECT fm_tts_tickets.* 
,fm_location1.loc1_name, fm_tts_views.id as view FROM fm_tts_tickets"
+                               . " $this->join fm_location1 ON 
fm_tts_tickets.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"
+                               . " $order_join"
+                               . " $filtermethod $querymethod";
+
+                               $sql2 = 'SELECT count(*) as cnt ' . 
substr($sql2,strripos($sql2,'FROM'));
+*/
+                               $sql2 = "SELECT count(*) as cnt FROM ({$sql}) 
as t";
+                               $this->db->query($sql2,__LINE__,__FILE__);
                                $this->db->next_record();
-                               $this->total_records = $this->db->f('hits');
-                               $this->db->fetchmode = 'ASSOC';
-                       if(!$allrows)
-                       {
-                               $this->db->limit_query($sql . 
$ordermethod,$start,__LINE__,__FILE__);
-                       }
-                       else
-                       {
-                               $this->db->query($sql . 
$ordermethod,__LINE__,__FILE__);
-                       }
+                               $this->total_records = $this->db->f('cnt');
+                               unset($sql2);
+                               if(!$allrows)
+                               {
+                                       $this->db->limit_query($sql . 
$ordermethod,$start,__LINE__,__FILE__);
+                               }
+                               else
+                               {
+                                       $this->db->query($sql . 
$ordermethod,__LINE__,__FILE__);
+                               }
 
                        }
 
@@ -282,12 +310,15 @@
                                        'finnish_date'          => 
$this->db->f('finnish_date'),
                                        'finnish_date2'         => 
$this->db->f('finnish_date2'),
                                        'order_id'                      => 
$this->db->f('order_id'),
-                                       'new_ticket'            => ''
+                                       'vendor_id'                     => 
$this->db->f('vendor_id'),
+                                       'actual_cost'           => 
$this->db->f('actual_cost'),
+                                       'estimate'                      => 
$this->db->f('budget'),
+                                       'new_ticket'            => 
$this->db->f('view') ? false : true,
                                );
                        }
-
+/*                     
                        foreach ($tickets as &$ticket)
-                               {
+                       {
                                $this->db->query("SELECT count(*) as hits FROM 
fm_tts_views where id={$ticket['id']}"
                                        . " AND 
account_id='{$this->account}'",__LINE__,__FILE__);
                                $this->db->next_record();
@@ -297,6 +328,7 @@
                                        $ticket['new_ticket'] = true;
                                }
                        }
+*/
                        return $tickets;
                }
 
@@ -361,19 +393,16 @@
                                $ticket['budget']                       = 
$this->db->f('budget');
                                $ticket['actual_cost']          = 
$this->db->f('actual_cost');
                                $ticket['order_cat_id']         = 
$this->db->f('order_cat_id');
+                               $ticket['building_part']        = 
$this->db->f('building_part',true);
+                               $ticket['order_dim1']           = 
$this->db->f('order_dim1');
 
                                $user_id=(int)$this->db->f('user_id');
-                               $this->db->query("SELECT 
account_firstname,account_lastname FROM phpgw_accounts WHERE 
account_id='$user_id' ");
-                               $this->db->next_record();
 
-                               $ticket['user_name']    = 
$this->db->f('account_firstname') . " " .$this->db->f('account_lastname') ;
-                               if ($ticket['assignedto']>0)
+                               $ticket['user_name']    = 
$GLOBALS['phpgw']->accounts->get($user_id)->__toString();
+                               if ($ticket['assignedto'] > 0)
                                {
-                                       $this->db->query("SELECT 
account_firstname,account_lastname FROM phpgw_accounts WHERE account_id='" . 
$ticket['assignedto'] . "'");
-                                       $this->db->next_record();
-                                       $ticket['assignedto_name']      = 
$this->db->f('account_firstname') . " " .$this->db->f('account_lastname') ;
+                                       $ticket['assignedto_name']      = 
$GLOBALS['phpgw']->accounts->get($ticket['assignedto'])->__toString();
                                }
-
                        }
 
                        return $ticket;
@@ -383,11 +412,11 @@
                {
                        // Have they viewed this ticket before ?
                        $id = (int) $id;
-                       $this->db->query("SELECT count(*) FROM fm_tts_views 
where id={$id}"
+                       $this->db->query("SELECT count(*) as cnt FROM 
fm_tts_views where id={$id}"
                                        . " AND account_id='" . 
$GLOBALS['phpgw_info']['user']['account_id'] . "'",__LINE__,__FILE__);
                        $this->db->next_record();
 
-                       if (! $this->db->f(0))
+                       if (! $this->db->f('cnt'))
                        {
                                $this->db->query("INSERT INTO fm_tts_views 
(id,account_id,time) values ({$id},'"
                                        . 
$GLOBALS['phpgw_info']['user']['account_id'] . "','" . 
phpgwapi_datetime::user_localtime() . "')",__LINE__,__FILE__);
@@ -482,7 +511,7 @@
                                                'location2_item_id' => $id,
                                                'account_id'            => 
$this->account
                                        );
-                                       
+
                                        $interlink      = 
CreateObject('property.interlink');
                                        
$interlink->add($interlink_data,$this->db);
                                }
@@ -595,7 +624,6 @@
                        $this->db->query("select * from fm_tts_tickets where 
id='$id'",__LINE__,__FILE__);
                        $this->db->next_record();
 
-
                        $location_code  = $this->db->f('location_code');
                        $oldlocation_code       = $this->db->f('location_code');
                        $oldfinnish_date        = $this->db->f('finnish_date');
@@ -612,7 +640,10 @@
                        $old_contact_id         = $this->db->f('contact_id');
                        $old_actual_cost        = $this->db->f('actual_cost');
                        $old_order_cat_id       = $this->db->f('order_cat_id');
+                       $old_building_part      = 
$this->db->f('building_part',true);
+                       $old_order_dim1         = 
(int)$this->db->f('order_dim1');
 
+       
                        if($oldcat_id ==0){$oldcat_id ='';}
                        if($old_order_cat_id ==0){$old_order_cat_id ='';}
                        if($oldassigned ==0){$oldassigned ='';}
@@ -783,7 +814,22 @@
                                $this->fields_updated = true;
                        }
 
+                       if ((int)$old_order_dim1 != (int)$ticket['order_dim1'])
+                       {
+                               $this->db->query("UPDATE fm_tts_tickets SET 
order_dim1='" . (int)$ticket['order_dim1']
+                                       . "' WHERE id='$id'",__LINE__,__FILE__);
+                               $receipt['message'][]= array('msg' => 
lang('order_dim1 has been updated'));
+                               $this->fields_updated = true;
+                       }
 
+                       if ($old_building_part != $ticket['building_part'])
+                       {
+                               $this->db->query("UPDATE fm_tts_tickets SET 
building_part='" . $ticket['building_part']
+                                       . "' WHERE id='$id'",__LINE__,__FILE__);
+                               $receipt['message'][]= array('msg' => 
lang('building part has been updated'));
+                               $this->fields_updated = true;
+                       }
+
                        if (($old_note != $ticket['note']) && $ticket['note'])
                        {
                                $this->fields_updated = true;

Modified: people/sigurdne/modules/property/trunk/inc/class.soworkorder.inc.php
===================================================================
--- people/sigurdne/modules/property/trunk/inc/class.soworkorder.inc.php        
2010-02-07 10:45:18 UTC (rev 21026)
+++ people/sigurdne/modules/property/trunk/inc/class.soworkorder.inc.php        
2010-02-07 10:47:13 UTC (rev 21027)
@@ -497,7 +497,7 @@
                                $sql2 = 'SELECT count(*) as cnt FROM (SELECT 
fm_workorder.id ' . substr($sql,strripos($sql,'from'))  . ') as cnt';
                                $this->db->query($sql2,__LINE__,__FILE__);
                                $this->db->next_record();
-                               $this->total_records = 
$this->db->f('cnt');//$this->db->f('0');
+                               $this->total_records = $this->db->f('cnt');
                        }
                        else
                        {

Modified: people/sigurdne/modules/property/trunk/inc/class.uievent.inc.php
===================================================================
--- people/sigurdne/modules/property/trunk/inc/class.uievent.inc.php    
2010-02-07 10:45:18 UTC (rev 21026)
+++ people/sigurdne/modules/property/trunk/inc/class.uievent.inc.php    
2010-02-07 10:47:13 UTC (rev 21027)
@@ -424,7 +424,7 @@
 
                        $location       = phpgw::get_var('location');
                        $attrib_id      = phpgw::get_var('attrib_id');
-                       $item_id        = phpgw::get_var('item_id', 'int');
+                       $item_id        = phpgw::get_var('item_id');//might be 
bigint
                        $id                     = phpgw::get_var('id', 'int');
                        $values         = phpgw::get_var('values');
 
@@ -548,15 +548,11 @@
                        phpgwapi_yui::tabview_setup('general_edit_tabview');
                        $tabs['general']        = array('label' => 
lang('general'), 'link' => '#general');
                        $tabs['repeat']         = array('label' => 
lang('repeat'), 'link' => '#repeat');
-                       $schedule = array();
-
                        if ($id)
                        {
                                $tabs['plan']           = array('label' => 
lang('plan'), 'link' => '#plan');
-                               $schedule = $this->schedule2($id);
                        }
 
-
                        $jscal = CreateObject('phpgwapi.jscalendar');
                        $jscal->add_listener('values_start_date');
                        $jscal->add_listener('values_end_date');
@@ -620,9 +616,22 @@
 
                                'textareacols'                                  
=> 
isset($GLOBALS['phpgw_info']['user']['preferences']['property']['textareacols'])
 && $GLOBALS['phpgw_info']['user']['preferences']['property']['textareacols'] ? 
$GLOBALS['phpgw_info']['user']['preferences']['property']['textareacols'] : 60,
                                'textarearows'                                  
=> 
isset($GLOBALS['phpgw_info']['user']['preferences']['property']['textarearows'])
 && $GLOBALS['phpgw_info']['user']['preferences']['property']['textarearows'] ? 
$GLOBALS['phpgw_info']['user']['preferences']['property']['textarearows'] : 10,
-                               'tabs'                                          
        => phpgwapi_yui::tabview_generate($tabs, 'general'),
+                               'tabs'                                          
        => $id ? phpgwapi_yui::tabview_generate($tabs, 'general') : '',
                        );
 
+                       $schedule = array();
+
+                       if ($id)
+                       {
+                               $schedule = $this->schedule2($id);
+                       }
+                       else
+                       {
+                               $data['td_count']               = '""';
+                               $data['base_java_url']  = '""';
+                               $data['property_js']    = '""';
+                       }
+
                        $data = array_merge($schedule, $data);
                        $appname        =  lang('event');
 

Modified: people/sigurdne/modules/property/trunk/inc/class.uiproject.inc.php
===================================================================
--- people/sigurdne/modules/property/trunk/inc/class.uiproject.inc.php  
2010-02-07 10:45:18 UTC (rev 21026)
+++ people/sigurdne/modules/property/trunk/inc/class.uiproject.inc.php  
2010-02-07 10:47:13 UTC (rev 21027)
@@ -565,7 +565,7 @@
                                //                      
$datatable['rowactions']['action'][] = array('link'=>'dummy');
                                        }
 
-                                               if (isset($project_entry) && 
$this->acl_add && 
$this->bocommon->check_perms($project_entry['grants'],PHPGW_ACL_ADD))
+                                               if($this->acl_add)
                                                {
                                                        
$datatable['rowactions']['action'][] = array(
                                                                                
                'my_name'                       => 'add',
@@ -753,7 +753,6 @@
                                                
phpgwapi_cache::session_set('property', 'project_index_json',$json);
                                                
phpgwapi_cache::session_set('property', 'project_index_json_get', 1);
                                }
-
                        return $json;
                        }
 //-------------------- JSON CODE ----------------------

Modified: people/sigurdne/modules/property/trunk/inc/class.uitts.inc.php
===================================================================
--- people/sigurdne/modules/property/trunk/inc/class.uitts.inc.php      
2010-02-07 10:45:18 UTC (rev 21026)
+++ people/sigurdne/modules/property/trunk/inc/class.uitts.inc.php      
2010-02-07 10:47:13 UTC (rev 21027)
@@ -627,6 +627,9 @@
                        if( $this->acl->check('.ticket.order', PHPGW_ACL_READ, 
'property') )
                        {
                                $uicols['name'][$i++] = 'order_id';
+                               $uicols['name'][$i++] = 'vendor';
+                               $uicols['name'][$i++] = 'estimate';
+                               $uicols['name'][$i++] = 'actual_cost';
                        }
 
                        foreach($uicols_related as $related)
@@ -2085,143 +2088,139 @@
                                // approval                                     
                        }
 
-
-                       if(isset($values['send_order']) && 
$values['send_order'])
+                       if(isset($values['vendor_email']) && 
$values['vendor_email'])
                        {
+                               $subject = lang(workorder).": 
{$ticket['order_id']}";
 
+                               $organisation = '';
+                               $contact_name = '';
+                               $contact_email = '';
+                               $contact_phone = '';
 
-                               if(isset($values['vendor_email']) && 
$values['vendor_email'])
+                               
if(isset($this->bo->config->config_data['org_name']))
                                {
-                                       $subject = lang(workorder).": 
{$ticket['order_id']}";
+                                       $organisation = 
$this->bo->config->config_data['org_name'];
+                               }
 
-                                       $organisation = '';
-                                       $contact_name = '';
-                                       $contact_email = '';
-                                       $contact_phone = '';
+                               $user_name = 
$GLOBALS['phpgw_info']['user']['fullname'];
+                               $ressursnr = 
$GLOBALS['phpgw_info']['user']['preferences']['property']['ressursnr'];
+                               $location = lang('Address'). ": 
{$ticket['address']}<br>";
 
-                                       
if(isset($this->bo->config->config_data['org_name']))
-                                       {
-                                               $organisation = 
$this->bo->config->config_data['org_name'];
-                                       }
+                               $address_element = 
$this->bo->get_address_element($ticket['location_code']);
 
-                                       $user_name = 
$GLOBALS['phpgw_info']['user']['fullname'];
-                                       $ressursnr = 
$GLOBALS['phpgw_info']['user']['preferences']['property']['ressursnr'];
-                                       $location = lang('Address'). ": 
{$ticket['address']}<br>";
+                               foreach($address_element as $address_entry)
+                               {
+                                       $location .= "{$address_entry['text']}: 
{$address_entry['value']} <br>";
+                               }
 
-                                       $address_element = 
$this->bo->get_address_element($ticket['location_code']);
+                               $location = rtrim($location, '<br>');
 
-                                       foreach($address_element as 
$address_entry)
-                                       {
-                                               $location .= 
"{$address_entry['text']}: {$address_entry['value']} <br>";
-                                       }
+                               $order_description = $ticket['order_descr'];
 
-                                       $location = rtrim($location, '<br>');
+                               if(isset($contact_data['value_contact_name']) 
&& $contact_data['value_contact_name'])
+                               {
+                                       $contact_name = 
$contact_data['value_contact_name'];
+                               }
+                               if(isset($contact_data['value_contact_email']) 
&& $contact_data['value_contact_email'])
+                               {
+                                       $contact_email = "<a 
href='mailto:{$contact_data['value_contact_email']}'>{$contact_data['value_contact_email']}</a>";
+                               }
+                               if(isset($contact_data['value_contact_tel']) && 
$contact_data['value_contact_tel'])
+                               {
+                                       $contact_phone = 
$contact_data['value_contact_tel'];
+                               }
 
-                                       $order_description = 
$ticket['order_descr'];
+                               $order_id = $ticket['order_id'];
 
-                                       
if(isset($contact_data['value_contact_name']) && 
$contact_data['value_contact_name'])
-                                       {
-                                               $contact_name = 
$contact_data['value_contact_name'];
-                                       }
-                                       
if(isset($contact_data['value_contact_email']) && 
$contact_data['value_contact_email'])
-                                       {
-                                               $contact_email = "<a 
href='mailto:{$contact_data['value_contact_email']}'>{$contact_data['value_contact_email']}</a>";
-                                       }
-                                       
if(isset($contact_data['value_contact_tel']) && 
$contact_data['value_contact_tel'])
-                                       {
-                                               $contact_phone = 
$contact_data['value_contact_tel'];
-                                       }
+                               $user_phone = 
$GLOBALS['phpgw_info']['user']['preferences']['property']['cellphone'];
+                               $user_email = 
$GLOBALS['phpgw_info']['user']['preferences']['property']['email'];
+                               $order_email_template = 
$GLOBALS['phpgw_info']['user']['preferences']['property']['order_email_template'];
 
-                                       $order_id = $ticket['order_id'];
+                               $body = nl2br(str_replace(array
+                                                       (
+                                                               
'__organisation__',
+                                                               '__user_name__',
+                                                               
'__user_phone__',
+                                                               
'__user_email__',
+                                                               '__ressursnr__',
+                                                               '__location__',
+                                                               
'__order_description__',
+                                                               
'__contact_name__',
+                                                               
'__contact_email__',
+                                                               
'__contact_phone__',
+                                                               '__order_id__',
+                                                               '[b]',
+                                                               '[/b]'
+                                                       ),array
+                                                       (
+                                                               $organisation,
+                                                               $user_name,
+                                                               $user_phone,
+                                                               $user_email,
+                                                               $ressursnr,
+                                                               $location,
+                                                               
$order_description,
+                                                               $contact_name,
+                                                               $contact_email,
+                                                               $contact_phone,
+                                                               $order_id,
+                                                               '<b>',
+                                                               '</b>'
+                                                       
),$order_email_template));
 
-                                       $user_phone = 
$GLOBALS['phpgw_info']['user']['preferences']['property']['cellphone'];
-                                       $user_email = 
$GLOBALS['phpgw_info']['user']['preferences']['property']['email'];
-                                       $order_email_template = 
$GLOBALS['phpgw_info']['user']['preferences']['property']['order_email_template'];
-
-                                       $body = nl2br(str_replace(array
-                                                               (
-                                                                       
'__organisation__',
-                                                                       
'__user_name__',
-                                                                       
'__user_phone__',
-                                                                       
'__user_email__',
-                                                                       
'__ressursnr__',
-                                                                       
'__location__',
-                                                                       
'__order_description__',
-                                                                       
'__contact_name__',
-                                                                       
'__contact_email__',
-                                                                       
'__contact_phone__',
-                                                                       
'__order_id__',
-                                                                       '[b]',
-                                                                       '[/b]'
-                                                               ),array
-                                                               (
-                                                                       
$organisation,
-                                                                       
$user_name,
-                                                                       
$user_phone,
-                                                                       
$user_email,
-                                                                       
$ressursnr,
-                                                                       
$location,
-                                                                       
$order_description,
-                                                                       
$contact_name,
-                                                                       
$contact_email,
-                                                                       
$contact_phone,
-                                                                       
$order_id,
-                                                                       '<b>',
-                                                                       '</b>'
-                                                               
),$order_email_template));
-
-                                       if(isset($values['file_attach']) && 
is_array($values['file_attach']))
+                               if(isset($values['file_attach']) && 
is_array($values['file_attach']))
+                               {
+                                       $bofiles        = 
CreateObject('property.bofiles');
+                                       $attachments = 
$bofiles->get_attachments("/fmticket/{$id}/", $values['file_attach']);
+                                       $attachment_log = ' ' . 
lang('attachments') . ' : ' . implode(', ',$values['file_attach']);
+                               }
+                               if 
(isset($GLOBALS['phpgw_info']['server']['smtp_server']) && 
$GLOBALS['phpgw_info']['server']['smtp_server'])
+                               {
+                                       if (!is_object($GLOBALS['phpgw']->send))
                                        {
-                                               $bofiles        = 
CreateObject('property.bofiles');
-                                               $attachments = 
$bofiles->get_attachments("/fmticket/{$id}/", $values['file_attach']);
-                                               $attachment_log = ' ' . 
lang('attachments') . ' : ' . implode(', ',$values['file_attach']);
+                                               $GLOBALS['phpgw']->send = 
CreateObject('phpgwapi.send');
                                        }
-                                       if 
(isset($GLOBALS['phpgw_info']['server']['smtp_server']) && 
$GLOBALS['phpgw_info']['server']['smtp_server'])
-                                       {
-                                               if 
(!is_object($GLOBALS['phpgw']->send))
-                                               {
-                                                       $GLOBALS['phpgw']->send 
= CreateObject('phpgwapi.send');
-                                               }
 
-                                               $coordinator_name = 
$GLOBALS['phpgw_info']['user']['fullname'];
-                                               $coordinator_email = 
$GLOBALS['phpgw_info']['user']['preferences']['property']['email'];
+                                       $coordinator_name = 
$GLOBALS['phpgw_info']['user']['fullname'];
+                                       $coordinator_email = 
"{$coordinator_name}<{$GLOBALS['phpgw_info']['user']['preferences']['property']['email']}>";
+                                       $bcc = $coordinator_email;
+                                       
if(isset($contact_data['value_contact_email']) && 
$contact_data['value_contact_email'])
+                                       {
+                                               $bcc .= 
";{$contact_data['value_contact_email']}";
+                                       }
 
-                                               $bcc = $coordinator_email;
-                                               
if(isset($contact_data['value_contact_email']) && 
$contact_data['value_contact_email'])
-                                               {
-                                                       $bcc .= 
";{$contact_data['value_contact_email']}";
-                                               }
-
-                                               $rcpt = 
$GLOBALS['phpgw']->send->msg('email', $values['vendor_email'], $subject, 
stripslashes($body), '', $cc, $bcc, $coordinator_email, $coordinator_name, 
'html', '', $attachments , true);
-                                               if($rcpt)
-                                               {
-                                                       
$receipt['message'][]=array('msg'=>lang('%1 is notified',$_address));
-                                                       $historylog     = 
CreateObject('property.historylog','tts');
-                                                       
$historylog->add('M',$id,"{$values['vendor_email']}{$attachment_log}");
-                                                       
$receipt['message'][]=array('msg'=>lang('Workorder is sent by email!'));
-                                                       $action_params = array
-                                                       (
-                                                               'appname'       
                => 'property',
-                                                               'location'      
                => '.ticket',
-                                                               'id'            
                => $id,
-                                                               'responsible'   
        => $values['vendor_id'],
-                                                               
'responsible_type'  => 'vendor',
-                                                               'action'        
                => 'remind',
-                                                               'remark'        
                => '',
-                                                               'deadline'      
                => ''
-                                                       );
-                               
-                                                       $reminds = 
execMethod('property.sopending_action.set_pending_action', $action_params);
-                                               }
-                                       }
-                                       else
+                                       $_to = 
implode(';',$values['vendor_email']);
+                                       
+                                       $rcpt = 
$GLOBALS['phpgw']->send->msg('email', $_to, $subject, stripslashes($body), '', 
$cc, $bcc, $coordinator_email, $coordinator_name, 'html', '', $attachments , 
true);
+                                       if($rcpt)
                                        {
-                                               
$receipt['error'][]=array('msg'=>lang('SMTP server is not set! (admin 
section)'));
-                                       }
-                               }
+                                               
$receipt['message'][]=array('msg'=>lang('%1 is notified',$_address));
+                                               $historylog     = 
CreateObject('property.historylog','tts');
+                                               
$historylog->add('M',$id,"{$_to}{$attachment_log}");
+                                               
$receipt['message'][]=array('msg'=>lang('Workorder is sent by email!'));
+                                               $action_params = array
+                                               (
+                                                       'appname'               
        => 'property',
+                                                       'location'              
        => '.ticket',
+                                                       'id'                    
        => $id,
+                                                       'responsible'           
=> $values['vendor_id'],
+                                                       'responsible_type'  => 
'vendor',
+                                                       'action'                
        => 'remind',
+                                                       'remark'                
        => '',
+                                                       'deadline'              
        => ''
+                                               );
+                       
+                                               $reminds = 
execMethod('property.sopending_action.set_pending_action', $action_params);
+                                       }
+                               }
+                               else
+                               {
+                                       
$receipt['error'][]=array('msg'=>lang('SMTP server is not set! (admin 
section)'));
+                               }
                        }
+
                        // start approval
-                       if ($values['approval'] && $values['mail_address'] && 
$this->bo->config->config_data['workorder_approval'])
+                       if (isset($values['approval']) && $values['approval']  
&& $this->bo->config->config_data['workorder_approval'])
                        {
                                
$coordinator_name=$GLOBALS['phpgw_info']['user']['fullname'];
                                
$coordinator_email=$GLOBALS['phpgw_info']['user']['preferences']['property']['email'];
@@ -2248,19 +2247,16 @@
                                                'deadline'                      
=> ''
                                        );
                                        $bcc = '';//$coordinator_email;
-                                       foreach ($values['mail_address'] as 
$_account_id => $_address)
+                                       foreach ($values['approval'] as 
$_account_id => $_address)
                                        {
-                                               
if(isset($values['approval'][$_account_id]) && 
$values['approval'][$_account_id])
-                                               {
-                                                       
$action_params['responsible'] = $_account_id;
-                                                       $rcpt = 
$GLOBALS['phpgw']->send->msg('email', $_address, $subject, 
stripslashes($message), '', $cc, $bcc, $coordinator_email, $coordinator_name, 
'html');
-                                                       if($rcpt)
-                                                       {
-                                                               
$receipt['message'][]=array('msg'=>lang('%1 is notified',$_address));
-                                                       }
+                                               $action_params['responsible'] = 
$_account_id;
+                                               $rcpt = 
$GLOBALS['phpgw']->send->msg('email', $_address, $subject, 
stripslashes($message), '', $cc, $bcc, $coordinator_email, $coordinator_name, 
'html');
+                                               if($rcpt)
+                                               {
+                                                       
$receipt['message'][]=array('msg'=>lang('%1 is notified',$_address));
+                                               }
 
-                                                        
execMethod('property.sopending_action.set_pending_action', $action_params);
-                                               }
+                                               
execMethod('property.sopending_action.set_pending_action', $action_params);
                                        }
                                }
                                else
@@ -2497,7 +2493,9 @@
                                'lang_file_statustext'                  => 
lang('Select file to upload'),
                                'textareacols'                                  
=> 
isset($GLOBALS['phpgw_info']['user']['preferences']['property']['textareacols'])
 && $GLOBALS['phpgw_info']['user']['preferences']['property']['textareacols'] ? 
$GLOBALS['phpgw_info']['user']['preferences']['property']['textareacols'] : 60,
                                'textarearows'                                  
=> 
isset($GLOBALS['phpgw_info']['user']['preferences']['property']['textarearows'])
 && $GLOBALS['phpgw_info']['user']['preferences']['property']['textarearows'] ? 
$GLOBALS['phpgw_info']['user']['preferences']['property']['textarearows'] : 6,
-                               'order_cat_list'                                
=> $order_catetory
+                               'order_cat_list'                                
=> $order_catetory,
+                               'building_part_list'                    => 
array('status_list' => $this->bocommon->select_category_list(array('type'=> 
'building_part','selected' =>$ticket['building_part'], 'order' => 'id', 
'id_in_name' => 'num' ))),
+                               'order_dim1_list'                               
=> array('status_list' => $this->bocommon->select_category_list(array('type'=> 
'order_dim1','selected' =>$ticket['order_dim1'], 'order' => 'id', 'id_in_name' 
=> 'num' ))),
                        );
 
                        //---datatable settings--------------------

Modified: 
people/sigurdne/modules/property/trunk/inc/cron/default/export_info_as_files.php
===================================================================
--- 
people/sigurdne/modules/property/trunk/inc/cron/default/export_info_as_files.php
    2010-02-07 10:45:18 UTC (rev 21026)
+++ 
people/sigurdne/modules/property/trunk/inc/cron/default/export_info_as_files.php
    2010-02-07 10:47:13 UTC (rev 21027)
@@ -38,10 +38,9 @@
 
                function export_info_as_files()
                {
-               //      $this->currentapp               = 
$GLOBALS['phpgw_info']['flags']['currentapp'];
                        $this->bocommon                 = 
CreateObject('property.bocommon');
-                       $this->db                               = 
$this->bocommon->new_db();
-                       $this->db2                              = 
$this->bocommon->new_db($this->db);
+                       $this->db                               = & 
$GLOBALS['phpgw']->db;
+                       $this->db2                              = 
clone($this->db);
                        $this->soadmin_location = 
CreateObject('property.soadmin_location');
 
                        $this->join                             = 
$this->db->join;

Modified: 
people/sigurdne/modules/property/trunk/inc/cron/default/import_files.php
===================================================================
--- people/sigurdne/modules/property/trunk/inc/cron/default/import_files.php    
2010-02-07 10:45:18 UTC (rev 21026)
+++ people/sigurdne/modules/property/trunk/inc/cron/default/import_files.php    
2010-02-07 10:47:13 UTC (rev 21027)
@@ -38,10 +38,9 @@
 
                function import_files()
                {
-               //      $this->currentapp               = 
$GLOBALS['phpgw_info']['flags']['currentapp'];
                        $this->bocommon                 = 
CreateObject('property.bocommon');
-                       $this->db                               = 
$this->bocommon->new_db();
-                       $this->db2                              = 
$this->bocommon->new_db($this->db);
+                       $this->db                               = & 
$GLOBALS['phpgw']->db;
+                       $this->db2                              = 
clone($this->db);
                        $this->soadmin_location = 
CreateObject('property.soadmin_location');
 
                        $this->join                             = 
$this->db->join;

Modified: 
people/sigurdne/modules/property/trunk/inc/cron/default/import_from_scanner.php
===================================================================
--- 
people/sigurdne/modules/property/trunk/inc/cron/default/import_from_scanner.php 
    2010-02-07 10:45:18 UTC (rev 21026)
+++ 
people/sigurdne/modules/property/trunk/inc/cron/default/import_from_scanner.php 
    2010-02-07 10:47:13 UTC (rev 21027)
@@ -55,8 +55,7 @@
                //      $this->currentapp       = 
$GLOBALS['phpgw_info']['flags']['currentapp'];
                        $this->bocommon         = 
CreateObject('property.bocommon');
                        $this->bofiles          = 
CreateObject('property.bofiles');
-                       $this->db           = $this->bocommon->new_db();
-
+                       $this->db                       = & 
$GLOBALS['phpgw']->db;
                }
 
                function pre_run($data='')
@@ -383,10 +382,10 @@
                        }
                        else
                        {
-                               $sql = "SELECT count(*) FROM fm_tts_tickets 
WHERE id='$id'";
+                               $sql = "SELECT count(*) as cnt FROM 
fm_tts_tickets WHERE id='$id'";
                                $this->db->query($sql,__LINE__,__FILE__);
                                $this->db->next_record();
-                               if($this->db->f(0))
+                               if($this->db->f('cnt'))
                                {
                                        return true;
                                }

Modified: 
people/sigurdne/modules/property/trunk/inc/cron/default/oppdater_antall_leieobjekt.php
===================================================================
--- 
people/sigurdne/modules/property/trunk/inc/cron/default/oppdater_antall_leieobjekt.php
      2010-02-07 10:45:18 UTC (rev 21026)
+++ 
people/sigurdne/modules/property/trunk/inc/cron/default/oppdater_antall_leieobjekt.php
      2010-02-07 10:47:13 UTC (rev 21027)
@@ -38,10 +38,9 @@
 
                function oppdater_antall_leieobjekt()
                {
-               //      $this->currentapp               = 
$GLOBALS['phpgw_info']['flags']['currentapp'];
                        $this->bocommon                 = 
CreateObject('property.bocommon');
-                       $this->db                               = 
$this->bocommon->new_db();
-                       $this->db2                              = 
$this->bocommon->new_db($this->db);
+                       $this->db                               = & 
$GLOBALS['phpgw']->db;
+                       $this->db2                              = 
clone($this->db);
                        $this->join                             = 
$this->db->join;
                }
 

Modified: 
people/sigurdne/modules/property/trunk/inc/cron/default/oppdater_namssakstatus_pr_leietaker.php
===================================================================
--- 
people/sigurdne/modules/property/trunk/inc/cron/default/oppdater_namssakstatus_pr_leietaker.php
     2010-02-07 10:45:18 UTC (rev 21026)
+++ 
people/sigurdne/modules/property/trunk/inc/cron/default/oppdater_namssakstatus_pr_leietaker.php
     2010-02-07 10:47:13 UTC (rev 21027)
@@ -38,10 +38,9 @@
 
                function oppdater_namssakstatus_pr_leietaker()
                {
-               //      $this->currentapp               = 
$GLOBALS['phpgw_info']['flags']['currentapp'];
                        $this->bocommon                 = 
CreateObject('property.bocommon');
-                       $this->db                               = 
$this->bocommon->new_db();
-                       $this->db2                              = 
$this->bocommon->new_db($this->db);
+                       $this->db                               = & 
$GLOBALS['phpgw']->db;
+                       $this->db2                              = 
clone($this->db);
                        $this->join                             = 
$this->db->join;
                        $this->like                             = 
$this->db->like;
                        $this->left_join                = " LEFT JOIN ";

Modified: 
people/sigurdne/modules/property/trunk/inc/cron/default/organize_drawing.php
===================================================================
--- 
people/sigurdne/modules/property/trunk/inc/cron/default/organize_drawing.php    
    2010-02-07 10:45:18 UTC (rev 21026)
+++ 
people/sigurdne/modules/property/trunk/inc/cron/default/organize_drawing.php    
    2010-02-07 10:47:13 UTC (rev 21027)
@@ -46,13 +46,11 @@
 
                function organize_drawing()
                {
-               //      $this->currentapp       = 
$GLOBALS['phpgw_info']['flags']['currentapp'];
                        $this->bocommon         = 
CreateObject('property.bocommon');
                        $this->vfs              = CreateObject('phpgwapi.vfs');
                        $this->rootdir          = $this->vfs->basedir;
                        $this->fakebase         = $this->vfs->fakebase;
-                       $this->db               = $this->bocommon->new_db();
-
+                       $this->db                       = & 
$GLOBALS['phpgw']->db;
                }
 
                function pre_run($data='')
@@ -311,12 +309,12 @@
 
                function check_building($loc1='',$loc2='')
                {
-                       $sql = "SELECT count(*)  FROM fm_location2 WHERE loc1= 
'$loc1' AND loc2= '$loc2'";
+                       $sql = "SELECT count(*) as cnt FROM fm_location2 WHERE 
loc1= '$loc1' AND loc2= '$loc2'";
 
 //_debug_array($sql);
                        $this->db->query($sql,__LINE__,__FILE__);
                        $this->db->next_record();
-                       if($this->db->f(0))
+                       if($this->db->f('cnt'))
                        {
                                return true;
                        }

Modified: 
people/sigurdne/modules/property/trunk/inc/cron/default/update_googlemap.php
===================================================================
--- 
people/sigurdne/modules/property/trunk/inc/cron/default/update_googlemap.php    
    2010-02-07 10:45:18 UTC (rev 21026)
+++ 
people/sigurdne/modules/property/trunk/inc/cron/default/update_googlemap.php    
    2010-02-07 10:47:13 UTC (rev 21027)
@@ -38,10 +38,9 @@
 
                function update_googlemap()
                {
-               //      $this->currentapp               = 
$GLOBALS['phpgw_info']['flags']['currentapp'];
                        $this->bocommon                 = 
CreateObject('property.bocommon');
-                       $this->db                               = 
$this->bocommon->new_db();
-                       $this->db2                              = 
$this->bocommon->new_db($this->db);
+                       $this->db                               = & 
$GLOBALS['phpgw']->db;
+                       $this->db2                              = 
clone($this->db);
 
                        $this->join                             = 
$this->db->join;
                        $this->like                             = 
$this->db->like;

Modified: people/sigurdne/modules/property/trunk/inc/hook_home.inc.php
===================================================================
--- people/sigurdne/modules/property/trunk/inc/hook_home.inc.php        
2010-02-07 10:45:18 UTC (rev 21026)
+++ people/sigurdne/modules/property/trunk/inc/hook_home.inc.php        
2010-02-07 10:47:13 UTC (rev 21027)
@@ -43,7 +43,7 @@
 
                $default_status         = 
isset($prefs['property']['tts_status']) ? $prefs['property']['tts_status'] : '';
                $tts = CreateObject('property.sotts');
-               $tickets = $tts->read(array('user_id' => $accound_id, 
'status_id' => array($default_status, 'O')));
+               $tickets = $tts->read(array('user_id' => $accound_id, 
'status_id' => array($default_status, 'O'), 'new' => true));
                $total_records = $tts->total_records;
 
                $portalbox = CreateObject('phpgwapi.listbox', array

Modified: people/sigurdne/modules/property/trunk/setup/phpgw_no.lang
===================================================================
--- people/sigurdne/modules/property/trunk/setup/phpgw_no.lang  2010-02-07 
10:45:18 UTC (rev 21026)
+++ people/sigurdne/modules/property/trunk/setup/phpgw_no.lang  2010-02-07 
10:47:13 UTC (rev 21027)
@@ -26,6 +26,7 @@
 activity num   property        no      Aktivitet num
 actor  property        no      Aktør
 actual cost    property        no      Faktisk kostnad
+actual_cost    property        no      Faktisk kostnad
 actual cost changed    property        no      Faktisk kostnad er endret
 actual cost - paid so far      property        no      Faktisk betalt - pr dd
 add a apartment        property        no      Legg til leilighet
@@ -719,6 +720,7 @@
 equipment id   property        no      utstyr ID
 equipment_id   property        no      utstyr ID
 equipment type property        no      Type utstyr/anlegg
+estimate       property        no      Kostnadsestimat
 event  property        no      Hendelse
 event action   property        no      Handling ved hendelse
 events property        no      Hendelser
@@ -1059,6 +1061,7 @@
 open edit in new window        property        no      Åpne endring i nytt 
vindu
 open view in new window        property        no      Åpne visning i nytt 
vindu
 order  property        no      bestill
+order_dim1     property        no      Aktivitet
 order id       property        no      OrdreNr
 order_id       property        no      OrdreNr
 order # that initiated the invoice     property        no      Order nr som 
referanse for fakturaen

Modified: people/sigurdne/modules/property/trunk/setup/setup.inc.php
===================================================================
--- people/sigurdne/modules/property/trunk/setup/setup.inc.php  2010-02-07 
10:45:18 UTC (rev 21026)
+++ people/sigurdne/modules/property/trunk/setup/setup.inc.php  2010-02-07 
10:47:13 UTC (rev 21027)
@@ -12,7 +12,7 @@
        */
 
        $setup_info['property']['name']         = 'property';
-       $setup_info['property']['version']              = '0.9.17.578';
+       $setup_info['property']['version']              = '0.9.17.579';
        $setup_info['property']['app_order']    = 8;
        $setup_info['property']['enable']       = 1;
        $setup_info['property']['app_group']    = 'office';
@@ -136,6 +136,7 @@
                'fm_ecobilag_category',
                'fm_ecodimb',
                'fm_ecodimd',
+               'fm_order_dim1',
                'fm_ecologg',
                'fm_ecomva',
                'fm_ecouser',

Modified: people/sigurdne/modules/property/trunk/setup/tables_current.inc.php
===================================================================
--- people/sigurdne/modules/property/trunk/setup/tables_current.inc.php 
2010-02-07 10:45:18 UTC (rev 21026)
+++ people/sigurdne/modules/property/trunk/setup/tables_current.inc.php 
2010-02-07 10:47:13 UTC (rev 21027)
@@ -875,7 +875,9 @@
                                'ecodimb' => array('type' => 'int','precision' 
=> 4,'nullable' => True),
                                'budget' => array('type' => 'int','precision' 
=> '4','nullable' => True),
                                'actual_cost' => array('type' => 
'decimal','precision' => '20','scale' => '2','nullable' => True,'default' => 
'0.00'),
-                               'order_cat_id' => array('type' => 
'int','precision' => '4','nullable' => True)
+                               'order_cat_id' => array('type' => 
'int','precision' => '4','nullable' => True),
+                               'building_part'=> array('type' => 
'varchar','precision' => 4,'nullable' => True),
+                               'order_dim1'=> array('type' => 
'int','precision' => 4,'nullable' => True)
                        ),
                        'pk' => array('id'),
                        'ix' => array(),
@@ -1062,6 +1064,17 @@
                        'fk' => array(),
                        'uc' => array()
                ),
+               'fm_order_dim1' => array(
+                       'fd' => array(
+                               'id' => array('type' => 'int','precision' => 
'4','nullable' => False),
+                               'num' => array('type' => 'varchar','precision' 
=> '20','nullable' => False),
+                               'descr' => array('type' => 
'varchar','precision' => '255','nullable' => False)
+                       ),
+                       'pk' => array('id'),
+                       'ix' => array(),
+                       'fk' => array(),
+                       'uc' => array()
+               ),
                'fm_ecomva' => array(
                        'fd' => array(
                                'id' => array('type' => 'int','precision' => 
'4','nullable' => False),

Modified: people/sigurdne/modules/property/trunk/setup/tables_update.inc.php
===================================================================
--- people/sigurdne/modules/property/trunk/setup/tables_update.inc.php  
2010-02-07 10:45:18 UTC (rev 21026)
+++ people/sigurdne/modules/property/trunk/setup/tables_update.inc.php  
2010-02-07 10:47:13 UTC (rev 21027)
@@ -186,9 +186,9 @@
 
                $GLOBALS['phpgw_setup']->oProc->query("UPDATE 
fm_location_attrib SET custom = 1");
 
-               $GLOBALS['phpgw_setup']->oProc->query("SELECT count(*) FROM 
fm_location_type");
+               $GLOBALS['phpgw_setup']->oProc->query("SELECT count(*) as cnt 
FROM fm_location_type");
                $GLOBALS['phpgw_setup']->oProc->next_record();
-               $locations = $GLOBALS['phpgw_setup']->oProc->f(0);
+               $locations = $GLOBALS['phpgw_setup']->oProc->f('cnt');
 
                for ($location_type=1; $location_type<($locations+1); 
$location_type++)
                {
@@ -393,9 +393,9 @@
 
                $datatype_text[$datatype];
 
-               $GLOBALS['phpgw_setup']->oProc->query("SELECT count(*) FROM 
fm_location_type");
+               $GLOBALS['phpgw_setup']->oProc->query("SELECT count(*) as cnt 
FROM fm_location_type");
                $GLOBALS['phpgw_setup']->oProc->next_record();
-               $locations = $GLOBALS['phpgw_setup']->oProc->f(0);
+               $locations = $GLOBALS['phpgw_setup']->oProc->f('cnt');
 
                for ($location_type=1; $location_type<($locations+1); 
$location_type++)
                {
@@ -3897,7 +3897,7 @@
 
 
        /**
-       * Update property version from 0.9.17.576 to 0.9.17.577
+       * Update property version from 0.9.17.577 to 0.9.17.578
        * Add order categories to ticket ad hoc orders
        * 
        */
@@ -3916,3 +3916,37 @@
                }
        }
 
+       /**
+       * Update property version from 0.9.17.578 to 0.9.17.579
+       * Add custom dimension for orders
+       * 
+       */
+
+       $test[] = '0.9.17.578';
+       function property_upgrade0_9_17_578()
+       {
+               $GLOBALS['phpgw_setup']->oProc->m_odb->transaction_begin();
+
+               
$GLOBALS['phpgw_setup']->oProc->AddColumn('fm_tts_tickets','building_part',array('type'
 => 'varchar','precision' => 4,'nullable' => True));
+               
$GLOBALS['phpgw_setup']->oProc->AddColumn('fm_tts_tickets','order_dim1',array('type'
 => 'int','precision' => 4,'nullable' => True));
+
+               $GLOBALS['phpgw_setup']->oProc->CreateTable(
+                       'fm_order_dim1', array(
+                               'fd' => array(
+                                       'id' => array('type' => 
'auto','precision' => 4,'nullable' => False),
+                                       'num' => array('type' => 
'varchar','precision' => 20,'nullable' => False),
+                                       'descr' => array('type' => 
'varchar','precision' => 255,'nullable' => False)
+                               ),
+                               'pk' => array('id'),
+                               'ix' => array(),
+                               'fk' => array(),
+                               'uc' => array()
+                       )
+               );
+
+               if($GLOBALS['phpgw_setup']->oProc->m_odb->transaction_commit())
+               {
+                       $GLOBALS['setup_info']['property']['currentver'] = 
'0.9.17.579';
+                       return $GLOBALS['setup_info']['property']['currentver'];
+               }
+       }

Modified: people/sigurdne/modules/property/trunk/templates/base/event_form.xsl
===================================================================
--- people/sigurdne/modules/property/trunk/templates/base/event_form.xsl        
2010-02-07 10:45:18 UTC (rev 21026)
+++ people/sigurdne/modules/property/trunk/templates/base/event_form.xsl        
2010-02-07 10:47:13 UTC (rev 21027)
@@ -9,7 +9,14 @@
                        self.name="first_Window";
                        function event_lookup_<xsl:value-of select="name"/>()
                        {
-                               Window1=window.open('<xsl:value-of 
select="event_link"/>',"Search","width=800,height=700,toolbar=no,scrollbars=yes,resizable=yes");
+                               var oArgs = <xsl:value-of select="event_link"/>;
+                               if(document.form.<xsl:value-of 
select="name"/>.value)
+                               {
+                                       oArgs['id'] = 
document.form.<xsl:value-of select="name"/>.value;
+                               }
+
+                               var strURL = phpGWLink('index.php', oArgs);
+                               
Window1=window.open(strURL,"Search","width=800,height=700,toolbar=no,scrollbars=yes,resizable=yes");
                        }               
                </script>
                <tr>

Modified: people/sigurdne/modules/property/trunk/templates/base/tts.xsl
===================================================================
--- people/sigurdne/modules/property/trunk/templates/base/tts.xsl       
2010-02-07 10:45:18 UTC (rev 21026)
+++ people/sigurdne/modules/property/trunk/templates/base/tts.xsl       
2010-02-07 10:47:13 UTC (rev 21027)
@@ -1089,23 +1089,40 @@
                                                <xsl:call-template 
name="vendor_form"/>
                                                <xsl:call-template 
name="ecodimb_form"/>
                                                <xsl:call-template 
name="b_account_form"/>
-<!--
+
                                                <tr>
                                                        <td>
-                                                               <xsl:value-of 
select="php:function('lang', 'order category')" />
+                                                               <xsl:value-of 
select="php:function('lang', 'building part')" />
                                                        </td>
                                                        <td>
-                                                               <xsl:variable 
name="lang_cat_statustext"><xsl:value-of select="php:function('lang', 'select 
order category')" /></xsl:variable>
-                                                                       <select 
name="values[order_cat_id]"  title="{$lang_cat_statustext}">
+                                                                       <select 
name="values[building_part]" >
+                                                                               
<xsl:attribute name="title">
+                                                                       
<xsl:value-of select="php:function('lang', 'select building part')" />
+                                                                               
</xsl:attribute>
                                                                                
<option value="0">
-                                                                               
        <xsl:value-of select="php:function('lang', 'select order category')" />
+                                                                               
        <xsl:value-of select="php:function('lang', 'select building part')" />
                                                                                
</option>
-                                                                               
        <xsl:apply-templates select="order_cat_list/cat_list"/>
+                                                                               
        <xsl:apply-templates select="building_part_list/status_list"/>
                                                                        
</select>
                                                        </td>
                                                </tr>
--->
                                                <tr>
+                                                       <td>
+                                                               <xsl:value-of 
select="php:function('lang', 'order_dim1')" />
+                                                       </td>
+                                                       <td>
+                                                                       <select 
name="values[order_dim1]" >
+                                                                               
<xsl:attribute name="title">
+                                                                       
<xsl:value-of select="php:function('lang', 'order_dim1')" />
+                                                                               
</xsl:attribute>
+                                                                               
<option value="0">
+                                                                               
        <xsl:value-of select="php:function('lang', 'order_dim1')" />
+                                                                               
</option>
+                                                                               
        <xsl:apply-templates select="order_dim1_list/status_list"/>
+                                                                       
</select>
+                                                       </td>
+                                               </tr>
+                                               <tr>
                                                        <td valign="top">
                                                <xsl:value-of 
select="php:function('lang', 'cost estimate')" />
                                                        </td>
@@ -1156,16 +1173,14 @@
                                                                                
        <xsl:for-each select="value_approval_mail_address" >
                                                                                
                <tr>
                                                                                
                        <td>
-                                                                               
                                <input type="checkbox" 
name="values[approval][{id}]" value="True">
+                                                                               
                                <input type="checkbox" 
name="values[approval][{id}]" value="{address}">
                                                                                
                                        <xsl:attribute name="title">
-                                                                               
                                                <xsl:value-of 
select="//lang_ask_approval_statustext"/>
+                                                                               
                                                <xsl:value-of 
select="php:function('lang', 'ask for approval')" />
                                                                                
                                        </xsl:attribute>
                                                                                
                                </input>
                                                                                
                        </td>
                                                                                
                        <td valign='top'>
                                                                                
                                <xsl:value-of select="address"/>
-                                                                               
                                <input type="hidden" 
name="values[mail_address][{id}]" value="{address}">
-                                                                               
                                </input>
                                                                                
                        </td>
                                                                                
                </tr>
                                                                                
        </xsl:for-each>
@@ -1175,31 +1190,12 @@
                                                        </xsl:when>
                                                </xsl:choose>
                                                <tr>
-                                                       <td>
+                                                       <td valign='top'>
                                                    <xsl:value-of 
select="php:function('lang', 'send order')" />
                                                        </td>
                                                        <td>
                                                                <table>
-                                                                       <tr>
-                                                                               
<td>
-                                                                               
        <input type="checkbox" name="values[send_order]" value="True">
-                                                                               
                <xsl:attribute name="title">
-                                                                               
            <xsl:value-of select="php:function('lang', 'send order')" />
-                                                                               
                </xsl:attribute>
-                                                                               
        </input>
-                                                                               
</td>
-                                                                               
<td>                                                                            
            
-                                                                               
        <select name="values[vendor_email]">
-                                                                               
                <xsl:attribute name="title">
-                                                                               
            <xsl:value-of select="php:function('lang', 'The address to which 
this order will be sendt')" />
-                                                                               
                </xsl:attribute>
-                                                                               
                <option value="">
-                                                                               
                        <xsl:value-of select="php:function('lang', 'select 
email')" />
-                                                                               
                </option>
-                                                                               
                <xsl:apply-templates select="vendor_email"/>
-                                                                               
        </select>
-                                                                               
</td>
-                                                                       </tr>
+                                                                       
<xsl:apply-templates select="vendor_email"/>
                                                                </table>
                                                        </td>
                                                </tr>
@@ -1739,15 +1735,17 @@
                </option>
        </xsl:template>
 
-
-       <xsl:template match="vendor_email">
-       <xsl:variable name="email"><xsl:value-of select="email"/></xsl:variable>
-               <xsl:choose>
-                       <xsl:when test="selected">
-                               <option value="{$email}" 
selected="selected"><xsl:value-of disable-output-escaping="yes" 
select="email"/></option>
-                       </xsl:when>
-                       <xsl:otherwise>
-                               <option value="{$email}"><xsl:value-of 
disable-output-escaping="yes" select="email"/></option>
-                       </xsl:otherwise>
-               </xsl:choose>
+       <xsl:template match="vendor_email" xmlns:php="http://php.net/xsl";>
+               <tr>
+                       <td>
+                               <input type="checkbox" 
name="values[vendor_email][]" value="{email}" >
+                                       <xsl:attribute name="title">
+                                               <xsl:value-of 
select="php:function('lang', 'The address to which this order will be sendt')" 
/>
+                                       </xsl:attribute>
+                               </input>
+                       </td>
+                       <td>
+                               <xsl:value-of select="email"/>
+                       </td>
+               </tr>
        </xsl:template>

Modified: 
people/sigurdne/modules/property/trunk/tutorials/property/examples/install.apache.sh
===================================================================
--- 
people/sigurdne/modules/property/trunk/tutorials/property/examples/install.apache.sh
        2010-02-07 10:45:18 UTC (rev 21026)
+++ 
people/sigurdne/modules/property/trunk/tutorials/property/examples/install.apache.sh
        2010-02-07 10:47:13 UTC (rev 21027)
@@ -75,6 +75,7 @@
 #/**
 #  * Oracle PDO-Support
 #  * Download: 
http://www.oracle.com/technology/software/tech/oci/instantclient/index.html
+#  * http://lacot.org/
 #  */
 
 ORACLETAR="instantclient-basic-linux32-11.2.0.1.zip"





reply via email to

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