fmsystem-commits
[Top][All Lists]
Advanced

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

[Fmsystem-commits] [6613] Property: More on generic code


From: Sigurd Nes
Subject: [Fmsystem-commits] [6613] Property: More on generic code
Date: Wed, 17 Nov 2010 21:51:16 +0000

Revision: 6613
          http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=6613
Author:   sigurdne
Date:     2010-11-17 21:51:15 +0000 (Wed, 17 Nov 2010)
Log Message:
-----------
Property: More on generic code

Modified Paths:
--------------
    trunk/property/inc/class.bocommon.inc.php
    trunk/property/inc/class.bodocument.inc.php
    trunk/property/inc/class.boevent.inc.php
    trunk/property/inc/class.boinvoice.inc.php
    trunk/property/inc/class.bolookup.inc.php
    trunk/property/inc/class.boproject.inc.php
    trunk/property/inc/class.botts.inc.php
    trunk/property/inc/class.boworkorder.inc.php
    trunk/property/inc/class.custom_fields.inc.php
    trunk/property/inc/class.menu.inc.php
    trunk/property/inc/class.uiXport.inc.php
    trunk/property/inc/class.uiadmin_location.inc.php
    trunk/property/inc/class.uiinvoice.inc.php
    trunk/property/inc/class.uilocation.inc.php
    trunk/property/inc/class.uilookup.inc.php
    trunk/property/inc/class.uipricebook.inc.php
    trunk/property/inc/hook_settings.inc.php

Added Paths:
-----------
    trunk/property/inc/class.bogeneric.inc.php
    trunk/property/inc/class.sogeneric.inc.php
    trunk/property/inc/class.uigeneric.inc.php
    trunk/property/js/yahoo/generic.index.js
    trunk/property/templates/base/generic.xsl

Modified: trunk/property/inc/class.bocommon.inc.php
===================================================================
--- trunk/property/inc/class.bocommon.inc.php   2010-11-17 14:13:13 UTC (rev 
6612)
+++ trunk/property/inc/class.bocommon.inc.php   2010-11-17 21:51:15 UTC (rev 
6613)
@@ -556,12 +556,13 @@
 
                        if(isset($data['vendor_id']) && $data['vendor_id'] && 
!$data['vendor_name'])
                        {
-                               $contacts       = 
CreateObject('property.soactor');
-                               $contacts->role='vendor';
+                               $contacts       = 
CreateObject('property.sogeneric');
+                               $contacts->get_location_info('vendor',false);
+
                                $custom                 = 
createObject('property.custom_fields');
                                $vendor_data['attributes'] = 
$custom->find('property','.vendor', 0, '', 'ASC', 'attrib_sort', true, true);
 
-                               $vendor_data    = 
$contacts->read_single($data['vendor_id'],$vendor_data);
+                               $vendor_data    = 
$contacts->read_single(array('id' => $data['vendor_id']),$vendor_data);
                                if(is_array($vendor_data))
                                {
                                        foreach($vendor_data['attributes'] as 
$attribute)
@@ -651,11 +652,12 @@
 
                        if($data['tenant_id'] && !$data['tenant_name'])
                        {
-                               $tenant_object  = 
CreateObject('property.soactor');
-                               $tenant_object->role = 'tenant';
+                               $tenant_object  = 
CreateObject('property.sogeneric');
+                               
$tenant_object->get_location_info('tenant',false);
+
                                $custom                 = 
createObject('property.custom_fields');
                                $tenant_data['attributes'] = 
$custom->find('property','.tenant', 0, '', 'ASC', 'attrib_sort', true, true);
-                               $tenant_data    = 
$tenant_object->read_single($data['tenant_id'],$tenant_data);
+                               $tenant_data    = 
$tenant_object->read_single(array('id' => $data['tenant_id']),$tenant_data);
                                if(is_array($tenant_data['attributes']))
                                {
 //_debug_array($tenant_data);
@@ -709,7 +711,7 @@
                        $b_account['lang_b_account']                    = 
isset($data['role']) && $data['role'] == 'group' ? lang('budget account group') 
: lang('Budget account');
                        if($data['b_account_id'] && !$data['b_account_name'])
                        {
-                               $b_account_object       = 
CreateObject('property.socategory');
+                               $b_account_object       = 
CreateObject('property.sogeneric');
                                if(isset($data['role']) && $data['role'] == 
'group')
                                {
                                        
$b_account_object->get_location_info('b_account',false);
@@ -751,7 +753,7 @@
                        $project_group['lang_project_group']                    
        = lang('project group');
                        if($data['project_group'] && 
(!isset($data['project_group_descr']) || !$data['project_group_descr']))
                        {
-                               $project_group_object                           
= CreateObject('property.socategory');
+                               $project_group_object                           
= CreateObject('property.sogeneric');
                                
$project_group_object->get_location_info('project_group',false);
                                $project_group_data                             
        = $project_group_object->read_single(array('id'=> 
$data['project_group']));
                                $project_group['value_project_group_descr']     
= $project_group_data['descr'];
@@ -785,7 +787,7 @@
                        $ecodimb['lang_ecodimb']                                
= lang('dimb');
                        if($data['ecodimb'] && (!isset($data['ecodimb_descr']) 
|| !$data['ecodimb_descr']))
                        {
-                               $ecodimb_object                                 
= CreateObject('property.socategory');
+                               $ecodimb_object                                 
= CreateObject('property.sogeneric');
                                
$ecodimb_object->get_location_info('dimb',false);
                                $ecodimb_data                                   
= $ecodimb_object->read_single(array('id'=> $data['ecodimb']));
                                $ecodimb['value_ecodimb_descr'] = 
$ecodimb_data['descr'];
@@ -1512,9 +1514,9 @@
                                        break;
                        }
 
-                       $socategory = CreateObject('property.socategory');
+                       $sogeneric = CreateObject('property.sogeneric');
 
-                       $categories= $socategory->get_list($data);
+                       $categories= $sogeneric->get_list($data);
 
                        return 
$this->select_list($data['selected'],$categories);
                }

Modified: trunk/property/inc/class.bodocument.inc.php
===================================================================
--- trunk/property/inc/class.bodocument.inc.php 2010-11-17 14:13:13 UTC (rev 
6612)
+++ trunk/property/inc/class.bodocument.inc.php 2010-11-17 21:51:15 UTC (rev 
6613)
@@ -60,8 +60,8 @@
                        $this->bocommon                 = 
CreateObject('property.bocommon');
                        $this->solocation               = 
CreateObject('property.solocation');
                        $this->historylog               = 
CreateObject('property.historylog','document');
-                       $this->contacts                 = 
CreateObject('property.soactor');
-                       $this->contacts->role   ='vendor';
+                       $this->contacts = CreateObject('property.sogeneric');
+                       $this->contacts->get_location_info('vendor',false);
                        $this->cats                             = & 
$this->so->cats;
                        $this->bofiles                  = 
CreateObject('property.bofiles');
 
@@ -230,7 +230,7 @@
                        {
                                $custom                                 = 
createObject('property.custom_fields');
                                $vendor['attributes']   = 
$custom->find('property','.vendor', 0, '', 'ASC', 'attrib_sort', true, true);
-                               $vendor                                 = 
$this->contacts->read_single($document['vendor_id'],$vendor);
+                               $vendor                                 = 
$this->contacts->read_single(array('id' => $document['vendor_id']),$vendor);
                                foreach($vendor['attributes'] as $attribute)
                                {
                                        if($attribute['name']=='org_name')

Modified: trunk/property/inc/class.boevent.inc.php
===================================================================
--- trunk/property/inc/class.boevent.inc.php    2010-11-17 14:13:13 UTC (rev 
6612)
+++ trunk/property/inc/class.boevent.inc.php    2010-11-17 21:51:15 UTC (rev 
6613)
@@ -248,7 +248,7 @@
                                $receipt = $this->so->add($data);
                        }
 
-                       $action_object          = 
CreateObject('property.socategory');
+                       $action_object          = 
CreateObject('property.sogeneric');
                        $action_object->get_location_info('event_action',false);
                        $action = $action_object->read_single(array('id'=> 
$data['action']),$values = array());
 
@@ -506,7 +506,7 @@
 
                public function get_action($selected = '')
                {
-/*                     $action_object                                  = 
CreateObject('property.socategory');
+/*                     $action_object                                  = 
CreateObject('property.sogeneric');
                        $action_object->get_location_info('event_action',false);
                        $values                                 = 
$action_object->read(array('allrows'=> true));
 */

Copied: trunk/property/inc/class.bogeneric.inc.php (from rev 6612, 
trunk/property/inc/class.bocategory.inc.php)
===================================================================
--- trunk/property/inc/class.bogeneric.inc.php                          (rev 0)
+++ trunk/property/inc/class.bogeneric.inc.php  2010-11-17 21:51:15 UTC (rev 
6613)
@@ -0,0 +1,231 @@
+<?php
+       /**
+       * phpGroupWare - property: a Facilities Management System.
+       *
+       * @author Sigurd Nes <address@hidden>
+       * @copyright Copyright (C) 2003,2004,2005,2006,2007,2008,2009 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_bogeneric
+       {
+               var $start;
+               var $query;
+               var $filter;
+               var $sort;
+               var $order;
+               var $cat_id;
+               var $location_info = array();
+
+               var $soap_functions = array(
+                       'list' => array(
+                               'in'  => 
array('int','int','struct','string','int'),
+                               'out' => array('array')
+                       ),
+                       'read' => array(
+                               'in'  => array('int','struct'),
+                               'out' => array('array')
+                       ),
+                       'save' => array(
+                               'in'  => array('int','struct'),
+                               'out' => array()
+                       ),
+                       'delete' => array(
+                               'in'  => array('int','struct'),
+                               'out' => array()
+                       )
+               );
+
+               function __construct($session=false)
+               {
+                       $this->so                       = 
CreateObject('property.sogeneric');
+                       $this->custom           = & $this->so->custom;
+                       $this->bocommon         = 
CreateObject('property.bocommon');
+
+                       $start                          = 
phpgw::get_var('start', 'int', 'REQUEST', 0);
+                       $query                          = 
phpgw::get_var('query');
+                       $sort                           = 
phpgw::get_var('sort');
+                       $order                          = 
phpgw::get_var('order');
+                       $filter                         = 
phpgw::get_var('filter', 'int');
+                       $cat_id                         = 
phpgw::get_var('cat_id', 'int');
+                       $allrows                        = 
phpgw::get_var('allrows', 'bool');
+                       $type                           = 
phpgw::get_var('type');
+                       $type_id                        = 
phpgw::get_var('type_id', 'int', 'REQUEST', 0);
+
+                       $this->type             = $type;
+                       $this->type_id          = $type_id;
+
+                       if ($session)
+                       {
+                               $this->read_sessiondata($type);
+                               $this->use_session = true;
+                       }
+
+                       $this->start            = $start ? $start : 0;
+                       $this->query            = isset($_REQUEST['query']) ? 
$query : $this->query;
+                       $this->sort                     = 
isset($_REQUEST['sort']) ? $sort : $this->sort;
+                       $this->order            = isset($_REQUEST['order']) && 
$_REQUEST['order'] ? $order : $this->order;
+                       $this->filter           = isset($_REQUEST['filter']) ? 
$filter : $this->filter;
+                       $this->cat_id           = isset($_REQUEST['cat_id'])  ? 
$cat_id :  $this->cat_id;
+                       $this->allrows          = isset($allrows) ? $allrows : 
false;
+
+                       $this->location_info = 
$this->so->get_location_info($type, $type_id);
+
+               }
+
+               public function save_sessiondata($data)
+               {
+                       if ($this->use_session)
+                       {
+                               
$GLOBALS['phpgw']->session->appsession('session_data',"generic_{$data['type']}",$data);
+                       }
+               }
+
+               function read_sessiondata($type)
+               {
+                       $data = 
$GLOBALS['phpgw']->session->appsession('session_data',"generic_{$type}");
+
+       //              _debug_array($data);
+
+                       $this->start    = $data['start'];
+                       $this->query    = $data['query'];
+                       $this->filter   = $data['filter'];
+                       $this->sort             = $data['sort'];
+                       $this->order    = $data['order'];
+                       $this->cat_id   = $data['cat_id'];
+                       $this->allrows  = $data['allrows'];
+               }
+
+               public function get_location_info($type,$type_id)
+               {
+                       return $this->so->get_location_info($type,$type_id);
+               }
+
+               function column_list($selected='',$allrows='')
+               {
+                       if(!$selected)
+                       {
+                               $selected = 
$GLOBALS['phpgw_info']['user']['preferences']['property']["generic_columns_{$this->type}_{$this->type_id}"];
+                       }
+
+                       $filter = array('list' => ''); // translates to "list 
IS NULL"
+                       $columns = 
$this->custom->find('property',$this->location_info['acl_location'], 0, 
'','','',true, false, $filter);
+                       
$column_list=$this->bocommon->select_multi_list($selected,$columns);
+
+                       return $column_list;
+               }
+
+               public function read($filter = array())
+               {
+                       if (! $filter )
+                       {
+                               foreach ( $this->location_info['fields'] as 
$field )
+                               {
+                                       if (isset($field['filter']) && 
$field['filter'])
+                                       {
+                                               $filter[$field['name']] = 
phpgw::get_var($field['name']);
+                                       }
+                               }
+                       }
+                       
+                       $values = $this->so->read(array('start' => 
$this->start,'query' => $this->query,'sort' => $this->sort,'order' => 
$this->order,
+                                                                               
        'allrows'=>$this->allrows),$filter);
+
+                       $this->total_records = $this->so->total_records;
+                       $this->uicols = $this->so->uicols;
+
+                       return $values;
+               }
+
+               public function read_single($data=array())
+               {
+                       $custom_fields = false;
+                       
if($GLOBALS['phpgw']->locations->get_attrib_table('property', 
$this->location_info['acl_location']))
+                       {
+                               $custom_fields = true;
+                               $values = array();
+                               $values['attributes'] = 
$this->custom->find('property', $this->location_info['acl_location'], 0, '', 
'ASC', 'attrib_sort', true, true);
+                       }
+
+                       if(isset($data['id']) && $data['id'])
+                       {
+                               $values = $this->so->read_single($data, 
$values);
+                       }
+                       if($custom_fields)
+                       {
+                               $values = $this->custom->prepare($values, 
'property',$this->location_info['acl_location'], $data['view']);
+                       }
+                       return $values;
+               }
+
+               public function save($data,$action='',$values_attribute = 
array())
+               {
+                       if(is_array($values_attribute))
+                       {
+                               $values_attribute = 
$this->custom->convert_attribute_save($values_attribute);
+                       }
+
+                       if ($action=='edit')
+                       {
+                               if ($data['id'] != '')
+                               {
+
+                                       $receipt = 
$this->so->edit($data,$values_attribute);
+                               }
+                       }
+                       else
+                       {
+                               $receipt = 
$this->so->add($data,$values_attribute);
+                       }
+
+                       return $receipt;
+               }
+
+               /**
+               * Get a list from and tag the selected item
+               *
+               * @param array $data
+               *
+               * @return array with information to include in forms
+               */
+
+               public function get_list($data)
+               {
+                       $values = $this->so->get_list($data);
+                       foreach ($values as &$entry)
+                       {
+                               $entry['selected'] = isset($data['selected']) 
&& trim($data['selected']) == trim($entry['id']) ? 1 : 0;
+                       }
+                       return $values;
+               }
+
+               public function delete($id)
+               {
+                       $this->so->delete($id);
+               }
+       }

Modified: trunk/property/inc/class.boinvoice.inc.php
===================================================================
--- trunk/property/inc/class.boinvoice.inc.php  2010-11-17 14:13:13 UTC (rev 
6612)
+++ trunk/property/inc/class.boinvoice.inc.php  2010-11-17 21:51:15 UTC (rev 
6613)
@@ -493,8 +493,8 @@
 
                function get_vendor_name($vendor_id='')
                {
-                       $contacts       = CreateObject('property.soactor');
-                       $contacts->role='vendor';
+                       $contacts       = CreateObject('property.sogeneric');
+                       $contacts->get_location_info('vendor',false);
 
                        $criteria = array
                        (
@@ -507,7 +507,7 @@
                                )
                        );
 
-                       $vendor_data    = $contacts->read_single($vendor_id, 
$criteria);
+                       $vendor_data    = $contacts->read_single(array('id' => 
$vendor_id), $criteria);
 
                        if(is_array($vendor_data))
                        {

Modified: trunk/property/inc/class.bolookup.inc.php
===================================================================
--- trunk/property/inc/class.bolookup.inc.php   2010-11-17 14:13:13 UTC (rev 
6612)
+++ trunk/property/inc/class.bolookup.inc.php   2010-11-17 21:51:15 UTC (rev 
6613)
@@ -314,7 +314,7 @@
 
                function read_project_group()
                {
-                       $project_group  = CreateObject('property.socategory');
+                       $project_group  = CreateObject('property.sogeneric');
                        
$project_group->get_location_info('project_group',false);
                        $values = $project_group->read(array('start' => 
$this->start,'query' => $this->query,'sort' => $this->sort,'order' => 
$this->order,
                                                                                
        'type' => 'project_group','allrows'=>$this->allrows));
@@ -325,7 +325,7 @@
                }
                function read_ecodimb()
                {
-                       $ecodimb        = CreateObject('property.socategory');
+                       $ecodimb        = CreateObject('property.sogeneric');
                        $ecodimb->get_location_info('dimb',false);
                        $values = $ecodimb->read(array('start' => 
$this->start,'query' => $this->query,'sort' => $this->sort,'order' => 
$this->order,
                                                                                
        'allrows'=>$this->allrows));

Modified: trunk/property/inc/class.boproject.inc.php
===================================================================
--- trunk/property/inc/class.boproject.inc.php  2010-11-17 14:13:13 UTC (rev 
6612)
+++ trunk/property/inc/class.boproject.inc.php  2010-11-17 21:51:15 UTC (rev 
6613)
@@ -366,8 +366,8 @@
 
                function read_single($project_id = 0, $values = array(), $view 
= false)
                {
-                       $contacts               = 
CreateObject('property.soactor');
-                       $contacts->role='vendor';
+                       $contacts       = CreateObject('property.sogeneric');
+                       $contacts->get_location_info('vendor',false);
 
                        $config                         = 
CreateObject('phpgwapi.config','property');
                        $config->read();
@@ -416,7 +416,7 @@
                                {
                                        $vendor['attributes'] = 
$this->custom->find('property','.vendor', 0, '', 'ASC', 'attrib_sort', true, 
true);
 
-                                       $vendor = 
$contacts->read_single($workorder_data[$i]['vendor_id'], $vendor);
+                                       $vendor = 
$contacts->read_single(array('id' => $workorder_data[$i]['vendor_id']), 
$vendor);
                                        foreach($vendor['attributes'] as 
$attribute)
                                        {
                                                
if($attribute['name']=='org_name')

Modified: trunk/property/inc/class.botts.inc.php
===================================================================
--- trunk/property/inc/class.botts.inc.php      2010-11-17 14:13:13 UTC (rev 
6612)
+++ trunk/property/inc/class.botts.inc.php      2010-11-17 21:51:15 UTC (rev 
6613)
@@ -324,8 +324,9 @@
                        if(!$external)
                        {
                                $entity = $this->get_origin_entity_type();
-                               $contacts       = 
CreateObject('property.soactor');
-                               $contacts->role='vendor';
+                               $contacts       = 
CreateObject('property.sogeneric');
+                               $contacts->get_location_info('vendor',false);
+
                                $custom                 = 
createObject('property.custom_fields');
                                $vendor_data['attributes'] = 
$custom->find('property','.vendor', 0, '', 'ASC', 'attrib_sort', true, true);
                        }
@@ -422,7 +423,7 @@
                                        }
                                        else
                                        {
-                                               $vendor_data    = 
$contacts->read_single($ticket['vendor_id'],$vendor_data);
+                                               $vendor_data    = 
$contacts->read_single(array('id' => $ticket['vendor_id']),$vendor_data);
                                                if($vendor_data)
                                                {
                                                        
foreach($vendor_data['attributes'] as $attribute)

Modified: trunk/property/inc/class.boworkorder.inc.php
===================================================================
--- trunk/property/inc/class.boworkorder.inc.php        2010-11-17 14:13:13 UTC 
(rev 6612)
+++ trunk/property/inc/class.boworkorder.inc.php        2010-11-17 21:51:15 UTC 
(rev 6613)
@@ -410,8 +410,8 @@
 
                function read_single($workorder_id)
                {
-                       $contacts               = 
CreateObject('property.soactor');
-                       $contacts->role='vendor';
+                       $contacts       = CreateObject('property.sogeneric');
+                       $contacts->get_location_info('vendor',false);
                        $workorder                                              
= $this->so->read_single($workorder_id);
                        $dateformat                                             
= $GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat'];
                        $workorder['start_date']                = 
$GLOBALS['phpgw']->common->show_date($workorder['start_date'],$dateformat);
@@ -421,7 +421,7 @@
                        {
                                $custom                 = 
createObject('property.custom_fields');
                                $vendor['attributes'] = 
$custom->find('property','.vendor', 0, '', 'ASC', 'attrib_sort', true, true);
-                               $vendor                 = 
$contacts->read_single($workorder['vendor_id'],$vendor);
+                               $vendor                 = 
$contacts->read_single(array('id' => $workorder['vendor_id']),$vendor);
                                foreach($vendor['attributes'] as $attribute)
                                {
                                        if($attribute['name']=='org_name')

Modified: trunk/property/inc/class.custom_fields.inc.php
===================================================================
--- trunk/property/inc/class.custom_fields.inc.php      2010-11-17 14:13:13 UTC 
(rev 6612)
+++ trunk/property/inc/class.custom_fields.inc.php      2010-11-17 21:51:15 UTC 
(rev 6613)
@@ -66,8 +66,9 @@
                public function prepare($values, $appname, $location, 
$view_only='')
                {
                        $contacts               = 
CreateObject('phpgwapi.contacts');
-                       $vendor                 = 
CreateObject('property.soactor');
-                       $vendor->role   = 'vendor';
+                       $vendor = CreateObject('property.sogeneric');
+                       $vendor->get_location_info('vendor',false);
+
                        $location_id    = 
$GLOBALS['phpgw']->locations->get_id($appname, $location);
 
                        $dateformat = 
$GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat'];
@@ -168,7 +169,7 @@
                                {
                                        if($attributes['value'])
                                        {
-                                               $vendor_data    = 
$vendor->read_single($attributes['value'],array('attributes' => array(0 => 
array('column_name' => 'org_name'))));
+                                               $vendor_data    = 
$vendor->read_single(array('id' => $attributes['value']),array('attributes' => 
array(0 => array('column_name' => 'org_name'))));
 
                                                for 
($n=0;$n<count($vendor_data['attributes']);$n++)
                                                {

Modified: trunk/property/inc/class.menu.inc.php
===================================================================
--- trunk/property/inc/class.menu.inc.php       2010-11-17 14:13:13 UTC (rev 
6612)
+++ trunk/property/inc/class.menu.inc.php       2010-11-17 21:51:15 UTC (rev 
6613)
@@ -108,7 +108,7 @@
                                        'tenant_cats'   => array
                                        (
                                                'text'  => lang('Tenant 
Categories'),
-                                               'url'   => 
$GLOBALS['phpgw']->link('/index.php', array('menuaction' => 
'property.uicategory.index', 'type' => 'tenant_cats') )
+                                               'url'   => 
$GLOBALS['phpgw']->link('/index.php', array('menuaction' => 
'property.uigeneric.index', 'type' => 'tenant_cats') )
                                        ),
                                        'tenant_global_cats'    => array
                                        (
@@ -123,7 +123,7 @@
                                        'claims_cats'   => array
                                        (
                                                'text'  => lang('Tenant Claim 
Categories'),
-                                               'url'   => 
$GLOBALS['phpgw']->link('/index.php', array('menuaction' => 
'property.uicategory.index', 'type' => 'tenant_claim') )
+                                               'url'   => 
$GLOBALS['phpgw']->link('/index.php', array('menuaction' => 
'property.uigeneric.index', 'type' => 'tenant_claim') )
                                        )
                                );
 
@@ -132,7 +132,7 @@
                                        'vendor_cats'   => array
                                        (
                                                'text'  => lang('Vendor 
Categories'),
-                                               'url'   => 
$GLOBALS['phpgw']->link('/index.php', array('menuaction' => 
'property.uicategory.index', 'type' => 'vendor_cats') )
+                                               'url'   => 
$GLOBALS['phpgw']->link('/index.php', array('menuaction' => 
'property.uigeneric.index', 'type' => 'vendor_cats') )
                                        ),
                                        'vendor_global_cats'    => array
                                        (
@@ -150,7 +150,7 @@
                                        'owner_cats'    => array
                                        (
                                                'text'  => lang('Owner 
Categories'),
-                                               'url'   => 
$GLOBALS['phpgw']->link('/index.php', array('menuaction' => 
'property.uicategory.index', 'type' => 'owner_cats') )
+                                               'url'   => 
$GLOBALS['phpgw']->link('/index.php', array('menuaction' => 
'property.uigeneric.index', 'type' => 'owner_cats') )
                                        ),
                                        'owner_attribs' => array
                                        (
@@ -164,17 +164,17 @@
                                        'accounting_cats'       => array
                                        (
                                                'text'  => lang('Accounting 
Categories'),
-                                               'url'   => 
$GLOBALS['phpgw']->link('/index.php', array('menuaction' => 
'property.uicategory.index', 'type' => 'b_account') )
+                                               'url'   => 
$GLOBALS['phpgw']->link('/index.php', array('menuaction' => 
'property.uigeneric.index', 'type' => 'b_account') )
                                        ),
                                        'budget_account'        => array
                                        (
                                                'text'  => lang('budget 
account'),
-                                               'url'   => 
$GLOBALS['phpgw']->link('/index.php', array('menuaction' => 
'property.uicategory.index', 'type' => 'budget_account') )
+                                               'url'   => 
$GLOBALS['phpgw']->link('/index.php', array('menuaction' => 
'property.uigeneric.index', 'type' => 'budget_account') )
                                        ),
                                        'accounting_dimb'       => array
                                        (
                                                'text'  => lang('Accounting dim 
b'),
-                                               'url'   => 
$GLOBALS['phpgw']->link('/index.php', array('menuaction' => 
'property.uicategory.index', 'type' => 'dimb') )
+                                               'url'   => 
$GLOBALS['phpgw']->link('/index.php', array('menuaction' => 
'property.uigeneric.index', 'type' => 'dimb') )
                                        ),
                                        'dimb_roles'    => array
                                        (
@@ -184,22 +184,22 @@
                                        'accounting_dimd'       => array
                                        (
                                                'text'  => lang('Accounting dim 
d'),
-                                               'url'   => 
$GLOBALS['phpgw']->link('/index.php', array('menuaction' => 
'property.uicategory.index', 'type' => 'dimd') )
+                                               'url'   => 
$GLOBALS['phpgw']->link('/index.php', array('menuaction' => 
'property.uigeneric.index', 'type' => 'dimd') )
                                        ),
                                        'accounting_tax'        => array
                                        (
                                                'text'  => lang('Accounting 
tax'),
-                                               'url'   => 
$GLOBALS['phpgw']->link('/index.php', array('menuaction' => 
'property.uicategory.index', 'type' => 'tax') )
+                                               'url'   => 
$GLOBALS['phpgw']->link('/index.php', array('menuaction' => 
'property.uigeneric.index', 'type' => 'tax') )
                                        ),
                                        'voucher_cats'  => array
                                        (
                                                'text'  => lang('Accounting 
voucher category'),
-                                               'url'   => 
$GLOBALS['phpgw']->link('/index.php', array('menuaction' => 
'property.uicategory.index', 'type' => 'voucher_cat') )
+                                               'url'   => 
$GLOBALS['phpgw']->link('/index.php', array('menuaction' => 
'property.uigeneric.index', 'type' => 'voucher_cat') )
                                        ),
                                        'voucher_type'  => array
                                        (
                                                'text'  => lang('Accounting 
voucher type'),
-                                               'url'   => 
$GLOBALS['phpgw']->link('/index.php', array('menuaction' => 
'property.uicategory.index', 'type' => 'voucher_type') )
+                                               'url'   => 
$GLOBALS['phpgw']->link('/index.php', array('menuaction' => 
'property.uigeneric.index', 'type' => 'voucher_type') )
                                        )
                                );
 
@@ -208,7 +208,7 @@
                                        'agreement_status'      => array
                                        (
                                                'text'  => lang('Agreement 
status'),
-                                               'url'   => 
$GLOBALS['phpgw']->link('/index.php', array('menuaction' => 
'property.uicategory.index', 'type' => 'agreement_status') )
+                                               'url'   => 
$GLOBALS['phpgw']->link('/index.php', array('menuaction' => 
'property.uigeneric.index', 'type' => 'agreement_status') )
                                        ),
                                        'agreement_attribs'     => array
                                        (
@@ -218,7 +218,7 @@
                                        'service_agree_cats'    => array
                                        (
                                                'text'  => lang('service 
agreement categories'),
-                                               'url'   => 
$GLOBALS['phpgw']->link('/index.php', array('menuaction' => 
'property.uicategory.index', 'type' => 's_agreement') )
+                                               'url'   => 
$GLOBALS['phpgw']->link('/index.php', array('menuaction' => 
'property.uigeneric.index', 'type' => 's_agreement') )
                                        ),
                                        'service_agree_attribs' => array
                                        (
@@ -241,7 +241,7 @@
                                        );
                                        
$admin_children_location_children["category_{$location['id']}"] = array
                                        (
-                                               'url'   => 
$GLOBALS['phpgw']->link('/index.php',array('menuaction'=> 
'property.uicategory.index', 'type' => 'location', 'type_id' => 
$location['id']) ),
+                                               'url'   => 
$GLOBALS['phpgw']->link('/index.php',array('menuaction'=> 
'property.uigeneric.index', 'type' => 'location', 'type_id' => $location['id']) 
),
                                                'text'  => $location['name'] . 
' ' . lang('categories'),
                                        );
                                }
@@ -251,22 +251,22 @@
                                        'street'        => array
                                        (
                                                'text'  => lang('Street'),
-                                               'url'   => 
$GLOBALS['phpgw']->link('/index.php', array('menuaction' => 
'property.uicategory.index', 'type' => 'street') )
+                                               'url'   => 
$GLOBALS['phpgw']->link('/index.php', array('menuaction' => 
'property.uigeneric.index', 'type' => 'street') )
                                        ),
                                        'district'      => array
                                        (
                                                'text'  => lang('District'),
-                                               'url'   => 
$GLOBALS['phpgw']->link('/index.php', array('menuaction' => 
'property.uicategory.index', 'type' => 'district') )
+                                               'url'   => 
$GLOBALS['phpgw']->link('/index.php', array('menuaction' => 
'property.uigeneric.index', 'type' => 'district') )
                                        ),
                                        'district'      => array
                                        (
                                                'text'  => lang('District'),
-                                               'url'   => 
$GLOBALS['phpgw']->link('/index.php', array('menuaction' => 
'property.uicategory.index', 'type' => 'district') )
+                                               'url'   => 
$GLOBALS['phpgw']->link('/index.php', array('menuaction' => 
'property.uigeneric.index', 'type' => 'district') )
                                        ),
                                        'town'  => array
                                        (
                                                'text'  => lang('Part of town'),
-                                               'url'   => 
$GLOBALS['phpgw']->link('/index.php', array('menuaction' => 
'property.uicategory.index', 'type' => 'part_of_town') )
+                                               'url'   => 
$GLOBALS['phpgw']->link('/index.php', array('menuaction' => 
'property.uigeneric.index', 'type' => 'part_of_town') )
                                        ),
                                        'location' => array
                                        (
@@ -320,7 +320,7 @@
                                        'workorder_detail'      => array
                                        (
                                                'text'  => lang('Workorder 
Detail Categories'),
-                                               'url'   => 
$GLOBALS['phpgw']->link('/index.php', array('menuaction' => 
'property.uicategory.index', 'type' => 'wo_hours') )
+                                               'url'   => 
$GLOBALS['phpgw']->link('/index.php', array('menuaction' => 
'property.uigeneric.index', 'type' => 'wo_hours') )
                                        ),
                                        'ticket_cats'   => array
                                        (
@@ -330,7 +330,7 @@
                                        'ticket_status' => array
                                        (
                                                'text'  => lang('Ticket 
status'),
-                                               'url'   => 
$GLOBALS['phpgw']->link('/index.php', array('menuaction' => 
'property.uicategory.index', 'type' => 'ticket_status') )
+                                               'url'   => 
$GLOBALS['phpgw']->link('/index.php', array('menuaction' => 
'property.uigeneric.index', 'type' => 'ticket_status') )
                                        ),
                                        'tenant'        => array
                                        (
@@ -359,12 +359,12 @@
                                        'building_part' => array
                                        (
                                                'text'  => lang('Building 
Part'),
-                                               'url'   => 
$GLOBALS['phpgw']->link('/index.php', array('menuaction' => 
'property.uicategory.index', 'type' => 'building_part') )
+                                               'url'   => 
$GLOBALS['phpgw']->link('/index.php', array('menuaction' => 
'property.uigeneric.index', 'type' => 'building_part') )
                                        ),
                                        'tender'        => array
                                        (
                                                'text'  => lang('Tender 
chapter'),
-                                               'url'   => 
$GLOBALS['phpgw']->link('/index.php', array('menuaction' => 
'property.uicategory.index', 'type' => 'tender_chapter') )
+                                               'url'   => 
$GLOBALS['phpgw']->link('/index.php', array('menuaction' => 
'property.uigeneric.index', 'type' => 'tender_chapter') )
                                        ),
                                        'id_control'    => array
                                        (
@@ -384,64 +384,64 @@
                                        'request_status'        => array
                                        (
                                                'text'  => lang('Request 
status'),
-                                               'url'   => 
$GLOBALS['phpgw']->link('/index.php', array('menuaction' => 
'property.uicategory.index', 'type' => 'request_status') )
+                                               'url'   => 
$GLOBALS['phpgw']->link('/index.php', array('menuaction' => 
'property.uigeneric.index', 'type' => 'request_status') )
                                        ),
                                        'request_condition'     => array
                                        (
                                                'text'  => lang('Request 
condition_type'),
-                                               'url'   => 
$GLOBALS['phpgw']->link('/index.php', array('menuaction' => 
'property.uicategory.index', 'type' => 'r_condition_type') )
+                                               'url'   => 
$GLOBALS['phpgw']->link('/index.php', array('menuaction' => 
'property.uigeneric.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') )
+                                               'url'   => 
$GLOBALS['phpgw']->link('/index.php', array('menuaction' => 
'property.uigeneric.index', 'type' => 'order_dim1') )
                                        ),
                                        'workorder_status'      => array
                                        (
                                                'text'  => lang('Workorders 
status'),
-                                               'url'   => 
$GLOBALS['phpgw']->link('/index.php', array('menuaction' => 
'property.uicategory.index', 'type' => 'workorder_status') )
+                                               'url'   => 
$GLOBALS['phpgw']->link('/index.php', array('menuaction' => 
'property.uigeneric.index', 'type' => 'workorder_status') )
                                        ),
                                        'project_status'        => array
                                        (
                                                'text'  => lang('project 
status'),
-                                               'url'   => 
$GLOBALS['phpgw']->link('/index.php', array('menuaction' => 
'property.uicategory.index', 'type' => 'project_status') )
+                                               'url'   => 
$GLOBALS['phpgw']->link('/index.php', array('menuaction' => 
'property.uigeneric.index', 'type' => 'project_status') )
                                        ),
                                        'project_group' => array
                                        (
                                                'text'  => lang('project 
group'),
-                                               'url'   => 
$GLOBALS['phpgw']->link('/index.php', array('menuaction' => 
'property.uicategory.index', 'type' => 'project_group') )
+                                               'url'   => 
$GLOBALS['phpgw']->link('/index.php', array('menuaction' => 
'property.uigeneric.index', 'type' => 'project_group') )
                                        ),
                                        'agreement'     => array
                                        (
                                                'text'  => lang('Agreement'),
-                                               'url'   => 
$GLOBALS['phpgw']->link('/index.php', array('menuaction' => 
'property.uicategory.index', 'type' => 'agreement_status') ),
+                                               'url'   => 
$GLOBALS['phpgw']->link('/index.php', array('menuaction' => 
'property.uigeneric.index', 'type' => 'agreement_status') ),
                                                'image'         => array( 
'property', 'agreement' ),
                                                'children'      => 
$admin_children_agreement
                                        ),
                                        'document_status'       => array
                                        (
                                                'text'  => lang('Document 
Status'),
-                                               'url'   => 
$GLOBALS['phpgw']->link('/index.php', array('menuaction' => 
'property.uicategory.index', 'type' => 'document_status') )
+                                               'url'   => 
$GLOBALS['phpgw']->link('/index.php', array('menuaction' => 
'property.uigeneric.index', 'type' => 'document_status') )
                                        ),
                                        'unit'  => array
                                        (
                                                'text'  => lang('Unit'),
-                                               'url'   => 
$GLOBALS['phpgw']->link('/index.php', array('menuaction' => 
'property.uicategory.index', 'type' => 'unit') )
+                                               'url'   => 
$GLOBALS['phpgw']->link('/index.php', array('menuaction' => 
'property.uigeneric.index', 'type' => 'unit') )
                                        ),
                                        'key_location'  => array
                                        (
                                                'text'  => lang('Key location'),
-                                               'url'   => 
$GLOBALS['phpgw']->link('/index.php', array('menuaction' => 
'property.uicategory.index', 'type' => 'key_location') )
+                                               'url'   => 
$GLOBALS['phpgw']->link('/index.php', array('menuaction' => 
'property.uigeneric.index', 'type' => 'key_location') )
                                        ),
                                        'branch'        => array
                                        (
                                                'text'  => lang('Branch'),
-                                               'url'   => 
$GLOBALS['phpgw']->link('/index.php', array('menuaction' => 
'property.uicategory.index', 'type' => 'branch') )
+                                               'url'   => 
$GLOBALS['phpgw']->link('/index.php', array('menuaction' => 
'property.uigeneric.index', 'type' => 'branch') )
                                        ),
                                        'accounting'    => array
                                        (
                                                'text'  => lang('Accounting'),
-                                               'url'   => 
$GLOBALS['phpgw']->link('/index.php', array('menuaction' => 
'property.uicategory.index', 'type' => 'budget_account') ),
+                                               'url'   => 
$GLOBALS['phpgw']->link('/index.php', array('menuaction' => 
'property.uigeneric.index', 'type' => 'budget_account') ),
                                                'children'      => 
$admin_children_accounting
                                        ),
                                        'admin_async'   => array
@@ -457,7 +457,7 @@
                                        'event_action'  => array
                                        (
                                                'text'  => lang('event action'),
-                                               'url'   => 
$GLOBALS['phpgw']->link('/index.php', array('menuaction' => 
'property.uicategory.index', 'type' => 'event_action') )
+                                               'url'   => 
$GLOBALS['phpgw']->link('/index.php', array('menuaction' => 
'property.uigeneric.index', 'type' => 'event_action') )
                                        ),
                                        'list_functions'        => array
                                        (
@@ -472,7 +472,7 @@
                                        'responsibility_role'   => array
                                        (
                                                'text'  => lang('responsibility 
role'),
-                                               'url'   => 
$GLOBALS['phpgw']->link('/index.php', array('menuaction' => 
'property.uicategory.index', 'type' => 'responsibility_role') )
+                                               'url'   => 
$GLOBALS['phpgw']->link('/index.php', array('menuaction' => 
'property.uigeneric.index', 'type' => 'responsibility_role') )
                                        ),
                                        'responsible_matrix'    => array
                                        (
@@ -482,7 +482,7 @@
                                        'pending_action_type'   => array
                                        (
                                                'text'          => 
lang('pending action type'),
-                                               'url'   => 
$GLOBALS['phpgw']->link('/index.php', array('menuaction' => 
'property.uicategory.index', 'type' => 'pending_action_type') )
+                                               'url'   => 
$GLOBALS['phpgw']->link('/index.php', array('menuaction' => 
'property.uigeneric.index', 'type' => 'pending_action_type') )
                                        )
                                );
                        }
@@ -614,7 +614,7 @@
                                (
                                        'order_template' => array
                                        (       
-                                               'url'   => 
$GLOBALS['phpgw']->link('/index.php', array('menuaction' => 
'property.uicategory.index', 'type' => 'order_template') ),
+                                               'url'   => 
$GLOBALS['phpgw']->link('/index.php', array('menuaction' => 
'property.uigeneric.index', 'type' => 'order_template') ),
                                                'text'  => lang('order 
template'),
                                                'image'         => 
array('property', 'helpdesk')
                                        )
@@ -722,7 +722,7 @@
                                                'budget_account'        => array
                                                (
                                                        'text'  => lang('budget 
account'),
-                                                       'url'   => 
$GLOBALS['phpgw']->link('/index.php', array('menuaction' => 
'property.uicategory.index', 'type' => 'budget_account') )
+                                                       'url'   => 
$GLOBALS['phpgw']->link('/index.php', array('menuaction' => 
'property.uigeneric.index', 'type' => 'budget_account') )
                                                ),
                                                'vendor'        => array
                                                (

Copied: trunk/property/inc/class.sogeneric.inc.php (from rev 6612, 
trunk/property/inc/class.socategory.inc.php)
===================================================================
--- trunk/property/inc/class.sogeneric.inc.php                          (rev 0)
+++ trunk/property/inc/class.sogeneric.inc.php  2010-11-17 21:51:15 UTC (rev 
6613)
@@ -0,0 +1,1858 @@
+<?php
+       /**
+       * phpGroupWare - property: a Facilities Management System.
+       *
+       * @author Sigurd Nes <address@hidden>
+       * @copyright Copyright (C) 2003,2004,2005,2006,2007,2008,2009 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_sogeneric
+       {
+               var $type;
+               var $type_id;
+               var $location_info = array();
+
+               function __construct()
+               {
+                       $this->account  = 
$GLOBALS['phpgw_info']['user']['account_id'];
+                       $this->custom   = 
createObject('property.custom_fields');
+                       $this->_db              = & $GLOBALS['phpgw']->db;
+                       $this->_like    = & $this->_db->like;
+                       $this->_join    = & $this->_db->join;
+               }
+
+               function read($data, $filter)
+               {
+                       $start          = isset($data['start']) && 
$data['start'] ? $data['start']:0;
+                       $query          = 
isset($data['query'])?$data['query']:'';
+                       $sort           = isset($data['sort']) && $data['sort'] 
? $data['sort']:'DESC';
+                       $order          = 
isset($data['order'])?$data['order']:'';
+                       $allrows        = 
isset($data['allrows'])?$data['allrows']:'';
+
+                       $values = array();
+                       if (!isset($this->location_info['table']) || !$table = 
$this->location_info['table'])
+                       {
+                               return $values;
+                       }
+
+/*
+                       $valid_order = false;
+
+                       if($order)
+                       {
+                               if($this->location_info['id']['name'] != $order)
+                               {
+
+                                       foreach ($this->location_info['fields'] 
as $field)
+                                       {
+                                               if($field['name'] == $order)
+                                               {
+                                                       $valid_order = true;
+                                                       break;
+                                               }
+                                       }       
+                               }
+                               else
+                               {
+                                       $valid_order = true;
+                               }
+
+                               if(!$valid_order)
+                               {
+//                                     $order = '';
+                               }                       
+                       }
+*/
+                       $_filter_array = array();
+                       $get_single = array();
+                       foreach ( $this->location_info['fields'] as $field )
+                       {
+                               if (isset($field['filter']) && $field['filter'])
+                               {
+                                       if(isset($filter[$field['name']]) && 
$filter[$field['name']] && $field['type'] == 'multiple_select')
+                                       {
+                                               $_filter_array[] = 
"{$field['name']} {$this->_like} '%,{$filter[$field['name']]},%'";
+                                       }
+                                       else if(isset($filter[$field['name']]) 
&& $filter[$field['name']])
+                                       {
+                                               $_filter_array[] = 
"{$field['name']} = '{$filter[$field['name']]}'";                               
     
+                                       }
+                               }
+                               if (isset($field['get_single']) && 
$field['get_single'])
+                               {
+                                       $get_single[$field['name']] = 
$field['get_single'];
+                               }
+                       }
+
+                       $uicols = array();
+                       $uicols['input_type'][]         = 'text';
+                       $uicols['name'][]                       = 
$this->location_info['id']['name'];
+                       $uicols['descr'][]                      = lang('id');
+                       $uicols['datatype'][]           = 
$this->location_info['id']['type'] == 'varchar' ? 'V' : 'I';
+                       $uicols['sortable'][]           = true;
+
+                       foreach($this->location_info['fields'] as $field)
+                       {
+                               $uicols['input_type'][]         = 
isset($field['hidden']) && $field['hidden'] ? 'hidden' : 'text';
+                               $uicols['name'][]                       = 
$field['name'];
+                               $uicols['descr'][]                      = 
$field['descr'];
+                               $uicols['datatype'][]           = 'V';
+                               $uicols['sortable'][]           = 
isset($field['sortable']) && $field['sortable'] ? true : false;
+                       }
+
+                       
if($GLOBALS['phpgw']->locations->get_attrib_table('property', 
$this->location_info['acl_location']))
+                       {
+                               $choice_table = 'phpgw_cust_choice';
+                               $attribute_table = 'phpgw_cust_attribute';
+                               $location_id = 
$GLOBALS['phpgw']->locations->get_id('property', 
$this->location_info['acl_location']);
+                               $attribute_filter = " location_id = 
{$location_id}";
+
+                               $user_columns = 
isset($GLOBALS['phpgw_info']['user']['preferences']['property']["generic_columns_{$this->type}_{$this->type_id}"])?$GLOBALS['phpgw_info']['user']['preferences']['property']["generic_columns_{$this->type}_{$this->type_id}"]:'';
+
+                               $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");
+
+                               $i      = count($uicols['name']);
+                               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'][$i]         = 
$this->_db->f('datatype');
+                                       $uicols['attib_id'][$i]         = 
$this->_db->f('id');
+                                       $cols_return_extra[]= array(
+                                               'name'  => 
$this->_db->f('column_name'),
+                                               'datatype'      => 
$this->_db->f('datatype'),
+                                               'attrib_id'     => 
$this->_db->f('id')
+                                       );
+
+                                       $i++;
+                               }
+                       }
+
+                       $where = 'WHERE';
+                       $filtermethod = '';
+                       if(isset($this->location_info['check_grant']) && 
$this->location_info['check_grant'])
+                       {
+                               $filtermethod = "{$where} user_id = 
{$this->account} OR public = 1";
+                               $where = 'AND';
+                       }
+
+                       if($_filter_array)
+                       {
+                               $filtermethod .= " $where " . implode(' AND ', 
$_filter_array);
+                               $where = 'AND';
+                       }
+
+                       $this->uicols = $uicols;
+
+                       if ($order)
+                       {
+                               $ordermethod = " ORDER BY {$table}.{$order} 
{$sort}";
+                       }
+                       else
+                       {
+                               $ordermethod = " ORDER BY 
{$table}.{$this->location_info['id']['name']} ASC";
+                       }
+
+                       if($query)
+                       {
+                               if($this->location_info['id']['type']=='auto' 
|| $this->location_info['id']['type']=='int')
+                               {
+                                       $id_query = (int) $query;
+                               }
+                               else
+                               {
+                                       $id_query = "'{$query}'";
+                               }
+                               $query = $this->_db->db_addslashes($query);
+                               $querymethod = " {$where } 
({$table}.{$this->location_info['id']['name']} = {$id_query}";
+//_debug_array($filtermethod);
+//_debug_array($where);die();
+
+                               foreach($this->location_info['fields'] as 
$field)
+                               {
+                                       if($field['type'] == 'varchar')
+                                       {
+                                               $querymethod .= " OR 
{$table}.{$field['name']} $this->_like '%$query%'";
+                                       }
+                                       $where = 'OR';
+                               }
+                               $querymethod .= ')';
+
+                               $_querymethod = array();
+
+                               $this->_db->query("SELECT * FROM 
$attribute_table WHERE $attribute_filter AND search='1'",__LINE__,__FILE__);
+
+                               while ($this->_db->next_record())
+                               {
+                                       if($this->_db->f('datatype')=='V' || 
$this->_db->f('datatype')=='email' || $this->_db->f('datatype')=='CH'):
+                                       {
+                                               $_querymethod[]= "$table." . 
$this->_db->f('column_name') . " {$this->_like} '%{$query}%'";
+                                       }
+                                       elseif($this->_db->f('datatype')=='I'):
+                                       {
+                                               if(ctype_digit($query))
+                                               {
+                                                       $_querymethod[]= 
"$table." . $this->_db->f('column_name') . '=' . (int)$query;
+                                               }
+                                       }
+                                       else:
+                                       {
+                                               $_querymethod[]= "$table." . 
$this->_db->f('column_name') . " = '$query'";
+                                       }
+                                       endif;
+                               }
+
+                               if (isset($_querymethod) AND 
is_array($_querymethod))
+                               {
+                                       $querymethod .= " $where (" . implode 
(' OR ',$_querymethod) . ')';
+                               }
+
+                       }
+
+                       $sql = "SELECT * FROM $table $filtermethod 
$querymethod";
+
+                       $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__);
+                       }
+
+                       $cols_return = $uicols['name'];
+                       $j=0;
+
+                       $dataset = array();
+                       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++;
+                       }
+
+                       $values = $this->custom->translate_value($dataset, 
$location_id);
+
+                       if($get_single)
+                       {
+                               foreach($values as $set => &$entry)
+                               {
+                                       foreach ($entry as $field => &$value)
+                                       {
+                                               foreach ($get_single as $key => 
$method)
+                                               {
+                                                       if($field == $key)
+                                                       {
+                                                               switch ($method)
+                                                               {
+                                                                       case 
'get_user':
+                                                                               
if($value)
+                                                                               
{
+                                                                               
        $value = $GLOBALS['phpgw']->accounts->get($value)->__toString();
+                                                                               
}
+                                                                               
break;
+                                                                       default:
+                                                                       // 
nothing
+                                                               }
+                                                       }
+                                               }
+                                       }
+                               }
+                       }
+                       return $values;
+               }
+
+
+               function get_location_info($type,$type_id)
+               {
+                       $type_id                = (int)$type_id;
+                       $this->type             = $type;
+                       $this->type_id  = $type_id;
+
+                       $info = array();
+                       switch($type)
+                       {
+//-------- ID type integer
+                               case 'part_of_town':
+                                       $info = array
+                                       (
+                                               'table'                         
=> 'fm_part_of_town',
+                                               'id'                            
=> array('name' => 'part_of_town_id', 'type' => 'int', 'descr' => lang('id')),
+                                               'fields'                        
=> array
+                                               (
+                                                       array
+                                                       (
+                                                               'name' => 
'name',
+                                                               'descr' => 
lang('name'),
+                                                               'type' => 
'varchar',
+                                                               'nullable'      
=> false,
+                                                               'size'          
=> 20
+                                                       ),
+                                                       array
+                                                       (
+                                                               'name'          
        => 'district_id',
+                                                               'descr'         
        => lang('district'),
+                                                               'type'          
        => 'select',
+                                                               'nullable'      
        => false,
+                                                               'filter'        
        => true,
+                                                               'values_def'    
=> array
+                                                               (
+                                                                       
'valueset'              => false,
+                                                                       
'method'                => 'property.bogeneric.get_list',
+                                                                       
'method_input'  => array('type' => 'district',  'selected' => '##district_id##')
+                                                               )
+                                                       ),
+                                               ),
+                                               'edit_msg'                      
=> lang('edit'),
+                                               'add_msg'                       
=> lang('add'),
+                                               'name'                          
=> lang('part of town'),
+                                               'acl_location'          => 
'.admin',
+                                               'menu_selection'        => 
'admin::property::location::town',
+/*
+                                               'default'                       
=> array
+                                               (
+                                                       'user_id'               
=> array('add'  => '$this->account'),
+                                                       'entry_date'    => 
array('add'  => 'time()'),
+                                                       'modified_date' => 
array('edit' => 'time()'),
+                                               ),
+*/
+                                               'check_grant'           => false
+                                       );
+
+                                       break;
+
+                               case 'project_group':
+                                       $info = array
+                                       (
+                                               'table' => 'fm_project_group',
+                                               'id'                            
=> array('name' => 'id', 'type' => 'int'),
+                                               'fields'                        
=> array
+                                               (
+                                                       array
+                                                       (
+                                                               'name' => 
'descr',
+                                                               'descr' => 
lang('descr'),
+                                                               'type' => 
'varchar'
+                                                       )
+                                               ),
+                                               'edit_msg'      => lang('edit'),
+                                               'add_msg'       => lang('add'),
+                                               'name'          => '',
+                                               'acl_location' => '.admin',
+                                               'menu_selection' => 
'admin::property::project_group'
+                                       );
+                                       break;
+                               case 'dimb':
+                                       $info = array
+                                       (
+                                               'table' => 'fm_ecodimb',
+                                               'id'                            
=> array('name' => 'id', 'type' => 'int'),
+                                               'fields'                        
=> array
+                                               (
+                                                       array
+                                                       (
+                                                               'name' => 
'descr',
+                                                               'descr' => 
lang('descr'),
+                                                               'type' => 
'varchar'
+                                                       )
+                                               ),
+                                               'edit_msg'      => lang('edit'),
+                                               'add_msg'       => lang('add'),
+                                               'name'          => lang('dimb'),
+                                               'acl_location' => '.admin',
+                                               'menu_selection' => 
'admin::property::accounting::accounting_dimb'
+                                       );
+                                       break;
+                               case 'dimd':
+                                       $info = array
+                                       (
+                                               'table' => 'fm_ecodimd',
+                                               'id'                            
=> array('name' => 'id', 'type' => 'int'),
+                                               'fields'                        
=> array
+                                               (
+                                                       array
+                                                       (
+                                                               'name' => 
'descr',
+                                                               'descr' => 
lang('descr'),
+                                                               'type' => 
'varchar'
+                                                       )
+                                               ),
+                                               'edit_msg'      => lang('edit'),
+                                               'add_msg'       => lang('add'),
+                                               'name'          => lang('dimd'),
+                                               'acl_location' => '.admin',
+                                               'menu_selection' => 
'admin::property::accounting::accounting_dimd'
+                                       );
+                                       break;
+                               case 'tax':
+                                       $info = array
+                                       (
+                                               'table' => 'fm_ecomva',
+                                               'id'                            
=> array('name' => 'id', 'type' => 'int'),
+                                               'fields'                        
=> array
+                                               (
+                                                       array
+                                                       (
+                                                               'name' => 
'descr',
+                                                               'descr' => 
lang('descr'),
+                                                               'type' => 
'varchar'
+                                                       )
+                                               ),
+                                               'edit_msg'      => lang('edit'),
+                                               'add_msg'       => lang('add'),
+                                               'name'          => '',
+                                               'acl_location' => '.admin',
+                                               'menu_selection' => 
'admin::property::accounting::accounting_tax'
+                                       );
+                                       break;
+                               case 'voucher_cat':
+                                       $info = array
+                                       (
+                                               'table' => 
'fm_ecobilag_category',
+                                               'id'                            
=> array('name' => 'id', 'type' => 'int'),
+                                               'fields'                        
=> array
+                                               (
+                                                       array
+                                                       (
+                                                               'name' => 
'descr',
+                                                               'descr' => 
lang('descr'),
+                                                               'type' => 
'varchar'
+                                                       )
+                                               ),
+                                               'edit_msg'      => lang('edit'),
+                                               'add_msg'       => lang('add'),
+                                               'name'          => '',
+                                               'acl_location' => '.admin',
+                                               'menu_selection' => 
'admin::property::accounting::voucher_cats'
+                                       );
+                                       break;
+                               case 'voucher_type':
+                                       $info = array
+                                       (
+                                               'table' => 'fm_ecoart',
+                                               'id'                            
=> array('name' => 'id', 'type' => 'int'),
+                                               'fields'                        
=> array
+                                               (
+                                                       array
+                                                       (
+                                                               'name' => 
'descr',
+                                                               'descr' => 
lang('descr'),
+                                                               'type' => 
'varchar'
+                                                       )
+                                               ),
+                                               'edit_msg'      => lang('edit'),
+                                               'add_msg'       => lang('add'),
+                                               'name'          => '',
+                                               'acl_location' => '.admin',
+                                               'menu_selection' => 
'admin::property::accounting::voucher_type'
+                                       );
+                                       break;
+                               case 'tender_chapter':
+                                       $info = array
+                                       (
+                                               'table' => 'fm_chapter',
+                                               'id'                            
=> array('name' => 'id', 'type' => 'int'),
+                                               'fields'                        
=> array
+                                               (
+                                                       array
+                                                       (
+                                                               'name' => 
'descr',
+                                                               'descr' => 
lang('descr'),
+                                                               'type' => 
'varchar'
+                                                       )
+                                               ),
+                                               'edit_msg'      => lang('edit'),
+                                               'add_msg'       => lang('add'),
+                                               'name'          => '',
+                                               'acl_location' => '.admin',
+                                               'menu_selection' => 
'admin::property::tender'
+                                       );
+                                       break;
+                               case 'location':
+
+                                       $this->_db->query("SELECT id FROM 
fm_location_type WHERE id ={$type_id}",__LINE__,__FILE__);
+
+                                       if($this->_db->next_record())
+                                       {
+                                               $info = array
+                                               (
+                                                       'table' => 
"fm_location{$type_id}_category",
+                                                       'id'                    
        => array('name' => 'id', 'type' => 'varchar'),
+                                                       'fields'                
        => array
+                                                       (
+                                                               array
+                                                               (
+                                                                       'name' 
=> 'descr',
+                                                                       'descr' 
=> lang('descr'),
+                                                                       'type' 
=> 'varchar'
+                                                               )
+                                                       ),
+                                                       'edit_msg'      => 
lang('edit'),
+                                                       'add_msg'       => 
lang('add'),
+                                                       'name'          => '',
+                                                       'acl_location' => 
'.admin',
+                                                       'menu_selection' => 
"admin::property::location::location::category_{$type_id}"
+                                               );
+                                       }
+                                       else
+                                       {
+                                               throw new 
Exception(lang('ERROR: illegal type %1', $type_id));
+                                       }
+                                       break;
+                               case 'owner_cats':
+                                       $info = array
+                                       (
+                                               'table' => 'fm_owner_category',
+                                               'id'                            
=> array('name' => 'id', 'type' => 'int'),
+                                               'fields'                        
=> array
+                                               (
+                                                       array
+                                                       (
+                                                               'name' => 
'descr',
+                                                               'descr' => 
lang('descr'),
+                                                               'type' => 
'varchar'
+                                                       )
+                                               ),
+                                               'edit_msg'      => lang('edit'),
+                                               'add_msg'       => lang('add'),
+                                               'name'          => '',
+                                               'acl_location' => '.admin',
+                                               'menu_selection' => 
'admin::property::owner::owner_cats'
+                                       );
+                                       break;
+                               case 'tenant_cats':
+                                       $info = array
+                                       (
+                                               'table' => 'fm_tenant_category',
+                                               'id'                            
=> array('name' => 'id', 'type' => 'int'),
+                                               'fields'                        
=> array
+                                               (
+                                                       array
+                                                       (
+                                                               'name' => 
'descr',
+                                                               'descr' => 
lang('descr'),
+                                                               'type' => 
'varchar'
+                                                       )
+                                               ),
+                                               'edit_msg'      => lang('edit'),
+                                               'add_msg'       => lang('add'),
+                                               'name'          => lang('tenant 
category'),
+                                               'acl_location' => '.admin',
+                                               'menu_selection' => 
'admin::property::tenant::tenant_cats'
+                                       );
+                                       break;
+                               case 'vendor_cats':
+                                       $info = array
+                                       (
+                                               'table' => 'fm_vendor_category',
+                                               'id'                            
=> array('name' => 'id', 'type' => 'int'),
+                                               'fields'                        
=> array
+                                               (
+                                                       array
+                                                       (
+                                                               'name' => 
'descr',
+                                                               'descr' => 
lang('descr'),
+                                                               'type' => 
'varchar'
+                                                       )
+                                               ),
+                                               'edit_msg'      => lang('edit'),
+                                               'add_msg'       => lang('add'),
+                                               'name'          => lang('vendor 
category'),
+                                               'acl_location' => '.admin',
+                                               'menu_selection' => 
'admin::property::vendor::vendor_cats'
+                                       );
+                                       break;
+                               case 'vendor':
+                                       $info = array
+                                       (
+                                               'table'                         
=> 'fm_vendor',
+                                               'id'                            
=> array('name' => 'id', 'type' => 'int'),
+                                               'fields'                        
=> array
+                                               (
+                                                       array
+                                                       (
+                                                               'name' => 
'contact_phone',
+                                                               'descr' => 
lang('contact phone'),
+                                                               'type' => 
'varchar'
+                                                       ),
+                                                       array
+                                                       (
+                                                               'name'          
        => 'category',
+                                                               'descr'         
        => lang('category'),
+                                                               'type'          
        => 'select',
+                                                               'nullable'      
        => false,
+                                                               'filter'        
        => true,
+                                                               'sortable'      
=> true,
+                                                               'values_def'    
=> array
+                                                               (
+                                                                       
'valueset'              => false,
+                                                                       
'method'                => 'property.bogeneric.get_list',
+                                                                       
'method_input'  => array('type' => 'vendor_cats',       'selected' => 
'##category##')
+                                                               )
+                                                       ),
+                                                       array
+                                                       (
+                                                               //FIXME
+                                                               'name'          
        => 'member_of',
+                                                               'descr'         
        => lang('member'),
+                                                               'type'          
        => 'multiple_select',
+                                                               'nullable'      
        => false,
+                                                               'filter'        
        => true,
+                                                               'sortable'      
        => false,
+                                                               'hidden'        
        => true,
+                                                               'values_def'    
=> array
+                                                               (
+                                                                       
'valueset'              => false,
+                                                                       
'method'                => 'property.bocommon.get_categories',
+                                                                       
'method_input'  => array('app' => 'property', 'acl_location' => '.vendor',      
'selected' => '##member_of##')
+                                                               )
+                                                       ),
+                                               ),
+                                               'edit_msg'      => lang('edit'),
+                                               'add_msg'       => lang('add'),
+                                               'name'          => 
lang('vendor'),
+                                               'acl_location' => '.vendor',
+                                               'menu_selection' => 
'property::invoice::vendor',
+                                               'default'                       
=> array
+                                               (
+                                                       'owner_id'              
=> array('add'  => '$this->account'),
+                                                       'entry_date'    => 
array('add'  => 'time()'),
+                               //                      'modified_date' => 
array('edit' => 'time()'),
+                                               )
+
+                                       );
+                                       break;
+                               case 'owner':
+                                       $info = array
+                                       (
+                                               'table'                         
=> 'fm_owner',
+                                               'id'                            
=> array('name' => 'id', 'type' => 'int'),
+                                               'fields'                        
=> array
+                                               (
+                                                       array
+                                                       (
+                                                               'name' => 
'remark',
+                                                               'descr' => 
lang('remark'),
+                                                               'type' => 'text'
+                                                       ),
+                                                       array
+                                                       (
+                                                               'name'          
        => 'category',
+                                                               'descr'         
        => lang('category'),
+                                                               'type'          
        => 'select',
+                                                               'nullable'      
        => false,
+                                                               'filter'        
        => true,
+                                                               'sortable'      
=> true,
+                                                               'values_def'    
=> array
+                                                               (
+                                                                       
'valueset'              => false,
+                                                                       
'method'                => 'property.bogeneric.get_list',
+                                                                       
'method_input'  => array('type' => 'owner_cats',        'selected' => 
'##category##')
+                                                               )
+                                                       ),
+                                               ),
+                                               'edit_msg'      => lang('edit'),
+                                               'add_msg'       => lang('add'),
+                                               'name'          => 
lang('owner'),
+                                               'acl_location' => '.owner',
+                                               'menu_selection' => 
'admin::property::owner',
+                                               'default'                       
=> array
+                                               (
+                                                       'owner_id'              
=> array('add'  => '$this->account'),
+                                                       'entry_date'    => 
array('add'  => 'time()'),
+                               //                      'modified_date' => 
array('edit' => 'time()'),
+                                               )
+
+                                       );
+                                       break;
+                               case 'tenant':
+                                       $info = array
+                                       (
+                                               'table'                         
=> 'fm_tenant',
+                                               'id'                            
=> array('name' => 'id', 'type' => 'int'),
+                                               'fields'                        
=> array
+                                               (
+                                                       array
+                                                       (
+                                                               'name' => 
'contact_email',
+                                                               'descr' => 
lang('contact_email'),
+                                                               'type' => 
'varchar',
+                                                               'sortable'      
=> true,
+                                                       ),
+                                                       array
+                                                       (
+                                                               'name'          
        => 'category',
+                                                               'descr'         
        => lang('category'),
+                                                               'type'          
        => 'select',
+                                                               'nullable'      
        => false,
+                                                               'filter'        
        => true,
+                                                               'sortable'      
=> true,
+                                                               'values_def'    
=> array
+                                                               (
+                                                                       
'valueset'              => false,
+                                                                       
'method'                => 'property.bogeneric.get_list',
+                                                                       
'method_input'  => array('type' => 'tenant_cats',       'selected' => 
'##category##')
+                                                               )
+                                                       )
+                                               ),
+                                               'edit_msg'      => lang('edit'),
+                                               'add_msg'       => lang('add'),
+                                               'name'          => 
lang('tenant'),
+                                               'acl_location' => '.tenant',
+                                               'menu_selection' => 
'admin::property::tenant',
+                                               'default'                       
=> array
+                                               (
+                                                       'owner_id'              
=> array('add'  => '$this->account'),
+                                                       'entry_date'    => 
array('add'  => 'time()'),
+                               //                      'modified_date' => 
array('edit' => 'time()'),
+                                               )
+
+                                       );
+                                       break;
+                               case 'district':
+                                       $info = array
+                                       (
+                                               'table' => 'fm_district',
+                                               'id'                            
=> array('name' => 'id', 'type' => 'int'),
+                                               'fields'                        
=> array
+                                               (
+                                                       array
+                                                       (
+                                                               'name' => 
'descr',
+                                                               'descr' => 
lang('descr'),
+                                                               'type' => 
'varchar'
+                                                       )
+                                               ),
+                                               'edit_msg'      => lang('edit'),
+                                               'add_msg'       => lang('add'),
+                                               'name'          => 
lang('district'),
+                                               'acl_location' => '.admin',
+                                               'menu_selection' => 
'admin::property::location::district'
+                                       );
+                                       break;
+                               case 'street':
+                                       $info = array
+                                       (
+                                               'table' => 'fm_streetaddress',
+                                               'id'                            
=> array('name' => 'id', 'type' => 'int'),
+                                               'fields'                        
=> array
+                                               (
+                                                       array
+                                                       (
+                                                               'name' => 
'descr',
+                                                               'descr' => 
lang('descr'),
+                                                               'type' => 
'varchar'
+                                                       )
+                                               ),
+                                               'edit_msg'      => lang('edit'),
+                                               'add_msg'       => lang('add'),
+                                               'name'          => 
lang('streetaddress'),
+                                               'acl_location' => '.admin',
+                                               'menu_selection' => 
'admin::property::location::street'
+                                       );
+                                       break;
+                               case 's_agreement':
+                                       $info = array
+                                       (
+                                               'table' => 
'fm_s_agreement_category',
+                                               'id'                            
=> array('name' => 'id', 'type' => 'int'),
+                                               'fields'                        
=> array
+                                               (
+                                                       array
+                                                       (
+                                                               'name' => 
'descr',
+                                                               'descr' => 
lang('descr'),
+                                                               'type' => 
'varchar'
+                                                       )
+                                               ),
+                                               'edit_msg'      => lang('edit'),
+                                               'add_msg'       => lang('add'),
+                                               'name'          => '',
+                                               'acl_location' => '.admin',
+                                               'menu_selection' => 
'admin::property::agreement::service_agree_cats'
+                                       );
+                                       break;
+                               case 'tenant_claim':
+                                       $info = array
+                                       (
+                                               'table' => 
'fm_tenant_claim_category',
+                                               'id'                            
=> array('name' => 'id', 'type' => 'int'),
+                                               'fields'                        
=> array
+                                               (
+                                                       array
+                                                       (
+                                                               'name' => 
'descr',
+                                                               'descr' => 
lang('descr'),
+                                                               'type' => 
'varchar'
+                                                       )
+                                               ),
+                                               'edit_msg'      => lang('edit'),
+                                               'add_msg'       => lang('add'),
+                                               'name'          => '',
+                                               'acl_location' => '.admin',
+                                               'menu_selection' => 
'admin::property::tenant::claims_cats'
+                                       );
+                                       break;
+                               case 'wo_hours':
+                                       $info = array
+                                       (
+                                               'table' => 
'fm_wo_hours_category',
+                                               'id'                            
=> array('name' => 'id', 'type' => 'int'),
+                                               'fields'                        
=> array
+                                               (
+                                                       array
+                                                       (
+                                                               'name' => 
'descr',
+                                                               'descr' => 
lang('descr'),
+                                                               'type' => 
'varchar'
+                                                       )
+                                               ),
+                                               'edit_msg'      => lang('edit'),
+                                               'add_msg'       => lang('add'),
+                                               'name'          => '',
+                                               'acl_location' => '.admin',
+                                               'menu_selection' => 
'admin::property::workorder_detail'
+                                       );
+                                       break;
+                               case 'r_condition_type':
+                                       $info = array
+                                       (
+                                               'table' => 
'fm_request_condition_type',
+                                               'id'                            
=> array('name' => 'id', 'type' => 'int'),
+                                               'fields'                        
=> array
+                                               (
+                                                       array
+                                                       (
+                                                               'name' => 
'descr',
+                                                               'descr' => 
lang('descr'),
+                                                               'type' => 
'varchar'
+                                                       )
+                                               ),
+                                               'edit_msg'      => lang('edit'),
+                                               'add_msg'       => lang('add'),
+                                               'name'          => '',
+                                               'acl_location' => '.admin',
+                                               'menu_selection' => 
'admin::property::request_condition'
+                                       );
+                                       break;
+                               case 'b_account':
+                                       $info = array
+                                       (
+                                               'table' => 
'fm_b_account_category',
+                                               'id'                            
=> array('name' => 'id', 'type' => 'int'),
+                                               'fields'                        
=> array
+                                               (
+                                                       array
+                                                       (
+                                                               'name' => 
'descr',
+                                                               'descr' => 
lang('descr'),
+                                                               'type' => 
'varchar'
+                                                       )
+                                               ),
+                                               'edit_msg'      => lang('edit'),
+                                               'add_msg'       => lang('add'),
+                                               'name'          => lang('budget 
account'),
+                                               'acl_location' => '.admin',
+                                               'menu_selection' => 
'admin::property::accounting::accounting_cats'
+                                       );
+                                       break;
+//-------- ID type varchar
+                               case 'project_status':
+                                       $info = array
+                                       (
+                                               'table'                         
=> 'fm_project_status',
+                                               'id'                            
=> array('name' => 'id', 'type' => 'varchar'),
+                                               'fields'                        
=> array
+                                               (
+                                                       array
+                                                       (
+                                                               'name' => 
'descr',
+                                                               'descr' => 
lang('descr'),
+                                                               'type' => 
'varchar'
+                                                       ),
+                                                       array
+                                                       (
+                                                               'name' => 
'approved',
+                                                               'descr' => 
lang('approved'),
+                                                               'type' => 
'checkbox'
+                                                       ),
+                                                       array
+                                                       (
+                                                               'name' => 
'closed',
+                                                               'descr' => 
lang('closed'),
+                                                               'type' => 
'checkbox'
+                                                       )
+                                               ),
+                                               'edit_msg'                      
=> lang('edit status'),
+                                               'add_msg'                       
=> lang('add status'),
+                                               'name'                          
=> lang('project status'),
+                                               'acl_location'          => 
'.admin',
+                                               'menu_selection'        => 
'admin::property::project_status'
+                                       );
+                                       break;
+                               case 'workorder_status':
+                                       $info = array
+                                       (
+                                               'table'                         
=> 'fm_workorder_status',
+                                               'id'                            
=> array('name' => 'id', 'type' => 'varchar'),
+                                               'fields'                        
=> array
+                                               (
+                                                       array
+                                                       (
+                                                               'name' => 
'descr',
+                                                               'descr' => 
lang('descr'),
+                                                               'type' => 
'varchar'
+                                                       ),
+                                                       array
+                                                       (
+                                                               'name' => 
'approved',
+                                                               'descr' => 
lang('approved'),
+                                                               'type' => 
'checkbox'
+                                                       ),
+                                                       array
+                                                       (
+                                                               'name' => 
'in_progress',
+                                                               'descr' => 
lang('In progress'),
+                                                               'type' => 
'checkbox'
+                                                       ),
+                                                       array
+                                                       (
+                                                               'name' => 
'delivered',
+                                                               'descr' => 
lang('delivered'),
+                                                               'type' => 
'checkbox'
+                                                       ),
+                                                       array
+                                                       (
+                                                               'name' => 
'closed',
+                                                               'descr' => 
lang('closed'),
+                                                               'type' => 
'checkbox'
+                                                       )
+                                               ),
+                                               'edit_msg'                      
=> lang('edit status'),
+                                               'add_msg'                       
=> lang('add status'),
+                                               'name'                          
=> lang('workorder status'),
+                                               'acl_location'          => 
'.admin',
+                                               'menu_selection'        => 
'admin::property::workorder_status'
+                                       );
+                                       break;
+                               case 'request_status':
+                                       $info = array
+                                       (
+                                               'table'                         
=> 'fm_request_status',
+                                               'id'                            
=> array('name' => 'id', 'type' => 'varchar'),
+                                               'fields'                        
=> array
+                                               (
+                                                       array
+                                                       (
+                                                               'name' => 
'descr',
+                                                               'descr' => 
lang('descr'),
+                                                               'type' => 
'varchar'
+                                                       )
+                                               ),
+                                               'edit_msg'                      
=> lang('edit status'),
+                                               'add_msg'                       
=> lang('add status'),
+                                               'name'                          
=> lang('request status'),
+                                               'acl_location'          => 
'.admin',
+                                               'menu_selection'        => 
'admin::property::request_status'
+                                       );
+                                       break;
+                               case 'agreement_status':
+                                       $info = array
+                                       (
+                                               'table'                         
=> 'fm_agreement_status',
+                                               'id'                            
=> array('name' => 'id', 'type' => 'varchar'),
+                                               'fields'                        
=> array
+                                               (
+                                                       array
+                                                       (
+                                                               'name' => 
'descr',
+                                                               'descr' => 
lang('descr'),
+                                                               'type' => 
'varchar'
+                                                       )
+                                               ),
+                                               'edit_msg'                      
=> lang('edit status'),
+                                               'add_msg'                       
=> lang('add status'),
+                                               'name'                          
=> lang('agreement status'),
+                                               'acl_location'          => 
'.admin',
+                                               'menu_selection'        => 
'admin::property::agreement::agreement_status'
+                                       );
+                                       break;
+                               case 'building_part':
+                                       $info = array
+                                       (
+                                               'table'                         
=> 'fm_building_part',
+                                               'id'                            
=> array('name' => 'id', 'type' => 'varchar'),
+                                               'fields'                        
=> array
+                                               (
+                                                       array
+                                                       (
+                                                               'name' => 
'descr',
+                                                               'descr' => 
lang('descr'),
+                                                               'type' => 
'varchar'
+                                                       )
+                                               ),
+                                               'edit_msg'                      
=> lang('edit'),
+                                               'add_msg'                       
=> lang('add'),
+                                               'name'                          
=> lang('building part'),
+                                               'acl_location'          => 
'.admin',
+                                               'menu_selection'        => 
'admin::property::building_part'
+                                       );
+                                       break;
+                               case 'document_status':
+                                       $info = array
+                                       (
+                                               'table'                         
=> 'fm_document_status',
+                                               'id'                            
=> array('name' => 'id', 'type' => 'varchar'),
+                                               'fields'                        
=> array
+                                               (
+                                                       array
+                                                       (
+                                                               'name' => 
'descr',
+                                                               'descr' => 
lang('descr'),
+                                                               'type' => 
'varchar'
+                                                       )
+                                               ),
+                                               'edit_msg'                      
=> lang('edit status'),
+                                               'add_msg'                       
=> lang('add status'),
+                                               'name'                          
=> lang('document status'),
+                                               'acl_location'          => 
'.admin',
+                                               'menu_selection'        => 
'admin::property::document_status'
+                                       );
+                                       break;
+                               case 'unit':
+                                       $info = array
+                                       (
+                                               'table'                         
=> 'fm_standard_unit',
+                                               'id'                            
=> array('name' => 'id', 'type' => 'varchar'),
+                                               'fields'                        
=> array
+                                               (
+                                                       array
+                                                       (
+                                                               'name' => 
'descr',
+                                                               'descr' => 
lang('descr'),
+                                                               'type' => 
'varchar'
+                                                       )
+                                               ),
+                                               'edit_msg'                      
=> lang('edit unit'),
+                                               'add_msg'                       
=> lang('add unit'),
+                                               'name'                          
=> lang('unit'),
+                                               'acl_location'          => 
'.admin',
+                                               'menu_selection'        => 
'admin::property::unit'
+                                       );
+                                       break;
+                               case 'budget_account':
+                                       $info = array
+                                       (
+                                               'table'                         
=> 'fm_b_account',
+                                               'id'                            
=> array('name' => 'id', 'type' => 'varchar'),
+                                               'fields'                        
=> array
+                                               (
+                                                       array
+                                                       (
+                                                               'name' => 
'descr',
+                                                               'descr' => 
lang('descr'),
+                                                               'type' => 
'varchar',
+                                                               'nullable'      
=> false,
+                                                               'size'          
=> 60,
+                                                               'sortable'      
=> true
+                                                       ),
+                                                       array
+                                                       (
+                                                               'name'          
        => 'category',
+                                                               'descr'         
        => lang('category'),
+                                                               'type'          
        => 'select',
+                                                               'nullable'      
        => false,
+                                                               'filter'        
        => true,
+                                                               'sortable'      
=> true,
+                                                               'values_def'    
=> array
+                                                               (
+                                                                       
'valueset'              => false,
+                                                                       
'method'                => 'property.bogeneric.get_list',
+                                                                       
'method_input'  => array('type' => 'b_account', 'selected' => 
'##category##')//b_account_category
+                                                               )
+                                                       ),
+                                                       array
+                                                       (
+                                                               'name'          
=> 'mva',
+                                                               'descr'         
=> lang('tax code'),
+                                                               'type'          
=> 'int',
+                                                               'nullable'      
=> true,
+                                                               'size'          
=> 4,
+                                                               'sortable'      
=> true
+                                                       ),
+                                                       array
+                                                       (
+                                                               'name'          
        => 'responsible',
+                                                               'descr'         
        => lang('responsible'),
+                                                               'type'          
        => 'select',
+                                                               'filter'        
        => true,
+                                                               'get_single'    
=> 'get_user',
+                                                               'values_def'    
=> array
+                                                               (
+                                                                       
'valueset'              => false,
+                                                                       
'method'                => 'property.bocommon.get_user_list_right2',
+                                                                       
'method_input'  => array('selected' => '##responsible##', 'right' => 128, 
'acl_location' => '.invoice')
+                                                               )
+                                                       ),
+                                                       array
+                                                       (
+                                                               'name' => 
'active',
+                                                               'descr' => 
lang('active'),
+                                                               'type' => 
'checkbox',
+                                                               'default' => 
'checked'
+                                                       ),
+                                               ),
+                                               'edit_msg'                      
=> lang('edit'),
+                                               'add_msg'                       
=> lang('add'),
+                                               'name'                          
=> lang('budget account'),
+                                               'acl_location'          => 
'.b_account',
+                                               'menu_selection'        => 
'property::invoice::budget_account',
+                                               'default'                       
=> array
+                                               (
+                                                       'user_id'               
=> array('add'  => '$this->account'),
+                                                       'entry_date'    => 
array('add'  => 'time()'),
+                                                       'modified_date' => 
array('edit' => 'time()'),
+                                               ),
+                                               'check_grant'           => false
+                                       );
+
+                                       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
+                                       (
+                                               'table'                         
=> 'fm_branch',
+                                               'id'                            
=> array('name' => 'id', 'type' => 'auto'),
+                                               'fields'                        
=> array
+                                               (
+                                                       array
+                                                       (
+                                                               'name' => 'num',
+                                                               'descr' => 
lang('name'),
+                                                               'type' => 
'varchar'
+                                                       ),
+                                                       array
+                                                       (
+                                                               'name' => 
'descr',
+                                                               'descr' => 
lang('descr'),
+                                                               'type' => 
'varchar'
+                                                       )
+                                               ),
+                                               'edit_msg'                      
=> lang('edit'),
+                                               'add_msg'                       
=> lang('add'),
+                                               'name'                          
=> lang('branch'),
+                                               'acl_location'          => 
'.admin',
+                                               'menu_selection'        => 
'admin::property::branch'
+                                       );
+
+                                       break;
+                               case 'key_location':
+                                       $info = array
+                                       (
+                                               'table'                         
=> 'fm_key_loc',
+                                               'id'                            
=> array('name' => 'id', 'type' => 'auto'),
+                                               'fields'                        
=> array
+                                               (
+                                                       array
+                                                       (
+                                                               'name' => 'num',
+                                                               'descr' => 
lang('name'),
+                                                               'type' => 
'varchar'
+                                                       ),
+                                                       array
+                                                       (
+                                                               'name' => 
'descr',
+                                                               'descr' => 
lang('key location'),
+                                                               'type' => 'text'
+                                                       )
+                                               ),
+                                               'edit_msg'                      
=> lang('edit'),
+                                               'add_msg'                       
=> lang('add'),
+                                               'name'                          
=> lang('branch'),
+                                               'acl_location'          => 
'.admin',
+                                               'menu_selection'        => 
'admin::property::key_location'
+                                       );
+
+                                       break;
+
+                               case 'async':
+                                       $info = array
+                                       (
+                                               'table'                         
=> 'fm_async_method',
+                                               'id'                            
=> array('name' => 'id', 'type' => 'auto'),
+                                               'fields'                        
=> array
+                                               (
+                                                       array
+                                                       (
+                                                               'name' => 
'name',
+                                                               'descr' => 
lang('name'),
+                                                               'type' => 
'varchar'
+                                                       ),
+                                                       array
+                                                       (
+                                                               'name' => 
'data',
+                                                               'descr' => 
lang('data'),
+                                                               'type' => 'text'
+                                                       ),
+                                                       array
+                                                       (
+                                                               'name' => 
'descr',
+                                                               'descr' => 
lang('descr'),
+                                                               'type' => 'text'
+                                                       )
+                                               ),
+                                               'edit_msg'                      
=> lang('edit'),
+                                               'add_msg'                       
=> lang('add'),
+                                               'name'                          
=> lang('Async services'),
+                                               'acl_location'          => 
'.admin',
+                                               'menu_selection'        => 
'admin::property::async'
+                                       );
+                                       break;
+
+                               case 'event_action':
+
+                                       $info = array
+                                       (
+                                               'table'                         
=> 'fm_event_action',
+                                               'id'                            
=> array('name' => 'id', 'type' => 'auto'),
+                                               'fields'                        
=> array
+                                               (
+                                                       array
+                                                       (
+                                                               'name' => 
'name',
+                                                               'descr' => 
lang('name'),
+                                                               'type' => 
'varchar'
+                                                       ),
+                                                       array
+                                                       (
+                                                               'name' => 
'action',
+                                                               'descr' => 
lang('action'),
+                                                               'type' => 
'varchar'
+                                                       ),
+                                                       array
+                                                       (
+                                                               'name' => 
'data',
+                                                               'descr' => 
lang('data'),
+                                                               'type' => 'text'
+                                                       ),
+                                                       array
+                                                       (
+                                                               'name' => 
'descr',
+                                                               'descr' => 
lang('descr'),
+                                                               'type' => 'text'
+                                                       )
+                                               ),
+                                               'edit_msg'                      
=> lang('edit'),
+                                               'add_msg'                       
=> lang('add'),
+                                               'name'                          
=> lang('event action'),
+                                               'acl_location'          => 
'.admin',
+                                               'menu_selection'        => 
'admin::property::event_action',
+                                               'default'                       
=> array
+                                               (
+                                                       'user_id'               
=> array('add'  => '$this->account'),
+                                                       'entry_date'    => 
array('add'  => 'time()'),
+                                                       'modified_date' => 
array('edit' => 'time()'),
+                                               )
+                                       );
+
+                                       break;
+
+                               case 'ticket_status':
+
+                                       $info = array
+                                       (
+                                               'table'                         
=> 'fm_tts_status',
+                                               'id'                            
=> array('name' => 'id', 'type' => 'auto'),
+                                               'fields'                        
=> array
+                                               (
+                                                       array
+                                                       (
+                                                               'name' => 
'name',
+                                                               'descr' => 
lang('name'),
+                                                               'type' => 
'varchar'
+                                                       ),
+                                                       array
+                                                       (
+                                                               'name' => 
'sorting',
+                                                               'descr' => 
lang('sorting'),
+                                                               'type' => 
'integer',
+                                                               'sortable'=> 
true
+                                                       ),
+                                                       array
+                                                       (
+                                                               'name' => 
'color',
+                                                               'descr' => 
lang('color'),
+                                                               'type' => 
'varchar'
+                                                       ),
+                                                       array
+                                                       (
+                                                               'name' => 
'approved',
+                                                               'descr' => 
lang('approved'),
+                                                               'type' => 
'checkbox'
+                                                       ),
+                                                       array
+                                                       (
+                                                               'name' => 
'in_progress',
+                                                               'descr' => 
lang('In progress'),
+                                                               'type' => 
'checkbox'
+                                                       ),
+                                                       array
+                                                       (
+                                                               'name' => 
'delivered',
+                                                               'descr' => 
lang('delivered'),
+                                                               'type' => 
'checkbox'
+                                                       ),
+                                                       array
+                                                       (
+                                                               'name' => 
'closed',
+                                                               'descr' => 
lang('closed'),
+                                                               'type' => 
'checkbox'
+                                                       )
+                                               ),
+                                               'edit_msg'                      
=> lang('edit'),
+                                               'add_msg'                       
=> lang('add'),
+                                               'name'                          
=> lang('event action'),
+                                               'acl_location'          => 
'.admin',
+                                               'menu_selection'        => 
'admin::property::ticket_status'
+                                       );
+                                       break;
+                               case 'pending_action_type':
+                                       $info = array
+                                       (
+                                               'table'                         
=> 'fm_action_pending_category',
+                                               'id'                            
=> array('name' => 'num', 'type' => 'varchar'),
+                                               'fields'                        
=> array
+                                               (
+                                                       array
+                                                       (
+                                                               'name' => 
'name',
+                                                               'descr' => 
lang('name'),
+                                                               'type' => 
'varchar'
+                                                       ),
+                                                       array
+                                                       (
+                                                               'name' => 
'descr',
+                                                               'descr' => 
lang('descr'),
+                                                               'type' => 'text'
+                                                       )
+                                               ),
+                                               'edit_msg'                      
=> lang('edit'),
+                                               'add_msg'                       
=> lang('add'),
+                                               'name'                          
=> lang('Pending action type'),
+                                               'acl_location'          => 
'.admin',
+                                               'menu_selection'        => 
'admin::property::action_type'
+                                       );
+
+                                       break;
+
+                               case 'order_template':
+
+                                       $info = array
+                                       (
+                                               'table'                         
=> 'fm_order_template',
+                                               'id'                            
=> array('name' => 'id', 'type' => 'auto'),
+                                               'fields'                        
=> array
+                                               (
+                                                       array
+                                                       (
+                                                               'name' => 
'name',
+                                                               'descr' => 
lang('name'),
+                                                               'type' => 
'varchar'
+                                                       ),
+                                                       array
+                                                       (
+                                                               'name' => 
'content',
+                                                               'descr' => 
lang('content'),
+                                                               'type' => 'text'
+                                                       ),
+                                                       array
+                                                       (
+                                                               'name' => 
'public',
+                                                               'descr' => 
lang('public'),
+                                                               'type' => 
'checkbox'
+                                                       )
+                                               ),
+                                               'edit_msg'                      
=> lang('edit'),
+                                               'add_msg'                       
=> lang('add'),
+                                               'name'                          
=> lang('order template'),
+                                               'acl_location'          => 
'.ticket.order',
+                                               'menu_selection'        => 
'property::helpdesk::order_template',
+                                               'default'                       
=> array
+                                               (
+                                                       'user_id'               
=> array('add'  => '$this->account'),
+                                                       'entry_date'    => 
array('add'  => 'time()'),
+                                                       'modified_date' => 
array('edit' => 'time()'),
+                                               ),
+                                               'check_grant'           => true
+                                       );
+
+                                       break;
+
+                               case 'responsibility_role':
+
+                                       $info = array
+                                       (
+                                               'table'                         
=> 'fm_responsibility_role',
+                                               'id'                            
=> array('name' => 'id', 'type' => 'auto'),
+                                               'fields'                        
=> array
+                                               (
+                                                       array
+                                                       (
+                                                               'name' => 
'name',
+                                                               'descr' => 
lang('name'),
+                                                               'type' => 
'varchar'
+                                                       ),
+                                                       array
+                                                       (
+                                                               'name' => 
'remark',
+                                                               'descr' => 
lang('remark'),
+                                                               'type' => 'text'
+                                                       ),
+                                                       array
+                                                       (
+                                                               'name'          
        => 'location',
+                                                               'descr'         
        => lang('location'),
+                                                               'type'          
        => 'select',
+                                                               'values_def'    
=> array
+                                                               (
+                                                                       
'valueset'              => false,
+                                                                       
'method'                => 'preferences.boadmin_acl.get_locations',
+                                                                       
'method_input'  => array('acl_app' => 'property',       'selected' => 
'##location##')
+                                                               )
+                                                       ),
+                                                       array
+                                                       (
+                                                               'name'          
        => 'responsibility_id',
+                                                               'descr'         
        => lang('responsibility'),
+                                                               'type'          
        => 'select',
+                                                               'values_def'    
=> array
+                                                               (
+                                                                       
'valueset'              => false,
+                                                                       
'method'                => 'property.boresponsible.get_responsibilities',
+                                                                       
'method_input'  => array('acl_app' => 'property',       'selected' => 
'##responsibility_id##')
+                                                               )
+                                                       )
+                                               ),
+                                               'edit_msg'                      
=> lang('edit'),
+                                               'add_msg'                       
=> lang('add'),
+                                               'name'                          
=> lang('responsibility role'),
+                                               'acl_location'          => 
'.admin',
+                                               'menu_selection'        => 
'admin::property::responsibility_role',
+                                               'default'                       
=> array
+                                               (
+                                                       'user_id'               
=> array('add'  => '$this->account'),
+                                                       'entry_date'    => 
array('add'  => 'time()'),
+                                                       'modified_date' => 
array('edit' => 'time()'),
+                                               ),
+                                               'check_grant'           => false
+                                       );
+
+                                       break;
+
+                               default:
+                                       $receipt = array();
+                                       
$receipt['error'][]=array('msg'=>lang('ERROR: illegal type %1', $type));
+                                       phpgwapi_cache::session_set('phpgwapi', 
'phpgw_messages', $receipt);
+                               //      throw new Exception(lang('ERROR: 
illegal type %1', $type));
+                       }
+
+                       $this->location_info = $info;
+                       return $info;
+               }
+
+               function read_single($data,$values = array())
+               {
+                       if (!isset($this->location_info['table']) || !$table = 
$this->location_info['table'])
+                       {
+                               return $values;
+                       }
+
+                       if($this->location_info['id']['type']=='auto' || 
$this->location_info['id']['type']=='int')
+                       {
+                               $id = (int) $data['id'];
+                       }
+                       else
+                       {
+                               $id = "'{$data['id']}'";
+                       }
+
+                       $sql = "SELECT * FROM $table WHERE 
{$this->location_info['id']['name']} = {$id}";
+
+                       $this->_db->query($sql,__LINE__,__FILE__);
+
+                       if ($this->_db->next_record())
+                       {
+                               $values['id'] = 
$this->_db->f($this->location_info['id']['name']);
+
+                               // FIXME - add field to $values['attributes']
+                               foreach($this->location_info['fields'] as 
$field)
+                               {
+                                       $values[$field['name']] = 
$this->_db->f($field['name'], true);
+                               }
+
+                               if ( isset($values['attributes']) && 
is_array($values['attributes']) )
+                               {
+                                       foreach ( $values['attributes'] as 
&$attr )
+                                       {
+                                               $attr['value']  = 
$this->_db->f($attr['column_name']);
+                                       }
+                               }
+                       }
+                       return $values;
+               }
+
+
+               //deprecated
+               function select_generic_list($data)
+               {
+                       return $this->get_entity_list($data);
+               }
+
+               function get_list($data)
+               {
+                       $values = array();
+
+                       $this->get_location_info($data['type'], 
$data['type_id']);
+
+                       if (!isset($this->location_info['table']) || !$table = 
$this->location_info['table'])
+                       {
+                               return $values;
+                       }
+
+                       $filtermthod = '';
+                       if (isset($data['filter']) && is_array($data['filter']))
+                       {
+                               $_filter = array();
+                               foreach ($data['filter'] as $_field => $_value)
+                               {
+                                       $_filter[] = "{$_field} = '{$_value}'";
+                               }
+                               if($_filter)
+                               {
+                                       $filtermthod = 'WHERE ' . implode(' AND 
', $_filter);
+                               }
+                       }
+                       $order          = isset($data['order']) && 
$data['order'] ? $data['order'] :'descr';
+
+                       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} 
{$filtermthod} ORDER BY {$order}");
+
+                       while ($this->_db->next_record())
+                       {
+                               $_extra = $this->_db->f($id_in_name);
+                               $id             = $this->_db->f('id');
+                               if(!$name = $this->_db->f('name', true))
+                               {
+                                       $name   = $this->_db->f('descr', true);
+                               }
+                               
+                               if($_extra)
+                               {
+                                       $name = "{$_extra} - {$name}";
+                               }
+
+                               $values[] = array
+                               (
+                                       'id'    => $id,
+                                       'name'  => $name
+                               );
+                       }
+                       return $values;
+               }
+
+               function add($data,$values_attribute)
+               {
+                       $receipt = array();
+
+                       if (!isset($this->location_info['table']) || !$table = 
$this->location_info['table'])
+                       {
+                               $receipt['error'][] = array('msg' => lang('not 
a valid type'));
+                               return $receipt;
+                       }
+
+                       if(isset($data['save']))
+                       {
+                               unset($data['save']);
+                       }
+                       if(isset($data['apply']))
+                       {
+                               unset($data['apply']);
+                       }
+
+                       foreach ( $this->location_info['fields'] as $field )
+                       {
+                               if (isset($field['filter']) && $field['filter'])
+                               {
+                                       if(isset($data[$field['name']]) && 
$data[$field['name']] && $field['type'] == 'multiple_select')
+                                       {
+                                               $data[$field['name']] = ',' . 
implode(',',$data[$field['name']]) . ',';
+                                       }
+                               }
+                       }
+
+                       $cols = array();
+                       $vals = array();
+
+                       $data['descr'] = 
$this->_db->db_addslashes($data['descr']);
+
+                       if(isset($data['extra']))
+                       {
+                               foreach ($data['extra'] as $input_name => 
$value)
+                               {
+                                       if(isset($value) && $value)
+                                       {
+                                               $cols[] = $input_name;
+                                               $vals[] = $value;
+                                       }
+                               }
+                       }
+                       unset($data['extra']);
+
+                       foreach ($data as $input_name => $value)
+                       {
+                               if(isset($value) && $value)
+                               {
+                                       $cols[] = $input_name;
+                                       $vals[] = 
$this->_db->db_addslashes($value);
+                               }
+                       }
+
+                       $data_attribute = $this->custom->prepare_for_db($table, 
$values_attribute);
+                       if(isset($data_attribute['value_set']))
+                       {
+                               foreach($data_attribute['value_set'] as 
$input_name => $value)
+                               {
+                                       if(isset($value) && $value)
+                                       {
+                                               $cols[] = $input_name;
+                                               $vals[] = $value;
+                                       }
+                               }
+                       }
+
+
+                       if(isset($this->location_info['default']) && 
is_array($this->location_info['default']))
+                       {
+                               foreach ($this->location_info['default'] as 
$field => $default)
+                               {
+                                       if(isset($default['add']))
+                                       {
+                                               $cols[] = $field;
+                                               eval('$vals[] = ' . 
$default['add'] .';');
+                                       }
+                               }
+                       }
+
+                       $this->_db->transaction_begin();
+
+                       if($this->location_info['id']['type']!='auto')
+                       {
+                               $this->_db->query("SELECT id FROM {$table} 
WHERE {$this->location_info['id']['name']} = 
'{$data['id']}'",__LINE__,__FILE__);
+                               if($this->_db->next_record())
+                               {
+                                       
$receipt['error'][]=array('msg'=>lang('duplicate key value'));
+                                       
$receipt['error'][]=array('msg'=>lang('record has not been saved'));
+                                       return $receipt;
+                               }
+                               $id = $data['id'];
+                       }
+                       else
+                       {
+                               $id = $this->_db->next_id($table);
+                               $cols[] = 'id';
+                               $vals[] = $id;
+                       }
+
+                       $cols   = implode(",", $cols);
+                       $vals   = $this->_db->validate_insert($vals);
+
+                       $this->_db->query("INSERT INTO {$table} ({$cols}) 
VALUES ({$vals})",__LINE__,__FILE__);
+
+/*                     if($this->location_info['id']['type']=='auto')
+                       {
+                               if(!$data['id'] = 
$this->_db->get_last_insert_id($table, 'id'))
+                               {
+                                       $this->_db->transaction_abort();
+                                       
$receipt['error'][]=array('msg'=>lang('record has not been saved'));
+                               }
+                       }
+*/
+                       $this->_db->transaction_commit();
+                       $receipt['id'] = $id;
+                       $receipt['message'][]=array('msg'=>lang('record has 
been saved'));
+                       return $receipt;
+               }
+
+               function edit($data,$values_attribute)
+               {
+                       $receipt = array();
+
+                       if (!isset($this->location_info['table']) || !$table = 
$this->location_info['table'])
+                       {
+                               $receipt['error'][] = array('msg' => lang('not 
a valid type'));
+                               return $receipt;
+                       }
+
+                       $value_set = array();
+
+                       if(isset($data['extra']))
+                       {
+                               foreach ($data['extra'] as $input_name => 
$value)
+                               {
+                                       $value_set[$input_name] = $value;
+                               }
+                               unset($data['extra']);
+                       }
+
+                       $data_attribute = $this->custom->prepare_for_db($table, 
$values_attribute, $data['id']);
+
+                       if(isset($data_attribute['value_set']))
+                       {
+                               $value_set = array_merge($value_set, 
$data_attribute['value_set']);
+                       }
+                       foreach($this->location_info['fields'] as $field)
+                       {
+                               if (isset($field['filter']) && $field['filter'])
+                               {
+                                       if(isset($data[$field['name']]) && 
$data[$field['name']] && $field['type'] == 'multiple_select')
+                                       {
+                                               $data[$field['name']] = ',' . 
implode(',',$data[$field['name']]) . ',';
+                                       }
+                               }
+
+                               $value_set[$field['name']] = 
$this->_db->db_addslashes($data[$field['name']]);
+                       }
+
+                       if(isset($this->location_info['default']) && 
is_array($this->location_info['default']))
+                       {
+                               foreach ($this->location_info['default'] as 
$field => $default)
+                               {
+                                       if(isset($default['edit']))
+                                       {
+                                               eval('$value_set[$field] = ' . 
$default['edit'] .';');
+                                       }
+                               }
+                       }
+
+                       $value_set      = 
$this->_db->validate_update($value_set);
+                       $this->_db->transaction_begin();
+                       $this->_db->query("UPDATE $table SET {$value_set} WHERE 
{$this->location_info['id']['name']}='" . $data['id']. "'",__LINE__,__FILE__);
+
+/*                     //FIXME
+                       if (isset($data_attribute['history_set']) && 
is_array($data_attribute['history_set']))
+                       {
+                               $historylog     = 
CreateObject('phpgwapi.historylog','property', 
$this->location_info['acl_location']);
+                               foreach ($data_attribute['history_set'] as 
$attrib_id => $history)
+                               {
+                                       
$historylog->add('SO',$data['id'],$history['value'],false, 
$attrib_id,$history['date']);
+                               }
+                       }
+*/
+                       $this->_db->transaction_commit();
+
+                       $receipt['id'] = $data['id'];
+
+                       $receipt['message'][]=array('msg'=>lang('record has 
been edited'));
+                       return $receipt;
+               }
+
+               function delete($id)
+               {
+                       if (!isset($this->location_info['table']) || !$table = 
$this->location_info['table'])
+                       {
+                               return false;
+                       }
+                       $this->_db->query("DELETE FROM $table WHERE 
{$this->location_info['id']['name']}='{$id}'",__LINE__,__FILE__);
+               }
+       }
+

Modified: trunk/property/inc/class.uiXport.inc.php
===================================================================
--- trunk/property/inc/class.uiXport.inc.php    2010-11-17 14:13:13 UTC (rev 
6612)
+++ trunk/property/inc/class.uiXport.inc.php    2010-11-17 21:51:15 UTC (rev 
6613)
@@ -59,8 +59,8 @@
                        $this->bo                       = 
CreateObject('property.boXport',true);
                        $this->invoice                  = 
CreateObject('property.boinvoice');
                        $this->bocommon                 = 
CreateObject('property.bocommon');
-                       $this->contacts                 = 
CreateObject('property.soactor');
-                       $this->contacts->role           = 'vendor';
+                       $this->contacts = CreateObject('property.sogeneric');
+                       $this->contacts->get_location_info('vendor',false);
 
                        $this->acl                              = & 
$GLOBALS['phpgw']->acl;
                        $this->acl_location             = '.invoice';
@@ -453,7 +453,7 @@
 
                        );
 
-                       $vendor = 
$this->contacts->read_single($invoice_common['vendor_id'], 
array('attributes'=>array(array('column_name' => 'org_name'))));
+                       $vendor = $this->contacts->read_single(array('id' => 
$invoice_common['vendor_id']), array('attributes'=>array(array('column_name' => 
'org_name'))));
 
                        foreach($vendor['attributes'] as $attribute)
                        {

Modified: trunk/property/inc/class.uiadmin_location.inc.php
===================================================================
--- trunk/property/inc/class.uiadmin_location.inc.php   2010-11-17 14:13:13 UTC 
(rev 6612)
+++ trunk/property/inc/class.uiadmin_location.inc.php   2010-11-17 21:51:15 UTC 
(rev 6613)
@@ -249,7 +249,7 @@
                                                'text'                  => 
lang('Categories'),
                                                'action'                => 
$GLOBALS['phpgw']->link('/index.php',array
                                                                (
-                                                                       
'menuaction'    => 'property.uicategory.index',
+                                                                       
'menuaction'    => 'property.uigeneric.index',
                                                                        'type'  
                => 'location'
 
                                                                )),

Copied: trunk/property/inc/class.uigeneric.inc.php (from rev 6612, 
trunk/property/inc/class.uicategory.inc.php)
===================================================================
--- trunk/property/inc/class.uigeneric.inc.php                          (rev 0)
+++ trunk/property/inc/class.uigeneric.inc.php  2010-11-17 21:51:15 UTC (rev 
6613)
@@ -0,0 +1,809 @@
+<?php
+       /**
+       * phpGroupWare - property: a Facilities Management System.
+       *
+       * @author Sigurd Nes <address@hidden>
+       * @copyright Copyright (C) 2003,2004,2005,2006,2007,2008,2009 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$
+       */
+       phpgw::import_class('phpgwapi.yui');
+
+       /**
+        * Description
+        * @package property
+        */
+
+       class property_uigeneric
+       {
+               var $grants;
+               var $start;
+               var $query;
+               var $sort;
+               var $order;
+               var $sub;
+               var $currentapp;
+               var $location_info;
+
+               var $public_functions = array
+               (
+                       'index'  => true,
+                       'view'   => true,
+                       'edit'   => true,
+                       'delete' => true,
+                       'download'      => true,
+                       'columns'       => true,
+               );
+
+               function __construct()
+               {
+                       $GLOBALS['phpgw_info']['flags']['xslt_app'] = true;
+                       $this->account                          = 
$GLOBALS['phpgw_info']['user']['account_id'];
+                       $this->bo                                       = 
CreateObject('property.bogeneric',true);
+                       $this->bocommon                         = & 
$this->bo->bocommon;
+                       $this->custom                           = & 
$this->bo->custom;
+
+                       $this->location_info            = 
$this->bo->location_info;
+                       $GLOBALS['phpgw_info']['flags']['menu_selection'] = 
$this->location_info['menu_selection'];
+                       $this->acl                                      = & 
$GLOBALS['phpgw']->acl;
+                       $this->acl_location                     = 
$this->location_info['acl_location'];
+                       $this->acl_read                         = 
$this->acl->check($this->acl_location, PHPGW_ACL_READ, 'property');
+                       $this->acl_add                          = 
$this->acl->check($this->acl_location, PHPGW_ACL_ADD, 'property');
+                       $this->acl_edit                         = 
$this->acl->check($this->acl_location, PHPGW_ACL_EDIT, 'property');
+                       $this->acl_delete                       = 
$this->acl->check($this->acl_location, PHPGW_ACL_DELETE, 'property');
+                       $this->acl_manage                       = 
$this->acl->check($this->acl_location, 16, 'property');
+
+                       $this->start                            = 
$this->bo->start;
+                       $this->query                            = 
$this->bo->query;
+                       $this->sort                                     = 
$this->bo->sort;
+                       $this->order                            = 
$this->bo->order;
+                       $this->allrows                          = 
$this->bo->allrows;
+
+                       $this->type             = $this->bo->type;
+                       $this->type_id          = $this->bo->type_id;
+
+               }
+
+               function save_sessiondata()
+               {
+                       $data = array
+                       (
+                               'start'         => $this->start,
+                               'query'         => $this->query,
+                               'sort'          => $this->sort,
+                               'order'         => $this->order,
+                               'allrows'       => $this->allrows,
+                               'type'          => $this->type
+                       );
+                       $this->bo->save_sessiondata($data);
+               }
+
+               function download()
+               {
+                       $list = $this->bo->read();
+                       $uicols = $this->bo->uicols;
+                       
$this->bocommon->download($list,$uicols['name'],$uicols['descr'],$uicols['input_type']);
+               }
+
+               function columns()
+               {
+
+                       //cramirez: necesary for windows.open . Avoid error JS
+                       phpgwapi_yui::load_widget('tabview');
+
+                       $GLOBALS['phpgw']->xslttpl->add_file(array('columns'));
+                       $GLOBALS['phpgw_info']['flags']['noframework'] = true;
+                       $values = phpgw::get_var('values');
+
+                       if ($values['save'])
+                       {
+                               $GLOBALS['phpgw']->preferences->account_id = 
$this->account;
+                               $GLOBALS['phpgw']->preferences->read();
+                               
$GLOBALS['phpgw']->preferences->add('property',"generic_columns_{$this->type}_{$this->type_id}",$values['columns'],'user');
+                               
$GLOBALS['phpgw']->preferences->save_repository();
+
+                               $receipt['message'][] = array('msg' => 
lang('columns is updated'));
+                       }
+
+                       $function_msg   = lang('Select Column');
+
+                       $link_data = array
+                       (
+                       'menuaction'    => 'property.uigeneric.columns',
+                               'type'                  => $this->type,
+                               'type_id'               => $this->type_id
+
+                       );
+
+                       $msgbox_data = $this->bocommon->msgbox_data($receipt);
+
+                       $data = array
+                       (
+                               'msgbox_data'   => 
$GLOBALS['phpgw']->common->msgbox($msgbox_data),
+                               'column_list'   => 
$this->bo->column_list($values['columns'],$allrows=true),
+                               'function_msg'  => $function_msg,
+                               'form_action'   => 
$GLOBALS['phpgw']->link('/index.php',$link_data),
+                               'lang_columns'  => lang('columns'),
+                               'lang_none'             => lang('None'),
+                               'lang_save'             => lang('save'),
+                               'select_name'   => 'period'
+                       );
+
+                       $GLOBALS['phpgw_info']['flags']['app_header'] = 
$function_msg;
+                       
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('columns' => $data));
+               }
+
+               function index()
+               {
+                       if(!$this->acl_read)
+                       {
+                               
$GLOBALS['phpgw']->redirect_link('/index.php',array('menuaction'=> 
'property.uilocation.stop', 'perm'=>1, 'acl_location'=> $this->acl_location));
+                       }
+
+                       $receipt = 
$GLOBALS['phpgw']->session->appsession('session_data', 
"general_receipt_{$this->type}_{$this->type_id}");
+                       $this->save_sessiondata();
+
+                       $GLOBALS['phpgw_info']['apps']['manual']['section'] = 
"general.index.{$this->type}";
+
+                       $datatable = array();
+
+                       if( phpgw::get_var('phpgw_return_as') != 'json' )
+                       {
+                               $datatable['config']['base_url'] = 
$GLOBALS['phpgw']->link('/index.php', array
+                       (
+                               'menuaction'    => 'property.uigeneric.index',
+                                       'type'          => $this->type,
+                                       'type_id'               => 
$this->type_id
+                               ));
+
+                               $datatable['config']['base_java_url'] = 
"menuaction:'property.uigeneric.index',"
+                                                                               
                        ."type:'{$this->type}',"
+                                                                               
                        ."type_id:'{$this->type_id}'";
+
+                               $link_data = array
+                               (
+                                       'menuaction'    => 
'property.uigeneric.index',
+                                       'type'          => $this->type,
+                                       'type_id'               => 
$this->type_id
+                               );
+
+
+                               $datatable['config']['allow_allrows'] = true;
+
+                               $datatable['actions']['form'] = array
+                               (
+                                       array
+                                       (
+                                       'action'        => 
$GLOBALS['phpgw']->link('/index.php',
+                                                               array
+                                                               (
+                                                                       
'menuaction'    => 'property.uigeneric.index',
+                                                                       'type'  
                => $this->type,
+                                                                       
'type_id'               => $this->type_id
+                                                               )
+                                                       ),
+                                       'fields'        => array
+                                       (
+                                       'field' => array
+                                       (
+                                                               array
+                                                               (
+                                                                       'type'  
=> 'button',
+                                                                       'id'    
=> 'btn_export',
+                                                                       'value' 
=> lang('download'),
+                                                                       
'tab_index' => 10
+                                                               ),
+                                                               array
+                                                               (
+                                                                       'type'  
=> 'button',
+                                                                       'id'    
=> 'btn_done',
+                                                                       'value' 
=> lang('done'),
+                                                                       
'tab_index' => 9
+                                                               ),
+                                                               array
+                                                               (
+                                                                       'type'  
=> 'button',
+                                                                       'id'    
=> 'btn_new',
+                                                                       'value' 
=> lang('add'),
+                                                                       
'tab_index' => 8
+                                                               ),
+                                                               array
+                                                               ( //button     
SEARCH
+                                                                       'id' => 
'btn_search',
+                                                                       'name' 
=> 'search',
+                                                                       'value' 
   => lang('search'),
+                                                                       'type' 
=> 'button',
+                                                                       
'tab_index' => 7
+                                                               ),
+                                                               array
+                                                               ( // TEXT INPUT
+                                                                       'name'  
   => 'query',
+                                                                       'id'    
 => 'txt_query',
+                                                                       'value' 
   => $this->query,
+                                                                       'type' 
=> 'text',
+                                                                       
'onkeypress' => 'return pulsar(event)',
+                                                                       'size'  
  => 28,
+                                                                       
'tab_index' => 6
+                                                               )
+                                                       )
+                                               )
+                                       )
+                               );
+
+
+                               
if($GLOBALS['phpgw']->locations->get_attrib_table('property', 
$this->location_info['acl_location']))
+                               {
+                                       
$datatable['actions']['form'][0]['fields']['field'][] =  array(
+                                                                               
                                'type'=> 'link',
+                                                                               
                                'id'  => 'btn_columns',
+                                                                               
                                'url' => 
"Javascript:window.open('".$GLOBALS['phpgw']->link('/index.php',
+                                                                               
                                array(
+                                                                               
                                        'menuaction' => 
'property.uigeneric.columns',
+                                                                               
                                        'type'                  => $this->type,
+                                                                               
                                        'type_id'               => 
$this->type_id
+                                                                               
                                        ))."','','width=350,height=370')",
+                                                                               
                                'value' => lang('columns'),
+                                                                               
                                'tab_index' => 7
+                                                                               
            );
+                               }
+
+                               $values_combo_box = array();
+                               $i = 0;
+                               $button_def = array();
+                               $code_inner = array();
+                               foreach ( $this->location_info['fields'] as 
$field )
+                               {
+                                       if (isset($field['filter']) && 
$field['filter'])
+                                       {
+                                               
$datatable['actions']['form'][0]['fields']['field'][] = array
+                                               (
+                                                       'id' => 
"btn_{$field['name']}",
+                                                       'name' => 
$field['name'],
+                                                       'value' => 
$field['descr'],
+                                                       'type' => 'button',
+                                                       'style' => 'filter',
+                                                       'tab_index' => $i
+                                               );
+
+                                               $button_def[] = 
"oMenuButton_{$i}"; 
+                                               $code_inner[] = "{order:{$i}, 
var_URL:'{$field['name']}',name:'btn_{$field['name']}',style:'genericbutton',dependiente:[]}";
+
+                                               
if($field['values_def']['valueset'])
+                                               {
+                                                       $values_combo_box[] = 
$field['values_def']['valueset'];
+                                                       // TODO find selected 
value
+                                               }
+                                               else 
if(isset($field['values_def']['method']))
+                                               {
+                                                       
foreach($field['values_def']['method_input'] as $_argument => $_argument_value)
+                                                       {
+                                                               
if(preg_match('/^##/', $_argument_value))
+                                                               {
+                                                                       
$_argument_value_name = trim($_argument_value,'#');
+                                                                       
$_argument_value = $values[$_argument_value_name];
+                                                               }
+                                                               
$method_input[$_argument] = $_argument_value;
+                                                       }
+       
+                                                       $values_combo_box[] = 
execMethod($field['values_def']['method'],$method_input);
+                                               }
+                                               $default_value = array 
('id'=>'','name'=> lang('select') . ' ' . $field['descr']);
+                                               array_unshift 
($values_combo_box[$i],$default_value);
+                                               $i++;
+                                       }
+                               }
+                               $code = '';
+                               if($button_def)
+                               {
+                                       $code = 'var ' . implode(',', 
$button_def)  . ";\n";
+                                       $code .= 'var selectsButtons = [' . 
"\n" . implode(",\n",$code_inner) . "\n];";
+                                       $GLOBALS['phpgw']->js->add_code('', 
$code);
+                               }
+
+                               if($values_combo_box)
+                               {
+                                       $i = 0;
+                                       foreach ( $values_combo_box as $combo )
+                                       {
+                                               
$datatable['actions']['form'][0]['fields']['hidden_value'][] = array
+                                               (
+                                                       'id'    => 
"values_combo_box_{$i}",
+                                                       'value' => 
$this->bocommon->select2String($combo)                                          
     
+                                               );
+                                               $i++;
+                                       }
+                               }
+
+//                             $dry_run = true;
+                       }
+
+                       $values = $this->bo->read();
+                       $uicols = $this->bo->uicols;
+
+                       $j = 0;
+                       $count_uicols_name = count($uicols['name']);
+
+                       if (isset($values) AND is_array($values))
+                       {
+                               foreach($values as $entry)
+                               {
+                                       for ($k=0;$k<$count_uicols_name;$k++)
+                                       {
+                                               
if($uicols['input_type'][$k]!='hidden')
+                                               {
+                                                       
$datatable['rows']['row'][$j]['column'][$k]['name']             = 
$uicols['name'][$k];
+                                                       
$datatable['rows']['row'][$j]['column'][$k]['value']            = 
$entry[$uicols['name'][$k]];
+                                               }
+                                       }
+                                       $j++;
+                               }
+                       }
+
+                       $datatable['rowactions']['action'] = array();
+
+                       $parameters = array
+                       (
+                               'parameter' => array
+                               (
+                                       array
+                                       (
+                                               'name'          => 
$this->location_info['id']['name'],
+                                               'source'        =>  
$this->location_info['id']['name']
+                                       ),
+                               )
+                       );
+
+                       if($this->acl_edit)
+                       {
+                               $datatable['rowactions']['action'][] = array
+                               (
+                                       'my_name'               => 'edit',
+                                       'statustext'    => lang('edit the 
actor'),
+                                       'text'                  => lang('edit'),
+                                       'action'                => 
$GLOBALS['phpgw']->link('/index.php',array
+                                                                               
(
+                                                                               
        'menuaction'            => 'property.uigeneric.edit',
+                                                                               
        'type'                          => $this->type,
+                                                                               
        'type_id'                       => $this->type_id
+                                                                               
)),
+                                       'parameters'    => $parameters
+                               );
+                               $datatable['rowactions']['action'][] = array
+                               (
+                                       'my_name'               => 'edit',
+                                       'text'                  => lang('open 
edit in new window'),
+                                       'action'                => 
$GLOBALS['phpgw']->link('/index.php',array
+                                                                               
(
+                                                                               
        'menuaction'            => 'property.uigeneric.edit',
+                                                                               
        'type'                          => $this->type,
+                                                                               
        'type_id'                       => $this->type_id,
+                                                                               
        'target'                        => '_blank'
+                                                                               
)),
+                                       'parameters'    => $parameters
+                               );
+                       }
+
+                       if($this->acl_delete)
+                       {
+                               $datatable['rowactions']['action'][] = array
+                               (
+                                       'my_name'               => 'delete',
+                                       'statustext'    => lang('delete the 
actor'),
+                                       'text'                  => 
lang('delete'),
+                                       'confirm_msg'   => lang('do you really 
want to delete this entry'),
+                                       'action'                => 
$GLOBALS['phpgw']->link('/index.php',array
+                                                                               
(
+                                                                               
        'menuaction'    => 'property.uigeneric.delete',
+                                                                               
        'type'                  => $this->type,
+                                                                               
        'type_id'               => $this->type_id
+                                                                               
)),
+                                       'parameters'    => $parameters
+                               );
+                       }
+                       unset($parameters);
+
+                       if($this->acl_add)
+                       {
+                               $datatable['rowactions']['action'][] = array
+                               (
+                                       'my_name'                       => 
'add',
+                                       'statustext'    => lang('add'),
+                                       'text'                  => lang('add'),
+                                       'action'                => 
$GLOBALS['phpgw']->link('/index.php',array
+                                                                               
(
+                                                                               
        'menuaction'    => 'property.uigeneric.edit',
+                                                                               
        'type'                  => $this->type,
+                                                                               
        'type_id'               => $this->type_id
+                                                                               
))
+                               );
+                       }
+
+                       for ($i=0;$i<$count_uicols_name;$i++)
+                       {
+                               if($uicols['input_type'][$i]!='hidden')
+                               {
+                                       
$datatable['headers']['header'][$i]['formatter']                = 
($uicols['formatter'][$i]==''?  '""' : $uicols['formatter'][$i]);
+                                       
$datatable['headers']['header'][$i]['name']                     = 
$uicols['name'][$i];
+                                       
$datatable['headers']['header'][$i]['text']                     = 
$uicols['descr'][$i];
+                                       
$datatable['headers']['header'][$i]['visible']                  = true;
+                                       
$datatable['headers']['header'][$i]['sortable']                 = 
$uicols['sortable'][$i];
+                                       
$datatable['headers']['header'][$i]['sort_field']       = $uicols['name'][$i];
+                               }
+                       }
+
+                       //path for property.js
+                       $datatable['property_js'] = 
$GLOBALS['phpgw_info']['server']['webserver_url']."/property/js/yahoo/property.js";
+
+                       // Pagination and sort values
+                       $datatable['pagination']['records_start']       = 
(int)$this->bo->start;
+                       $datatable['pagination']['records_limit']       = 
$GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs'];
+                       $datatable['pagination']['records_returned']= 
count($values);
+                       $datatable['pagination']['records_total']       = 
$this->bo->total_records;
+
+                       $appname                        =  
$this->location_info['name'];
+                       $function_msg           = lang('list %1', $appname);
+
+                       if ( ($this->start == 0) && (!$this->order))
+                       {
+                               $datatable['sorting']['order']                  
=  $this->location_info['id']['name']; // name key Column in myColumnDef
+                               $datatable['sorting']['sort']                   
= 'asc'; // ASC / DESC
+                       }
+                       else
+                       {
+                               $datatable['sorting']['order']                  
= $this->order; // name of column of Database
+                               $datatable['sorting']['sort']                   
= $this->sort; // ASC / DESC
+                       }
+
+                       phpgwapi_yui::load_widget('dragdrop');
+                       phpgwapi_yui::load_widget('datatable');
+                       phpgwapi_yui::load_widget('menu');
+                       phpgwapi_yui::load_widget('connection');
+                       phpgwapi_yui::load_widget('loader');
+                       phpgwapi_yui::load_widget('tabview');
+                       phpgwapi_yui::load_widget('paginator');
+                       phpgwapi_yui::load_widget('animation');
+
+                       //-- BEGIN----------------------------- JSON CODE 
------------------------------
+               //values for Pagination
+                       $json = array
+                       (
+                               'recordsReturned'       => 
$datatable['pagination']['records_returned'],
+                               'totalRecords'          => 
(int)$datatable['pagination']['records_total'],
+                               'startIndex'            => 
$datatable['pagination']['records_start'],
+                                       'sort'                          => 
$datatable['sorting']['order'],
+                               'dir'                           => 
$datatable['sorting']['sort'],
+                                       'records'                       => 
array()
+                       );
+
+                               // values for datatable
+                       if(isset($datatable['rows']['row']) && 
is_array($datatable['rows']['row'])){
+                               foreach( $datatable['rows']['row'] as $row )
+                               {
+                                       $json_row = array();
+                                       foreach( $row['column'] as $column)
+                                       {
+                                               if(isset($column['format']) && 
$column['format']== "link" && $column['java_link']==true)
+                                               {
+                                                       
$json_row[$column['name']] = "<a href='#' id='".$column['link']."' 
onclick='javascript:filter_data(this.id);'>" .$column['value']."</a>";
+                                               }
+                                               elseif(isset($column['format']) 
&& $column['format']== "link")
+                                               {
+                                                 $json_row[$column['name']] = 
"<a href='".$column['link']."'>" .$column['value']."</a>";
+                                               }else
+                                               {
+                                                 $json_row[$column['name']] = 
$column['value'];
+                                               }
+                                       }
+                                       $json['records'][] = $json_row;
+                               }
+                       }
+
+                               // right in datatable
+                               if(isset($datatable['rowactions']['action']) && 
is_array($datatable['rowactions']['action']))
+                               {
+                                       $json ['rights'] = 
$datatable['rowactions']['action'];
+                               }
+
+                               if( phpgw::get_var('phpgw_return_as') == 'json' 
)
+                               {
+                               return $json;
+                               }
+
+
+                       $datatable['json_data'] = json_encode($json);
+                       //-------------------- JSON CODE ----------------------
+
+                       $template_vars = array();
+                       $template_vars['datatable'] = $datatable;
+                       
$GLOBALS['phpgw']->xslttpl->add_file(array('datatable'));
+               $GLOBALS['phpgw']->xslttpl->set_var('phpgw', $template_vars);
+
+               if ( !isset($GLOBALS['phpgw']->css) || 
!is_object($GLOBALS['phpgw']->css) )
+               {
+                       $GLOBALS['phpgw']->css = createObject('phpgwapi.css');
+               }
+
+               $GLOBALS['phpgw']->css->validate_file('datatable');
+                       $GLOBALS['phpgw']->css->validate_file('property');
+                       
$GLOBALS['phpgw']->css->add_external_file('property/templates/base/css/property.css');
+                       
$GLOBALS['phpgw']->css->add_external_file('phpgwapi/js/yahoo/datatable/assets/skins/sam/datatable.css');
+                       
$GLOBALS['phpgw']->css->add_external_file('phpgwapi/js/yahoo/paginator/assets/skins/sam/paginator.css');
+                       
$GLOBALS['phpgw']->css->add_external_file('phpgwapi/js/yahoo/container/assets/skins/sam/container.css');
+
+                       $GLOBALS['phpgw_info']['flags']['app_header'] = 
lang('property') . "::{$appname}::{$function_msg}";
+
+                       $GLOBALS['phpgw']->js->validate_file( 'yahoo', 
'generic.index', 'property' );
+               }
+
+               function edit()
+               {
+                       if(!$this->acl_add)
+                       {
+                               
$GLOBALS['phpgw']->redirect_link('/index.php',array('menuaction'=> 
'property.uilocation.stop', 'perm'=> 2, 'acl_location'=> $this->acl_location));
+                       }
+
+                       $id                     = 
phpgw::get_var($this->location_info['id']['name']);
+                       $values         = phpgw::get_var('values');
+
+                       $values_attribute  = phpgw::get_var('values_attribute');
+               
+                       $GLOBALS['phpgw_info']['apps']['manual']['section'] = 
'general.edit.' . $this->type;
+
+                       
$GLOBALS['phpgw']->xslttpl->add_file(array('generic','attributes_form'));
+                       $receipt = array();
+
+                       if (is_array($values))
+                       {
+                               $insert_record_values = 
$GLOBALS['phpgw']->session->appsession("insert_record_values{$this->acl_location}",'property');
+                               
+                               if(is_array($insert_record_values))
+                               {
+                                       foreach($insert_record_values as $field)
+                                       {
+                                               $values['extra'][$field] =      
phpgw::get_var($field);
+                                       }
+                               }
+
+                               if ((isset($values['save']) && $values['save']) 
|| (isset($values['apply']) && $values['apply']))
+                               {
+                                       
if($GLOBALS['phpgw']->session->is_repost())
+                                       {
+                                               
$receipt['error'][]=array('msg'=>lang('Hmm... looks like a repost!'));
+                                       }
+
+                                       if(!$id && 
!$values[$this->location_info['id']['name']] && 
$this->location_info['id']['type'] !='auto')
+                                       {
+                                               
$receipt['error'][]=array('msg'=>lang('missing value for %1', lang('id')));     
                                                                
+                                       }
+
+                                       foreach ( 
$this->location_info['fields'] as $field_info )
+                                       {
+                                               if 
(isset($field_info['nullable']) && $field_info['nullable'] != true)
+                                               {
+                                                       if( 
!$values[$field_info['name']] )
+                                                       {
+                                                               
$receipt['error'][]=array('msg'=>lang('missing value for %1', 
$field_info['descr']));                                                         
          
+                                                       }
+                                               }
+                                       }
+
+                                       if($values['id'] && 
$this->location_info['id']['type'] == 'int' && !ctype_digit($values['id']))
+                                       {
+                                               
$receipt['error'][]=array('msg'=>lang('Please enter an integer !'));
+                                               unset($values['id']);
+                                       }
+
+                                       if(isset($values_attribute) && 
is_array($values_attribute))
+                                       {
+                                               foreach ($values_attribute as 
$attribute )
+                                               {
+                                                       
if($attribute['nullable'] != 1 && !$attribute['value'])
+                                                       {
+                                                               
$receipt['error'][]=array('msg'=>lang('Please enter value for attribute %1', 
$attribute['input_text']));
+                                                       }
+                                               }
+                                       }
+
+                                       if($id)
+                                       {
+                                               $values['id']=$id;
+                                               $action='edit';
+                                       }
+                                       else
+                                       {
+                                               $id =   $values['id'];
+                                       }
+
+                                       if(!$receipt['error'])
+                                       {
+                                               $receipt = 
$this->bo->save($values,$action,$values_attribute);
+
+                                               if (isset($values['save']) && 
$values['save'])
+                                               {
+                                                       
$GLOBALS['phpgw']->session->appsession('session_data', 
"general_receipt_{$this->type}_{$this->type_id}", $receipt);
+                                                       
$GLOBALS['phpgw']->redirect_link('/index.php',array('menuaction'=> 
'property.uigeneric.index', 'type'=> $this->type,    'type_id' => 
$this->type_id));
+                                               }
+                                               $id = $receipt['id'];
+                                       }
+                                       else
+                                       {
+                                               unset($values['id']);
+                                               $id = '';
+                                       }
+                                       
+                               }
+                               else
+                               {
+                                       
$GLOBALS['phpgw']->redirect_link('/index.php',array('menuaction'=> 
'property.uigeneric.index', 'type'=> $this->type,    'type_id' => 
$this->type_id));
+                               }
+                       }
+
+                       if ($id)
+                       {
+                               $values = $this->bo->read_single(array('id' => 
$id));
+                               $function_msg = 
$this->location_info['edit_msg'];
+                               $action='edit';
+                       }
+                       else
+                       {
+                               $values = $this->bo->read_single();
+                               $function_msg = $this->location_info['add_msg'];
+                               $action='add';
+                       }
+
+                       /* Preserve attribute values from post */
+                       if(isset($receipt['error']))
+                       {
+                               foreach ( $this->location_info['fields'] as 
$field )
+                               {
+                                       $values[$field['name']] = 
phpgw::clean_value($_POST['values'][$field['name']]);
+                               }
+
+                               if(isset( $values_attribute) && is_array( 
$values_attribute))
+                               {
+                                       $values = 
$this->custom->preserve_attribute_values($values,$values_attribute);
+                               }
+                       }
+
+                       $link_data = array
+                       (
+                               'menuaction'    => 'property.uigeneric.edit',
+                               'id'                    => $id,
+                               'type'                  => $this->type,
+                               'type_id'               => $this->type_id
+                       );
+
+                       $tabs = array();
+
+                       if (isset($values['attributes']) && 
is_array($values['attributes']))
+                       {
+                               foreach ($values['attributes'] as & $attribute)
+                               {
+                                       if($attribute['history'] == true)
+                                       {
+                                               $link_history_data = array
+                                               (
+                                                       'menuaction'    => 
'property.uigeneric.attrib_history',
+                                                       'attrib_id'     => 
$attribute['id'],
+                                                       'actor_id'      => 
$actor_id,
+                                                       'role'          => 
$this->role,
+                                                       'edit'          => true
+                                               );
+
+                                               $attribute['link_history'] = 
$GLOBALS['phpgw']->link('/index.php',$link_history_data);
+                                       }
+                               }
+
+                               
phpgwapi_yui::tabview_setup('general_edit_tabview');
+                               $tabs['general']        = array('label' => 
lang('general'), 'link' => '#general');
+
+                               $attributes_groups = 
$this->custom->get_attribute_groups('property', $this->acl_location, 
$values['attributes']);
+
+                               $attributes = array();
+                               foreach ($attributes_groups as $group)
+                               {
+                                       if(isset($group['attributes']))
+                                       {
+                                               $tabs[str_replace(' ', '_', 
$group['name'])] = array('label' => $group['name'], 'link' => '#' . 
str_replace(' ', '_', $group['name']));
+                                               $group['link'] = str_replace(' 
', '_', $group['name']);
+                                               $attributes[] = $group;
+                                       }
+                               }
+                               unset($attributes_groups);
+                               unset($values['attributes']);
+                       }
+
+                       foreach ($this->location_info['fields'] as & $field)
+                       {
+                               $field['value'] =       
isset($values[$field['name']]) ? $values[$field['name']] : '';
+                               if(isset($field['values_def']))
+                               {
+                                       if($field['values_def']['valueset'])
+                                       {
+                                               $field['valueset'] = 
$field['values_def']['valueset'];
+                                               // TODO find selected value
+                                       }
+                                       else 
if(isset($field['values_def']['method']))
+                                       {
+                                       
+                                               
foreach($field['values_def']['method_input'] as $_argument => $_argument_value)
+                                               {
+                                                       if(preg_match('/^##/', 
$_argument_value))
+                                                       {
+                                                               
$_argument_value_name = trim($_argument_value,'#');
+                                                               
$_argument_value = $values[$_argument_value_name];
+                                                       }
+                                                       
$method_input[$_argument] = $_argument_value;
+                                               }
+
+                                               $field['valueset'] = 
execMethod($field['values_def']['method'],$method_input);
+                                       }
+                               }
+                       }
+
+                       $msgbox_data = $this->bocommon->msgbox_data($receipt);
+
+                       $data = array
+                       (
+                               'msgbox_data'                                   
=> $GLOBALS['phpgw']->common->msgbox($msgbox_data),
+                               'form_action'                                   
=> $GLOBALS['phpgw']->link('/index.php',$link_data),
+                               'done_action'                                   
=> $GLOBALS['phpgw']->link('/index.php',array('menuaction'=> 
'property.uigeneric.index', 'type'=> $this->type, 'type_id'=> $this->type_id)),
+                               'lang_descr'                                    
=> lang('Descr'),
+                               'lang_save'                                     
        => lang('save'),
+                               'lang_cancel'                                   
=> lang('cancel'),
+                               'lang_apply'                                    
=> lang('apply'),
+                               'value_id'                                      
        => isset($values['id']) ? $values['id'] : '',
+                               'value_descr'                                   
=> $values['descr'],
+
+                               'attributes_group'                              
=> $attributes,
+                               'lookup_functions'                              
=> isset($values['lookup_functions'])?$values['lookup_functions']:'',
+                               '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'),
+                               'id_name'                                       
        => $this->location_info['id']['name'],
+                               'id_type'                                       
        => $this->location_info['id']['type'],
+                               'fields'                                        
        => $this->location_info['fields']
+                       );
+
+                       $appname        =  $this->location_info['name'];
+
+                       $GLOBALS['phpgw_info']['flags']['app_header'] = 
lang('property') . "::{$appname}::{$function_msg}";
+                       
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('edit' => $data));
+               }
+
+               function delete()
+               {
+                       if(!$this->acl_delete)
+                       {
+                               return lang('no access');
+                       }
+
+                       $id     = 
phpgw::get_var($this->location_info['id']['name']);
+
+                       if( phpgw::get_var('phpgw_return_as') == 'json' )
+                       {
+                               $this->bo->delete($id);
+                               return lang('id %1 has been deleted', $id);
+                       }
+               }
+       }
+

Modified: trunk/property/inc/class.uiinvoice.inc.php
===================================================================
--- trunk/property/inc/class.uiinvoice.inc.php  2010-11-17 14:13:13 UTC (rev 
6612)
+++ trunk/property/inc/class.uiinvoice.inc.php  2010-11-17 21:51:15 UTC (rev 
6613)
@@ -1990,8 +1990,9 @@
 
                        if($vendor_id)
                        {
-                               $contacts               = 
CreateObject('property.soactor');
-                               $contacts->role         = 'vendor';
+                               $contacts       = 
CreateObject('property.sogeneric');
+                               $contacts->get_location_info('vendor',false);
+
                                $lookup = array
                                (
                                        'attributes' => array
@@ -2003,7 +2004,7 @@
                                        )
                                );
 
-                               $vendor                 = 
$contacts->read_single($vendor_id, $lookup);
+                               $vendor                 = 
$contacts->read_single(array('id' => $vendor_id), $lookup);
 
                                if(is_array($vendor))
                                {
@@ -2677,13 +2678,14 @@
                        if (isSet($values) AND is_array($values))
                        {
 
-                               $contacts       = 
CreateObject('property.soactor');
-                               $contacts->role='vendor';
+                               $contacts       = 
CreateObject('property.sogeneric');
+                               $contacts->get_location_info('vendor',false);
+
                                if($values[0]['vendor_id'])
                                {
                                        $custom                                 
        = createObject('property.custom_fields');
                                        $vendor_data['attributes']      = 
$custom->find('property','.vendor', 0, '', 'ASC', 'attrib_sort', true, true);
-                                       $vendor_data                            
= $contacts->read_single($values[0]['vendor_id'],$vendor_data);
+                                       $vendor_data                            
= $contacts->read_single(array('id' => $values[0]['vendor_id']),$vendor_data);
                                        if(is_array($vendor_data))
                                        {
                                                
foreach($vendor_data['attributes'] as $attribute)

Modified: trunk/property/inc/class.uilocation.inc.php
===================================================================
--- trunk/property/inc/class.uilocation.inc.php 2010-11-17 14:13:13 UTC (rev 
6612)
+++ trunk/property/inc/class.uilocation.inc.php 2010-11-17 21:51:15 UTC (rev 
6613)
@@ -871,6 +871,7 @@
 
 
 
+
                        }
 
                        $datatable['pagination']['records_total']       = 
$this->bo->total_records;
@@ -1039,7 +1040,7 @@
                        $values_assign = $_POST['values_assign'];
                        $role_id = phpgw::get_var('role_id', 'int');
                        $receipt = array();
-               $_role = CreateObject('property.socategory');
+               $_role = CreateObject('property.sogeneric');
                        $_role->get_location_info('responsibility_role','');
 
                        $this->save_sessiondata();
@@ -1097,6 +1098,7 @@
                                'status'                        => 
$this->status,
                                'location_code'                 => 
$this->location_code
                                        ));
+
                        $datatable['config']['allow_allrows'] = true;
 
                                $datatable['config']['base_java_url'] = 
"menuaction:'property.uilocation.responsiblility_role',"
@@ -1167,7 +1169,7 @@
                                'order'         => 'name'
                        );
 
-                       $values_combo_box[4] =   
execMethod('property.socategory.get_list',$_role_criteria);
+                       $values_combo_box[4] =   
execMethod('property.sogeneric.get_list',$_role_criteria);
                                $default_value = array 
('id'=>'','name'=>lang('no role'));
                                array_unshift 
($values_combo_box[4],$default_value);
 

Modified: trunk/property/inc/class.uilookup.inc.php
===================================================================
--- trunk/property/inc/class.uilookup.inc.php   2010-11-17 14:13:13 UTC (rev 
6612)
+++ trunk/property/inc/class.uilookup.inc.php   2010-11-17 21:51:15 UTC (rev 
6613)
@@ -2748,7 +2748,7 @@
                        );
 
                        $template_list = array();
-                       $bo     = CreateObject('property.bocategory',true);
+                       $bo     = CreateObject('property.bogeneric',true);
                        $template_list = $bo->read();
 
                        $content = array();

Modified: trunk/property/inc/class.uipricebook.inc.php
===================================================================
--- trunk/property/inc/class.uipricebook.inc.php        2010-11-17 14:13:13 UTC 
(rev 6612)
+++ trunk/property/inc/class.uipricebook.inc.php        2010-11-17 21:51:15 UTC 
(rev 6613)
@@ -69,8 +69,8 @@
 
                        $this->bo                               = 
CreateObject('property.bopricebook',true);
                        $this->bocommon                         = 
CreateObject('property.bocommon');
-                       $this->contacts                         = 
CreateObject('property.soactor');
-                       $this->contacts->role                   = 'vendor';
+                       $this->contacts = CreateObject('property.sogeneric');
+                       $this->contacts->get_location_info('vendor',false);
 
                        $this->acl                                      = & 
$GLOBALS['phpgw']->acl;
                        $this->acl_location                     = '.agreement';
@@ -920,7 +920,7 @@
                        $num_records    = count($pricebook_list);
 
 
-                       $vendor_data = 
$this->contacts->read_single(array('actor_id'=>$vendor_id));
+                       $vendor_data = 
$this->contacts->read_single(array('id'=>$vendor_id), 
array('attributes'=>array(array('column_name' => 'org_name'))));
 
                        if(is_array($vendor_data))
                        {

Modified: trunk/property/inc/hook_settings.inc.php
===================================================================
--- trunk/property/inc/hook_settings.inc.php    2010-11-17 14:13:13 UTC (rev 
6612)
+++ trunk/property/inc/hook_settings.inc.php    2010-11-17 21:51:15 UTC (rev 
6613)
@@ -236,7 +236,7 @@
 
        create_input_box('Your Cellphone','cellphone');
        create_input_box('RessursNr','ressursnr');
-       $ecodimb        = CreateObject('property.socategory');
+       $ecodimb        = CreateObject('property.sogeneric');
        $ecodimb->get_location_info('dimb',false);
        $values_dimb = $ecodimb->read(array('sort' => 'ASC','order' => 'id', 
'allrows'=>true));
 

Copied: trunk/property/js/yahoo/generic.index.js (from rev 6612, 
trunk/property/js/yahoo/category.index.js)
===================================================================
--- trunk/property/js/yahoo/generic.index.js                            (rev 0)
+++ trunk/property/js/yahoo/generic.index.js    2010-11-17 21:51:15 UTC (rev 
6613)
@@ -0,0 +1,65 @@
+//--------------------------------------------------------
+// Declaration of location.index vars
+//--------------------------------------------------------
+       // define buttons
+//     var selectsButtons = [];
+
+       var oNormalButton_0,oNormalButton_1,oNormalButton_2,oNormalButton_3;
+       var normalButtons = [
+       {order:0, name:'btn_search', funct:"onSearchClick"},
+       {order:1, name:'btn_new', funct:"onNewClick"},
+       {order:2, name:'btn_done', funct:"onDoneClick"},
+       {order:3, name:'btn_export', funct:"onDownloadClick"}
+       ];
+
+       // define Text buttons
+       var textImput = [
+               {order:0, name:'query',id:'txt_query'}
+       ];
+
+       var toolTips =
+       [
+               {name:'btn_export', title:'download', description:'Download 
table to your browser',ColumnDescription:''}
+       ]
+
+       // define the hidden column in datatable
+       var config_values =
+       {
+               date_search : 0, //if search has link "Data search"
+               particular_done : "admin.uimainscreen.mainscreen"
+       }
+/****************************************************************************************/
+       this.particular_setting = function()
+       {
+               if(flag_particular_setting=='init')
+               {
+               }
+               else if(flag_particular_setting=='update')
+               {
+               }
+       }
+/****************************************************************************************/
+
+       this.myParticularRenderEvent = function()
+       {
+               //don't delete it
+               document.getElementById('txt_query').focus();
+       }
+/****************************************************************************************/
+       YAHOO.util.Event.addListener(window, "load", function()
+       {
+               
YAHOO.util.Dom.getElementsByClassName('toolbar','div')[0].style.display = 
'none';
+
+               var loader = new YAHOO.util.YUILoader();
+               loader.addModule({
+                       name: "anyone", //module name; must be unique
+                       type: "js", //can be "js" or "css"
+                   fullpath: property_js //'property_js' have the path for 
property.js, is render in HTML
+                   });
+
+               loader.require("anyone");
+
+               //Insert JSON utility on the page
+
+           loader.insert();
+       });

Copied: trunk/property/templates/base/generic.xsl (from rev 6612, 
trunk/property/templates/base/category.xsl)
===================================================================
--- trunk/property/templates/base/generic.xsl                           (rev 0)
+++ trunk/property/templates/base/generic.xsl   2010-11-17 21:51:15 UTC (rev 
6613)
@@ -0,0 +1,171 @@
+<!-- $Id$ -->
+
+       <xsl:template name="app_data">
+               <xsl:choose>
+                       <xsl:when test="edit">
+                               <xsl:apply-templates select="edit"/>
+                       </xsl:when>
+               </xsl:choose>
+       </xsl:template>
+
+<!-- add / edit  -->
+       <xsl:template match="edit" xmlns:php="http://php.net/xsl";>
+               <script type="text/javascript">
+                       self.name="first_Window";
+                       <xsl:value-of select="lookup_functions"/>
+               </script>
+       
+               <xsl:choose>
+                       <xsl:when test="msgbox_data != ''">
+                               <xsl:call-template name="msgbox"/>
+                       </xsl:when>
+               </xsl:choose>
+
+               <div class="yui-navset" id="general_edit_tabview">
+
+                       <xsl:variable name="form_action"><xsl:value-of 
select="form_action"/></xsl:variable>
+                       <form method="post" action="{$form_action}">
+                       <xsl:value-of disable-output-escaping="yes" 
select="tabs" />
+                       <div class="yui-content">               
+                               <div id="general">
+               <table cellpadding="2" cellspacing="2" width="79%" 
align="center">
+                       <xsl:choose>
+                               <xsl:when test="id_type != 'auto'">
+                                       <tr>
+                                               <td valign="top">
+                                                       <xsl:value-of 
select="php:function('lang', 'id')"/>
+                                               </td>
+                                               <td>
+                                                       <xsl:choose>
+                                                               <xsl:when 
test="value_id != ''">
+                                                                       
<xsl:value-of select="value_id"/>
+                                                               </xsl:when>
+                                                               <xsl:otherwise>
+                                                                       <input 
type="text" name="values[{id_name}]" value="{value_id}" 
onMouseout="window.status='';return true;">
+                                                                               
<xsl:attribute name="title">
+                                                                               
        <xsl:value-of select="php:function('lang', 'Enter the ID')"/>
+                                                                               
</xsl:attribute>
+                                                                       </input>
+                                                               </xsl:otherwise>
+                                                       </xsl:choose>   
+                                               </td>
+                                       </tr>
+                               </xsl:when>
+                               <xsl:otherwise>
+
+                                       <xsl:choose>
+                                               <xsl:when test="value_id != ''">
+                                                       <tr>
+                                                               <td 
valign="top">
+                                                                       
<xsl:value-of select="php:function('lang', 'id')"/>
+                                                               </td>
+                                                               <td>
+                                                                       
<xsl:value-of select="value_id"/>
+                                                               </td>
+                                                       </tr>
+                                               </xsl:when>
+                                       </xsl:choose>   
+                               </xsl:otherwise>
+                       </xsl:choose>
+
+               <xsl:for-each select="fields" >
+                       <xsl:variable name="name"><xsl:value-of 
select="name"/></xsl:variable>
+                       <tr>
+                               <td align="left" width="19%" valign="top" 
title="{descr}">
+                                       <xsl:value-of select="descr"/>
+                               </td>
+                               <td align="left">
+                                       <xsl:choose>
+                                               <xsl:when test="type='text'">
+                                                       <textarea 
cols="{//textareacols}" rows="{//textarearows}" name="values[{name}]">
+                                                               <xsl:value-of 
select="value"/>          
+                                                       </textarea>
+                                               </xsl:when>
+                                               <xsl:when test="type='varchar' 
or type='integer' or type='int'">
+                                                       <input type="text" 
name="values[{name}]" value="{value}" size="{size}" >
+                                                               <xsl:attribute 
name="title">
+                                                                       
<xsl:value-of select="descr"/>
+                                                               </xsl:attribute>
+                                                       </input>
+                                               </xsl:when>
+                                               <xsl:when 
test="type='checkbox'">
+                                                       <xsl:choose>
+                                                               <xsl:when 
test="value = 1">
+                                                                       <input 
type="checkbox" name="values[{name}]" value="1" checked="checked">
+                                                                               
<xsl:attribute name="title">
+                                                                               
                <xsl:value-of select="descr"/>
+                                                                               
</xsl:attribute>
+                                                                       </input>
+                                                               </xsl:when>
+                                                               <xsl:otherwise>
+                                                                       <input 
type="checkbox" name="values[{name}]" value="1">
+                                                                               
<xsl:attribute name="title">
+                                                                               
                <xsl:value-of select="descr"/>
+                                                                               
</xsl:attribute>
+                                                                       </input>
+                                                               </xsl:otherwise>
+                                                       </xsl:choose>
+                                               </xsl:when>
+                                               <xsl:when test="type='select'">
+                                                       <select 
name="values[{name}]" >
+                                                               <option 
value="">
+                                                                       
<xsl:value-of select="php:function('lang', 'select value')" />
+                                                               </option>
+                                                               <xsl:for-each 
select="valueset" >
+                                                                       <option 
value="{id}">
+                                                                               
<xsl:if test="selected != 0">
+                                                                               
        <xsl:attribute name="selected" value="selected" />
+                                                                               
</xsl:if>
+                                                                               
<xsl:value-of select="name"/>
+                                                                       
</option>                                               
+                                                               </xsl:for-each>
+                                                       </select>
+                                               </xsl:when>
+                                               <xsl:when 
test="type='multiple_select'">
+                                                       <select 
name="values[{name}][]" multiple="multiple">
+                                                               <xsl:for-each 
select="valueset" >
+                                                                       <option 
value="{id}">
+                                                                               
<xsl:if test="selected != 0">
+                                                                               
        <xsl:attribute name="selected" value="selected" />
+                                                                               
</xsl:if>
+                                                                               
<xsl:value-of select="name"/>
+                                                                       
</option>                                               
+                                                               </xsl:for-each>
+                                                       </select>
+                                               </xsl:when>
+                                       </xsl:choose>
+                               </td>
+                       </tr>
+               </xsl:for-each>
+               </table>
+               </div>
+               <xsl:call-template name="attributes_values"/>
+               <table cellpadding="2" cellspacing="2" width="80%" 
align="center">
+                       <tr height="50">
+                               <td valign="bottom">
+                                       <input type="submit" 
name="values[save]" value="{lang_save}" onMouseout="window.status='';return 
true;">
+                                               <xsl:attribute name="title">
+                                                       <xsl:value-of 
select="php:function('lang', 'Save the record and return to the list')"/>
+                                               </xsl:attribute>
+                                       </input>
+                               </td>
+                               <td valign="bottom">
+                                       <input type="submit" 
name="values[apply]" value="{lang_apply}" onMouseout="window.status='';return 
true;">
+                                               <xsl:attribute name="title">
+                                                       <xsl:value-of 
select="php:function('lang', 'Apply the values')"/>
+                                               </xsl:attribute>
+                                       </input>
+                               </td>
+                               <td align="right" valign="bottom">
+                                       <input type="submit" 
name="values[cancel]" value="{lang_cancel}" onMouseout="window.status='';return 
true;">
+                                               <xsl:attribute name="title">
+                                                       <xsl:value-of 
select="php:function('lang', 'Leave the record untouched and return to the 
list')"/>
+                                               </xsl:attribute>
+                                       </input>
+                               </td>
+                       </tr>
+               </table>
+               </div>
+               </form>
+               </div>
+       </xsl:template>




reply via email to

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