phpgroupware-cvs
[Top][All Lists]
Advanced

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

[Phpgroupware-cvs] [18654] update and stabilize


From: Sigurd Nes
Subject: [Phpgroupware-cvs] [18654] update and stabilize
Date: Wed, 27 Aug 2008 18:20:25 +0000

Revision: 18654
          
http://svn.sv.gnu.org/viewvc/?view=rev&root=phpgroupware&revision=18654
Author:   sigurdne
Date:     2008-08-27 18:20:24 +0000 (Wed, 27 Aug 2008)

Log Message:
-----------
update and stabilize

Modified Paths:
--------------
    trunk/property/inc/class.boentity.inc.php
    trunk/property/inc/class.boproject.inc.php
    trunk/property/inc/class.borequest.inc.php
    trunk/property/inc/class.botts.inc.php
    trunk/property/inc/class.soentity.inc.php
    trunk/property/inc/class.soinvoice.inc.php
    trunk/property/inc/class.solocation.inc.php
    trunk/property/inc/class.soproject.inc.php
    trunk/property/inc/class.sorequest.inc.php
    trunk/property/inc/class.sotenant_claim.inc.php
    trunk/property/inc/class.sotts.inc.php
    trunk/property/inc/class.uiXport.inc.php
    trunk/property/inc/class.uientity.inc.php
    trunk/property/inc/class.uilocation.inc.php
    trunk/property/inc/class.uiproject.inc.php
    trunk/property/inc/class.uirequest.inc.php
    trunk/property/inc/class.uitenant_claim.inc.php
    trunk/property/inc/class.uitts.inc.php
    trunk/property/inc/cron/synkroniser_med_boei.php
    trunk/property/setup/default_records.inc.php
    trunk/property/setup/phpgw_en.lang
    trunk/property/setup/phpgw_no.lang
    trunk/property/setup/setup.inc.php
    trunk/property/setup/tables_current.inc.php
    trunk/property/setup/tables_update.inc.php
    trunk/property/templates/base/entity.xsl
    trunk/property/templates/base/project.xsl
    trunk/property/templates/base/request.xsl
    trunk/property/templates/base/tenant_claim.xsl
    trunk/property/templates/base/tts.xsl
    trunk/property/tutorials/property/examples/install.apache.sh

Added Paths:
-----------
    trunk/property/inc/class.interlink.inc.php

Modified: trunk/property/inc/class.boentity.inc.php
===================================================================
--- trunk/property/inc/class.boentity.inc.php   2008-08-02 18:25:56 UTC (rev 
18653)
+++ trunk/property/inc/class.boentity.inc.php   2008-08-27 18:20:24 UTC (rev 
18654)
@@ -319,6 +319,9 @@
                                unset($values['files']);
                        }
 
+                       $interlink      = CreateObject('property.interlink');
+                       $values['origin'] = 
$interlink->get_relation('property', 
".entity.{$data['entity_id']}.{$data['cat_id']}", $data['id'], 'origin');
+                       $values['target'] = 
$interlink->get_relation('property', 
".entity.{$data['entity_id']}.{$data['cat_id']}", $data['id'], 'target');
                        return $values;
                }
 

Modified: trunk/property/inc/class.boproject.inc.php
===================================================================
--- trunk/property/inc/class.boproject.inc.php  2008-08-02 18:25:56 UTC (rev 
18653)
+++ trunk/property/inc/class.boproject.inc.php  2008-08-27 18:20:24 UTC (rev 
18654)
@@ -59,6 +59,7 @@
                        $this->cats                                     = 
CreateObject('phpgwapi.categories');
                        $this->cats->app_name           = 'property.project';
                        $this->cats->supress_info       = true;
+                       $this->interlink        = 
CreateObject('property.interlink');
 
                        if ($session)
                        {
@@ -222,22 +223,15 @@
 
 //                     $cols_extra             = $this->so->cols_extra;
 
-                       for ($i=0; $i<count($project); $i++)
+                       foreach ($project as & $entry)
                        {
-                               $project[$i]['start_date'] = 
$GLOBALS['phpgw']->common->show_date($project[$i]['start_date'],$dateformat);
-                               $project[$i]['ticket_id'] = 
$this->so->get_ticket($project[$i]['project_id']);
-
-/*                             
$location_data=$this->solocation->read_single($project[$i]['location_code']);
-
-                               for ($j=0;$j<count($cols_extra);$j++)
+                               $entry['start_date'] = 
$GLOBALS['phpgw']->common->show_date($entry['start_date'],$dateformat);
+                               $origin = 
$this->interlink->get_relation('property', '.project', $entry['project_id'], 
'origin');
+                               if($origin[0]['location'] == '.ticket')
                                {
-                                       $project[$i][$cols_extra[$j]] = 
$location_data[$cols_extra[$j]];
+                                       $entry['ticket_id'] = 
$origin[0]['data'][0]['id'];
                                }
-*/
                        }
-
-//_debug_array($project);
-
                        return $project;
                }
 
@@ -330,6 +324,8 @@
                                
$project['p'][$project['p_entity_id']]['p_cat_name'] = $category['name'];
                        }
 
+                       $project['origin'] = 
$this->interlink->get_relation('property', '.project', $project_id, 'origin');
+                       $project['target'] = 
$this->interlink->get_relation('property', '.project', $project_id, 'target');
 
 //_debug_array($project);
                        return $project;

Modified: trunk/property/inc/class.borequest.inc.php
===================================================================
--- trunk/property/inc/class.borequest.inc.php  2008-08-02 18:25:56 UTC (rev 
18653)
+++ trunk/property/inc/class.borequest.inc.php  2008-08-27 18:20:24 UTC (rev 
18654)
@@ -343,6 +343,10 @@
                                unset($request['files']);
                        }
 
+                       $interlink      = CreateObject('property.interlink');
+                       $request['origin'] = 
$interlink->get_relation('property', '.project.request', $request_id, 'origin');
+                       $request['target'] = 
$interlink->get_relation('property', '.project.request', $request_id, 'target');
+
                        return $request;
                }
 

Modified: trunk/property/inc/class.botts.inc.php
===================================================================
--- trunk/property/inc/class.botts.inc.php      2008-08-02 18:25:56 UTC (rev 
18653)
+++ trunk/property/inc/class.botts.inc.php      2008-08-27 18:20:24 UTC (rev 
18654)
@@ -296,6 +296,7 @@
 
                function read($start_date='',$end_date='', $external='')
                {
+                       $interlink      = CreateObject('property.interlink');
                        $start_date     = 
$this->bocommon->date_to_timestamp($start_date);
                        $end_date       = 
$this->bocommon->date_to_timestamp($end_date);
 
@@ -311,7 +312,7 @@
                        }
                        else
                        {
-                               $entity[0]['type']='project';
+                               $entity[0]['type']='.project';
                                $this->uicols[] = lang('project');
                        }
 
@@ -356,18 +357,16 @@
                                {
                                        for ($j=0;$j<count($entity);$j++)
                                        {
-                                               $ticket['child_date'][$j] = 
$this->so->get_child_date($ticket['id'],$entity[$j]['type'],(isset($entity[$j]['entity_id'])?$entity[$j]['entity_id']:''),(isset($entity[$j]['cat_id'])?$entity[$j]['cat_id']:''));
+                                               $ticket['child_date'][$j] = 
$interlink->get_child_date('property', '.ticket', $entity[$j]['type'], 
$ticket['id'], 
isset($entity[$j]['entity_id'])?$entity[$j]['entity_id']:'',isset($entity[$j]['cat_id'])?$entity[$j]['cat_id']:'');
                                        }
                                }
                        }
-
 //_debug_array($tickets);
                        return $tickets;
                }
 
                function read_single($id)
                {
-
                        $this->so->update_view($id);
 
                        $ticket = $this->so->read_single($id);
@@ -375,7 +374,10 @@
                        $ticket['user_lid'] = 
$GLOBALS['phpgw']->accounts->id2name($ticket['user_id']);
                        $ticket['group_lid'] = 
$GLOBALS['phpgw']->accounts->id2name($ticket['group_id']);
 
-
+                       $interlink      = CreateObject('property.interlink');
+                       $ticket['origin'] = 
$interlink->get_relation('property', '.ticket', $id, 'origin');
+                       $ticket['target'] = 
$interlink->get_relation('property', '.ticket', $id, 'target');
+//_debug_array($ticket);
                        if(isset($ticket['finnish_date2']) && 
$ticket['finnish_date2'])
                        {
                                
$ticket['finnish_date']=$ticket['finnish_date2'];

Added: trunk/property/inc/class.interlink.inc.php
===================================================================
--- trunk/property/inc/class.interlink.inc.php                          (rev 0)
+++ trunk/property/inc/class.interlink.inc.php  2008-08-27 18:20:24 UTC (rev 
18654)
@@ -0,0 +1,389 @@
+<?php
+       /**
+       * phpGroupWare - property: a Facilities Management System.
+       *
+       * @author Sigurd Nes <address@hidden>
+       * @copyright Copyright (C) 2008 Free Software Foundation, Inc. 
http://www.fsf.org/
+       * @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 phpgroupware
+       * @subpackage property
+       * @category core
+       * @version $Id: class.interlink.inc.php 732 2008-02-10 16:21:14Z sigurd 
$
+       */
+
+       /*
+          This program 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 3 of the License, or
+          (at your option) any later version.
+
+          This program 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 this program.  If not, see <http://www.gnu.org/licenses/>.
+        */
+
+       /**
+        * interlink - handles information of relations of items across 
locations.
+        *
+        * @package phpgroupware
+        * @subpackage property
+        * @category core
+        */
+
+       class property_interlink
+       {
+               /**
+               * @var object $_db Database connection
+               */
+               protected $_db;
+
+               /**
+               * Constructor
+               *
+               */
+
+               function __construct()
+               {
+//                     $this->_account                 =& 
$GLOBALS['phpgw_info']['user']['account_id'];
+                       $this->_db                              =& 
$GLOBALS['phpgw']->db;
+                       $this->boadmin_entity   = 
CreateObject('property.boadmin_entity');
+
+//                     $this->_like                    =& $this->db->like;
+//                     $this->_join                    =& $this->db->join;
+//                     $this->_left_join               =& $this->db->left_join;
+               }
+
+               /**
+               * Get relation of the interlink
+               *
+               * @param string  $appname  the application name for the location
+               * @param string  $location the location name
+               * @param integer $id       id of the referenced item
+               * @param integer $role     role of the referenced item 
('origin' or 'target')
+               *
+               * @return array interlink data
+               */
+
+               public function get_relation($appname, $location, $id, $role = 
'origin')
+               {
+                       $location_id    = 
$GLOBALS['phpgw']->locations->get_id($appname, $location);
+                       $id                             = (int) $id;
+
+                       switch( $role )
+                       {
+                               case 'target':
+                                       $sql = "SELECT location2_id as 
linkend_location, location2_item_id as linkend_id FROM phpgw_interlink WHERE 
location1_id = {$location_id} AND location1_item_id = {$id} ORDER by 
location1_id DESC";
+                                       break;
+                               default:
+                                       $sql = "SELECT location1_id as 
linkend_location, location1_item_id as linkend_id FROM phpgw_interlink WHERE 
location2_id = {$location_id} AND location2_item_id = {$id} ORDER by 
location2_id DESC";
+                       }
+
+                       $this->_db->query($sql,__LINE__,__FILE__);
+                       $relation = array();
+
+                       $last_type = false;
+                       $i=-1;
+                       while ($this->_db->next_record())
+                       {
+                               if($last_type != 
$this->_db->f('linkend_location'))
+                               {
+                                       $i++;
+                               }
+                               $relation[$i]['linkend_location']       = 
$this->_db->f('linkend_location');
+                               $relation[$i]['data'][] = array( 'id' => 
$this->_db->f('linkend_id'));
+
+                               $last_type = $this->_db->f('linkend_location');
+                       }
+
+                       foreach ($relation as &$entry)
+                       {
+                               $linkend_location = 
$GLOBALS['phpgw']->locations->get_name($entry['linkend_location']);
+                               $entry['location'] = 
$linkend_location['location'];
+
+                               $entry['descr']= 
$this->get_location_name($linkend_location['location']);
+
+                               foreach ($entry['data'] as &$data)
+                               {
+                                       $data['link'] = 
$this->get_relation_link($linkend_location, $data['id']);
+                               }
+                       }
+                       return $relation;
+               }
+
+               /**
+               * Get specific target
+               *
+               * @param string  $appname  the application name for the location
+               * @param string  $location1 the location name of origin
+               * @param string  $location1 the location name of target
+               * @param integer $id       id of the referenced item
+               * @param integer $role     role of the referenced item 
('origin' or 'target')
+               *
+               * @return array targets
+               */
+
+               public function get_specific_relation($appname, $location1, 
$location2, $id, $role = 'origin')
+               {
+                       $location1_id   = 
$GLOBALS['phpgw']->locations->get_id($appname, $location1);
+                       $location2_id   = 
$GLOBALS['phpgw']->locations->get_id($appname, $location2);
+                       $id = (int) $id;
+                       $targets = array();
+
+                       switch( $role )
+                       {
+                               case 'target':
+                                       $sql = "SELECT location2_item_id as 
item_id FROM phpgw_interlink WHERE location1_id = {$location1_id} AND 
location2_id = {$location2_id} AND location1_item_id = {$id}";
+                                       break;
+                               default:
+                                       $sql = "SELECT location1_item_id as 
item_id FROM phpgw_interlink WHERE location1_id = {$location1_id} AND 
location2_id = {$location2_id} AND location2_item_id = {$id}";
+                       }
+
+                       $this->_db->query($sql,__LINE__,__FILE__);
+                       while ($this->_db->next_record())
+                       {
+                               $targets[]= $this->_db->f('item_id');
+                       }
+                       return $targets;
+               }
+
+               
+               /**
+               * Get location name
+               *
+               * @param array   $linkend_location the location
+               * @param integer $id                       the id of the 
referenced item
+               *
+               * @return string the linkt to the the related item
+               */
+
+               public function get_location_name($location)
+               {
+                       if(substr($location,1,6)=='entity')
+                       {
+                               $type           = explode(".",$location);
+                               $entity_id      = $type[2];
+                               $cat_id         = $type[3];
+
+                               $entity_category = 
$this->boadmin_entity->read_single_category($entity_id,$cat_id);
+                               return $entity_category['name'];
+                       }
+                       else
+                       {
+                               return lang($location);
+                       }
+               }
+               /**
+               * Get relation of the interlink
+               *
+               * @param array   $linkend_location the location
+               * @param integer $id                       the id of the 
referenced item
+               *
+               * @return string the linkt to the the related item
+               */
+
+               public function get_relation_link($linkend_location, $id)
+               {
+                       $link = array();
+                       $type = $linkend_location['location'];
+                       if($type == '.ticket')
+                       {
+                               $link = array('menuaction' => 
'property.uitts.view', 'id' => $id);
+                       }
+                       else if($type == '.project.workorder')
+                       {
+                               $link = array('menuaction' => 
'property.uiworkorder.view', 'id' => $id);
+                       }
+                       else if($type == '.project.request')
+                       {
+                               $link = array('menuaction' => 
'property.uirequest.view', 'id' => $id);
+                       }
+                       else if($type == '.project')
+                       {
+                               $link = array('menuaction' => 
'property.uiproject.view', 'id' => $id);
+                       }
+                       else if( substr($type, 1, 6) == 'entity' )
+                       {
+                               $type           = explode('.',$type);
+                               $entity_id      = $type[2];
+                               $cat_id         = $type[3];
+                               $link = array
+                               (
+                                       'menuaction'    => 
'property.uientity.view',
+                                       'entity_id'             => $entity_id,
+                                       'cat_id'                => $cat_id,
+                                       'id'                    => $id
+                               );
+                       }
+                       return $GLOBALS['phpgw']->link('/index.php',$link);     
+               }
+
+               /**
+               * Get entry date of the related item
+               *
+               * @param string  $appname                 the application name 
for the location
+               * @param string  $origin_location the location name of the 
origin
+               * @param string  $target_location the location name of the 
target
+               * @param integer $id                      id of the referenced 
item (parent)
+               * @param integer $entity_id               id of the entity type 
if the type is a entity
+               * @param integer $cat_id                  id of the 
entity_category type if the type is a entity
+               *
+               * @return array date_info and link to related items
+               */
+
+               public function get_child_date($appname, $origin_location, 
$target_location, $id, $entity_id = '', $cat_id = '')
+               {
+                       $dateformat     = 
$GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat'];
+                       if($cat_id)
+                       {
+                               $soadmin_entity = 
CreateObject('property.soadmin_entity');
+                       }
+
+                       $location1_id   = 
$GLOBALS['phpgw']->locations->get_id($appname, $origin_location);
+                       $location2_id   = 
$GLOBALS['phpgw']->locations->get_id($appname, $target_location);
+
+                       $sql = "SELECT entry_date, location2_item_id FROM 
phpgw_interlink WHERE location1_item_id = {$id} AND location1_id = 
{$location1_id} AND location2_id = {$location2_id}";
+
+                       $this->_db->query($sql,__LINE__,__FILE__);
+
+                       $date_info = array();
+                       while ($this->_db->next_record())
+                       {
+                               $date_info[] = array
+                               (
+                                       'entry_date'    => 
$GLOBALS['phpgw']->common->show_date($this->_db->f('entry_date'),$dateformat),
+                                       'target_id'             => 
$this->_db->f('location2_item_id')
+                               );
+                       }
+
+                       foreach ( $date_info as &$entry )
+                       {
+                               
$entry['link']=$this->get_relation_link(array('location'=>$target_location), 
$entry['target_id']);
+                               if($cat_id)
+                               {
+                                       
$entry['descr']=$soadmin_entity->read_category_name($entity_id,$cat_id);
+                               }
+                               else
+                               {
+                                       $entry['descr']=lang($target_location);
+                               }
+                       }
+                       return array('date_info' => $date_info);
+               }
+
+               /**
+               * Add link to item
+               *
+               * @param array  $data   link data
+               * @param object $db             db-object - used to keep the 
operation within the callers transaction
+               *
+               * @return bool true on success, false otherwise
+               */
+
+               public function add($data, $db = '')
+               {
+                       if(!$db)
+                       {
+                               $db = $this->_db;
+                       }
+                       $location1_id           = $data['location1_id'];
+                       $location1_item_id      = $data['location1_item_id'];
+                       $location2_id           = $data['location2_id'];
+                       $location2_item_id      = $data['location2_item_id'];
+                       $account_id                     = $data['account_id'];
+                       $entry_date                     = time();
+                       $is_private                     = 
isset($data['is_private']) && $data['is_private'] ? $data['is_private'] : -1;
+                       $start_date                     = 
isset($data['start_date']) && $data['start_date'] ? $data['start_date'] : -1;
+                       $end_date                       = 
isset($data['end_date']) && $data['end_date'] ? $data['end_date'] : -1;
+                       
+                       $db->query('INSERT INTO phpgw_interlink 
(location1_id,location1_item_id,location2_id,location2_item_id,account_id,entry_date,is_private,start_date,end_date)
 '
+                               . "VALUES 
({$location1_id},{$location1_item_id},{$location2_id},{$location2_item_id},{$account_id},{$entry_date},{$is_private},{$start_date},{$end_date})",__LINE__,__FILE__);
+                       
+               }
+
+               /**
+               * Delete link at origin
+               *
+               * @param string  $appname   the application name for the 
location
+               * @param string  $location1 the location name of origin
+               * @param string  $location1 the location name of target
+               * @param integer $id        id of the referenced item
+               * @param object $db                     db-object - used to 
keep the operation within the callers transaction
+               *
+               * @return array interlink data
+               */
+
+               public function delete_at_origin($appname, $location1, 
$location2, $id, $db = '')
+               {
+                       if(!$db)
+                       {
+                               $db = $this->_db;
+                       }
+
+                       $location1_id   = 
$GLOBALS['phpgw']->locations->get_id($appname, $location1);
+                       $location2_id   = 
$GLOBALS['phpgw']->locations->get_id($appname, $location2);
+                       $id                             = (int) $id;
+
+                       $sql = "DELETE FROM phpgw_interlink WHERE location1_id 
= {$location1_id} AND location2_id = {$location2_id} AND location1_item_id = 
{$id}";
+
+                       $db->query($sql,__LINE__,__FILE__);
+               }
+
+               /**
+               * Delete all relations based on a given start point (location1 
and item1)
+               *
+               * @param string  $appname   the application name for the 
location
+               * @param string  $location  the location name of target
+               * @param integer $id        id of the referenced item
+               * @param object $db                     db-object - used to 
keep the operation within the callers transaction
+               *
+               * @return array interlink data
+               */
+
+               public function delete_at_target($appname, $location, $id, $db 
= '')
+               {
+                       if(!$db)
+                       {
+                               $db = $this->_db;
+                       }
+
+                       $location_id = 
$GLOBALS['phpgw']->locations->get_id($appname, $location);
+                       $id              = (int) $id;
+
+                       $sql             = "DELETE FROM phpgw_interlink WHERE 
location1_id = {$location_id} AND location1_item_id = {$id}";
+
+                       $db->query($sql,__LINE__,__FILE__);
+               }
+
+               /**
+               * Delete all relations based on a given end point (location2 
and item2)
+               *
+               * @param string  $appname   the application name for the 
location
+               * @param string  $location  the location name of target
+               * @param integer $id        id of the referenced item
+               * @param object $db                     db-object - used to 
keep the operation within the callers transaction
+               *
+               * @return array interlink data
+               */
+
+               public function delete_from_target($appname, $location, $id, 
$db = '')
+               {
+                       if(!$db)
+                       {
+                               $db = $this->_db;
+                       }
+
+                       $location_id = 
$GLOBALS['phpgw']->locations->get_id($appname, $location);
+                       $id              = (int) $id;
+
+                       $sql             = "DELETE FROM phpgw_interlink WHERE 
location2_id = {$location_id} AND location2_item_id = {$id}";
+
+                       $db->query($sql,__LINE__,__FILE__);
+               }
+
+
+       }

Modified: trunk/property/inc/class.soentity.inc.php
===================================================================
--- trunk/property/inc/class.soentity.inc.php   2008-08-02 18:25:56 UTC (rev 
18653)
+++ trunk/property/inc/class.soentity.inc.php   2008-08-27 18:20:24 UTC (rev 
18654)
@@ -484,55 +484,9 @@
                                        }
                                }
 
-// ------------- get origin---------------
-                               $sql = "SELECT * FROM fm_origin WHERE 
destination ='entity_" . $entity_id . '_' . $cat_id . "' AND destination_id = 
$id ORDER by origin DESC";
-                               $this->db->query($sql,__LINE__,__FILE__);
-
-                               $last_type = '';
-                               $i=-1;
-                               while ($this->db->next_record())
-                               {
-                                       if($last_type != $this->db->f('origin'))
-                                       {
-                                               $i++;
-                                       }
-                                       $values['origin'][$i]['type'] = 
$this->db->f('origin');
-                                       $values['origin'][$i]['link'] = 
$this->bocommon->get_origin_link($this->db->f('origin'));
-                                       $values['origin'][$i]['data'][]= array(
-                                               'id'=> 
$this->db->f('origin_id'),
-                                               'type'=> $this->db->f('origin')
-                                               );
-
-                                       $last_type = $this->db->f('origin');
-                               }
-// ------------- end get origin---------------
-// ------------- get destination---------------
-                               $sql = "SELECT * FROM fm_origin WHERE origin 
='entity_" . $entity_id . '_' . $cat_id . "' AND origin_id = $id ORDER by 
destination DESC";
-                               $this->db->query($sql,__LINE__,__FILE__);
-
-                               $last_type = '';
-                               $i=-1;
-                               while ($this->db->next_record())
-                               {
-                                       if($last_type != 
$this->db->f('destination'))
-                                       {
-                                               $i++;
-                                       }
-                                       $values['destination'][$i]['type'] = 
$this->db->f('destination');
-                                       $values['destination'][$i]['link'] = 
$this->bocommon->get_origin_link($this->db->f('destination'));
-                                       $values['destination'][$i]['data'][]= 
array(
-                                               'id'=> 
$this->db->f('destination_id'),
-                                               'type'=> 
$this->db->f('destination')
-                                               );
-
-                                       $last_type=$this->db->f('destination');
-                               }
-
-// ------------- end get destination---------------
                        return  $values;
                }
 
-
                function check_entity($entity_id,$cat_id,$num)
                {
                        $table='fm_entity_' . $entity_id .'_' . $cat_id;
@@ -656,18 +610,21 @@
                                . time() . ","
                                . $this->account. " $vals)",__LINE__,__FILE__);
 
-                       if (is_array($values['origin']))
+                       if(isset($values['origin']) && 
is_array($values['origin']))
                        {
                                if($values['origin'][0]['data'][0]['id'])
                                {
-                                       $this->db->query("INSERT INTO fm_origin 
(origin,origin_id,destination,destination_id,user_id,entry_date) "
-                                               . "VALUES ('"
-                                               . $values['origin'][0]['type']. 
"',"
-                                               . 
$values['origin'][0]['data'][0]['id']. ","
-                                               . "'entity_" . $entity_id .'_' 
. $cat_id . "',"
-                                               . $values['id']. ","
-                                               . $this->account. ","
-                                               . time() . 
")",__LINE__,__FILE__);
+                                       $interlink_data = array
+                                       (
+                                               'location1_id'          => 
$GLOBALS['phpgw']->locations->get_id('property', 
$values['origin'][0]['location']),
+                                               'location1_item_id' => 
$values['origin'][0]['data'][0]['id'],
+                                               'location2_id'          => 
$GLOBALS['phpgw']->locations->get_id('property', 
".entity.{$entity_id}.{$cat_id}"),
+                                               'location2_item_id' => 
$values['id'],
+                                               'account_id'            => 
$this->account
+                                       );
+                                       
+                                       $interlink      = 
CreateObject('property.interlink');
+                                       
$interlink->add($interlink_data,$this->db);
                                }
                        }
 
@@ -802,10 +759,11 @@
 
                function delete($entity_id,$cat_id,$id )
                {
+                       $location2_id   = 
$GLOBALS['phpgw']->locations->get_id('property', 
".entity.{$entity_id}.{$cat_id}");                   
                        $table='fm_entity_' . $entity_id .'_' . $cat_id;
                        $this->db->transaction_begin();
                        $this->db->query("DELETE FROM $table WHERE 
id=$id",__LINE__,__FILE__);
-                       $this->db->query("DELETE FROM fm_origin WHERE 
destination ='entity_" . $entity_id . '_' . $cat_id . "' AND 
destination_id=$id",__LINE__,__FILE__);
+                       $this->db->query("DELETE FROM phpgw_interlink WHERE 
location2_id ={$location2_id} AND location2_item_id = {$id}",__LINE__,__FILE__);
                        $this->db->transaction_commit();
                }
 

Modified: trunk/property/inc/class.soinvoice.inc.php
===================================================================
--- trunk/property/inc/class.soinvoice.inc.php  2008-08-02 18:25:56 UTC (rev 
18653)
+++ trunk/property/inc/class.soinvoice.inc.php  2008-08-27 18:20:24 UTC (rev 
18654)
@@ -38,47 +38,37 @@
 
                function property_soinvoice()
                {
-               //      $this->currentapp       = 
$GLOBALS['phpgw_info']['flags']['currentapp'];
                        $this->bocommon         = 
CreateObject('property.bocommon');
                        $this->account_id       = 
$GLOBALS['phpgw_info']['user']['account_id'];
 
-                       $this->acl              = & $GLOBALS['phpgw']->acl;
+                       $this->acl                      = & 
$GLOBALS['phpgw']->acl;
 
-                       $this->join             = $this->bocommon->join;
+                       $this->join                     = $this->bocommon->join;
                        $this->left_join        = $this->bocommon->left_join;
-                       $this->like             = $this->bocommon->like;
-                       $this->db               = $this->bocommon->new_db();
-                       $this->db2              = 
$this->bocommon->new_db($this->db);
-
+                       $this->like                     = $this->bocommon->like;
+                       $this->db               = $this->bocommon->new_db();
                }
 
                function read_invoice($data)
                {
                        if(is_array($data))
                        {
-                               if ($data['start'])
-                               {
-                                       $start=$data['start'];
-                               }
-                               else
-                               {
-                                       $start=0;
-                               }
-                               $query                  = 
(isset($data['query'])?$data['query']:'');
-                               $sort                   = 
(isset($data['sort'])?$data['sort']:'DESC');
-                               $order                  = 
(isset($data['order'])?$data['order']:'');
-                               $cat_id                 = 
(isset($data['cat_id'])?$data['cat_id']:0);
-                               $user_lid               = 
(isset($data['user_lid'])?$data['user_lid']:'none');
-                               $paid                   = 
(isset($data['paid'])?$data['paid']:'');
-                               $start_date             = 
(isset($data['start_date'])?$data['start_date']:'');
-                               $end_date               = 
(isset($data['end_date'])?$data['end_date']:'');
-                               $vendor_id              = 
(isset($data['vendor_id'])?$data['vendor_id']:'');
-                               $loc1                   = 
(isset($data['loc1'])?$data['loc1']:'');
-                               $workorder_id           = 
(isset($data['workorder_id'])?$data['workorder_id']:'');
-                               $allrows                = 
(isset($data['allrows'])?$data['allrows']:'');
-                               $voucher_id             = 
(isset($data['voucher_id'])?$data['voucher_id']:'');
-                               $b_account_class        = 
(isset($data['b_account_class'])?$data['b_account_class']:'');
-                               $district_id            = 
(isset($data['district_id'])?$data['district_id']:'');
+                               $start                  = isset($data['start']) 
&& $data['start'] ? $data['start'] : 0;
+                               $query                  = 
isset($data['query'])?$data['query']:'';
+                               $sort                   = isset($data['sort']) 
&& $data['sort'] ? $data['sort']:'DESC';
+                               $order                  = 
isset($data['order'])?$data['order']:'';
+                               $cat_id                 = 
isset($data['cat_id']) && $data['cat_id'] ? $data['cat_id']:0;
+                               $user_lid               = 
isset($data['user_lid']) && $data['user_lid']?$data['user_lid']:'none';
+                               $paid                   = 
isset($data['paid'])?$data['paid']:'';
+                               $start_date     = 
isset($data['start_date'])?$data['start_date']:'';
+                               $end_date               = 
isset($data['end_date'])?$data['end_date']:'';
+                               $vendor_id              = 
isset($data['vendor_id'])?$data['vendor_id']:'';
+                               $loc1                   = 
isset($data['loc1'])?$data['loc1']:'';
+                               $workorder_id   = 
isset($data['workorder_id'])?$data['workorder_id']:'';
+                               $allrows                = 
isset($data['allrows'])?$data['allrows']:'';
+                               $voucher_id     = 
isset($data['voucher_id'])?$data['voucher_id']:'';
+                               $b_account_class= 
isset($data['b_account_class'])?$data['b_account_class']:'';
+                               $district_id    = 
isset($data['district_id'])?$data['district_id']:'';
                        }
                        $join_tables    = '';
                        $filtermethod   = '';
@@ -207,9 +197,7 @@
 
                        if($query)
                        {
-                               $query = preg_replace("/'/",'',$query);
-                               $query = preg_replace('/"/','',$query);
-
+                               $query = $this->db->db_addslashes($query);
                                $querymethod = " $where ( spvend_code 
$this->like '%$query%' OR bilagsnr $this->like '%$query%' )";
                        }
 
@@ -218,8 +206,8 @@
                        $sql2 = "SELECT DISTINCT bilagsnr FROM  $table 
$join_tables $filtermethod $querymethod";
 
 //echo $sql;
-                       $this->db2->query($sql2,__LINE__,__FILE__);
-                       $this->total_records = $this->db2->num_rows();
+                       $this->db->query($sql2,__LINE__,__FILE__);
+                       $this->total_records = $this->db->num_rows();
 
                        if(!$allrows)
                        {
@@ -362,19 +350,12 @@
                {
                        if(is_array($data))
                        {
-                               if ($data['start'])
-                               {
-                                       $start=$data['start'];
-                               }
-                               else
-                               {
-                                       $start=0;
-                               }
-                               $filter = 
(isset($data['filter'])?$data['filter']:'none');
-                               $sort = 
(isset($data['sort'])?$data['sort']:'DESC');
-                               $order = 
(isset($data['order'])?$data['order']:'');
-                               $voucher_id = 
(isset($data['voucher_id'])?$data['voucher_id']:0);
-                               $paid = (isset($data['paid'])?$data['paid']:'');
+                               $start          = isset($data['start']) && 
$data['start'] ? $data['start'] : 0;
+                               $filter         = isset($data['filter']) ? 
$data['filter'] : 'none';
+                               $sort           = isset($data['sort']) ? 
$data['sort'] : 'DESC';
+                               $order          = isset($data['order']) ? 
$data['order'] : '';
+                               $voucher_id     = isset($data['voucher_id']) && 
$data['voucher_id'] ? $data['voucher_id'] : 0;
+                               $paid           = isset($data['paid']) ? 
$data['paid'] : '';
                        }
 
                        if ($paid)
@@ -403,10 +384,10 @@
 
                        $sql = "SELECT 
$table.*,fm_workorder.status,fm_workorder.charge_tenant,org_name,fm_workorder.claim_issued
 FROM $table "
                        . " $this->left_join fm_workorder on fm_workorder.id = 
$table.pmwrkord_code  "
-                       . " $this->join fm_vendor  on $table.spvend_code = 
fm_vendor.id  $filtermethod ";
+                       . " $this->join fm_vendor ON $table.spvend_code = 
fm_vendor.id $filtermethod";
 
-                       $this->db2->query($sql,__LINE__,__FILE__);
-                       $this->total_records = $this->db2->num_rows();
+                       $this->db->query($sql,__LINE__,__FILE__);
+                       $this->total_records = $this->db->num_rows();
                        $this->db->query($sql . 
$ordermethod,$start,__LINE__,__FILE__);
 
                        $i = 0;
@@ -438,11 +419,9 @@
                                $invoice[$i]['charge_tenant']                   
= $this->db->f('charge_tenant');
                                $invoice[$i]['vendor']                          
        = $this->db->f('org_name');
                                $i++;
-
                        }
 
                        return $invoice;
-
                }
 
 
@@ -450,26 +429,19 @@
                {
                        if(is_array($data))
                        {
-                               if ($data['start'])
-                               {
-                                       $start=$data['start'];
-                               }
-                               else
-                               {
-                                       $start=0;
-                               }
-                               $filter                 = 
(isset($data['filter'])?$data['filter']:'none');
-                               $query                  = 
(isset($data['query'])?$data['query']:'');
-                               $sort                   = 
(isset($data['sort'])?$data['sort']:'DESC');
-                               $order                  = 
(isset($data['order'])?$data['order']:'');
-                               $cat_id                 = 
(isset($data['cat_id'])?$data['cat_id']:0);
-                               $start_date     = 
(isset($data['start_date'])?$data['start_date']:'');
-                               $end_date               = 
(isset($data['end_date'])?$data['end_date']:'');
-                               $vendor_id              = 
(isset($data['vendor_id'])?$data['vendor_id']:'');
-                               $loc1   = 
(isset($data['loc1'])?$data['loc1']:'');
-                               $district_id    = 
(isset($data['district_id'])?$data['district_id']:'');
-                               $workorder_id   = 
(isset($data['workorder_id'])?$data['workorder_id']:0);
-                               $b_account_class = 
(isset($data['b_account_class'])?$data['b_account_class']:'');
+                               $start                  = isset($data['start']) 
&& $data['start'] ? $data['start'] : 0;
+                               $filter                 = 
isset($data['filter'])?$data['filter']:'none';
+                               $query                  = 
isset($data['query'])?$data['query']:'';
+                               $sort                   = 
isset($data['sort'])?$data['sort']:'DESC';
+                               $order                  = 
isset($data['order'])?$data['order']:'';
+                               $cat_id                 = 
isset($data['cat_id']) && $data['cat_id'] ? $data['cat_id']:0;
+                               $start_date     = 
isset($data['start_date'])?$data['start_date']:'';
+                               $end_date               = 
isset($data['end_date'])?$data['end_date']:'';
+                               $vendor_id              = 
isset($data['vendor_id'])?$data['vendor_id']:'';
+                               $loc1                   = 
isset($data['loc1'])?$data['loc1']:'';
+                               $district_id    = 
isset($data['district_id'])?$data['district_id']:'';
+                               $workorder_id   = isset($data['workorder_id']) 
&& $data['workorder_id'] ? $data['workorder_id']:0;
+                               $b_account_class = 
isset($data['b_account_class'])?$data['b_account_class']:'';
                        }
 //_debug_array($data);
 

Modified: trunk/property/inc/class.solocation.inc.php
===================================================================
--- trunk/property/inc/class.solocation.inc.php 2008-08-02 18:25:56 UTC (rev 
18653)
+++ trunk/property/inc/class.solocation.inc.php 2008-08-27 18:20:24 UTC (rev 
18654)
@@ -100,6 +100,19 @@
                                );
                        }
 
+                       $sql = "SELECT count(*) as hits FROM fm_request WHERE 
location_code $this->like '$location_code%'";
+                       $this->db->query($sql,__LINE__,__FILE__);
+                       $this->db->next_record();
+                       if($this->db->f('hits'))
+                       {
+                               $entity[] = array
+                               (
+                                       'entity_link'   => 
$GLOBALS['phpgw']->link('/index.php',array('menuaction' => 
'property.uirequest.index','query'=> $location_code)),
+                                       'name'          => lang('request') . ' 
[' . $this->db->f('hits') . ']',
+                                       'descr'         => lang('request')
+                               );
+                       }
+
                        if (isset($entity))
                        {
                                return $entity;
@@ -980,6 +993,10 @@
 
 //echo $sql;
                        $this->db->query($sql,__LINE__,__FILE__);
+
+                       $sql    = "INSERT INTO fm_locations (level, 
location_code) VALUES ({$type_id}, '{$location['location_code']}')";
+                       $this->db->query($sql,__LINE__,__FILE__);
+
                        $this->db->transaction_commit();
                        $receipt['message'][] = array('msg'=>lang('Location %1 
has been saved',$location['location_code']));
                        return $receipt;
@@ -1069,9 +1086,10 @@
                {
                        $location_array = split('-',$location_code);
                        $type_id= count($location_array);
-
-                       $this->db->query("DELETE FROM fm_location$type_id WHERE 
location_code='" . $location_code ."'",__LINE__,__FILE__);
-//                     $this->db->query("DELETE FROM fm_location WHERE 
location_code='" . $location_code ."'",__LINE__,__FILE__);
+                       $this->db->transaction_begin();
+                       $this->db->query("DELETE FROM fm_location$type_id WHERE 
location_code='{$location_code}'",__LINE__,__FILE__);
+                       $this->db->query("DELETE FROM fm_locations WHERE 
location_code='{$location_code}'",__LINE__,__FILE__);
+                       $this->db->transaction_commit();
                }
 
                function update_cat()

Modified: trunk/property/inc/class.soproject.inc.php
===================================================================
--- trunk/property/inc/class.soproject.inc.php  2008-08-02 18:25:56 UTC (rev 
18653)
+++ trunk/property/inc/class.soproject.inc.php  2008-08-27 18:20:24 UTC (rev 
18654)
@@ -41,6 +41,7 @@
                        $this->bocommon         = 
CreateObject('property.bocommon');
                        $this->db               = $this->bocommon->new_db();
                        $this->db2              = 
$this->bocommon->new_db($this->db);
+                       $this->interlink        = 
CreateObject('property.interlink');
 
                        $this->like =& $this->db->like;
                        $this->join =& $this->db->join;
@@ -398,40 +399,10 @@
                                $project['power_meter'] = 
$this->get_power_meter($this->db->f('location_code'));
                        }
 
-                       $sql = "SELECT * FROM fm_origin WHERE destination = 
'project' AND destination_id='$project_id' ORDER by origin DESC  ";
-
-                       $this->db->query($sql,__LINE__,__FILE__);
-
-                       $last_type = false;
-                       $i=-1;
-                       while ($this->db->next_record())
-                       {
-                               if($last_type != $this->db->f('origin'))
-                               {
-                                       $i++;
-                               }
-                               $project['origin'][$i]['type'] = 
$this->db->f('origin');
-                               $project['origin'][$i]['link'] = 
$this->bocommon->get_origin_link($this->db->f('origin'));
-                               $project['origin'][$i]['data'][]= array(
-                                       'id'=> $this->db->f('origin_id'),
-                                       'type'=> $this->db->f('origin')
-                                       );
-
-                               $last_type=$this->db->f('origin');
-                       }
-
 //_debug_array($project);
                                return $project;
                }
 
-               function get_ticket($project_id = '')
-               {
-                       $sql = "SELECT * FROM fm_origin WHERE origin ='tts' AND 
destination = 'project' AND destination_id='$project_id' ORDER by origin DESC  
";
-                       $this->db->query($sql,__LINE__,__FILE__);
-                       $this->db->next_record();
-                       return $this->db->f('origin_id');
-               }
-
                function get_power_meter($location_code = '')
                {
                        if(!$meter_table = $this->get_meter_table())
@@ -585,15 +556,17 @@
                        if(is_array($project['origin']))
                        {
                                if($project['origin'][0]['data'][0]['id'])
-                               {
-                                       $this->db->query("INSERT INTO  
fm_origin (origin,origin_id,destination,destination_id,user_id,entry_date) "
-                                               . "VALUES ('"
-                                               . 
$project['origin'][0]['type']. "','"
-                                               . 
$project['origin'][0]['data'][0]['id']. "',"
-                                               . "'project',"
-                                               . $project['project_id']. ","
-                                               . $this->account . ","
-                                               . time() . 
")",__LINE__,__FILE__);
+                               {                                       
+                                       $interlink_data = array
+                                       (
+                                               'location1_id'          => 
$GLOBALS['phpgw']->locations->get_id('property', 
$project['origin'][0]['location']),
+                                               'location1_item_id' => 
$project['origin'][0]['data'][0]['id'],
+                                               'location2_id'          => 
$GLOBALS['phpgw']->locations->get_id('property', '.project'),                   
     
+                                               'location2_item_id' => 
$project['project_id'],
+                                               'account_id'            => 
$this->account
+                                       );
+                                       
+                                       
$this->interlink->add($interlink_data,$this->db);
                                }
                        }
 
@@ -844,13 +817,13 @@
                }
 
 
-               function delete_request_from_project($request_id,$project_id)
+               function delete_request_from_project($request,$project_id)
                {
-                       for ($i=0;$i<count($request_id);$i++)
+                       foreach ($request as $request_id)
                        {
-                               $this->db->query("update fm_request set 
project_id = NULL where id='". $request_id[$i] . "'",__LINE__,__FILE__);
-                               $this->db->query("DELETE FROM fm_origin WHERE 
destination ='project' AND origin_id='" . $request_id[$i] . "' AND 
origin='request'",__LINE__,__FILE__);
-                               $receipt['message'][] = 
array('msg'=>lang('Request %1 has been deleted from project 
%2',$request_id[$i],$project_id));
+                               $this->db->query("UPDATE fm_request set 
project_id = NULL where id='{$request_id}'",__LINE__,__FILE__);
+                               $this->interlink->delete_at_origin('property', 
'.project.request', '.project', $request_id, $this->db);
+                               $receipt['message'][] = 
array('msg'=>lang('Request %1 has been deleted from project 
%2',$request_id,$project_id));
                        }
                        return $receipt;
                }
@@ -860,19 +833,12 @@
                {
                        $historylog_r   = 
CreateObject('property.historylog','request');
 
-                       $sql = "SELECT origin_id FROM fm_origin WHERE 
destination ='project' AND destination_id='$project_id' and origin ='request'";
-//                     $sql = "SELECT origin_id FROM fm_project_origin WHERE 
project_id='$project_id' and origin ='request'";
-                       $this->db->query($sql,__LINE__,__FILE__);
+                       $request = 
$this->interlink->get_specific_relation('property', '.project.request', 
'.project', $project_id, 'target');
 
-                       while ($this->db->next_record())
+                       foreach ($request as $request_id)
                        {
-                               $request_id[]   = $this->db->f('origin_id');
-                       }
+                               $this->db->query("SELECT 
status,category,coordinator FROM fm_request WHERE 
id='{$request_id}'",__LINE__,__FILE__);
 
-                       for ($i=0;$i<count($request_id);$i++)
-                       {
-                               $this->db->query("SELECT 
status,category,coordinator FROM fm_request where id='" .$request_id[$i] 
."'",__LINE__,__FILE__);
-
                                $this->db->next_record();
 
                                $old_status = $this->db->f('status');
@@ -881,55 +847,53 @@
 
                                if ($old_status != $status)
                                {
-                                       
$historylog_r->add('S',$request_id[$i],$status);
+                                       
$historylog_r->add('S',$request_id,$status);
                                }
 
                                if ((int)$old_category != (int)$category)
                                {
-                                       
$historylog_r->add('T',$request_id[$i],$category);
+                                       
$historylog_r->add('T',$request_id,$category);
                                }
 
                                if ((int)$old_coordinator != (int)$coordinator)
                                {
-                                       
$historylog_r->add('C',$request_id[$i],$coordinator);
+                                       
$historylog_r->add('C',$request_id,$coordinator);
                                }
 
-                               $this->db->query("update fm_request set 
status='$status',coordinator='$coordinator' where id='". $request_id[$i] . 
"'",__LINE__,__FILE__);
+                               $this->db->query("UPDATE fm_request SET 
status='{$status}',coordinator='{$coordinator}' WHERE 
id='{$request_id}'",__LINE__,__FILE__);
                        }
                }
 
-
                function check_request($request_id)
                {
-                       $sql = "SELECT destination_id FROM fm_origin WHERE 
destination ='project' AND origin_id='$request_id' and origin ='request'";
-                       $this->db->query($sql,__LINE__,__FILE__);
+                       $target = 
$this->interlink->get_specific_targets('property', '.project.request', 
'.project', $request_id);
 
-                       $this->db->next_record();
-
-                       if ( $this->db->f(0))
+                       if ( $target)
                        {
-                               return $this->db->f('destination_id');
+                               return $target[0];
                        }
                }
 
                function add_request($add_request,$id)
                {
-
                        for ($i=0;$i<count($add_request['request_id']);$i++)
                        {
                                
$project_id=$this->check_request($add_request['request_id'][$i]);
 
                                if(!$project_id)
                                {
-                                       $this->db->query("INSERT INTO  
fm_origin (origin,origin_id,destination,destination_id,user_id,entry_date) "
-                                               . "VALUES ('request','"
-                                               . 
$add_request['request_id'][$i]. "','"
-                                               . "project',"
-                                               . $id . ","
-                                               . $this->account . ","
-                                               . time() . 
")",__LINE__,__FILE__);
+                                       $interlink_data = array
+                                       (
+                                               'location1_id'          => 
$GLOBALS['phpgw']->locations->get_id('property', '.project.request'),
+                                               'location1_item_id' => 
$add_request['request_id'][$i],
+                                               'location2_id'          => 
$GLOBALS['phpgw']->locations->get_id('property', '.project'),                   
     
+                                               'location2_item_id' => $id,
+                                               'account_id'            => 
$this->account
+                                       );
+                                       
+                                       $this->interlink->add($interlink_data);
 
-                                       $this->db->query("update fm_request set 
project_id='$id' where id='". $add_request['request_id'][$i] . 
"'",__LINE__,__FILE__);
+                                       $this->db->query("UPDATE fm_request SET 
project_id='$id' where id='". $add_request['request_id'][$i] . 
"'",__LINE__,__FILE__);
 
                                        $receipt['message'][] = 
array('msg'=>lang('request %1 has been added',$add_request['request_id'][$i]));
                                }
@@ -945,14 +909,8 @@
 
                function delete($project_id )
                {
-                       $sql = "SELECT origin_id FROM fm_origin WHERE 
destination ='project' AND destination_id='$project_id' and origin ='request'";
-                       $this->db->query($sql,__LINE__,__FILE__);
+                       $request = 
$this->interlink->get_specific_targets('property', '.project.request', 
'.project', $project_id);
 
-                       while ($this->db->next_record())
-                       {
-                               $request_id[]   = $this->db->f('origin_id');
-                       }
-
                        $sql = "SELECT id as workorder_id FROM fm_workorder 
WHERE project_id='$project_id'";
                        $this->db->query($sql,__LINE__,__FILE__);
 
@@ -963,16 +921,18 @@
 
                        $this->db->transaction_begin();
 
-                       for ($i=0;$i<count($request_id);$i++)
+                       foreach ($request as $request_id)
                        {
-
-                               $this->db->query("update fm_request set 
project_id = NULL where id='". $request_id[$i] . "'",__LINE__,__FILE__);
+                               $this->db->query("UPDATE fm_request set 
project_id = NULL where id='{$request_id}'",__LINE__,__FILE__);
                        }
 
                        $this->db->query("DELETE FROM fm_project WHERE id='" . 
$project_id . "'",__LINE__,__FILE__);
                        $this->db->query("DELETE FROM fm_project_history  WHERE 
 history_record_id='" . $project_id   . "'",__LINE__,__FILE__);
                        $this->db->query("DELETE FROM fm_projectbranch  WHERE  
project_id='" . $project_id   . "'",__LINE__,__FILE__);
-                       $this->db->query("DELETE FROM fm_origin WHERE 
destination ='project' AND destination_id ='" . $project_id . 
"'",__LINE__,__FILE__);
+//                     $this->db->query("DELETE FROM fm_origin WHERE 
destination ='project' AND destination_id ='" . $project_id . 
"'",__LINE__,__FILE__);
+                       $this->interlink->delete_at_origin('property', 
'.project.request', '.project', $project_id, $this->db);
+                       $this->interlink->delete_at_target('property', 
'.project', $project_id, $this->db);
+
                        $this->db->query("DELETE FROM fm_workorder WHERE 
project_id='" . $project_id . "'",__LINE__,__FILE__);
 
                        for ($i=0;$i<count($workorder_id);$i++)
@@ -982,7 +942,5 @@
                        }
 
                        $this->db->transaction_commit();
-
                }
        }
-

Modified: trunk/property/inc/class.sorequest.inc.php
===================================================================
--- trunk/property/inc/class.sorequest.inc.php  2008-08-02 18:25:56 UTC (rev 
18653)
+++ trunk/property/inc/class.sorequest.inc.php  2008-08-27 18:20:24 UTC (rev 
18654)
@@ -45,6 +45,7 @@
                        $this->db2              = 
$this->bocommon->new_db($this->db);
                        $this->join                     = $this->bocommon->join;
                        $this->like                     = $this->bocommon->like;
+                       $this->interlink        = 
CreateObject('property.interlink');
                }
 
                function read_priority_key()
@@ -366,47 +367,6 @@
                                $request['power_meter'] = 
$this->soproject->get_power_meter($this->db->f('location_code'));
                        }
 
-                       $sql = "SELECT * FROM fm_origin WHERE destination = 
'request' AND destination_id='$request_id' ORDER by origin DESC  ";
-
-                       $this->db->query($sql,__LINE__,__FILE__);
-
-                       $i=-1;
-                       while ($this->db->next_record())
-                       {
-                               if($last_type != $this->db->f('origin'))
-                               {
-                                       $i++;
-                               }
-                               $request['origin'][$i]['type'] = 
$this->db->f('origin');
-                               $request['origin'][$i]['link'] = 
$this->bocommon->get_origin_link($this->db->f('origin'));
-                               $request['origin'][$i]['data'][]= array(
-                                       'id'=> $this->db->f('origin_id'),
-                                       'type'=> $this->db->f('origin')
-                                       );
-
-                               $last_type=$this->db->f('origin');
-                       }
-
-                       $sql = "SELECT * FROM fm_origin WHERE origin = 
'request' AND origin_id='$request_id' ORDER by destination DESC  ";
-
-                       $this->db->query($sql,__LINE__,__FILE__);
-
-                       while ($this->db->next_record())
-                       {
-                               if($last_type != $this->db->f('destination'))
-                               {
-                                       $i++;
-                               }
-                               $request['origin'][$i]['type'] = 
$this->db->f('destination');
-                               $request['origin'][$i]['link'] = 
$this->bocommon->get_origin_link($this->db->f('destination'));
-                               $request['origin'][$i]['data'][]= array(
-                                       'id'=> $this->db->f('destination_id'),
-                                       'type'=> $this->db->f('destination')
-                                       );
-
-                               $last_type=$this->db->f('destination');
-                       }
-
                        return $request;
                }
 
@@ -533,17 +493,18 @@
 
                        if(is_array($request['origin']) && 
isset($request['origin'][0]['data'][0]['id']))
                        {
-                               $this->db->query("INSERT INTO fm_origin 
(origin,origin_id,destination,destination_id,user_id,entry_date) "
-                                       . "VALUES ('"
-                                       . $request['origin'][0]['type']. "','"
-                                       . 
$request['origin'][0]['data'][0]['id']. "',"
-                                       . "'request',"
-                                       . $request['request_id']. ","
-                                       . $this->account . ","
-                                       . time() . ")",__LINE__,__FILE__);
+                               $interlink_data = array
+                               (
+                                       'location1_id'          => 
$GLOBALS['phpgw']->locations->get_id('property', 
$request['origin'][0]['location']),
+                                       'location1_item_id' => 
$request['origin'][0]['data'][0]['id'],
+                                       'location2_id'          => 
$GLOBALS['phpgw']->locations->get_id('property', '.project.request'),           
             
+                                       'location2_item_id' => 
$request['request_id'],
+                                       'account_id'            => 
$this->account
+                               );
+                                       
+                               
$this->interlink->add($interlink_data,$this->db);
                        }
 
-
                        if($this->db->transaction_commit())
                        {
                                $this->increment_request_id();
@@ -673,11 +634,14 @@
 
                function delete($request_id )
                {
-                       $this->db->query("DELETE FROM fm_request WHERE id='" . 
$request_id . "'",__LINE__,__FILE__);
-                       $this->db->query("DELETE FROM fm_request_condition 
WHERE request_id='" . $request_id . "'",__LINE__,__FILE__);
-                       $this->db->query("DELETE FROM fm_request_history  WHERE 
 history_record_id='" . $request_id   . "'",__LINE__,__FILE__);
-                       $this->db->query("DELETE FROM fm_origin WHERE 
destination = 'request' AND destination_id='" . $request_id . 
"'",__LINE__,__FILE__);
-
+                       $request_id = (int) $request_id;
+                       $this->db->transaction_begin();
+                       $this->db->query("DELETE FROM fm_request WHERE id = 
{$request_id}",__LINE__,__FILE__);
+                       $this->db->query("DELETE FROM fm_request_condition 
WHERE request_id = {$request_id}",__LINE__,__FILE__);
+                       $this->db->query("DELETE FROM fm_request_history  WHERE 
 history_record_id = {$request_id}",__LINE__,__FILE__);
+               //      $this->db->query("DELETE FROM fm_origin WHERE 
destination = 'request' AND destination_id='" . $request_id . 
"'",__LINE__,__FILE__);
+                       $this->interlink->delete_at_target('property', 
'.project.request', $request_id, $this->db);
+                       $this->db->transaction_commit();
                }
        }
 

Modified: trunk/property/inc/class.sotenant_claim.inc.php
===================================================================
--- trunk/property/inc/class.sotenant_claim.inc.php     2008-08-02 18:25:56 UTC 
(rev 18653)
+++ trunk/property/inc/class.sotenant_claim.inc.php     2008-08-27 18:20:24 UTC 
(rev 18654)
@@ -36,14 +36,13 @@
        {
                function property_sotenant_claim()
                {
-               //      $this->currentapp       = 
$GLOBALS['phpgw_info']['flags']['currentapp'];
                        $this->account  = 
$GLOBALS['phpgw_info']['user']['account_id'];
                        $this->bocommon         = 
CreateObject('property.bocommon');
                        $this->db               = $this->bocommon->new_db();
-                       $this->db2              = 
$this->bocommon->new_db($this->db);
 
                        $this->join                     = $this->bocommon->join;
                        $this->like                     = $this->bocommon->like;
+                       $this->interlink        = 
CreateObject('property.interlink');
                }
 
                function read($data)
@@ -99,8 +98,7 @@
 
                        if($query)
                        {
-                               $query = preg_replace("/'/",'',$query);
-                               $query = preg_replace('/"/','',$query);
+                               $query = $this->db->db_addslashes($query);
 
                                $querymethod = " $where ( first_name 
$this->like '%$query%' OR last_name $this->like '%$query%')";
                        }
@@ -110,8 +108,8 @@
                         . " $this->join fm_tenant ON fm_tenant_claim.tenant_id 
= fm_tenant.id"
                         . " $filtermethod $querymethod";
 
-                       $this->db2->query($sql,__LINE__,__FILE__);
-                       $this->total_records = $this->db2->num_rows();
+                       $this->db->query($sql,__LINE__,__FILE__);
+                       $this->total_records = $this->db->num_rows();
 
                        if(!$allrows)
                        {
@@ -129,7 +127,7 @@
                                        'claim_id'              => 
$this->db->f('id'),
                                        'project_id'    => 
$this->db->f('project_id'),
                                        'tenant_id'             => 
$this->db->f('tenant_id'),
-                                       'remark'                => 
stripslashes($this->db->f('remark')),
+                                       'remark'                => 
$this->db->f('remark',true),
                                        'entry_date'    => 
$this->db->f('entry_date'),
                                        'category'              => 
$this->db->f('category'),
                                        'status'                => 
$this->db->f('status')
@@ -144,8 +142,8 @@
                         . " $this->join fm_tenant_claim_category on 
fm_tenant_claim.category=fm_tenant_claim_category.id"
                         . " WHERE project_id = $project_id";
 
-                       $this->db2->query($sql,__LINE__,__FILE__);
-                       $this->total_records = $this->db2->num_rows();
+                       $this->db->query($sql,__LINE__,__FILE__);
+                       $this->total_records = $this->db->num_rows();
 
                        $this->db->query($sql . $ordermethod,__LINE__,__FILE__);
 
@@ -165,19 +163,18 @@
 
                function check_claim_workorder($workorder_id)
                {
-                       $this->db->query("select * from fm_origin WHERE 
destination ='tenant_claim' AND origin_id='$workorder_id'",__LINE__,__FILE__);
+                       $claim = 
$this->interlink->get_specific_relation('property', '.project.workorder', 
'.tenant_claim', $workorder_id, 'origin');
 
-                       while ($this->db->next_record())
+                       if ( $claim)
                        {
-                               $claim[] = $this->db->f('destination_id');
+                               return implode(",", $claim);
                        }
-
-                       return @implode(",", $claim);
                }
 
                function read_single($id)
                {
-                       $this->db->query("select * from fm_tenant_claim where 
id='$id'",__LINE__,__FILE__);
+                       $id = (int) $id;
+                       $this->db->query("SELECT * FROM fm_tenant_claim WHERE 
id={$id}",__LINE__,__FILE__);
 
                        if ($this->db->next_record())
                        {
@@ -194,11 +191,11 @@
 
                        }
 
-                       $this->db->query("select * from fm_origin WHERE 
destination ='tenant_claim' AND destination_id='$id'",__LINE__,__FILE__);
+                       $target = 
$this->interlink->get_specific_relation('property', '.project.workorder', 
'.tenant_claim', $id, 'origin');
 
-                       while ($this->db->next_record())
+                       if ( $target)
                        {
-                               $claim['workorder'][] = 
$this->db->f('origin_id');
+                               $claim['workorder'] = $target;
                        }
 
                        return $claim;
@@ -234,15 +231,18 @@
 
                        foreach ($claim['workorder'] as $workorder_id)
                        {
-                               $this->db->query("INSERT INTO fm_origin 
(origin,origin_id,destination,destination_id,entry_date,user_id) "
-                               . "VALUES ('workorder',"
-                               . $workorder_id .","
-                               . "'tenant_claim',"
-                               . $claim_id . ","
-                               . time().","
-                               . $this->account .")",__LINE__,__FILE__);
+                               $interlink_data = array
+                               (
+                                       'location1_id'          => 
$GLOBALS['phpgw']->locations->get_id('property', '.project.workorder'),
+                                       'location1_item_id' => $workorder_id,
+                                       'location2_id'          => 
$GLOBALS['phpgw']->locations->get_id('property', '.tenant_claim'),              
     
+                                       'location2_item_id' => $claim_id,
+                                       'account_id'            => 
$this->account
+                               );
+                                       
+                               
$this->interlink->add($interlink_data,$this->db);
 
-                               $this->db->query("UPDATE fm_workorder set 
claim_issued = 1 WHERE id=" . $workorder_id ,__LINE__,__FILE__);
+                               $this->db->query("UPDATE fm_workorder SET 
claim_issued = 1 WHERE id=" . $workorder_id ,__LINE__,__FILE__);
                        }
 
                        $this->db->transaction_commit();
@@ -271,23 +271,26 @@
 
                        $value_set      = 
$this->bocommon->validate_db_update($value_set);
 
-                       $this->db->query("UPDATE fm_tenant_claim set $value_set 
 WHERE id=" . intval($claim['claim_id']),__LINE__,__FILE__);
+                       $this->db->query("UPDATE fm_tenant_claim set $value_set 
 WHERE id=" . (int)$claim['claim_id'],__LINE__,__FILE__);
 
                        $claim_id = $claim['claim_id'];
 
-                       $this->db->query("DELETE FROM fm_origin WHERE 
destination ='tenant_claim' AND destination_id=$claim_id",__LINE__,__FILE__);
+                       $this->interlink->delete_from_target('property', 
'.tenant_claim', $claim_id, $this->db);
 
-                       $this->db->query("UPDATE fm_workorder set claim_issued 
= NULL WHERE id=" . $claim['project_id'] ,__LINE__,__FILE__);
+                       $this->db->query("UPDATE fm_workorder set claim_issued 
= NULL WHERE project_id = {$claim['project_id']}" ,__LINE__,__FILE__);
 
                        foreach ($claim['workorder'] as $workorder_id)
                        {
-                               $this->db->query("INSERT INTO fm_origin 
(origin,origin_id,destination,destination_id,entry_date,user_id) "
-                               . "VALUES ('workorder',"
-                               . $workorder_id .","
-                               . "'tenant_claim',"
-                               . $claim_id . ","
-                               . time().","
-                               . $this->account .")",__LINE__,__FILE__);
+                               $interlink_data = array
+                               (
+                                       'location1_id'          => 
$GLOBALS['phpgw']->locations->get_id('property', '.project.workorder'),
+                                       'location1_item_id' => $workorder_id,
+                                       'location2_id'          => 
$GLOBALS['phpgw']->locations->get_id('property', '.tenant_claim'),              
     
+                                       'location2_item_id' => $claim_id,
+                                       'account_id'            => 
$this->account
+                               );
+                                       
+                               
$this->interlink->add($interlink_data,$this->db);
 
                                $this->db->query("UPDATE fm_workorder set 
claim_issued = 1 WHERE id=" . $workorder_id ,__LINE__,__FILE__);
                        }
@@ -303,7 +306,7 @@
                {
                        $this->db->transaction_begin();
                        $this->db->query('DELETE FROM fm_tenant_claim WHERE 
id=' . intval($id),__LINE__,__FILE__);
-                       $this->db->query("DELETE FROM fm_origin WHERE 
destination ='tenant_claim' AND destination_id=$id",__LINE__,__FILE__);
+                       $this->interlink->delete_from_target('property', 
'.tenant_claim', $id, $this->db);
                        $this->db->transaction_commit();
 
                }

Modified: trunk/property/inc/class.sotts.inc.php
===================================================================
--- trunk/property/inc/class.sotts.inc.php      2008-08-02 18:25:56 UTC (rev 
18653)
+++ trunk/property/inc/class.sotts.inc.php      2008-08-27 18:20:24 UTC (rev 
18654)
@@ -242,55 +242,18 @@
                        {
                                
$entity[$i]['entity_id']=$this->db->f('entity_id');
                                $entity[$i]['cat_id']=$this->db->f('cat_id');
-                               $entity[$i]['type']='entity';
+                               
$entity[$i]['type']=".entity.{$this->db->f('entity_id')}.{$this->db->f('cat_id')}";
                                $uicols[]       = $this->db->f('name');
                                $i++;
                        }
 
-                       $entity[$i]['type']='project';
+                       $entity[$i]['type']='.project';
                        $uicols[]       = lang('project');
 
                        $this->uicols   = $uicols;
                        return $entity;
                }
 
-               function get_child_date($id,$type,$entity_id='',$cat_id='')
-               {
-                       $table= 'fm_origin';
-                       if($cat_id)
-                       {
-                               $and = " AND destination = 'entity_" . 
$entity_id . '_' . $cat_id . "'";
-                       }
-                       else
-                       {
-                               $and = " AND destination = '$type'";
-                       }
-
-                       $sql = "SELECT * FROM $table WHERE origin_id='$id' and 
origin ='tts' $and";
-
-                       $this->db->query($sql,__LINE__,__FILE__);
-
-                       $i=0;
-                       $date_info = array();
-                       while ($this->db->next_record())
-                       {
-                               $date_info['date_info'][$i]['entry_date']= 
$GLOBALS['phpgw']->common->show_date($this->db->f('entry_date'),$this->dateformat);
-                               if($cat_id)
-                               {
-                                       
$date_info['date_info'][$i]['link']=$GLOBALS['phpgw']->link('/index.php',array('menuaction'=>
 'property.uientity.view','entity_id'=> $entity_id,'cat_id'=> $cat_id, 'id'=> 
$this->db->f('destination_id')));
-                                       
$date_info['date_info'][$i]['descr']=$this->soadmin_entity->read_category_name($entity_id,$cat_id);
-                               }
-                               else
-                               {
-                                       
$date_info['date_info'][$i]['link']=$GLOBALS['phpgw']->link('/index.php',array('menuaction'=>
 'property.ui' . $type . '.view','id'=> $this->db->f('destination_id')));
-                                       
$date_info['date_info'][$i]['descr']=lang($type);
-                               }
-                               $i++;
-                       }
-//_debug_array($date_info);
-                       return $date_info;
-               }
-
                function read_single($id)
                {
                        $sql = "SELECT * FROM fm_tts_tickets WHERE id=$id";
@@ -331,53 +294,6 @@
 
                        }
 
-// ------------- get origin---------------
-                       $sql = "SELECT * FROM fm_origin WHERE destination = 
'tts' AND destination_id='$id' ORDER by origin DESC";
-
-                       $this->db->query($sql,__LINE__,__FILE__);
-
-                       $last_type = false;
-                       $i=-1;
-                       while ($this->db->next_record())
-                       {
-                               if($last_type != $this->db->f('origin'))
-                               {
-                                       $i++;
-                               }
-                               $ticket['origin'][$i]['type'] = 
$this->db->f('origin');
-                               $ticket['origin'][$i]['link'] = 
$this->bocommon->get_origin_link($this->db->f('origin'));
-                               $ticket['origin'][$i]['data'][]= array(
-                                       'id'=> $this->db->f('origin_id'),
-                                       'type'=> $this->db->f('origin')
-                                       );
-
-                               $last_type=$this->db->f('origin');
-                       }
-//------------end get origin---------------
-//--- --------get destination
-
-                       $sql = "SELECT * FROM fm_origin WHERE origin = 'tts' 
AND origin_id='$id' ORDER by destination DESC";
-
-                       $this->db->query($sql,__LINE__,__FILE__);
-
-                       $last_type = false;
-                       $i=-1;
-                       while ($this->db->next_record())
-                       {
-                               if($last_type != $this->db->f('destination'))
-                               {
-                                       $i++;
-                               }
-                               $ticket['destination'][$i]['type'] = 
$this->db->f('destination');
-                               $ticket['destination'][$i]['link'] = 
$this->bocommon->get_origin_link($this->db->f('destination'));
-                               $ticket['destination'][$i]['data'][]= array(
-                                       'id'=> $this->db->f('destination_id'),
-                                       'type'=> $this->db->f('destination')
-                                       );
-
-                               $last_type=$this->db->f('destination');
-                       }
-//-------------
                        return $ticket;
                }
 
@@ -472,18 +388,20 @@
                        {
                                if($ticket['origin'][0]['data'][0]['id'])
                                {
-                                       $this->db->query("INSERT INTO  
fm_origin (origin,origin_id,destination,destination_id,user_id,entry_date) "
-                                               . "VALUES ('"
-                                               . $ticket['origin'][0]['type']. 
"','"
-                                               . 
$ticket['origin'][0]['data'][0]['id']. "',"
-                                               . "'tts',"
-                                               . $id . ","
-                                               . $this->account . ","
-                                               . time() . 
")",__LINE__,__FILE__);
+                                       $interlink_data = array
+                                       (
+                                               'location1_id'          => 
$GLOBALS['phpgw']->locations->get_id('property', 
$ticket['origin'][0]['location']),
+                                               'location1_item_id' => 
$ticket['origin'][0]['data'][0]['id'],
+                                               'location2_id'          => 
$GLOBALS['phpgw']->locations->get_id('property', '.ticket'),                 
+                                               'location2_item_id' => 
$ticket['project_id'],
+                                               'account_id'            => 
$this->account
+                                       );
+                                       
+                                       $interlink      = 
CreateObject('property.interlink');
+                                       
$interlink->add($interlink_data,$this->db);
                                }
                        }
 
-
                        if($this->db->transaction_commit())
                        {
                                $this->historylog->add('O',$id,mktime(),'');

Modified: trunk/property/inc/class.uiXport.inc.php
===================================================================
--- trunk/property/inc/class.uiXport.inc.php    2008-08-02 18:25:56 UTC (rev 
18653)
+++ trunk/property/inc/class.uiXport.inc.php    2008-08-27 18:20:24 UTC (rev 
18654)
@@ -455,16 +455,14 @@
 
                        );
 
-                       $vendor = 
$this->contacts->read_single(array('actor_id'=>$table[0]['spvend_code']));
-                       if(is_array($vendor))
+                       $vendor = 
$this->contacts->read_single($table[0]['spvend_code'], 
array('attributes'=>array(array('column_name' => 'org_name'))));
+
+                       foreach($vendor['attributes'] as $attribute)
                        {
-                               foreach($vendor['attributes'] as $attribute)
+                               if($attribute['column_name']=='org_name')
                                {
-                                       if($attribute['name']=='org_name')
-                                       {
-                                               
$vendor_name=$attribute['value'];
-                                               break;
-                                       }
+                                       $vendor_name = $attribute['value'];
+                                       break;
                                }
                        }
 

Modified: trunk/property/inc/class.uientity.inc.php
===================================================================
--- trunk/property/inc/class.uientity.inc.php   2008-08-02 18:25:56 UTC (rev 
18653)
+++ trunk/property/inc/class.uientity.inc.php   2008-08-27 18:20:24 UTC (rev 
18654)
@@ -586,15 +586,17 @@
                                $origin_id      = $values['origin_id'];
                        }
 
+                       $interlink      = CreateObject('property.interlink');
+
                        if(isset($origin) && $origin)
                        {
                                unset($values['origin']);
                                unset($values['origin_id']);
-                               $values['origin'][0]['type']= $origin;
-                               
$values['origin'][0]['link']=$this->bocommon->get_origin_link($origin);
+                               $values['origin'][0]['location']= $origin;
+                               $values['origin'][0]['descr']= 
$interlink->get_location_name($origin);
                                $values['origin'][0]['data'][]= array(
-                                       'id'=> $origin_id,
-                                       'type'=> $origin
+                                       'id'    => $origin_id,
+                                       'link'  => 
$interlink->get_relation_link(array('location' => $origin), $origin_id),
                                        );
                        }
 
@@ -880,7 +882,7 @@
                                'p_entity_id'           => 
$values['p_entity_id'],
                                'p_cat_id'                      => 
$values['p_cat_id'],
                                'tenant_id'                     => 
$values['tenant_id'],
-                               'origin'                        => 'entity_' . 
$this->entity_id . '_' . $this->cat_id,
+                               'origin'                        => 
".entity.{$this->entity_id}.{$this->cat_id}",
                                'origin_id'                     => $id
                        );
 
@@ -893,62 +895,13 @@
                                'p_entity_id'           => 
$values['p_entity_id'],
                                'p_cat_id'                      => 
$values['p_cat_id'],
                                'tenant_id'                     => 
$values['tenant_id'],
-                               'origin'                        => 'entity_' . 
$this->entity_id . '_' . $this->cat_id,
+                               'origin'                        => 
".entity.{$this->entity_id}.{$this->cat_id}",
                                'origin_id'                     => $id
                        );
 
 
 //_debug_array($values['origin']);
-                       if(isset($values['origin']) && 
is_array($values['origin']))
-                       {
-                               for ($i=0;$i<count($values['origin']);$i++)
-                               {
-                                       
$values['origin'][$i]['link']=$GLOBALS['phpgw']->link('/index.php',$values['origin'][$i]['link']);
-                                       
if(substr($values['origin'][$i]['type'],0,6)=='entity')
-                                       {
-                                               $type           = 
explode("_",$values['origin'][$i]['type']);
-                                               $entity_id      = $type[1];
-                                               $cat_id         = $type[2];
 
-                                               if(!is_object($boadmin_entity))
-                                               {
-                                                       $boadmin_entity = 
CreateObject('property.boadmin_entity');
-                                               }
-                                               $entity_category = 
$boadmin_entity->read_single_category($entity_id,$cat_id);
-                                               $values['origin'][$i]['descr'] 
= $entity_category['name'];
-                                       }
-                                       else
-                                       {
-                                               $values['origin'][$i]['descr']= 
lang($values['origin'][$i]['type']);
-                                       }
-                               }
-                       }
-
-                       if(isset($values['destination']) && 
is_array($values['destination']))
-                       {
-                               for ($i=0;$i<count($values['destination']);$i++)
-                               {
-                                       
$values['destination'][$i]['link']=$GLOBALS['phpgw']->link('/index.php',$values['destination'][$i]['link']);
-                                       
if(substr($values['destination'][$i]['type'],0,6)=='entity')
-                                       {
-                                               $type           = 
explode("_",$values['destination'][$i]['type']);
-                                               $entity_id      = $type[1];
-                                               $cat_id         = $type[2];
-
-                                               if(!is_object($boadmin_entity))
-                                               {
-                                                       $boadmin_entity = 
CreateObject('property.boadmin_entity');
-                                               }
-                                               $entity_category = 
$boadmin_entity->read_single_category($entity_id,$cat_id);
-                                               
$values['destination'][$i]['descr'] = $entity_category['name'];
-                                       }
-                                       else
-                                       {
-                                               
$values['destination'][$i]['descr']= lang($values['destination'][$i]['type']);
-                                       }
-                               }
-                       }
-
                        for ($i=0;$i<count($values['attributes']);$i++)
                        {
                                if($values['attributes'][$i]['history']==1)
@@ -1010,8 +963,8 @@
                                'value_origin_type'                             
=> isset($origin)?$origin:'',
                                'value_origin_id'                               
=> isset($origin_id)?$origin_id:'',
 
-                               'value_destination'                             
=> isset($values['destination'])?$values['destination']:'',
-                               'lang_destination'                              
=> lang('destination'),
+                               'value_target'                                  
=> isset($values['target'])?$values['target']:'',
+                               'lang_target'                                   
=> lang('target'),
                                'lang_no_cat'                                   
=> lang('no category'),
                                'lang_cat_statustext'                   => 
lang('Select the category. To do not use a category select NO CATEGORY'),
                                'select_name'                                   
=> 'cat_id',
@@ -1247,56 +1200,6 @@
                                }
                        }
 
-                       if(isset($values['origin']) && 
is_array($values['origin']))
-                       {
-                               for ($i=0;$i<count($values['origin']);$i++)
-                               {
-                                       
$values['origin'][$i]['link']=$GLOBALS['phpgw']->link('/index.php',$values['origin'][$i]['link']);
-                                       
if(substr($values['origin'][$i]['type'],0,6)=='entity')
-                                       {
-                                               $type           = 
explode("_",$values['origin'][$i]['type']);
-                                               $entity_id      = $type[1];
-                                               $cat_id         = $type[2];
-
-                                               if(!is_object($boadmin_entity))
-                                               {
-                                                       $boadmin_entity = 
CreateObject('property.boadmin_entity');
-                                               }
-                                               $entity_category = 
$boadmin_entity->read_single_category($entity_id,$cat_id);
-                                               $values['origin'][$i]['descr'] 
= $entity_category['name'];
-                                       }
-                                       else
-                                       {
-                                               $values['origin'][$i]['descr']= 
lang($values['origin'][$i]['type']);
-                                       }
-                               }
-                       }
-
-                       if(isset($values['destination']) && 
is_array($values['destination']))
-                       {
-                               for ($i=0;$i<count($values['destination']);$i++)
-                               {
-                                       
$values['destination'][$i]['link']=$GLOBALS['phpgw']->link('/index.php',$values['destination'][$i]['link']);
-                                       
if(substr($values['destination'][$i]['type'],0,6)=='entity')
-                                       {
-                                               $type           = 
explode("_",$values['destination'][$i]['type']);
-                                               $entity_id      = $type[1];
-                                               $cat_id         = $type[2];
-
-                                               if(!is_object($boadmin_entity))
-                                               {
-                                                       $boadmin_entity = 
CreateObject('property.boadmin_entity');
-                                               }
-                                               $entity_category = 
$boadmin_entity->read_single_category($entity_id,$cat_id);
-                                               
$values['destination'][$i]['descr'] = $entity_category['name'];
-                                       }
-                                       else
-                                       {
-                                               
$values['destination'][$i]['descr']= lang($values['destination'][$i]['type']);
-                                       }
-                               }
-                       }
-
                        for ($i=0;$i<count($attributes_values);$i++)
                        {
                                if($attributes_values[$i]['history']==1)
@@ -1337,8 +1240,8 @@
                                'value_origin'                                  
=> isset($values['origin'])?$values['origin']:'',
                                'value_origin_type'                             
=> isset($origin)?$origin:'',
                                'value_origin_id'                               
=> isset($origin_id)?$origin_id:'',
-                               'lang_destination'                              
=> lang('destination'),
-                               'value_destination'                             
=> isset($values['destination'])?$values['destination']:'',
+                               'lang_target'                           => 
lang('target'),
+                               'value_target'                          => 
isset($values['target'])?$values['target']:'',
 
                                'lang_entity'                                   
=> lang('entity'),
                                'entity_name'                                   
=> $entity['name'],

Modified: trunk/property/inc/class.uilocation.inc.php
===================================================================
--- trunk/property/inc/class.uilocation.inc.php 2008-08-02 18:25:56 UTC (rev 
18653)
+++ trunk/property/inc/class.uilocation.inc.php 2008-08-27 18:20:24 UTC (rev 
18654)
@@ -32,6 +32,8 @@
         * @package property
         */
 
+  phpgw::import_class('phpgwapi.yui');
+
        class property_uilocation
        {
                var $grants;
@@ -46,7 +48,7 @@
 
                var $public_functions = array
                (
-                       'download'      => true,
+                       'download'  => true,
                        'index'         => true,
                        'view'          => true,
                        'edit'          => true,
@@ -54,7 +56,8 @@
                        'update_cat'=> true,
                        'stop'          => true,
                        'summary'       => true,
-                       'columns'       => true
+                       'columns'       => true,
+                       'index2'        => true
                );
 
                function property_uilocation()
@@ -600,6 +603,476 @@
 
                }
 
+
+               function index2()
+               {
+                       $type_id        = $this->type_id;
+                       $lookup         = $this->lookup;
+                       $lookup_name    = phpgw::get_var('lookup_name');
+                       $lookup_tenant  = phpgw::get_var('lookup_tenant', 
'bool');
+
+                       if(!$type_id)
+                       {
+                               $type_id = 1;
+                       }
+                       if($lookup)
+                       {
+                               $GLOBALS['phpgw_info']['flags']['noframework'] 
= true;
+                       }
+
+                       if ( $type_id && !$lookup_tenant )
+                       {
+                               
$GLOBALS['phpgw_info']['flags']['menu_selection'] .= "::loc_$type_id";
+                       }
+                       else
+                       {
+                               
$GLOBALS['phpgw_info']['flags']['menu_selection'] .= '::tenant';
+                       }
+
+                       if (!$this->acl_read)
+                       {
+                               $this->bocommon->no_access();
+                               return;
+                       }
+
+               $GLOBALS['phpgw']->css->validate_file('datatable');
+               
$GLOBALS['phpgw']->css->add_external_file('phpgwapi/js/yahoo/datatable/assets/skins/sam/datatable.css');
+
+               phpgwapi_yui::load_widget('dragdrop');
+               phpgwapi_yui::load_widget('datatable');
+               phpgwapi_yui::load_widget('menu');
+               phpgwapi_yui::load_widget('connection');
+
+                       
$GLOBALS['phpgw']->js->validate_file('overlib','overlib','property');
+                       $GLOBALS['phpgw']->js->validate_file( 'newdesign', 
'gabnr', 'property' );
+
+                       
$GLOBALS['phpgw']->js->set_onload('document.search.query.focus();');
+
+
+                       $location_list = 
$this->bo->read(array('type_id'=>$type_id,'lookup_tenant'=>$lookup_tenant,'lookup'=>$lookup,'allrows'=>$this->allrows));
+
+                       //echo $location_list;
+                       $uicols = $this->bo->uicols;
+
+
+//_debug_array($location_list);
+//_debug_array($uicols);
+
+                       $content = array();
+                       $j=0;
+                       if (isSet($location_list) && is_array($location_list))
+                       {
+                               foreach($location_list as $location)
+                               {
+                                       for 
($i=0;$i<count($uicols['name']);$i++)
+                                       {
+
+                                               
if($uicols['input_type'][$i]!='hidden')
+                                               {
+                                                       
if(isset($location['query_location'][$uicols['name'][$i]]))
+                                                       {
+                                                               
$content[$j]['row'][$i]['statustext']                   = lang('search');
+                                                               
$content[$j]['row'][$i]['text']                         = 
$location[$uicols['name'][$i]];
+                                                               
$content[$j]['row'][$i]['link']                         = 
$GLOBALS['phpgw']->link('/index.php',array(
+                                                                               
                                                                        
'menuaction'    => 'property.uilocation.index',
+                                                                               
                                                                        'query' 
        => $location['query_location'][$uicols['name'][$i]],
+                                                                               
                                                                        
'lookup'        => $lookup,
+                                                                               
                                                                        
'type_id'       => $type_id,
+                                                                               
                                                                        
'lookup_tenant' => $lookup_tenant,
+                                                                               
                                                                        
'lookup_name'   => $lookup_name
+                                                                               
                                                                        )
+                                                                               
                                                                );
+                                                       }
+                                                       else
+                                                       {
+                                                               
$content[$j]['row'][$i]['value']                        = 
$location[$uicols['name'][$i]];
+                                                               
$content[$j]['row'][$i]['name']                         = $uicols['name'][$i];
+                                                               
$content[$j]['row'][$i]['lookup']                       = $lookup;
+                                                               
$content[$j]['row'][$i]['align']                        = 
(isset($uicols['align'][$i])?$uicols['align'][$i]:'center');
+
+                                                               
if(isset($uicols['datatype']) && isset($uicols['datatype'][$i]) && 
$uicols['datatype'][$i]=='link' && $location[$uicols['name'][$i]])
+                                                               {
+                                                                       
$content[$j]['row'][$i]['text']         = lang('link');
+                                                                       
$content[$j]['row'][$i]['link']         = $location[$uicols['name'][$i]];
+                                                                       
$content[$j]['row'][$i]['target']       = '_blank';
+                                                               }
+                                                       }
+                                               }
+
+                                               
$content[$j]['hidden'][$i]['value']                     = 
$location[$uicols['name'][$i]];
+                                               
$content[$j]['hidden'][$i]['name']                              = 
$uicols['name'][$i];
+
+                                       }
+
+                                       if(!$lookup)
+                                       {
+                                               if($this->acl_read)
+                                               {
+                                                       
$content[$j]['row'][$i]['statustext']                   = lang('view the 
location');
+                                                       
$content[$j]['row'][$i]['text']                         = lang('view');
+                                                       
$content[$j]['row'][$i]['link']                         = 
$GLOBALS['phpgw']->link('/index.php',array(
+                                                                               
                                                                'menuaction'=> 
'property.uilocation.view',
+                                                                               
                                                                
'location_code'=> $location['location_code'],
+                                                                               
                                                                
'lookup_tenant'=>$lookup_tenant
+                                                                               
                                                                )
+                                                                               
                                                        );
+                                                       $i++;
+                                               }
+
+                                               if($this->acl_edit)
+                                               {
+                                                       
$content[$j]['row'][$i]['statustext']                   = lang('edit the 
location');
+                                                       
$content[$j]['row'][$i]['text']                         = lang('edit');
+                                                       
$content[$j]['row'][$i]['link']                         = 
$GLOBALS['phpgw']->link('/index.php',array(
+                                                                               
                                                                'menuaction'=> 
'property.uilocation.edit',
+                                                                               
                                                                
'location_code'=> $location['location_code'],
+                                                                               
                                                                
'lookup_tenant'=>$lookup_tenant
+                                                                               
                                                                )
+                                                                               
                                                        );
+                                                       $i++;
+                                               }
+
+                                               if($this->acl_delete)
+                                               {
+                                                       
$content[$j]['row'][$i]['statustext']                   = lang('delete the 
location');
+                                                       
$content[$j]['row'][$i]['text']                         = lang('delete');
+                                                       
$content[$j]['row'][$i]['link']                         = 
$GLOBALS['phpgw']->link('/index.php',array(
+                                                                               
                                                                'menuaction'=> 
'property.uilocation.delete',
+                                                                               
                                                                
'location_code'=> $location['location_code'],
+                                                                               
                                                                'type_id'=> 
$type_id,
+                                                                               
                                                                
'lookup_tenant'=>$lookup_tenant
+                                                                               
                                                                )
+                                                                               
                                                        );
+                                               }
+                                       }
+                                       $j++;
+                               }
+                       }
+//_debug_array($content);
+                       $uicols_count   = count($uicols['descr']);
+                       for ($i=0;$i<$uicols_count;$i++)
+                       {
+                               if($uicols['input_type'][$i]!='hidden')
+                               {
+                                       $table_header[$i]['header']     = 
$uicols['descr'][$i];
+                                       $table_header[$i]['width']              
= '5%';
+                                       $table_header[$i]['align']              
= 'center';
+                                       if($uicols['name'][$i]=='loc1'):
+                                       {
+                                               $table_header[$i]['sort_link']  
=true;
+                                               $table_header[$i]['sort']       
        = $this->nextmatchs->show_sort_order(array
+                                                                               
(
+                                                                               
        'sort'  => $this->sort,
+                                                                               
        'var'   => 'fm_location1.loc1',
+                                                                               
        'order' => $this->order,
+                                                                               
        'extra' => array('menuaction' => 'property.uilocation.index',
+                                                                               
                                                        'type_id'               
=> $type_id,
+                                                                               
                                                        'query'                 
=> $this->query,
+                                                                               
                                                        'district_id'           
=> $this->district_id,
+                                                                               
                                                        'part_of_town_id'       
=> $this->part_of_town_id,
+                                                                               
                                                        'lookup'                
=> $lookup,
+                                                                               
                                                        'lookup_tenant'         
=> $lookup_tenant,
+                                                                               
                                                        'lookup_name'           
=> $lookup_name,
+                                                                               
                                                        'cat_id'                
=> $this->cat_id,
+                                                                               
                                                        'status'                
=> $this->status)
+                                                                               
));
+                                       }
+                                       
elseif($uicols['name'][$i]=='street_name'):
+                                       {
+                                               $table_header[$i]['sort_link']  
=true;
+                                               $table_header[$i]['sort']       
        = $this->nextmatchs->show_sort_order(array
+                                                                               
(
+                                                                               
        'sort'  => $this->sort,
+                                                                               
        'var'   => 'street_name',
+                                                                               
        'order' => $this->order,
+                                                                               
        'extra' => array('menuaction'   => 'property.uilocation.index',
+                                                                               
                                                        'type_id'               
=> $type_id,
+                                                                               
                                                        'query'                 
=> $this->query,
+                                                                               
                                                        'district_id'           
=> $this->district_id,
+                                                                               
                                                        'part_of_town_id'       
=> $this->part_of_town_id,
+                                                                               
                                                        'lookup'                
=> $lookup,
+                                                                               
                                                        'lookup_tenant'         
=> $lookup_tenant,
+                                                                               
                                                        'lookup_name'           
=> $lookup_name,
+                                                                               
                                                        'cat_id'                
=> $this->cat_id,
+                                                                               
                                                        'status'                
=> $this->status)
+                                                                               
));
+                                       }
+                                       
elseif(isset($uicols['cols_return_extra'][$i]) && 
($uicols['cols_return_extra'][$i]!='T' || 
$uicols['cols_return_extra'][$i]!='CH')):
+                                       {
+                                               $table_header[$i]['sort_link']  
=true;
+                                               $table_header[$i]['sort']       
        = $this->nextmatchs->show_sort_order(array
+                                                       (
+                                                               'sort'  => 
$this->sort,
+                                                               'var'   => 
$uicols['name'][$i],
+                                                               'order' => 
$this->order,
+                                                               'extra' => 
array('menuaction'   => 'property.uilocation.index',
+                                                                               
                                                        'type_id'               
=> $type_id,
+                                                                               
                                                        'query'                 
=> $this->query,
+                                                                               
                                                        'district_id'           
=> $this->district_id,
+                                                                               
                                                        'part_of_town_id'       
=> $this->part_of_town_id,
+                                                                               
                                                        'lookup'                
=> $lookup,
+                                                                               
                                                        'lookup_tenant'         
=> $lookup_tenant,
+                                                                               
                                                        'lookup_name'           
=> $lookup_name,
+                                                                               
                                                        'cat_id'                
=> $this->cat_id,
+                                                                               
                                                        'status'                
=> $this->status)
+
+                                                       ));
+                                       }
+                                       endif;
+                               }
+                       }
+
+                       if(!$lookup)
+                       {
+                               if($this->acl_read)
+                               {
+                                       $table_header[$i]['width']              
        = '5%';
+                                       $table_header[$i]['align']              
        = 'center';
+                                       $table_header[$i]['header']             
        = lang('view');
+                                       $i++;
+                               }
+                               if($this->acl_edit)
+                               {
+                                       $table_header[$i]['width']              
        = '5%';
+                                       $table_header[$i]['align']              
        = 'center';
+                                       $table_header[$i]['header']             
        = lang('edit');
+                                       $i++;
+                               }
+                               if($this->acl_delete)
+                               {
+                                       $table_header[$i]['width']              
        = '5%';
+                                       $table_header[$i]['align']              
        = 'center';
+                                       $table_header[$i]['header']             
        = lang('delete');
+                                       $i++;
+                               }
+                       }
+                       else
+                       {
+                               $table_header[$i]['width']                      
= '5%';
+                               $table_header[$i]['align']                      
= 'center';
+                               $table_header[$i]['header']                     
= lang('select');
+                       }
+
+                       if($this->acl_add)
+                       {
+                               $table_add[] = array
+                               (
+                                       'lang_add'              => lang('add'),
+                                       'lang_add_statustext'   => lang('add a 
location'),
+                                       'add_action'            => 
$GLOBALS['phpgw']->link('/index.php',array(
+                                                                               
                        'menuaction'=> 'property.uilocation.edit',
+                                                                               
                        'type_id'=>$type_id
+                                                                               
                        )
+                                                                               
          )
+                               );
+                       }
+
+                       $link_data = array
+                       (
+                               'menuaction'            => 
'property.uilocation.index',
+                               'sort'                  => $this->sort,
+                               'order'                 => $this->order,
+                               'cat_id'                => $this->cat_id,
+                               'district_id'           => $this->district_id,
+                               'part_of_town_id'       => 
$this->part_of_town_id,
+                               'filter'                => $this->filter,
+                               'query'                 => $this->query,
+                               'lookup'                => $lookup,
+                               'lookup_tenant'         => $lookup_tenant,
+                               'lookup_name'           => $lookup_name,
+                               'type_id'               => $type_id,
+                               'status'                => $this->status
+                       );
+
+                       $input_name             = 
$GLOBALS['phpgw']->session->appsession('lookup_fields','property');
+
+                       $function_exchange_values = '';
+                       if(is_array($input_name))
+                       {
+                               for ($k=0;$k<count($input_name);$k++)
+                               {
+                                       $function_exchange_values .= 
"opener.document.form." . $input_name[$k] . ".value = '';" ."\r\n";
+                               }
+                       }
+
+                       for ($i=0;$i<count($uicols['name']);$i++)
+                       {
+                               if(isset($uicols['exchange'][$i]) && 
$uicols['exchange'][$i])
+                               {
+                                       $function_exchange_values .= 
'opener.document.form.' . $uicols['name'][$i] .'.value = thisform.elements[' . 
$i . '].value;' ."\r\n";
+                               }
+                       }
+
+                       $function_exchange_values .='window.close()';
+
+//_debug_array($input_name);
+                       $link_download = array
+                       (
+                               'menuaction'            => 
'property.uilocation.download',
+                               'sort'                  => $this->sort,
+                               'order'                 => $this->order,
+                               'cat_id'                => $this->cat_id,
+                               'district_id'           => $this->district_id,
+                               'part_of_town_id'       => 
$this->part_of_town_id,
+                               'filter'                => $this->filter,
+                               'query'                 => $this->query,
+                               'lookup'                => $lookup,
+                               'lookup_tenant'         => $lookup_tenant,
+                               'lookup_name'           => $lookup_name,
+                               'type_id'               => $type_id,
+                               'status'                => $this->status,
+                               'start'                 => $this->start
+                       );
+
+                       $link_columns = array
+                       (
+                               'menuaction'    => 
'property.uilocation.columns',
+                               'type_id'               => $type_id,
+                               'lookup'                => $this->lookup
+                       );
+
+                       if(!$this->allrows)
+                       {
+                               $record_limit   = 
$GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs'];
+                       }
+                       else
+                       {
+                               $record_limit   = $this->bo->total_records;
+                       }
+
+                       
if(isset($GLOBALS['phpgw_info']['user']['preferences']['property']['property_filter'])
 && 
$GLOBALS['phpgw_info']['user']['preferences']['property']['property_filter'] == 
'owner')
+                       {
+                               $owner_list = 
$this->bo->get_owner_list('filter', $this->filter);
+                       }
+                       else
+                       {
+                               $owner_list = 
$this->bo->get_owner_type_list('filter', $this->filter);
+                       }
+
+                       //_debug_array($owner_list);
+
+                       $data = array
+                       (
+                               'menu'                                  => 
$this->bocommon->get_menu(),
+                               'colspan'                               => 
$uicols_count+1,
+                               'lang_download'                         => 
'download',
+                               'link_download'                         => 
$GLOBALS['phpgw']->link('/index.php',$link_download),
+                               'lang_download_help'                    => 
lang('Download table to your browser'),
+
+                               'lang_columns'                          => 
lang('columns'),
+                               'link_columns'                          => 
$GLOBALS['phpgw']->link('/index.php',$link_columns),
+                               'lang_columns_help'                     => 
lang('Choose columns'),
+
+                               'exchange_values'                       => 
'Exchange_values(this.form);',
+                               'function_exchange_values'              => 
$function_exchange_values,
+                               'lang_select'                           => 
lang('select'),
+                               'lookup'                                => 
$lookup,
+                               'lang_property_name'                    => 
lang('Property name'),
+                               'allow_allrows'                         => true,
+                               'allrows'                               => 
$this->allrows,
+                               'start_record'                          => 
$this->start,
+                               'record_limit'                          => 
$record_limit,
+                               'num_records'                           => 
count($location_list),
+                               'all_records'                           => 
$this->bo->total_records,
+                               'link_url'                              => 
$GLOBALS['phpgw']->link('/index.php',$link_data),
+                               'img_path'                              => 
$GLOBALS['phpgw']->common->get_image_path('phpgwapi','default'),
+
+                               'lang_status_statustext'                => 
lang('Select the status. To do not use a status select NO STATUS'),
+                               'status_name'                           => 
'status',
+                               'lang_no_status'                        => 
lang('No status'),
+                               'status_list'                           => 
$this->bo->select_status_list('filter',$this->status),
+
+                               'part_of_town_list'                             
=> 
$this->bocommon->select_part_of_town('filter',$this->part_of_town_id,$this->district_id),
+                               'lang_no_part_of_town'                          
=> lang('no part of town'),
+                               'lang_town_statustext'                          
=> lang('Select the part of town the selection belongs to. To do not use a part 
of town select NO PART OF TOWN'),
+                               'select_name_part_of_town'                      
=> 'part_of_town_id',
+
+                               'district_list'                                 
=> $this->bocommon->select_district_list('filter',$this->district_id),
+                               'lang_no_district'                              
=> lang('no district'),
+                               'lang_district_statustext'                      
=> lang('Select the district the selection belongs to. To do not use a district 
select NO DISTRICT'),
+                               'select_district_name'                          
=> 'district_id',
+
+                               'lang_no_cat'                                   
=> lang('no category'),
+                               'lang_cat_statustext'                           
=> lang('Select the category the location belongs to. To do not use a category 
select NO CATEGORY'),
+                               'select_name'                                   
=> 'cat_id',
+                               'cat_list'                                      
=> $this->bocommon->select_category_list(array('format'=>'filter','selected' => 
$this->cat_id,'type' =>'location','type_id' =>$type_id,'order'=>'descr')),
+                               'select_action'                                 
=> $GLOBALS['phpgw']->link('/index.php',$link_data),
+                               'owner_name'                                    
=> 'filter',
+                               'owner_list'                                    
=> $owner_list,
+                               'lang_show_all'                                 
=> lang('Show all'),
+                               'lang_owner_statustext'                         
=> lang('Select the owner type. To show all entries select SHOW ALL'),
+                               'lang_searchfield_statustext'                   
=> lang('Enter the search string. To show all entries, empty this field and 
press the SUBMIT button again'),
+                               'lang_searchbutton_statustext'                  
=> lang('Submit the search string'),
+                               'query'                                         
=> $this->query,
+                               'lang_search'                                   
=> lang('search'),
+                               'table_header'                                  
=> $table_header,
+                               'values'                                        
=> $content,
+                               'table_add'                                     
=> $table_add
+                       );
+
+                       $appname                                                
= lang('location');
+
+                       if($lookup)
+                       {
+                               $lookup_list    = 
$GLOBALS['phpgw']->session->appsession('lookup_name','property');
+                               $function_msg   = $lookup_list[$lookup_name];
+                       }
+                       else
+                       {
+                               if($lookup_tenant)
+                               {
+                                       $function_msg   = lang('Tenant');
+                               }
+                               else
+                               {
+                                       $function_msg                           
        = $uicols['descr'][($type_id)];
+                               }
+                       }
+
+/***********************************/
+               if( phpgw::get_var('phpgw_return_as') == 'json' ) {
+
+               $json = array(
+                       'recordsReturned'       => 3,
+                       'totalRecords'          => count($data["values"]),
+                       'recordStartIndex'      => 0,
+                       'sortKey'                       => null,
+                       'sortDir'                       => "asc",
+                       'records'                       => array()
+               );
+
+
+               for( $i=0;$i < count($data["values"]) ; $i++)
+               {
+                               $fields = $data["values"][$i]["hidden"];
+                               //$row = $data["values"][$i]["row"];
+                               $json_row = array();
+
+                               foreach($fields as $row){
+                               $json_row[$row["name"]] = $row["value"];
+                               }
+
+                       $json['records'][] = $json_row;
+               }
+
+
+               return $json;
+               }
+
+/*********************************************/
+
+
+                       $GLOBALS['phpgw']->xslttpl->add_file(array('location',
+                                                                               
'nextmatchs',
+                                                                               
'search_field'));
+
+                       $GLOBALS['phpgw_info']['flags']['app_header'] = 
lang('property') . ' - ' . $appname . ': ' . $function_msg;
+                       
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('list' => $data));
+               //      $GLOBALS['phpgw']->xslttpl->pp();
+                       $this->save_sessiondata();
+
+               }
+
                function edit()
                {
                        $get_history            = phpgw::get_var('get_history', 
'bool', 'POST');
@@ -803,10 +1276,6 @@
                                        }
                                }
                        }
-
-                       $values['attributes']   = 
$this->bo->find_attribute(".location.{$this->type_id}");
-                       $values                                 = 
$this->bo->prepare_attribute($values, ".location.{$this->type_id}");
-
                        /* Preserve attribute values from post */
                        if(isset($receipt['error']) && (isset( 
$values_attribute) && is_array( $values_attribute)))
                        {
@@ -814,6 +1283,12 @@
                                unset($values['location_code']);
                        }
 
+                       if(!$values)
+                       {
+                               $values['attributes']   = 
$this->bo->find_attribute(".location.{$this->type_id}");
+                               $values                                 = 
$this->bo->prepare_attribute($values, ".location.{$this->type_id}");
+                       }
+
                        if ($values['cat_id'] > 0)
                        {
                                $this->cat_id = $values['cat_id'];
@@ -1425,6 +1900,8 @@
 
                        $GLOBALS['phpgw_info']['flags']['app_header'] = 
lang('property') . ' - ' . $appname . ': ' . $function_msg;
                        
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('view' => $data));
+
+
                }
 
                /**
@@ -1529,8 +2006,27 @@
 
                        $GLOBALS['phpgw']->xslttpl->add_file(array('location'));
 
-                       
$GLOBALS['phpgw']->js->validate_file('overlib','overlib','property');
+                       
//$GLOBALS['phpgw']->js->validate_file('overlib','overlib','property');
 
+       /***********************************/
+               /// Enable for use Yahoo YUI
+               
//$GLOBALS['phpgw']->css->add_external_file('phpgwapi/js/yahoo/datatable/assets/skins/sam/datatable.css');
+
+               
//$GLOBALS['phpgw']->css->add_external_file('equipo/templates/idots/css/table.css');
+
+       /*      phpgwapi_yui::load_widget('dragdrop');
+               phpgwapi_yui::load_widget('datatable');
+               phpgwapi_yui::load_widget('menu');
+               phpgwapi_yui::load_widget('connection');*/
+
+       //phpgwapi_yui::load_widget('tabview');
+
+               // Uncomment the following line to enable experimental YUI 
Datagrid version
+         //    $GLOBALS['phpgw']->js->validate_file( 'newdesign', 'gabnr', 
'property' );
+
+       /***********************************/
+
+
                        $summary_list= $this->bo->read_summary();
                        $uicols = $this->bo->uicols;
 

Modified: trunk/property/inc/class.uiproject.inc.php
===================================================================
--- trunk/property/inc/class.uiproject.inc.php  2008-08-02 18:25:56 UTC (rev 
18653)
+++ trunk/property/inc/class.uiproject.inc.php  2008-08-27 18:20:24 UTC (rev 
18654)
@@ -541,7 +541,7 @@
                                $origin_id                      = 
phpgw::get_var('origin_id', 'int');
 
                                //23.jun 08: This will be handled by the 
interlink code - just doing a quick hack for now...
-                               if($origin == 'tts' && $origin_id && 
!$values['descr'])
+                               if($origin == '.ticket' && $origin_id && 
!$values['descr'])
                                {
                                        $boticket= 
CreateObject('property.botts');
                                        $ticket = 
$boticket->read_single($origin_id);
@@ -580,15 +580,17 @@
                                $origin_id      = $values['origin_id'];
                        }
 
+                       $interlink      = CreateObject('property.interlink');
+
                        if(isset($origin) && $origin)
                        {
                                unset($values['origin']);
                                unset($values['origin_id']);
-                               $values['origin'][0]['type']= $origin;
-                               
$values['origin'][0]['link']=$this->bocommon->get_origin_link($origin);
+                               $values['origin'][0]['location']= $origin;
+                               $values['origin'][0]['descr']= 
$interlink->get_location_name($origin);
                                $values['origin'][0]['data'][]= array(
-                                       'id'=> $origin_id,
-                                       'type'=> $origin
+                                       'id'    => $origin_id,
+                                       'link'  => 
$interlink->get_relation_link(array('location' => $origin), $origin_id),
                                        );
                        }
 
@@ -918,35 +920,6 @@
                        $jscal->add_listener('values_start_date');
                        $jscal->add_listener('values_end_date');
 
-                       if (isset($values['origin']) AND 
is_array($values['origin']))
-                       {
-                               for ($i=0;$i<count($values['origin']);$i++)
-                               {
-                                       
$values['origin'][$i]['link']=$GLOBALS['phpgw']->link('/index.php',$values['origin'][$i]['link']);
-                                       
if(substr($values['origin'][$i]['type'],0,6)=='entity')
-                                       {
-                                               $type           = 
explode("_",$values['origin'][$i]['type']);
-                                               $entity_id      = $type[1];
-                                               $cat_id         = $type[2];
-
-                                               if(!is_object($boadmin_entity))
-                                               {
-                                                       $boadmin_entity = 
CreateObject('property.boadmin_entity');
-                                               }
-                                               $entity_category = 
$boadmin_entity->read_single_category($entity_id,$cat_id);
-                                               $values['origin'][$i]['descr'] 
= $entity_category['name'];
-                                       }
-                                       else
-                                       {
-                                               $values['origin'][$i]['descr']= 
lang($values['origin'][$i]['type']);
-                                               
if($values['origin'][$i]['type'] == 'request')
-                                               {
-                                                       $selected_request = 
true;
-                                               }
-                                       }
-                               }
-                       }
-
                        $data = array
                        (
                                'tabs'                                          
        => self::_generate_tabs(),
@@ -956,7 +929,7 @@
                                'value_origin'                                  
=> isset($values['origin']) ? $values['origin'] : '',
                                'value_origin_type'                             
=> (isset($origin)?$origin:''),
                                'value_origin_id'                               
=> (isset($origin_id)?$origin_id:''),
-                               'selected_request'                              
=> (isset($selected_request)?$selected_request:''),
+               //              'selected_request'                              
=> (isset($selected_request)?$selected_request:''),
 
                                'lang_select_request'                           
=> lang('Select request'),
                                'lang_select_request_statustext'                
=> lang('Add request for this project'),
@@ -1216,31 +1189,6 @@
 //_debug_array($values);
                        $msgbox_data = $this->bocommon->msgbox_data($receipt);
 
-                       if (isset($values['origin']) AND 
is_array($values['origin']))
-                       {
-                               for ($i=0;$i<count($values['origin']);$i++)
-                               {
-                                       
$values['origin'][$i]['link']=$GLOBALS['phpgw']->link('/index.php',$values['origin'][$i]['link']);
-                                       
if(substr($values['origin'][$i]['type'],0,6)=='entity')
-                                       {
-                                               $type           = 
explode("_",$values['origin'][$i]['type']);
-                                               $entity_id      = $type[1];
-                                               $cat_id         = $type[2];
-
-                                               if(!is_object($boadmin_entity))
-                                               {
-                                                       $boadmin_entity = 
CreateObject('property.boadmin_entity');
-                                               }
-                                               $entity_category = 
$boadmin_entity->read_single_category($entity_id,$cat_id);
-                                               $values['origin'][$i]['descr'] 
= $entity_category['name'];
-                                       }
-                                       else
-                                       {
-                                               $values['origin'][$i]['descr']= 
lang($values['origin'][$i]['type']);
-                                       }
-                               }
-                       }
-
                        $categories = 
$this->cats->formatted_xslt_list(array('selected' => $this->cat_id));
 
                        $data = array

Modified: trunk/property/inc/class.uirequest.inc.php
===================================================================
--- trunk/property/inc/class.uirequest.inc.php  2008-08-02 18:25:56 UTC (rev 
18653)
+++ trunk/property/inc/class.uirequest.inc.php  2008-08-27 18:20:24 UTC (rev 
18654)
@@ -71,12 +71,12 @@
                        $this->config                           = 
CreateObject('phpgwapi.config');
 
                        $this->acl                                      = & 
$GLOBALS['phpgw']->acl;
-                       $this->acl_location                     = '.project';
-                       $this->acl_read                         = 
$this->acl->check('.project', PHPGW_ACL_READ, 'property');
-                       $this->acl_add                          = 
$this->acl->check('.project', PHPGW_ACL_ADD, 'property');
-                       $this->acl_edit                         = 
$this->acl->check('.project', PHPGW_ACL_EDIT, 'property');
-                       $this->acl_delete                       = 
$this->acl->check('.project', PHPGW_ACL_DELETE, 'property');
-                       $this->acl_manage                       = 
$this->acl->check('.project', 16, 'property');
+                       $this->acl_location                     = 
'.project.request';
+                       $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;
@@ -574,18 +574,22 @@
                                $origin_id      = $values['origin_id'];
                        }
 
-                       if($origin)
+                       $interlink      = CreateObject('property.interlink');
+
+                       if(isset($origin) && $origin)
                        {
                                unset($values['origin']);
                                unset($values['origin_id']);
-                               $values['origin'][0]['type']= $origin;
-                               
$values['origin'][0]['link']=$this->bocommon->get_origin_link($origin);
+                               $values['origin'][0]['location']= $origin;
+                               $values['origin'][0]['descr']= 
$interlink->get_location_name($origin);
                                $values['origin'][0]['data'][]= array(
-                                       'id'=> $origin_id,
-                                       'type'=> $origin
+                                       'id'    => $origin_id,
+                                       'link'  => 
$interlink->get_relation_link(array('location' => $origin), $origin_id),
                                        );
                        }
 
+
+
 //_debug_array($values);
                        $this->config->read_repository();
 
@@ -833,31 +837,6 @@
                                
$values['files'][$i]['file_name']=urlencode($values['files'][$i]['name']);
                        }
 
-                       if (isset($values['origin']) AND 
is_array($values['origin']))
-                       {
-                               for ($i=0;$i<count($values['origin']);$i++)
-                               {
-                                       
$values['origin'][$i]['link']=$GLOBALS['phpgw']->link('/index.php',$values['origin'][$i]['link']);
-                                       
if(substr($values['origin'][$i]['type'],0,6)=='entity')
-                                       {
-                                               $type           = 
explode("_",$values['origin'][$i]['type']);
-                                               $entity_id      = $type[1];
-                                               $cat_id         = $type[2];
-
-                                               if(!is_object($boadmin_entity))
-                                               {
-                                                       $boadmin_entity = 
CreateObject('property.boadmin_entity');
-                                               }
-                                               $entity_category = 
$boadmin_entity->read_single_category($entity_id,$cat_id);
-                                               $values['origin'][$i]['descr'] 
= $entity_category['name'];
-                                       }
-                                       else
-                                       {
-                                               $values['origin'][$i]['descr']= 
lang($values['origin'][$i]['type']);
-                                       }
-                               }
-                       }
-
                        $data = array
                        (
                                'fileupload'                            => true,
@@ -874,6 +853,8 @@
 
                                'msgbox_data'                           => 
$GLOBALS['phpgw']->common->msgbox($msgbox_data),
 
+                               'value_acl_location'            => 
$this->acl_location,
+                               'value_target'                          => 
$values['target'],
                                'value_origin'                          => 
$values['origin'],
                                'value_origin_type'                     => 
$origin,
                                'value_origin_id'                       => 
$origin_id,
@@ -1108,17 +1089,6 @@
                                'lang_consequence'      => lang('Consequence')
                        );
 
-
-
-                       if($values['origin']== 'tts')
-                       {
-                               $origin_data = array
-                               (
-                                       'menuaction'    => 
'property.uitts.view',
-                                       'id'            => $values['origin_id']
-                               );
-                       }
-
                        if($values['project_id'])
                        {
                                $project_lookup_data = array
@@ -1143,31 +1113,6 @@
                                
$values['files'][$i]['file_name']=urlencode($values['files'][$i]['name']);
                        }
 
-                       if (isset($values['origin']) AND 
is_array($values['origin']))
-                       {
-                               for ($i=0;$i<count($values['origin']);$i++)
-                               {
-                                       
$values['origin'][$i]['link']=$GLOBALS['phpgw']->link('/index.php',$values['origin'][$i]['link']);
-                                       
if(substr($values['origin'][$i]['type'],0,6)=='entity')
-                                       {
-                                               $type           = 
explode("_",$values['origin'][$i]['type']);
-                                               $entity_id      = $type[1];
-                                               $cat_id         = $type[2];
-
-                                               if(!is_object($boadmin_entity))
-                                               {
-                                                       $boadmin_entity = 
CreateObject('property.boadmin_entity');
-                                               }
-                                               $entity_category = 
$boadmin_entity->read_single_category($entity_id,$cat_id);
-                                               $values['origin'][$i]['descr'] 
= $entity_category['name'];
-                                       }
-                                       else
-                                       {
-                                               $values['origin'][$i]['descr']= 
lang($values['origin'][$i]['type']);
-                                       }
-                               }
-                       }
-
                        $categories = 
$this->cats->formatted_xslt_list(array('selected' => $values['cat_id']));
 
                        $data = array
@@ -1179,6 +1124,7 @@
                                'lang_filename'                                 
=> lang('Filename'),
                                'lang_view_file_statustext'                     
=> lang('click to view file'),
 
+                               'value_target'                                  
=> $values['target'],
                                'value_origin'                                  
=> $values['origin'],
                                'value_origin_type'                             
=> $origin,
                                'value_origin_id'                               
=> $origin_id,

Modified: trunk/property/inc/class.uitenant_claim.inc.php
===================================================================
--- trunk/property/inc/class.uitenant_claim.inc.php     2008-08-02 18:25:56 UTC 
(rev 18653)
+++ trunk/property/inc/class.uitenant_claim.inc.php     2008-08-27 18:20:24 UTC 
(rev 18654)
@@ -484,6 +484,13 @@
                                'project_id'    => $values['project_id']
                        );
 
+                       $cats                           = 
CreateObject('phpgwapi.categories');
+                       $cats->app_name         = 'property.project';
+                       $cats->supress_info     = true;
+
+                       $cat_list_project       = 
$cats->return_array('',0,false,'','','',false);
+                       $cat_list_project       = 
$this->bocommon->select_list($project_values['cat_id'],$cat_list_project);
+
                        $msgbox_data = $this->bocommon->msgbox_data($receipt);
 
                        $data = array
@@ -549,10 +556,8 @@
 
                                'lang_select_workorder_statustext'      => 
lang('Include the workorder to this claim'),
 
-                               'cat_list_project'                      => 
$this->bocommon->select_category_list(array('format'=>'select','selected' => 
$project_values['cat_id'],'type' =>'project','order'=>'descr')),
-
+                               'cat_list_project'                              
        => $cat_list_project,
 //------------------
-
                                'lang_status'                           => 
lang('Status'),
                                'lang_status_statustext'                => 
lang('Select status'),
                                'status_list'                           => 
$this->bo->get_status_list(array('format' => 'select', 'selected' => 
$values['status'],'default' => 'open')),
@@ -744,6 +749,13 @@
 
                        $msgbox_data = $this->bocommon->msgbox_data($receipt);
 
+                       $cats                           = 
CreateObject('phpgwapi.categories');
+                       $cats->app_name         = 'property.project';
+                       $cats->supress_info     = true;
+
+                       $cat_list_project       = 
$cats->return_array('',0,false,'','','',false);
+                       $cat_list_project       = 
$this->bocommon->select_list($project_values['cat_id'],$cat_list_project);
+
                        $data = array
                        (
                                'table_header_workorder'                => 
$table_header_workorder,
@@ -804,7 +816,7 @@
 
                                'b_account_data'                        => 
$b_account_data,
 
-                               'cat_list_project'                      => 
$this->bocommon->select_category_list(array('format'=>'select','selected' => 
$project_values['cat_id'],'type' =>'project','order'=>'descr')),
+                               'cat_list_project'                      => 
$cat_list_project,
 
 //------------------
 
@@ -837,7 +849,7 @@
                                'value_date'                            => 
$GLOBALS['phpgw']->common->show_date($tenant_claim['entry_date'])
 
                        );
-                       $GLOBALS['phpgw_info']['flags']['app_header'] = 
lang('Tenant claim') . ': ' . ($claim_id?lang('edit claim'):lang('add claim'));
+                       $GLOBALS['phpgw_info']['flags']['app_header'] = 
lang('Tenant claim') . '::' . lang('view claim');
 
                        
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('view' => $data));
                //      $GLOBALS['phpgw']->xslttpl->pp();

Modified: trunk/property/inc/class.uitts.inc.php
===================================================================
--- trunk/property/inc/class.uitts.inc.php      2008-08-02 18:25:56 UTC (rev 
18653)
+++ trunk/property/inc/class.uitts.inc.php      2008-08-27 18:20:24 UTC (rev 
18654)
@@ -127,11 +127,11 @@
                        if (isset($list) AND is_array($list))
                        {
                                $i=0;
-                               foreach($list as $entry)
+                               foreach($list as &$entry)
                                {
                                        if($entry['subject'])
                                        {
-                                               $list[$i]['category'] = 
$entry['subject'];
+                                               $entry['category'] = 
$entry['subject'];
                                        }
 
                                        if (isset($entry['child_date']) AND 
is_array($entry['child_date']))
@@ -141,12 +141,13 @@
                                                {
                                                        
if($date['date_info'][0]['descr'])
                                                        {
-                                                               
$list[$i]['date_' . $j]=$date['date_info'][0]['entry_date'];
+                                                               $entry['date_' 
. $j]=$date['date_info'][0]['entry_date'];
                                                                
$name_temp['date_' . $j]=true;
                                                                
$descr_temp[$date['date_info'][0]['descr']]=true;
                                                         }
                                                         $j++;
                                                }
+                                               unset($entry['child_date']);
                                        }
                                        $i++;
                                }
@@ -185,8 +186,6 @@
 
                        array_push($descr,lang('finnish date'),lang('delay'));
 
-//_debug_array($descr);
-
                        $this->bocommon->download($list,$name,$descr);
                }
 
@@ -317,7 +316,7 @@
                                                'district_id'           => 
$this->district_id,
                                                'allrows'                       
=> $this->allrows
                                        );
-
+//_debug_array($ticket['child_date']);
                                        $content[] = array
                                        (
                                                'id'                            
        => $ticket['id'],
@@ -995,47 +994,19 @@
                                $origin_id      = $values['origin_id'];
                        }
 
+                       $interlink      = CreateObject('property.interlink');
+
                        if(isset($origin) && $origin)
                        {
                                unset($values['origin']);
                                unset($values['origin_id']);
-                               $values['origin'][0]['type']= $origin;
-                               
$values['origin'][0]['link']=$this->bocommon->get_origin_link($origin);
+                               $values['origin'][0]['location']= $origin;
+                               $values['origin'][0]['descr']= 
$interlink->get_location_name($origin);
                                $values['origin'][0]['data'][]= array(
-                                       'id'=> $origin_id,
-                                       'type'=> $origin
+                                       'id'    => $origin_id,
+                                       'link'  => 
$interlink->get_relation_link(array('location' => $origin), $origin_id),
                                        );
                        }
-
-                       if (isset($values['origin']) AND 
is_array($values['origin']))
-                       {
-                               for ($i=0;$i<count($values['origin']);$i++)
-                               {
-                                       
$values['origin'][$i]['link']=$GLOBALS['phpgw']->link('/index.php',$values['origin'][$i]['link']);
-                                       
if(substr($values['origin'][$i]['type'],0,6)=='entity')
-                                       {
-                                               $type           = 
explode("_",$values['origin'][$i]['type']);
-                                               $entity_id      = $type[1];
-                                               $cat_id         = $type[2];
-
-                                               if(!is_object($boadmin_entity))
-                                               {
-                                                       $boadmin_entity = 
CreateObject('property.boadmin_entity');
-                                               }
-                                               $entity_category = 
$boadmin_entity->read_single_category($entity_id,$cat_id);
-                                               $values['origin'][$i]['descr'] 
= $entity_category['name'];
-                                       }
-                                       else
-                                       {
-                                               $values['origin'][$i]['descr']= 
lang($values['origin'][$i]['type']);
-                                               
if($values['origin'][$i]['type'] == 'request')
-                                               {
-                                                       $selected_request = 
true;
-                                               }
-                                       }
-                               }
-                       }
-//------------------------
 //_debug_array($insert_record);
                        if (isset($values['save']))
                        {
@@ -1551,7 +1522,7 @@
                                'p_entity_id'           => 
$ticket['p_entity_id'],
                                'p_cat_id'              => $ticket['p_cat_id'],
                                'tenant_id'             => $ticket['tenant_id'],
-                               'origin'                => 'tts',
+                               'origin'                => '.ticket',
                                'origin_id'             => $id
                        );
 
@@ -1565,7 +1536,7 @@
                                'p_entity_id'           => 
$ticket['p_entity_id'],
                                'p_cat_id'              => $ticket['p_cat_id'],
                                'tenant_id'             => $ticket['tenant_id'],
-                               'origin'                => 'tts',
+                               'origin'                => '.ticket',
                                'origin_id'             => $id
                        );
 
@@ -1639,7 +1610,7 @@
                                                'p_entity_id'           => 
$ticket['p_entity_id'],
                                                'p_cat_id'              => 
$ticket['p_cat_id'],
                                                'tenant_id'             => 
$ticket['tenant_id'],
-                                               'origin'                => 
'tts',
+                                               'origin'                => 
'.ticket',
                                                'origin_id'             => $id
                                        ));
                                        $link_entity[$i]['name']        = 
$entry['name'];
@@ -1651,59 +1622,6 @@
 
                        $msgbox_data = $this->bocommon->msgbox_data($receipt);
 
-                       if (isset($ticket['origin']) AND 
is_array($ticket['origin']))
-                       {
-                               for ($i=0;$i<count($ticket['origin']);$i++)
-                               {
-                                       
$ticket['origin'][$i]['link']=$GLOBALS['phpgw']->link('/index.php',$ticket['origin'][$i]['link']);
-
-                                       
if(substr($ticket['origin'][$i]['type'],0,6)=='entity')
-                                       {
-                                               $type           = 
explode("_",$ticket['origin'][$i]['type']);
-                                               $entity_id      = $type[1];
-                                               $cat_id         = $type[2];
-
-                                               if(!isset($boadmin_entity) || 
!is_object($boadmin_entity))
-                                               {
-                                                       $boadmin_entity = 
CreateObject('property.boadmin_entity');
-                                               }
-                                               $entity_category = 
$boadmin_entity->read_single_category($entity_id,$cat_id);
-                                               $ticket['origin'][$i]['descr'] 
= $entity_category['name'];
-                                       }
-                                       else
-                                       {
-                                               $ticket['origin'][$i]['descr']= 
lang($ticket['origin'][$i]['type']);
-                                       }
-                               }
-                       }
-
-
-                       if (isset($ticket['destination']) AND 
is_array($ticket['destination']))
-                       {
-                               for ($i=0;$i<count($ticket['destination']);$i++)
-                               {
-                                       
$ticket['destination'][$i]['link']=$GLOBALS['phpgw']->link('/index.php',$ticket['destination'][$i]['link']);
-
-                                       
if(substr($ticket['destination'][$i]['type'],0,6)=='entity')
-                                       {
-                                               $type           = 
explode("_",$ticket['destination'][$i]['type']);
-                                               $entity_id      = $type[1];
-                                               $cat_id         = $type[2];
-
-                                               if(!isset($boadmin_entity) || 
!is_object($boadmin_entity))
-                                               {
-                                                       $boadmin_entity = 
CreateObject('property.boadmin_entity');
-                                               }
-                                               $entity_category = 
$boadmin_entity->read_single_category($entity_id,$cat_id);
-                                               
$ticket['destination'][$i]['descr'] = $entity_category['name'];
-                                       }
-                                       else
-                                       {
-                                               
$ticket['destination'][$i]['descr']= lang($ticket['destination'][$i]['type']);
-                                       }
-                               }
-                       }
-
                        $link_file_data = array
                        (
                                'menuaction'    => 'property.uitts.view_file',
@@ -1715,8 +1633,8 @@
 
                        $data = array
                        (
-                               'value_origin'                          => 
(isset($ticket['origin'])?$ticket['origin']:''),
-                               'value_destination'                     => 
(isset($ticket['destination'])?$ticket['destination']:''),
+                               'value_origin'                          => 
$ticket['origin'],
+                               'value_target'                          => 
$ticket['target'],
                                'lang_finnish_date'                     => 
lang('finnish date'),
                                'value_finnish_date'            => 
$ticket['finnish_date'],
                                'img_cal'                                       
=> $GLOBALS['phpgw']->common->image('phpgwapi','cal'),

Modified: trunk/property/inc/cron/synkroniser_med_boei.php
===================================================================
--- trunk/property/inc/cron/synkroniser_med_boei.php    2008-08-02 18:25:56 UTC 
(rev 18653)
+++ trunk/property/inc/cron/synkroniser_med_boei.php    2008-08-27 18:20:24 UTC 
(rev 18654)
@@ -244,8 +244,8 @@
                                }
                                $owner_utf[]= array (
                                 'id'           => $this->db_boei->f('id'),
-                                'org_name'     => 
$this->db->db_addslashes($this->bocommon->ascii2utf($this->db_boei->f('org_name'))),
-                                'remark'       => 
$this->db->db_addslashes($this->bocommon->ascii2utf($this->db_boei->f('org_name'))),
+                                'org_name'     => 
$this->db->db_addslashes(utf8_encode($this->db_boei->f('org_name'))),
+                                'remark'       => 
$this->db->db_addslashes(utf8_encode($this->db_boei->f('org_name'))),
                                 'category'     => $category,
                                 'entry_date'   => time(),
                                 'owner_id'             => 6
@@ -270,7 +270,7 @@
                                $sql2_latin = "INSERT INTO fm_owner 
(id,org_name,remark,category,entry_date,owner_id)"
                                        . "VALUES (" . 
$this->bocommon->validate_db_insert($owner_latin[$i]) . ")";
 
-                               $this->db->query($sql2_latin,__LINE__,__FILE__);
+                               $this->db->query($sql2_utf,__LINE__,__FILE__);
                                
$this->db_boei->query($sql2_latin,__LINE__,__FILE__);
 
                                $owner_msg[]=$owner_utf[$i]['org_name'];
@@ -316,13 +316,13 @@
                                        . " VALUES (" . $gate[$i]['id'] . ", 
'". $gate[$i]['descr']. "')";
 
                                $sql2_utf = "INSERT INTO fm_streetaddress 
(id,descr)"
-                                       . " VALUES (" . $gate[$i]['id'] . ", 
'". $this->bocommon->ascii2utf($gate[$i]['descr']). "')";
+                                       . " VALUES (" . $gate[$i]['id'] . ", 
'". utf8_encode($gate[$i]['descr']). "')";
 
                                $this->db->query($sql,__LINE__,__FILE__);
                                $this->db_boei->query($sql,__LINE__,__FILE__);
-                               $this->db->query($sql2_latin,__LINE__,__FILE__);
+                               $this->db->query($sql2_utf,__LINE__,__FILE__);
                                
$this->db_boei->query($sql2_latin,__LINE__,__FILE__);
-                               
$gate_msg[]=$this->bocommon->ascii2utf($gate[$i]['descr']);
+                               $gate_msg[]=utf8_encode($gate[$i]['descr']);
                        }
 
                        $this->db->transaction_commit();
@@ -349,7 +349,7 @@
                                $objekt_utf[]= array (
                                 'location_code'        => 
$this->db_boei->f('objekt_id'),
                                 'loc1'                         => 
$this->db_boei->f('objekt_id'),
-                                'loc1_name'            => 
$this->bocommon->ascii2utf($this->db_boei->f('navn')),
+                                'loc1_name'            => 
utf8_encode($this->db_boei->f('navn')),
                                 'part_of_town_id'      => 
$this->db_boei->f('bydel_id'),
                                 'owner_id'             => 
$this->db_boei->f('eier_id'),
                                 'kostra_id'            => 
$this->db_boei->f('tjenestested')
@@ -376,8 +376,9 @@
                                $sql2_latin = "INSERT INTO fm_location1 
(location_code, loc1, loc1_name, part_of_town_id, owner_id, kostra_id) "
                                        . "VALUES (" . 
$this->bocommon->validate_db_insert($objekt_latin[$i]) . ")";
 
-                               $this->db->query($sql2_latin,__LINE__,__FILE__);
+                               $this->db->query($sql2_utf,__LINE__,__FILE__);
                                
$this->db_boei->query($sql2_latin,__LINE__,__FILE__);
+                               $this->db->query("INSERT INTO fm_locations 
(level, location_code) VALUES (1, 
'{$objekt_utf[$i]['location_code']}')",__LINE__,__FILE__);
 
                                $obj_msg[]=$objekt_utf[$i]['loc1'];
                        }
@@ -408,7 +409,7 @@
                                 'location_code'        => 
$this->db_boei->f('location_code'),
                                 'loc1'                         => 
$this->db_boei->f('objekt_id'),
                                 'loc2'                         => 
$this->db_boei->f('bygg_id'),
-                                'loc2_name'            => 
$this->bocommon->ascii2utf($this->db_boei->f('byggnavn')),
+                                'loc2_name'            => 
utf8_encode($this->db_boei->f('byggnavn')),
                                 );
                                $bygg_latin[]= array (
                                 'location_code'        => 
$this->db_boei->f('location_code'),
@@ -429,8 +430,9 @@
                                $sql2_latin = "INSERT INTO fm_location2 
(location_code, loc1, loc2, loc2_name) "
                                        . "VALUES (" . 
$this->bocommon->validate_db_insert($bygg_latin[$i]) . ")";
 
-                               $this->db->query($sql2_latin,__LINE__,__FILE__);
+                               $this->db->query($sql2_utf,__LINE__,__FILE__);
                                
$this->db_boei->query($sql2_latin,__LINE__,__FILE__);
+                               $this->db->query("INSERT INTO fm_locations 
(level, location_code) VALUES (2, 
'{$bygg_utf[$i]['location_code']}')",__LINE__,__FILE__);
 
                                $bygg_msg[]=$bygg_utf[$i]['location_code'];
                        }
@@ -466,7 +468,7 @@
                                 'loc1'                         => 
$this->db_boei->f('objekt_id'),
                                 'loc2'                         => 
$this->db_boei->f('bygg_id'),
                                 'loc3'                         => 
$this->db_boei->f('seksjons_id'),
-                                'loc3_name'            => 
$this->bocommon->ascii2utf($this->db_boei->f('beskrivelse')),
+                                'loc3_name'            => 
utf8_encode($this->db_boei->f('beskrivelse')),
                                 'fellesareal'  => 
$this->db_boei->f('totalt_fellesareal')
                                 );
                                $seksjon_latin[]= array (
@@ -490,8 +492,9 @@
                                $sql2_latin = "INSERT INTO fm_location3 
(location_code, loc1, loc2, loc3, loc3_name, fellesareal) "
                                        . "VALUES (" . 
$this->bocommon->validate_db_insert($seksjon_latin[$i]) . ")";
 
-                               $this->db->query($sql2_latin,__LINE__,__FILE__);
+                               $this->db->query($sql2_utf,__LINE__,__FILE__);
                                
$this->db_boei->query($sql2_latin,__LINE__,__FILE__);
+                               $this->db->query("INSERT INTO fm_locations 
(level, location_code) VALUES (3, 
'{$seksjon_utf[$i]['location_code']}')",__LINE__,__FILE__);
 
                                
$seksjon_msg[]=$seksjon_utf[$i]['location_code'];
                        }
@@ -533,8 +536,8 @@
                                 'loc3'                         => 
$this->db_boei->f('seksjons_id'),
                                 'category'             => 
$this->db_boei->f('formaal_id'),
                                 'street_id'            => 
$this->db_boei->f('gateadresse_id'),
-                                'street_number'        => 
$this->bocommon->ascii2utf($this->db_boei->f('gatenr')),
-                                'etasje'                       => 
$this->bocommon->ascii2utf($this->db_boei->f('etasje')),
+                                'street_number'        => 
utf8_encode($this->db_boei->f('gatenr')),
+                                'etasje'                       => 
utf8_encode($this->db_boei->f('etasje')),
                                 'antallrom'            => 
$this->db_boei->f('antallrom'),
                                 'boareal'                      => 
$this->db_boei->f('boareal'),
                                 'livslopsstd'          => 
$this->db_boei->f('livslopsstd'),
@@ -580,8 +583,9 @@
                       tenant_id, beregnet_boa, flyttenr)"
                                        . "VALUES (" . 
$this->bocommon->validate_db_insert($leieobjekt_latin[$i]) . ")";
 
-                               $this->db->query($sql2_latin,__LINE__,__FILE__);
+                               $this->db->query($sql2_utf,__LINE__,__FILE__);
                                
$this->db_boei->query($sql2_latin,__LINE__,__FILE__);
+                               $this->db->query("INSERT INTO fm_locations 
(level, location_code) VALUES (4, 
'{$leieobjekt_utf[$i]['location_code']}')",__LINE__,__FILE__);
 
                                
$leieobjekt_msg[]=$leieobjekt_utf[$i]['location_code'];
                        }
@@ -611,8 +615,8 @@
                        {
                                $leietaker_utf[]= array (
                                 'id'                           => 
$this->db_boei->f('leietaker_id'),
-                                'first_name'           => 
$this->db->db_addslashes($this->bocommon->ascii2utf($this->db_boei->f('fornavn'))),
-                                'last_name'            => 
$this->db->db_addslashes($this->bocommon->ascii2utf($this->db_boei->f('etternavn'))),
+                                'first_name'           => 
$this->db->db_addslashes(utf8_encode($this->db_boei->f('fornavn'))),
+                                'last_name'            => 
$this->db->db_addslashes(utf8_encode($this->db_boei->f('etternavn'))),
                                 'category'                     => 
$this->db_boei->f('kjonn_juridisk') + 1,
                                 'status_eco'           => 
$this->db_boei->f('namssakstatusokonomi_id'),
                                 'status_drift'         => 
$this->db_boei->f('namssakstatusdrift_id'),
@@ -644,7 +648,7 @@
                                $sql2_latin = "INSERT INTO fm_tenant (id, 
first_name, last_name, category, status_eco, status_drift,entry_date,owner_id)"
                                        . "VALUES (" . 
$this->bocommon->validate_db_insert($leietaker_latin[$i]) . ")";
 
-                               $this->db->query($sql2_latin,__LINE__,__FILE__);
+                               $this->db->query($sql2_utf,__LINE__,__FILE__);
                                
$this->db_boei->query($sql2_latin,__LINE__,__FILE__);
 
                                $leietaker_msg[]= '[' 
.$leietaker_utf[$i]['last_name'] . ', ' . $leietaker_utf[$i]['first_name'] . 
']';
@@ -670,8 +674,8 @@
                        while ($this->db_boei->next_record())
                        {
                                $sql2_utf = " UPDATE  fm_tenant SET "
-                               . " first_name          = '" . 
$this->db->db_addslashes($this->bocommon->ascii2utf($this->db_boei->f('fornavn')))
 . "',"
-                               . " last_name           = '" . 
$this->db->db_addslashes($this->bocommon->ascii2utf($this->db_boei->f('etternavn')))
 ."'"
+                               . " first_name          = '" . 
$this->db->db_addslashes(utf8_encode($this->db_boei->f('fornavn'))) . "',"
+                               . " last_name           = '" . 
$this->db->db_addslashes(utf8_encode($this->db_boei->f('etternavn'))) ."'"
                                . " WHERE  id = " . 
(int)$this->db_boei->f('leietaker_id');
 
                                $sql2_latin = " UPDATE  fm_tenant SET "
@@ -679,7 +683,7 @@
                                . " last_name           = '" . 
$this->db->db_addslashes($this->db_boei->f('etternavn')) ."'"
                                . " WHERE  id = " . 
(int)$this->db_boei->f('leietaker_id');
 
-                               $this->db->query($sql2_latin,__LINE__,__FILE__);
+                               $this->db->query($sql2_utf,__LINE__,__FILE__);
                                
$this->db_boei2->query($sql2_latin,__LINE__,__FILE__);
                                $i++;
                        }
@@ -708,9 +712,9 @@
                                $sql2_utf = " UPDATE  fm_location4 SET "
                                . " tenant_id = '" . 
$this->db_boei->f('leietaker_id') . "',"
                                . " category = '" . 
$this->db_boei->f('formaal_id') . "',"
-                               . " etasje = '" . 
$this->bocommon->ascii2utf($this->db_boei->f('etasje')) . "',"
+                               . " etasje = '" . 
utf8_encode($this->db_boei->f('etasje')) . "',"
                                . " street_id = '" . 
$this->db_boei->f('gateadresse_id') . "',"
-                               . " street_number = '" . 
$this->bocommon->ascii2utf($this->db_boei->f('gatenr')) . "',"
+                               . " street_number = '" . 
utf8_encode($this->db_boei->f('gatenr')) . "',"
                                . " driftsstatus_id = '" . 
$this->db_boei->f('driftsstatus_id') . "',"
                                . " boareal = '" . $this->db_boei->f('boareal') 
. "',"
                                . " flyttenr = '" . 
$this->db_boei->f('flyttenr') . "',"
@@ -728,7 +732,7 @@
                                . " innflyttetdato = '" . 
date($this->bocommon->dateformat,strtotime($this->db_boei->f('innflyttetdato')))
 . "'"
                                . " WHERE  loc1 = '" . 
$this->db_boei->f('objekt_id') . "'  AND  loc4= '" . 
$this->db_boei->f('leie_id') . "'";
 
-                               $this->db->query($sql2_latin,__LINE__,__FILE__);
+                               $this->db->query($sql2_utf,__LINE__,__FILE__);
                                
$this->db_boei2->query($sql2_latin,__LINE__,__FILE__);
                                $i++;
                        }
@@ -759,7 +763,7 @@
                        while ($this->db_boei->next_record())
                        {
                                $sql2_utf = " UPDATE fm_location1 SET "
-                               . " loc1_name = '" . 
$this->bocommon->ascii2utf($this->db_boei->f('navn')) . "',"
+                               . " loc1_name = '" . 
utf8_encode($this->db_boei->f('navn')) . "',"
                                . " sum_boa = '" . $this->db_boei->f('sum_boa') 
. "',"
                                . " ant_leieobjekt = '" . 
$this->db_boei->f('ant_leieobjekt') . "',"
                                . " part_of_town_id = '" . 
$this->db_boei->f('bydel_id') . "',"
@@ -775,7 +779,7 @@
                                . " kostra_id = '" . 
$this->db_boei->f('tjenestested') . "'"
                                . " WHERE  loc1 = '" . 
$this->db_boei->f('objekt_id') . "'";
 
-                               $this->db->query($sql2_latin,__LINE__,__FILE__);
+                               $this->db->query($sql2_utf,__LINE__,__FILE__);
                                
$this->db_boei2->query($sql2_latin,__LINE__,__FILE__);
                                $i++;
                        }
@@ -806,7 +810,7 @@
                        while ($this->db_boei->next_record())
                        {
                                $sql2_utf = " UPDATE fm_location2 SET "
-                               . " loc2_name = '" . 
$this->bocommon->ascii2utf($this->db_boei->f('byggnavn')) . "',"
+                               . " loc2_name = '" . 
utf8_encode($this->db_boei->f('byggnavn')) . "',"
                                . " sum_boa = '" . $this->db_boei->f('sum_boa') 
. "',"
                                . " ant_leieobjekt = '" . 
$this->db_boei->f('ant_leieobjekt') . "'"
                                . " WHERE  loc1 = '" . 
$this->db_boei->f('objekt_id') . "'  AND  loc2= '" . 
$this->db_boei->f('bygg_id') . "'";
@@ -816,7 +820,7 @@
                                . " ant_leieobjekt = '" . 
$this->db_boei->f('ant_leieobjekt') . "'"
                                . " WHERE  loc1 = '" . 
$this->db_boei->f('objekt_id') . "'  AND  loc2= '" . 
$this->db_boei->f('bygg_id') . "'";
 
-                               $this->db->query($sql2_latin,__LINE__,__FILE__);
+                               $this->db->query($sql2_utf,__LINE__,__FILE__);
                                
$this->db_boei2->query($sql2_latin,__LINE__,__FILE__);
                                $i++;
                        }
@@ -849,7 +853,7 @@
                        while ($this->db_boei->next_record())
                        {
                                $sql2_utf = " UPDATE fm_location3 SET "
-                               . " loc3_name = '" . 
$this->bocommon->ascii2utf($this->db_boei->f('beskrivelse')) . "',"
+                               . " loc3_name = '" . 
utf8_encode($this->db_boei->f('beskrivelse')) . "',"
                                . " sum_boa = '" . $this->db_boei->f('sum_boa') 
. "',"
                                . " ant_leieobjekt = '" . 
$this->db_boei->f('ant_leieobjekt') . "'"
                                . " WHERE  loc1 = '" . 
$this->db_boei->f('objekt_id') . "'  AND  loc2= '" . 
$this->db_boei->f('bygg_id') . "'  AND  loc3= '" . 
$this->db_boei->f('seksjons_id') . "'";
@@ -859,7 +863,7 @@
                                . " ant_leieobjekt = '" . 
$this->db_boei->f('ant_leieobjekt') . "'"
                                . " WHERE  loc1 = '" . 
$this->db_boei->f('objekt_id') . "'  AND  loc2= '" . 
$this->db_boei->f('bygg_id') . "'  AND  loc3= '" . 
$this->db_boei->f('seksjons_id') . "'";
 
-                               $this->db->query($sql2_latin,__LINE__,__FILE__);
+                               $this->db->query($sql2_utf,__LINE__,__FILE__);
                                
$this->db_boei2->query($sql2_latin,__LINE__,__FILE__);
                                $i++;
                        }

Modified: trunk/property/setup/default_records.inc.php
===================================================================
--- trunk/property/setup/default_records.inc.php        2008-08-02 18:25:56 UTC 
(rev 18653)
+++ trunk/property/setup/default_records.inc.php        2008-08-27 18:20:24 UTC 
(rev 18654)
@@ -58,6 +58,8 @@
 $GLOBALS['phpgw_setup']->oProc->query("INSERT INTO phpgw_locations (app_id, 
name, descr) VALUES ({$app_id}, '.location.4', 'Apartment')");
 $GLOBALS['phpgw_setup']->oProc->query("INSERT INTO phpgw_locations (app_id, 
name, descr) VALUES ({$app_id}, '.custom', 'custom queries')");
 $GLOBALS['phpgw_setup']->oProc->query("INSERT INTO phpgw_locations (app_id, 
name, descr, allow_grant) VALUES ({$app_id}, '.project', 'Demand -> Workorder', 
1)");
+$GLOBALS['phpgw_setup']->oProc->query("INSERT INTO phpgw_locations (app_id, 
name, descr, allow_grant, allow_c_function) VALUES ({$app_id}, 
'.project.workorder', 'Workorder', 1, 1)");
+$GLOBALS['phpgw_setup']->oProc->query("INSERT INTO phpgw_locations (app_id, 
name, descr, allow_grant, allow_c_function) VALUES ({$app_id}, 
'.project.request', 'Request', 1, 1)");
 $GLOBALS['phpgw_setup']->oProc->query("INSERT INTO phpgw_locations (app_id, 
name, descr, allow_grant) VALUES ({$app_id}, '.ticket', 'Helpdesk', 1)");
 $GLOBALS['phpgw_setup']->oProc->query("INSERT INTO phpgw_locations (app_id, 
name, descr) VALUES ({$app_id}, '.ticket.external', 'Helpdesk External user')");
 $GLOBALS['phpgw_setup']->oProc->query("INSERT INTO phpgw_locations (app_id, 
name, descr) VALUES ({$app_id}, '.invoice', 'Invoice')");

Modified: trunk/property/setup/phpgw_en.lang
===================================================================
--- trunk/property/setup/phpgw_en.lang  2008-08-02 18:25:56 UTC (rev 18653)
+++ trunk/property/setup/phpgw_en.lang  2008-08-27 18:20:24 UTC (rev 18654)
@@ -1657,3 +1657,8 @@
 You have to select type of invoice     property        en      You have to 
select type of invoice
 Your message could not be sent by mail!        property        en      Your 
message could not be sent by mail!
 Your message could not be sent!        property        en      Your message 
could not be sent!
+.project       property        en      Project
+.project.workorder     property        en      Workorder
+.project.request       property        en      Request
+.tenant_claim  property        en      Tenant claim
+.ticket        property        en      Ticket

Modified: trunk/property/setup/phpgw_no.lang
===================================================================
--- trunk/property/setup/phpgw_no.lang  2008-08-02 18:25:56 UTC (rev 18653)
+++ trunk/property/setup/phpgw_no.lang  2008-08-27 18:20:24 UTC (rev 18654)
@@ -1626,3 +1626,8 @@
 Your message could not be sent by mail!        property        no      Din 
melding kunne ikke sendes med epost!
 obligations    property        no      forpliktelser
 contractual obligations        property        no      forpliktelser
+.project       property        no      Prosjekt
+.project.workorder     property        no      Arbeidsordre
+.project.request       property        no      Behov
+.tenant_claim  property        no      Leietaker krav
+.ticket        property        no      Melding

Modified: trunk/property/setup/setup.inc.php
===================================================================
--- trunk/property/setup/setup.inc.php  2008-08-02 18:25:56 UTC (rev 18653)
+++ trunk/property/setup/setup.inc.php  2008-08-27 18:20:24 UTC (rev 18654)
@@ -12,7 +12,7 @@
        */
 
        $setup_info['property']['name']         = 'property';
-       $setup_info['property']['version']      = '0.9.17.544';
+       $setup_info['property']['version']      = '0.9.17.546';
        $setup_info['property']['app_order']    = 8;
        $setup_info['property']['enable']       = 1;
        $setup_info['property']['app_group']    = 'office';
@@ -79,6 +79,7 @@
                'fm_vendor',
                'fm_vendor_category',
                'fm_district',
+               'fm_locations',
                'fm_location1_category',
                'fm_location1',
                'fm_location1_history',
@@ -167,7 +168,6 @@
                'fm_s_agreement_history',
                'fm_async_method',
                'fm_cron_log',
-               'fm_origin',
                'fm_tenant_claim',
                'fm_tenant_claim_category',
                'fm_r_agreement',

Modified: trunk/property/setup/tables_current.inc.php
===================================================================
--- trunk/property/setup/tables_current.inc.php 2008-08-02 18:25:56 UTC (rev 
18653)
+++ trunk/property/setup/tables_current.inc.php 2008-08-27 18:20:24 UTC (rev 
18654)
@@ -154,7 +154,17 @@
                        'ix' => array(),
                        'uc' => array()
                ),
-
+               'fm_locations' => array(
+                       'fd' => array(
+                               'id' => array('type' => 'auto','precision' => 
'4','nullable' => False),
+                               'level' => array('type' => 'int','precision' => 
'4','nullable' => False),
+                               'location_code' => array('type' => 
'varchar','precision' => '50','nullable' => False)
+                       ),
+                       'pk' => array('id'),
+                       'fk' => array(),
+                       'ix' => array(),
+                       'uc' => array('location_code')
+               ),
                'fm_location1_category' => array(
                        'fd' => array(
                                'id' => array('type' => 'int','precision' => 
'4','nullable' => False),
@@ -1378,20 +1388,6 @@
                        'ix' => array(),
                        'uc' => array()
                ),
-               'fm_origin' => array(
-                       'fd' => array(
-                               'origin' => array('type' => 
'varchar','precision' => '12','nullable' => False),
-                               'origin_id' => array('type' => 
'int','precision' => '4','nullable' => False),
-                               'destination' => array('type' => 
'varchar','precision' => '12','nullable' => False),
-                               'destination_id' => array('type' => 
'int','precision' => '4','nullable' => False),
-                               'user_id' => array('type' => 'int','precision' 
=> '4','nullable' => True),
-                               'entry_date' => array('type' => 
'int','precision' => '4','nullable' => True)
-                       ),
-                       'pk' => 
array('origin','origin_id','destination','destination_id'),
-                       'fk' => array(),
-                       'ix' => array(),
-                       'uc' => array()
-               ),
                'fm_entity_1_1' => array(
                        'fd' => array(
                                'id' => array('type' => 'auto','precision' => 
'4','nullable' => False),

Modified: trunk/property/setup/tables_update.inc.php
===================================================================
--- trunk/property/setup/tables_update.inc.php  2008-08-02 18:25:56 UTC (rev 
18653)
+++ trunk/property/setup/tables_update.inc.php  2008-08-27 18:20:24 UTC (rev 
18654)
@@ -1944,28 +1944,15 @@
        function property_upgrade0_9_17_540()
        {
                $GLOBALS['phpgw_setup']->oProc->m_odb->transaction_begin();
-               $GLOBALS['phpgw_setup']->oProc->query("DELETE FROM 
phpgw_acl_location where appname = 'property' AND id = '.agreement'");
-               $GLOBALS['phpgw_setup']->oProc->query("DELETE FROM 
phpgw_acl_location where appname = 'property' AND id = '.s_agreement'");
-               $GLOBALS['phpgw_setup']->oProc->query("DELETE FROM 
phpgw_acl_location where appname = 'property' AND id = '.r_agreement'");
-               $GLOBALS['phpgw_setup']->oProc->query("DELETE FROM 
phpgw_acl_location where appname = 'property' AND id = '.tenant'");
-               $GLOBALS['phpgw_setup']->oProc->query("DELETE FROM 
phpgw_acl_location where appname = 'property' AND id = '.owner'");
-               $GLOBALS['phpgw_setup']->oProc->query("DELETE FROM 
phpgw_acl_location where appname = 'property' AND id = '.vendor'");
 
-               $GLOBALS['phpgw_setup']->oProc->query("INSERT INTO 
phpgw_acl_location (appname,id, descr, allow_c_attrib,c_attrib_table) VALUES 
('property', '.agreement', 'Agreement',1,'fm_agreement')");
-               $GLOBALS['phpgw_setup']->oProc->query("INSERT INTO 
phpgw_acl_location (appname,id, descr, allow_c_attrib,c_attrib_table) VALUES 
('property', '.s_agreement', 'Service agreement',1,'fm_s_agreement')");
-               $GLOBALS['phpgw_setup']->oProc->query("INSERT INTO 
phpgw_acl_location (appname,id, descr, allow_c_attrib,c_attrib_table) VALUES 
('property', '.s_agreement.detail', 'Service agreement 
detail',1,'fm_s_agreement_detail')");
-               $GLOBALS['phpgw_setup']->oProc->query("INSERT INTO 
phpgw_acl_location (appname,id, descr, allow_c_attrib,c_attrib_table) VALUES 
('property', '.r_agreement', 'Rental agreement',1,'fm_r_agreement')");
-               $GLOBALS['phpgw_setup']->oProc->query("INSERT INTO 
phpgw_acl_location (appname,id, descr, allow_c_attrib,c_attrib_table) VALUES 
('property', '.r_agreement.detail', 'Rental agreement 
detail',1,'fm_r_agreement_detail')");
-               $GLOBALS['phpgw_setup']->oProc->query("INSERT INTO 
phpgw_acl_location (appname,id, descr, allow_c_attrib,c_attrib_table) VALUES 
('property', '.tenant', 'Tenant',1,'fm_tenant')");
-               $GLOBALS['phpgw_setup']->oProc->query("INSERT INTO 
phpgw_acl_location (appname,id, descr, allow_c_attrib,c_attrib_table) VALUES 
('property', '.owner', 'Owner',1,'fm_owner')");
-               $GLOBALS['phpgw_setup']->oProc->query("INSERT INTO 
phpgw_acl_location (appname,id, descr, allow_c_attrib,c_attrib_table) VALUES 
('property', '.vendor', 'Vendor',1,'fm_vendor')");
+               $GLOBALS['phpgw']->locations->add('.s_agreement.detail', 
'Service agreement detail', 'property', $allow_grant = false, $custom_tbl = 
'fm_s_agreement_detail', $c_function = false);
+               $GLOBALS['phpgw']->locations->add('.r_agreement.detail', 
'Rental agreement detail', 'property', $allow_grant = false, $custom_tbl = 
'fm_r_agreement_detail', $c_function = false);
 
                $GLOBALS['phpgw_setup']->oProc->query("SELECT * FROM 
fm_agreement_attribute");
                while ($GLOBALS['phpgw_setup']->oProc->next_record())
                {
                        $attrib[]=array(
-                                       'appname'               => 'property',
-                                       'location'              => 
$GLOBALS['phpgw_setup']->oProc->f('attrib_detail') == 1 ? 
'.agreement':'.agreement.detail',
+                                       'location_id'   => 
$GLOBALS['phpgw_setup']->oProc->f('attrib_detail') == 1 ? 
'.agreement':'.agreement.detail',
                                        'id'                    => 
$GLOBALS['phpgw_setup']->oProc->f('id'),
                                        'column_name'   => 
$GLOBALS['phpgw_setup']->oProc->f('column_name'),
                                        'input_text'    => 
$GLOBALS['phpgw_setup']->oProc->f('input_text'),
@@ -1988,8 +1975,7 @@
                while ($GLOBALS['phpgw_setup']->oProc->next_record())
                {
                        $attrib[]=array(
-                                       'appname'               => 'property',
-                                       'location'              => 
$GLOBALS['phpgw_setup']->oProc->f('attrib_detail') == 1 ? 
'.r_agreement':'.r_agreement.detail',
+                                       'location_id'   => 
$GLOBALS['phpgw_setup']->oProc->f('attrib_detail') == 1 ? 
'.r_agreement':'.r_agreement.detail',
                                        'id'                    => 
$GLOBALS['phpgw_setup']->oProc->f('id'),
                                        'column_name'   => 
$GLOBALS['phpgw_setup']->oProc->f('column_name'),
                                        'input_text'    => 
$GLOBALS['phpgw_setup']->oProc->f('input_text'),
@@ -2012,8 +1998,7 @@
                while ($GLOBALS['phpgw_setup']->oProc->next_record())
                {
                        $attrib[]=array(
-                                       'appname'               => 'property',
-                                       'location'              => 
$GLOBALS['phpgw_setup']->oProc->f('attrib_detail') == 1 ? 
'.s_agreement':'.s_agreement.detail',
+                                       'location_id'   => 
$GLOBALS['phpgw_setup']->oProc->f('attrib_detail') == 1 ? 
'.s_agreement':'.s_agreement.detail',
                                        'id'                    => 
$GLOBALS['phpgw_setup']->oProc->f('id'),
                                        'column_name'   => 
$GLOBALS['phpgw_setup']->oProc->f('column_name'),
                                        'input_text'    => 
$GLOBALS['phpgw_setup']->oProc->f('input_text'),
@@ -2036,8 +2021,7 @@
                while ($GLOBALS['phpgw_setup']->oProc->next_record())
                {
                        $attrib[]=array(
-                                       'appname'               => 'property',
-                                       'location'              => '.owner',
+                                       'location_id'   => '.owner',
                                        'id'                    => 
$GLOBALS['phpgw_setup']->oProc->f('id'),
                                        'column_name'   => 
$GLOBALS['phpgw_setup']->oProc->f('column_name'),
                                        'input_text'    => 
$GLOBALS['phpgw_setup']->oProc->f('input_text'),
@@ -2060,8 +2044,7 @@
                while ($GLOBALS['phpgw_setup']->oProc->next_record())
                {
                        $attrib[]=array(
-                                       'appname'               => 'property',
-                                       'location'              => '.tenant',
+                                       'location_id'   => '.tenant',
                                        'id'                    => 
$GLOBALS['phpgw_setup']->oProc->f('id'),
                                        'column_name'   => 
$GLOBALS['phpgw_setup']->oProc->f('column_name'),
                                        'input_text'    => 
$GLOBALS['phpgw_setup']->oProc->f('input_text'),
@@ -2084,8 +2067,7 @@
                while ($GLOBALS['phpgw_setup']->oProc->next_record())
                {
                        $attrib[]=array(
-                                       'appname'               => 'property',
-                                       'location'              => '.vendor',
+                                       'location_id'   => '.vendor',
                                        'id'                    => 
$GLOBALS['phpgw_setup']->oProc->f('id'),
                                        'column_name'   => 
$GLOBALS['phpgw_setup']->oProc->f('column_name'),
                                        'input_text'    => 
$GLOBALS['phpgw_setup']->oProc->f('input_text'),
@@ -2104,8 +2086,9 @@
                        );
                }
 
-               foreach ($attrib as $entry)
+               foreach ($attrib as & $entry)
                {
+                       $entry['location_id'] = 
$GLOBALS['phpgw']->locations->get_id('property', $entry['location_id']);
                        $GLOBALS['phpgw_setup']->oProc->query('INSERT INTO 
phpgw_cust_attribute (' . implode(',',array_keys($entry)) . ') VALUES (' . 
$GLOBALS['phpgw_setup']->oProc->validate_insert(array_values($entry)) . ')');
                }
                
@@ -2113,8 +2096,7 @@
                while ($GLOBALS['phpgw_setup']->oProc->next_record())
                {
                        $choice[]=array(
-                                       'appname'               => 'property',
-                                       'location'              => 
$GLOBALS['phpgw_setup']->oProc->f('attrib_detail') == 1 ? 
'.agreement':'.agreement.detail',
+                                       'location_id'   => 
$GLOBALS['phpgw_setup']->oProc->f('attrib_detail') == 1 ? 
'.agreement':'.agreement.detail',
                                        'attrib_id'             => 
$GLOBALS['phpgw_setup']->oProc->f('attrib_id'),
                                        'id'                    => 
$GLOBALS['phpgw_setup']->oProc->f('id'),
                                        'value'                 => 
$GLOBALS['phpgw_setup']->oProc->f('value')
@@ -2125,8 +2107,7 @@
                while ($GLOBALS['phpgw_setup']->oProc->next_record())
                {
                        $choice[]=array(
-                                       'appname'               => 'property',
-                                       'location'              => 
$GLOBALS['phpgw_setup']->oProc->f('attrib_detail') == 1 ? 
'.r_agreement':'.r_agreement.detail',
+                                       'location_id'   => 
$GLOBALS['phpgw_setup']->oProc->f('attrib_detail') == 1 ? 
'.r_agreement':'.r_agreement.detail',
                                        'attrib_id'             => 
$GLOBALS['phpgw_setup']->oProc->f('attrib_id'),
                                        'id'                    => 
$GLOBALS['phpgw_setup']->oProc->f('id'),
                                        'value'                 => 
$GLOBALS['phpgw_setup']->oProc->f('value')
@@ -2137,8 +2118,7 @@
                while ($GLOBALS['phpgw_setup']->oProc->next_record())
                {
                        $choice[]=array(
-                                       'appname'               => 'property',
-                                       'location'              => 
$GLOBALS['phpgw_setup']->oProc->f('attrib_detail') == 1 ? 
'.s_agreement':'.s_agreement.detail',
+                                       'location_id'   => 
$GLOBALS['phpgw_setup']->oProc->f('attrib_detail') == 1 ? 
'.s_agreement':'.s_agreement.detail',
                                        'attrib_id'             => 
$GLOBALS['phpgw_setup']->oProc->f('attrib_id'),
                                        'id'                    => 
$GLOBALS['phpgw_setup']->oProc->f('id'),
                                        'value'                 => 
$GLOBALS['phpgw_setup']->oProc->f('value')
@@ -2149,8 +2129,7 @@
                while ($GLOBALS['phpgw_setup']->oProc->next_record())
                {
                        $choice[]=array(
-                                       'appname'               => 'property',
-                                       'location'              => '.owner',
+                                       'location_id'   => '.owner',
                                        'attrib_id'             => 
$GLOBALS['phpgw_setup']->oProc->f('attrib_id'),
                                        'id'                    => 
$GLOBALS['phpgw_setup']->oProc->f('id'),
                                        'value'                 => 
$GLOBALS['phpgw_setup']->oProc->f('value')
@@ -2161,8 +2140,7 @@
                while ($GLOBALS['phpgw_setup']->oProc->next_record())
                {
                        $choice[]=array(
-                                       'appname'               => 'property',
-                                       'location'              => '.tenant',
+                                       'location_id'   => '.tenant',
                                        'attrib_id'             => 
$GLOBALS['phpgw_setup']->oProc->f('attrib_id'),
                                        'id'                    => 
$GLOBALS['phpgw_setup']->oProc->f('id'),
                                        'value'                 => 
$GLOBALS['phpgw_setup']->oProc->f('value')
@@ -2173,16 +2151,16 @@
                while ($GLOBALS['phpgw_setup']->oProc->next_record())
                {
                        $choice[]=array(
-                                       'appname'               => 'property',
-                                       'location'              => '.vendor',
+                                       'location_id'   => '.vendor',
                                        'attrib_id'             => 
$GLOBALS['phpgw_setup']->oProc->f('attrib_id'),
                                        'id'                    => 
$GLOBALS['phpgw_setup']->oProc->f('id'),
                                        'value'                 => 
$GLOBALS['phpgw_setup']->oProc->f('value')
                        );
                }
 
-               foreach ($choice as $entry)
+               foreach ($choice as & $entry)
                {
+                       $entry['location_id'] = 
$GLOBALS['phpgw']->locations->get_id('property', $entry['location_id']);
                        $GLOBALS['phpgw_setup']->oProc->query('INSERT INTO 
phpgw_cust_choice (' . implode(',',array_keys($entry)) . ') VALUES (' . 
$GLOBALS['phpgw_setup']->oProc->validate_insert(array_values($entry)) . ')');
                }
 
@@ -2205,8 +2183,7 @@
                while ($GLOBALS['phpgw_setup']->oProc->next_record())
                {
                        $attrib[]=array(
-                                       'appname'               => 'property',
-                                       'location'              => '.entity.' . 
$GLOBALS['phpgw_setup']->oProc->f('entity_id') . '.' . 
$GLOBALS['phpgw_setup']->oProc->f('cat_id'),
+                                       'location_id'   => '.entity.' . 
$GLOBALS['phpgw_setup']->oProc->f('entity_id') . '.' . 
$GLOBALS['phpgw_setup']->oProc->f('cat_id'),
                                        'id'                    => 
$GLOBALS['phpgw_setup']->oProc->f('id'),
                                        'column_name'   => 
$GLOBALS['phpgw_setup']->oProc->f('column_name'),
                                        'input_text'    => 
$GLOBALS['phpgw_setup']->oProc->f('input_text'),
@@ -2226,8 +2203,9 @@
                        );
                }
 
-               foreach ($attrib as $entry)
+               foreach ($attrib as & $entry)
                {
+                       $entry['location_id'] = 
$GLOBALS['phpgw']->locations->get_id('property', $entry['location_id']);
                        $GLOBALS['phpgw_setup']->oProc->query('INSERT INTO 
phpgw_cust_attribute (' . implode(',',array_keys($entry)) . ') VALUES (' . 
$GLOBALS['phpgw_setup']->oProc->validate_insert(array_values($entry)) . ')');
                }
 
@@ -2236,32 +2214,38 @@
                while ($GLOBALS['phpgw_setup']->oProc->next_record())
                {
                        $choice[]=array(
-                                       'appname'               => 'property',
-                                       'location'              => '.entity.' . 
$GLOBALS['phpgw_setup']->oProc->f('entity_id') . '.' . 
$GLOBALS['phpgw_setup']->oProc->f('cat_id'),
+                                       'location_id'   => '.entity.' . 
$GLOBALS['phpgw_setup']->oProc->f('entity_id') . '.' . 
$GLOBALS['phpgw_setup']->oProc->f('cat_id'),
                                        'attrib_id'             => 
$GLOBALS['phpgw_setup']->oProc->f('attrib_id'),
                                        'id'                    => 
$GLOBALS['phpgw_setup']->oProc->f('id'),
                                        'value'                 => 
$GLOBALS['phpgw_setup']->oProc->f('value')
                        );
                }
 
-               foreach ($choice as $entry)
+               foreach ($choice as & $entry)
                {
+                       $entry['location_id'] = 
$GLOBALS['phpgw']->locations->get_id('property', $entry['location_id']);
                        $GLOBALS['phpgw_setup']->oProc->query('INSERT INTO 
phpgw_cust_choice (' . implode(',',array_keys($entry)) . ') VALUES (' . 
$GLOBALS['phpgw_setup']->oProc->validate_insert(array_values($entry)) . ')');
                }
 
                $location = array();
-               $GLOBALS['phpgw_setup']->oProc->query("SELECT * FROM 
phpgw_acl_location WHERE appname = 'property' AND id LIKE '.entity.%'");
 
+               $app_id = $GLOBALS['phpgw']->applications->name2id('property');
+               $GLOBALS['phpgw_setup']->oProc->query("SELECT location_id,name 
FROM phpgw_locations WHERE app_id = {$app_id} AND name LIKE '.entity.%'");
+
                while ($GLOBALS['phpgw_setup']->oProc->next_record())
                {
-                       $location[]= $GLOBALS['phpgw_setup']->oProc->f('id');
+                       $location[]= array
+                       (
+                               'location_id'   => 
$GLOBALS['phpgw_setup']->oProc->f('location_id'),
+                               'name'                  => 
$GLOBALS['phpgw_setup']->oProc->f('name')
+                       );
                }
 
                foreach ($location as $entry)
                {
-                       if (strlen($entry)>10)
+                       if (strlen($entry['name'])>10)
                        {
-                               $GLOBALS['phpgw_setup']->oProc->query("UPDATE 
phpgw_acl_location SET allow_c_attrib=1 ,c_attrib_table ='fm" . 
str_replace('.','_', $entry) ."' WHERE id = '$entry'");
+                               $GLOBALS['phpgw_setup']->oProc->query("UPDATE 
phpgw_locations SET allow_c_attrib=1 ,c_attrib_table ='fm" . 
str_replace('.','_', $entry['name']) ."' WHERE location_id = 
{$entry['location_id']}");
                        }
                }
 
@@ -2275,8 +2259,7 @@
                while ($GLOBALS['phpgw_setup']->oProc->next_record())
                {
                        $custom[]=array(
-                                       'appname'               => 'property',
-                                       'location'              => 
$GLOBALS['phpgw_setup']->oProc->f('acl_location'),
+                                       'location_id'   => 
$GLOBALS['phpgw_setup']->oProc->f('acl_location'),
                                        'id'                    => 
$GLOBALS['phpgw_setup']->oProc->f('id'),
                                        'descr'                 => 
$GLOBALS['phpgw_setup']->oProc->f('descr'),
                                        'file_name'             => 
$GLOBALS['phpgw_setup']->oProc->f('file_name'),
@@ -2284,8 +2267,10 @@
                                        'custom_sort'   => 
$GLOBALS['phpgw_setup']->oProc->f('custom_sort')
                        );
                }
-               foreach ($custom as $entry)
+
+               foreach ($custom as & $entry)
                {
+                       $entry['location_id'] = 
$GLOBALS['phpgw']->locations->get_id('property', $entry['location_id']);
                        $GLOBALS['phpgw_setup']->oProc->query('INSERT INTO 
phpgw_cust_function (' . implode(',',array_keys($entry)) . ') VALUES (' . 
$GLOBALS['phpgw_setup']->oProc->validate_insert(array_values($entry)) . ')');
                }
 
@@ -2299,8 +2284,7 @@
                while ($GLOBALS['phpgw_setup']->oProc->next_record())
                {
                        $attrib[]=array(
-                                       'appname'               => 'property',
-                                       'location'              => '.location.' 
. $GLOBALS['phpgw_setup']->oProc->f('type_id'),
+                                       'location_id'           => '.location.' 
. $GLOBALS['phpgw_setup']->oProc->f('type_id'),
                                        'id'                    => 
$GLOBALS['phpgw_setup']->oProc->f('id'),
                                        'column_name'   => 
$GLOBALS['phpgw_setup']->oProc->f('column_name'),
                                        'input_text'    => 
$GLOBALS['phpgw_setup']->oProc->f('input_text'),
@@ -2321,8 +2305,9 @@
                        );
                }
 
-               foreach ($attrib as $entry)
+               foreach ($attrib as & $entry)
                {
+                       $entry['location_id'] = 
$GLOBALS['phpgw']->locations->get_id('property', $entry['location_id']);
                        $GLOBALS['phpgw_setup']->oProc->query('INSERT INTO 
phpgw_cust_attribute (' . implode(',',array_keys($entry)) . ') VALUES (' . 
$GLOBALS['phpgw_setup']->oProc->validate_insert(array_values($entry)) . ')');
                }
 
@@ -2331,16 +2316,16 @@
                while ($GLOBALS['phpgw_setup']->oProc->next_record())
                {
                        $choice[]=array(
-                                       'appname'               => 'property',
-                                       'location'              => '.location.' 
. $GLOBALS['phpgw_setup']->oProc->f('type_id'),
+                                       'location_id'   => '.location.' . 
$GLOBALS['phpgw_setup']->oProc->f('type_id'),
                                        'attrib_id'             => 
$GLOBALS['phpgw_setup']->oProc->f('attrib_id'),
                                        'id'                    => 
$GLOBALS['phpgw_setup']->oProc->f('id'),
                                        'value'                 => 
$GLOBALS['phpgw_setup']->oProc->f('value')
                        );
                }
 
-               foreach ($choice as $entry)
+               foreach ($choice as & $entry)
                {
+                       $entry['location_id'] = 
$GLOBALS['phpgw']->locations->get_id('property', $entry['location_id']);
                        $GLOBALS['phpgw_setup']->oProc->query('INSERT INTO 
phpgw_cust_choice (' . implode(',',array_keys($entry)) . ') VALUES (' . 
$GLOBALS['phpgw_setup']->oProc->validate_insert(array_values($entry)) . ')');
                }
 
@@ -2568,6 +2553,7 @@
 
                unset($GLOBALS['phpgw']->accounts);
                unset($GLOBALS['phpgw']->acl);
+               $GLOBALS['phpgw']->hooks->register_all_hooks(); //get the menus
                unset($GLOBALS['phpgw']->hooks);
 
                if($GLOBALS['phpgw_setup']->oProc->m_odb->transaction_commit())
@@ -2579,18 +2565,158 @@
 
        /**
        * Update property version from 0.9.17.544 to 0.9.17.545
+       * Move interlink data from property to API
        */
-/*
+
        $test[] = '0.9.17.544';
        function property_upgrade0_9_17_544()
        {
                $GLOBALS['phpgw_setup']->oProc->m_odb->transaction_begin();
                $GLOBALS['phpgw_setup']->oProc->query('DELETE FROM fm_cache');
                
$GLOBALS['phpgw_setup']->oProc->AlterColumn('fm_wo_hours','hours_descr',array('type'
 => 'text', 'nullable' => True));
+
+               $GLOBALS['phpgw']->locations->add('.project.workorder', 
'Workorder', 'property', $allow_grant = true, $custom_tbl = null, $c_function = 
true);
+               $GLOBALS['phpgw']->locations->add('.project.request', 
'Request', 'property', $allow_grant = true, $custom_tbl = null, $c_function = 
true);
+               $GLOBALS['phpgw_setup']->oProc->query('SELECT * FROM 
fm_origin');
+               while ($GLOBALS['phpgw_setup']->oProc->next_record())
+               {
+                       $interlink[] = array
+                       (
+                               'origin'                        => 
$GLOBALS['phpgw_setup']->oProc->f('origin'),
+                               'origin_id'                     => 
$GLOBALS['phpgw_setup']->oProc->f('origin_id'),
+                               'destination'           => 
$GLOBALS['phpgw_setup']->oProc->f('destination'),
+                               'destination_id'        => 
$GLOBALS['phpgw_setup']->oProc->f('destination_id'),
+                               'user_id'                       => 
$GLOBALS['phpgw_setup']->oProc->f('user_id'),
+                               'entry_date'            => 
$GLOBALS['phpgw_setup']->oProc->f('entry_date')
+                       );
+               }
+
+               foreach ($interlink as $entry)
+               {
+                       if($entry['origin'] == 'workorder')
+                       {
+                               $entry['origin'] = 'project.workorder';
+                       }
+                       if($entry['origin'] == 'request')
+                       {
+                               $entry['origin'] = 'project.request';
+                       }
+                       if($entry['destination'] == 'request')
+                       {
+                               $entry['destination'] = 'project.request';
+                       }
+                       if($entry['destination'] == 'tenant_claim')
+                       {
+                               $entry['destination'] = 'tenant&claim';
+                       }
+                       
+                       $location1_id = 
$GLOBALS['phpgw']->locations->get_id('property', '.' . str_replace('_', '.', 
$entry['origin']=='tts' ? 'ticket' : $entry['origin']));
+                       $location2_id = 
$GLOBALS['phpgw']->locations->get_id('property', '.' . 
str_replace(array('_','&'), array('.','_'), $entry['destination']=='tts' ? 
'ticket' : $entry['destination']));
+                       $account_id = $entry['user_id'] ? $entry['user_id'] : 
-1;
+                       $GLOBALS['phpgw_setup']->oProc->query('INSERT INTO 
phpgw_interlink 
(location1_id,location1_item_id,location2_id,location2_item_id,account_id,entry_date,is_private,start_date,end_date)
 '
+                               .'VALUES('
+                               .$location1_id . ','
+                               .$entry['origin_id'] . ','
+                               .$location2_id . ','
+                               .$entry['destination_id'] . ','
+                               .$account_id . ','
+                               .$entry['entry_date'] . ',-1,-1,-1)');
+               }
+
+               $GLOBALS['phpgw_setup']->oProc->DropTable('fm_origin');
+
                if($GLOBALS['phpgw_setup']->oProc->m_odb->transaction_commit())
                {
                        $GLOBALS['setup_info']['property']['currentver'] = 
'0.9.17.545';
                        return $GLOBALS['setup_info']['property']['currentver'];
                }
        }
-*/
+       
+       /**
+       * Update property version from 0.9.17.545 to 0.9.17.546
+       * Add table for a common unified location-mapping for use with interlink
+       */
+
+       $test[] = '0.9.17.545';
+       function property_upgrade0_9_17_545()
+       {
+               $GLOBALS['phpgw_setup']->oProc->m_odb->transaction_begin();
+
+               //old table that may exist
+               if 
($GLOBALS['phpgw_setup']->oProc->m_odb->metadata('fm_location'))
+               {
+                       
$GLOBALS['phpgw_setup']->oProc->DropTable('fm_location');
+               }
+
+               $GLOBALS['phpgw_setup']->oProc->CreateTable(
+                       'fm_locations', array(
+                               'fd' => array(
+                                       'id' => array('type' => 
'auto','precision' => '4','nullable' => False),
+                                       'level' => array('type' => 
'int','precision' => '4','nullable' => False),
+                                       'location_code' => array('type' => 
'varchar','precision' => '50','nullable' => False)
+                               ),
+                               'pk' => array('id'),
+                               'fk' => array(),
+                               'ix' => array(),
+                               'uc' => array('location_code')
+                       )
+               );
+
+               $GLOBALS['phpgw_setup']->oProc->query('SELECT max(id) as levels 
FROM fm_location_type');
+               $GLOBALS['phpgw_setup']->oProc->next_record();
+               $levels =  $GLOBALS['phpgw_setup']->oProc->f('levels');
+
+               //perform an update on all location_codes on all levels to make 
sure they are consistent and unique
+               for ($level=1;$level<($levels+1);$level++)
+               {
+                       $sql = "SELECT * from fm_location{$level}";
+                       
$GLOBALS['phpgw_setup']->oProc->query($sql,__LINE__,__FILE__);
+                       $i = 0;
+                       while($GLOBALS['phpgw_setup']->oProc->next_record())
+                       {
+                               $location_code = array();
+                               $where = 'WHERE';
+                               $locations[$i]['condition'] = '';
+                               for ($j=1;$j<($level+1);$j++)
+                               {
+                                       $loc = 
$GLOBALS['phpgw_setup']->oProc->f("loc{$j}");
+                                       $location_code[] = $loc;
+                                       $locations[$i]['condition'] .= "$where 
loc{$j}='{$loc}'";
+                                       $where = 'AND';
+                               }
+                               $locations[$i]['new_values']['location_code'] = 
implode('-', $location_code);
+                               $i++;
+                       }
+
+                       foreach($locations as $location)
+                       {
+                               $sql = "UPDATE fm_location{$level} SET 
location_code = '{$location['new_values']['location_code']}' 
{$location['condition']}";
+                               
$GLOBALS['phpgw_setup']->oProc->query($sql,__LINE__,__FILE__);
+                       }
+               }
+
+               $locations = array();
+               for ($i=1;$i<($levels+1);$i++)
+               {
+                       $GLOBALS['phpgw_setup']->oProc->query("SELECT * from 
fm_location{$i}");
+                       while($GLOBALS['phpgw_setup']->oProc->next_record())
+                       {
+                               $locations[] = array
+                               (
+                                       'level'                 => $i,
+                                       'location_code' => 
$GLOBALS['phpgw_setup']->oProc->f('location_code')
+                               );
+                       }
+               }
+               
+               foreach ($locations as $location)
+               {
+                       $GLOBALS['phpgw_setup']->oProc->query("INSERT INTO 
fm_locations (level, location_code) VALUES ({$location['level']}, 
'{$location['location_code']}')");
+               }
+
+               if($GLOBALS['phpgw_setup']->oProc->m_odb->transaction_commit())
+               {
+                       $GLOBALS['setup_info']['property']['currentver'] = 
'0.9.17.546';
+                       return $GLOBALS['setup_info']['property']['currentver'];
+               }
+       }

Modified: trunk/property/templates/base/entity.xsl
===================================================================
--- trunk/property/templates/base/entity.xsl    2008-08-02 18:25:56 UTC (rev 
18653)
+++ trunk/property/templates/base/entity.xsl    2008-08-27 18:20:24 UTC (rev 
18654)
@@ -236,15 +236,14 @@
                                        <xsl:apply-templates 
select="table_apply"/>
                                </td>
                        </tr>
-                       <xsl:call-template name="destination"/>
+                       <xsl:call-template name="target"/>
                        <xsl:for-each select="origin_list" >
-                               <xsl:variable name="link"><xsl:value-of 
select="link"/>&amp;id=<xsl:value-of select="id"/></xsl:variable>
                                <tr>
                                        <td class="th_text">
                                                <xsl:value-of select="name"/>
                                        </td>
                                        <td class="th_text">
-                                               <a href="{$link}"  
onMouseover="window.status='{statustext}';return true;" 
onMouseout="window.status='';return true;"><xsl:value-of select="id"/></a>
+                                               <a href="{link}"  
title="{//lang_origin_statustext}" style ="cursor:help"><xsl:value-of 
select="id"/></a>
                                        </td>
                                </tr>
                        </xsl:for-each>
@@ -306,7 +305,6 @@
                                                </td>
                                        </tr>
                                        <xsl:for-each select="value_origin" >
-                                               <xsl:variable 
name="link_origin_type"><xsl:value-of select="link"/></xsl:variable>
                                                <tr>
                                                        <td class="th_text" 
valign ="top">
                                                                <xsl:value-of 
select="descr"/>
@@ -318,20 +316,7 @@
                                                        <tr>
                
                                                        <td class="th_text"  
align="left" >
-                                                               <a 
href="{$link_origin_type}&amp;id={id}"  
onMouseover="window.status='{//lang_origin_statustext}';return true;" 
onMouseout="window.status='';return true;"><xsl:value-of select="id"/></a>
-                                                               <xsl:text> 
</xsl:text>
-               
-                                                               <xsl:choose>
-                                                                       
<xsl:when test="type ='request'">
-                                                                       <input 
type="checkbox" name="values[delete_request][]" value="{id}"  
onMouseout="window.status='';return true;">
-                                                                               
<xsl:attribute name="onMouseover">
-                                                                               
        <xsl:text>window.status='</xsl:text>
-                                                                               
                <xsl:value-of select="//lang_delete_request_statustext"/>
-                                                                               
        <xsl:text>'; return true;</xsl:text>
-                                                                               
</xsl:attribute>
-                                                                       </input>
-                                                                       
</xsl:when>
-                                                               </xsl:choose>
+                                                               <a 
href="{link}"  title="{//lang_origin_statustext}" style 
="cursor:help"><xsl:value-of select="id"/></a>
                                                        </td>
                                                        </tr>
                                                        </xsl:for-each>
@@ -342,7 +327,6 @@
                                </xsl:when>
                                <xsl:otherwise>
                                        <xsl:for-each select="value_origin" >
-                                               <xsl:variable 
name="link_origin_type"><xsl:value-of select="link"/></xsl:variable>
                                                <tr>
                                                        <td class="th_text" 
valign ="top">
                                                                <xsl:value-of 
select="descr"/>
@@ -352,7 +336,7 @@
                                                                        
<xsl:for-each select="data">
                                                                                
<tr>
                                                                                
        <td class="th_text"  align="left" >
-                                                                               
                <a href="{$link_origin_type}&amp;id={id}"  
onMouseover="window.status='{//lang_origin_statustext}';return true;" 
onMouseout="window.status='';return true;"><xsl:value-of select="id"/></a>
+                                                                               
                <a href="{link}"  title="{//lang_origin_statustext}" style 
="cursor:help"><xsl:value-of select="id"/></a>
                                                                                
                <xsl:text> </xsl:text>
                                                                                
        </td>
                                                                                
</tr>
@@ -492,7 +476,6 @@
                                </td>
                        </tr>
                        <xsl:for-each select="value_origin" >
-                       <xsl:variable name="link_origin_type"><xsl:value-of 
select="link"/></xsl:variable>
                        <tr>
                                <td class="th_text" valign ="top">
                                        <xsl:value-of select="descr"/>
@@ -502,7 +485,7 @@
                                                <xsl:for-each select="data">
                                                        <tr>
                                                                <td 
class="th_text"  align="left" >
-                                                                       <a 
href="{$link_origin_type}&amp;id={id}"  
onMouseover="window.status='{//lang_origin_statustext}';return true;" 
onMouseout="window.status='';return true;"><xsl:value-of select="id"/></a>
+                                                                       <a 
href="{link}"  title="{//lang_origin_statustext}" style 
="cursor:help"><xsl:value-of select="id"/></a>
                                                                        
<xsl:text> </xsl:text>
                                                                </td>
                                                        </tr>
@@ -511,7 +494,7 @@
                                </td>
                        </tr>
                        </xsl:for-each>
-                       <xsl:call-template name="destination"/>
+                       <xsl:call-template name="target"/>
                        <tr>
                                <td class="th_text">
                                        <xsl:value-of select="lang_entity"/>
@@ -622,21 +605,20 @@
                        </tr>
        </xsl:template>
 
-       <xsl:template name="destination">
+       <xsl:template name="target">
                                <xsl:choose>
-                               <xsl:when test="value_destination!=''">
-                                       <xsl:for-each 
select="value_destination" >
-                                               <xsl:variable 
name="link_destination_type"><xsl:value-of select="link"/></xsl:variable>
+                               <xsl:when test="value_target!=''">
+                                       <xsl:for-each select="value_target" >
                                                <tr>
                                                        <td class="th_text" 
valign ="top">
-                                                               <xsl:value-of 
select="//lang_destination"/>
+                                                               <xsl:value-of 
select="//lang_target"/>
                                                        </td>
                                                        <td>
                                                                <table>         
                                        
                                                                        
<xsl:for-each select="data">
                                                                                
<tr>
                                                                                
        <td class="th_text"  align="left" >
-                                                                               
                <a href="{$link_destination_type}&amp;id={id}"  
onMouseover="window.status='{//lang_destination_statustext}';return true;" 
onMouseout="window.status='';return true;"><xsl:value-of 
select="type"/><xsl:text> #</xsl:text> <xsl:value-of select="id"/></a>
+                                                                               
                <a href="{link}"  title="{//lang_target_statustext}" style 
="cursor:help"><xsl:value-of select="type"/><xsl:text> #</xsl:text> 
<xsl:value-of select="id"/></a>
                                                                                
                <xsl:text> </xsl:text>
                                                                                
        </td>
                                                                                
</tr>

Modified: trunk/property/templates/base/project.xsl
===================================================================
--- trunk/property/templates/base/project.xsl   2008-08-02 18:25:56 UTC (rev 
18653)
+++ trunk/property/templates/base/project.xsl   2008-08-27 18:20:24 UTC (rev 
18654)
@@ -147,28 +147,17 @@
                                        </tr>
 
 
-                                       <xsl:choose>
-                                               <xsl:when 
test="selected_request =''">
-                                                       <tr>
-                                                               <td 
valign="top">
-                                                                       <a 
href="{link_select_request}" title="{lang_select_request_statustext}" 
onMouseover="window.status='{lang_select_request_statustext}';return true;" 
onMouseout="window.status='';return true;"><xsl:value-of 
select="lang_select_request"/></a>
-                                                               </td>
-                                                       </tr>
-                                               </xsl:when>
-                                       </xsl:choose>
+                                       <tr>
+                                               <td valign="top">
+                                                       <a 
href="{link_select_request}"  title="{lang_select_request_statustext}" style 
="cursor:help"><xsl:value-of select="lang_select_request"/></a>
+                                               </td>
+                                       </tr>
 
                                        <xsl:for-each select="value_origin" >
-                                               <xsl:variable 
name="link_origin_type"><xsl:value-of select="link"/></xsl:variable>
+                                               <xsl:variable 
name="origin_location"><xsl:value-of select="location"/></xsl:variable>
                                                <tr>
                                                        <td valign ="top">
-                                                               <xsl:choose>
-                                                                       
<xsl:when test="type ='request'">
-                                                                               
<a href="{//link_select_request}" 
onMouseover="window.status='{//lang_select_request_statustext}';return true;" 
onMouseout="window.status='';return true;"><xsl:value-of 
select="//lang_select_request"/></a>
-                                                                       
</xsl:when>
-                                                                       
<xsl:otherwise>
-                                                                               
        <xsl:value-of select="descr"/>
-                                                                       
</xsl:otherwise>
-                                                               </xsl:choose>
+                                                               <xsl:value-of 
select="descr"/>
                                                        </td>
                                                        <td>
                                                        <table>
@@ -177,18 +166,18 @@
                                                        <tr>
 
                                                        <td class="th_text"  
align="left" >
-                                                               <xsl:variable 
name="link_request"><xsl:value-of 
select="//link_request"/>&amp;id=<xsl:value-of select="id"/></xsl:variable>
-                                                               <a 
href="{$link_origin_type}&amp;id={id}"  
onMouseover="window.status='{//lang_origin_statustext}';return true;" 
onMouseout="window.status='';return true;"><xsl:value-of select="id"/></a>
+                                                               <a 
href="{link}"  title="{//lang_origin_statustext}" style 
="cursor:help"><xsl:value-of select="id"/></a>
                                                                <xsl:text> 
</xsl:text>
 
                                                                <xsl:choose>
-                                                                       
<xsl:when test="type ='request'">
+                                                                       
<xsl:when test="$origin_location ='.project.request'">
                                                                        <input 
type="checkbox" name="values[delete_request][]" value="{id}"  
onMouseout="window.status='';return true;">
-                                                                               
<xsl:attribute name="onMouseover">
-                                                                               
        <xsl:text>window.status='</xsl:text>
-                                                                               
                <xsl:value-of select="//lang_delete_request_statustext"/>
-                                                                               
        <xsl:text>'; return true;</xsl:text>
+                                                                               
<xsl:attribute name="title">
+                                                                               
        <xsl:value-of select="//lang_delete_request_statustext"/>
                                                                                
</xsl:attribute>
+                                                                               
<xsl:attribute name="style">
+                                                                               
        <xsl:text>cursor:help</xsl:text>
+                                                                               
</xsl:attribute>
                                                                        </input>
                                                                        
</xsl:when>
                                                                </xsl:choose>
@@ -202,7 +191,6 @@
                                </xsl:when>
                                <xsl:otherwise>
                                        <xsl:for-each select="value_origin" >
-                                               <xsl:variable 
name="link_origin_type"><xsl:value-of select="link"/></xsl:variable>
                                                <tr>
                                                        <td valign ="top">
                                                                <xsl:value-of 
select="descr"/>
@@ -212,8 +200,7 @@
                                                                        
<xsl:for-each select="data">
                                                                                
<tr>
                                                                                
        <td class="th_text"  align="left" >
-                                                                               
                <xsl:variable name="link_request"><xsl:value-of 
select="//link_request"/>&amp;id=<xsl:value-of select="id"/></xsl:variable>
-                                                                               
                <a href="{$link_origin_type}&amp;id={id}"  
onMouseover="window.status='{//lang_origin_statustext}';return true;" 
onMouseout="window.status='';return true;"><xsl:value-of select="id"/></a>
+                                                                               
                <a href="{link}"  title="{//lang_origin_statustext}" style 
="cursor:help"><xsl:value-of select="id"/></a>
                                                                                
                <xsl:text> </xsl:text>
                                                                                
        </td>
                                                                                
</tr>
@@ -813,14 +800,13 @@
                        </tr>
 
                        <xsl:for-each select="value_origin" >
-                               <xsl:variable 
name="link_origin_type"><xsl:value-of select="link"/></xsl:variable>
                                <tr>
                                        <td valign ="top">
                                                <xsl:value-of select="descr"/>
                                        </td>
                                                <td class="th_text"  
align="left" >
                                                <xsl:for-each select="data">
-                                                       <a 
href="{$link_origin_type}&amp;id={id}"  
onMouseover="window.status='{//lang_origin_statustext}';return true;" 
onMouseout="window.status='';return true;"><xsl:value-of select="id"/></a>
+                                                       <a href="{link}"  
title="{//lang_origin_statustext}" style ="cursor:help"><xsl:value-of 
select="id"/></a>
                                                        <xsl:text> </xsl:text>
                                                </xsl:for-each>
                                        </td>

Modified: trunk/property/templates/base/request.xsl
===================================================================
--- trunk/property/templates/base/request.xsl   2008-08-02 18:25:56 UTC (rev 
18653)
+++ trunk/property/templates/base/request.xsl   2008-08-27 18:20:24 UTC (rev 
18654)
@@ -250,7 +250,7 @@
                                                        <xsl:variable 
name="generate_project_action"><xsl:value-of 
select="generate_project_action"/></xsl:variable>
                                                        <xsl:variable 
name="lang_generate_project"><xsl:value-of 
select="lang_generate_project"/></xsl:variable>
                                                        <form method="post" 
action="{$generate_project_action}">
-                                                       <input type="hidden" 
name="origin" value="request"></input>
+                                                       <input type="hidden" 
name="origin" value="{value_acl_location}"></input>
                                                        <input type="hidden" 
name="origin_id" value="{value_request_id}"></input>
                                                        <input type="hidden" 
name="location_code" value="{location_code}"></input>
                                                        <input type="hidden" 
name="bypass" value="true"></input>
@@ -299,7 +299,6 @@
                                                </td>
                                        </tr>
                                        <xsl:for-each select="value_origin" >
-                                               <xsl:variable 
name="link_origin_type"><xsl:value-of select="link"/></xsl:variable>
                                                <tr>
                                                        <td class="th_text" 
valign ="top">
                                                                <xsl:value-of 
select="descr"/>
@@ -311,11 +310,11 @@
                                                        <tr>
                
                                                        <td class="th_text"  
align="left" >
-                                                               <a 
href="{$link_origin_type}&amp;id={id}"  
onMouseover="window.status='{//lang_origin_statustext}';return true;" 
onMouseout="window.status='';return true;"><xsl:value-of select="id"/></a>
+                                                               <a 
href="{link}"  title="{//lang_origin_statustext}" style 
="cursor:help"><xsl:value-of select="id"/></a>
                                                                <xsl:text> 
</xsl:text>
                
                                                                <xsl:choose>
-                                                                       
<xsl:when test="type ='request'">
+                                                                       
<xsl:when test="location ='.project.request'">
                                                                        <input 
type="checkbox" name="values[delete_request][]" value="{id}"  
onMouseout="window.status='';return true;">
                                                                                
<xsl:attribute name="onMouseover">
                                                                                
        <xsl:text>window.status='</xsl:text>
@@ -335,7 +334,6 @@
                                </xsl:when>
                                <xsl:otherwise>
                                        <xsl:for-each select="value_origin" >
-                                               <xsl:variable 
name="link_origin_type"><xsl:value-of select="link"/></xsl:variable>
                                                <tr>
                                                        <td class="th_text" 
valign ="top">
                                                                <xsl:value-of 
select="descr"/>
@@ -345,7 +343,7 @@
                                                                        
<xsl:for-each select="data">
                                                                                
<tr>
                                                                                
        <td class="th_text"  align="left" >
-                                                                               
                <a href="{$link_origin_type}&amp;id={id}"  
onMouseover="window.status='{//lang_origin_statustext}';return true;" 
onMouseout="window.status='';return true;"><xsl:value-of select="id"/></a>
+                                                                               
                <a href="{link}"  title="{//lang_origin_statustext}" style 
="cursor:help"><xsl:value-of select="id"/></a>
                                                                                
                <xsl:text> </xsl:text>
                                                                                
        </td>
                                                                                
</tr>
@@ -356,6 +354,20 @@
                                        </xsl:for-each>
                                </xsl:otherwise>
                        </xsl:choose>
+                       <xsl:for-each select="value_target" >
+                               <tr>
+                                       <td class="th_text" valign ="top">
+                                               <xsl:value-of select="descr"/>
+                                       </td>
+                                               <td class="th_text"  
align="left" >
+                                               <xsl:for-each select="data">
+                                                       <a href="{link}"  
title="{//lang_target_statustext}" style ="cursor:help"><xsl:value-of 
select="id"/></a>
+                                                       <xsl:text> </xsl:text>
+                                               </xsl:for-each>
+                                       </td>
+                               </tr>
+                       </xsl:for-each>
+
                        <tr>
                                <td valign="top">
                                        <xsl:value-of select="lang_title"/>
@@ -1063,7 +1075,6 @@
                
                <table cellpadding="2" cellspacing="2" width="80%" 
align="center">
                        <xsl:for-each select="value_origin" >
-                       <xsl:variable name="link_origin_type"><xsl:value-of 
select="link"/></xsl:variable>
                        <tr>
                                <td class="th_text" valign ="top">
                                        <xsl:value-of select="descr"/>
@@ -1073,7 +1084,7 @@
                                                <xsl:for-each select="data">
                                                        <tr>
                                                                <td 
class="th_text"  align="left" >
-                                                                       <a 
href="{$link_origin_type}&amp;id={id}"  
onMouseover="window.status='{//lang_origin_statustext}';return true;" 
onMouseout="window.status='';return true;"><xsl:value-of select="id"/></a>
+                                                                       <a 
href="{link}"  title="{//lang_origin_statustext}" style 
="cursor:help"><xsl:value-of select="id"/></a>
                                                                        
<xsl:text> </xsl:text>
                                                                </td>
                                                        </tr>
@@ -1082,6 +1093,20 @@
                                </td>
                        </tr>
                        </xsl:for-each>
+                       <xsl:for-each select="value_target" >
+                               <tr>
+                                       <td class="th_text" valign ="top">
+                                               <xsl:value-of select="descr"/>
+                                       </td>
+                                               <td class="th_text"  
align="left" >
+                                               <xsl:for-each select="data">
+                                                       <a href="{link}"  
title="{//lang_target_statustext}" style ="cursor:help"><xsl:value-of 
select="id"/></a>
+                                                       <xsl:text> </xsl:text>
+                                               </xsl:for-each>
+                                       </td>
+                               </tr>
+                       </xsl:for-each>
+
                        <tr>
                                <td>
                                        <xsl:value-of select="lang_request_id"/>
@@ -1110,6 +1135,7 @@
                                <xsl:when test="value_origin_id!=''">
                                        <tr>
                                                <td>
+                                                       <!-- FIXME-->
                                                        <a href="{link_origin}" 
onMouseover="window.status='{lang_origin_statustext}';return true;" 
onMouseout="window.status='';return true;"><xsl:value-of 
select="lang_origin"/></a>
                                                </td>
                                        </tr>

Modified: trunk/property/templates/base/tenant_claim.xsl
===================================================================
--- trunk/property/templates/base/tenant_claim.xsl      2008-08-02 18:25:56 UTC 
(rev 18653)
+++ trunk/property/templates/base/tenant_claim.xsl      2008-08-27 18:20:24 UTC 
(rev 18654)
@@ -206,14 +206,13 @@
                        </tr>
 
                        <xsl:for-each select="value_origin" >
-                               <xsl:variable 
name="link_origin_type"><xsl:value-of select="link"/></xsl:variable>
                                <tr>
                                        <td valign ="top">
                                                <xsl:value-of select="descr"/>
                                        </td>
                                                <td class="th_text"  
align="left" >
                                                <xsl:for-each select="data">
-                                                       <a 
href="{$link_origin_type}&amp;id={id}"  
onMouseover="window.status='{//lang_origin_statustext}';return true;" 
onMouseout="window.status='';return true;"><xsl:value-of select="id"/></a>
+                                                       <a href="{link}"  
title="{//lang_origin_statustext}" style ="cursor:help"><xsl:value-of 
select="id"/></a>
                                                        <xsl:text> </xsl:text>
                                                </xsl:for-each>
                                        </td>

Modified: trunk/property/templates/base/tts.xsl
===================================================================
--- trunk/property/templates/base/tts.xsl       2008-08-02 18:25:56 UTC (rev 
18653)
+++ trunk/property/templates/base/tts.xsl       2008-08-27 18:20:24 UTC (rev 
18654)
@@ -183,15 +183,16 @@
                                <td class="small_text" align="center">
                                        <a href="{$link_view}" 
onMouseover="window.status='{$lang_view_statustext}';return true;" 
onMouseout="window.status='';return true;"><xsl:value-of select="date"/></a>
                                </td>
+       
                                <xsl:for-each select="child_date" >
                                        <td class="small_text">
                                                <xsl:for-each 
select="date_info" >
-                                                       <xsl:variable 
name="link"><xsl:value-of select="link"/></xsl:variable>
-                                                       <a href="{$link}" 
onMouseover="window.status='';return true;" onMouseout="window.status='';return 
true;"><xsl:value-of select="entry_date"/></a>
+                                                       <a 
href="{link}"><xsl:value-of select="entry_date"/></a>
                                                        <br/>
                                                </xsl:for-each>
                                        </td>
                                </xsl:for-each>
+
                                <td class="small_text" align="center">
                                        <xsl:value-of select="finnish_date"/>
                                </td>
@@ -402,7 +403,6 @@
                        <xsl:variable name="form_action"><xsl:value-of 
select="form_action"/></xsl:variable>
                        <form ENCTYPE="multipart/form-data" name="form" 
method="post" action="{$form_action}">
                                <xsl:for-each select="value_origin" >
-                                       <xsl:variable 
name="link_origin_type"><xsl:value-of select="link"/></xsl:variable>
                                        <tr>
                                                <td valign ="top">
                                                        <xsl:value-of 
select="descr"/>
@@ -413,7 +413,7 @@
                                                                        <tr>
                                                                                
<td class="th_text"  align="left" >
                                                                                
        <xsl:variable name="link_request"><xsl:value-of 
select="//link_request"/>&amp;id=<xsl:value-of select="id"/></xsl:variable>
-                                                                               
        <a href="{$link_origin_type}&amp;id={id}"  
onMouseover="window.status='{//lang_origin_statustext}';return true;" 
onMouseout="window.status='';return true;"><xsl:value-of select="id"/></a>
+                                                                               
        <a href="{link}"  title="{//lang_origin_statustext}" style 
="cursor:help"><xsl:value-of select="id"/></a>
                                                                                
        <xsl:text> </xsl:text>
                                                                                
</td>
                                                                        </tr>
@@ -800,8 +800,7 @@
                                        </input>
                                </td>
                        </tr>
-                       <xsl:for-each select="value_origin" >
-                               <xsl:variable 
name="link_origin_type"><xsl:value-of select="link"/></xsl:variable>
+                       <xsl:for-each select="value_origin">
                                <tr>
                                        <td valign ="top">
                                                <xsl:value-of select="descr"/>
@@ -811,8 +810,7 @@
                                                        <xsl:for-each 
select="data">
                                                                <tr>
                                                                        <td 
class="th_text"  align="left" >
-                                                                               
<xsl:variable name="link_request"><xsl:value-of 
select="//link_request"/>&amp;id=<xsl:value-of select="id"/></xsl:variable>
-                                                                               
<a href="{$link_origin_type}&amp;id={id}"  
onMouseover="window.status='{//lang_origin_statustext}';return true;" 
onMouseout="window.status='';return true;"><xsl:value-of select="id"/></a>
+                                                                               
<a href="{link}"  title="{//lang_target_statustext}" style 
="cursor:help"><xsl:value-of select="id"/></a>
                                                                                
<xsl:text> </xsl:text>
                                                                        </td>
                                                                </tr>
@@ -876,73 +874,20 @@
                                </td>
                        </tr>
 
-                       <xsl:for-each select="value_destination" >
-                               <xsl:variable 
name="link_destination_type"><xsl:value-of select="link"/></xsl:variable>
+                       <xsl:for-each select="value_target" >
                                <tr>
                                        <td class="th_text" valign ="top">
                                                <xsl:value-of select="descr"/>
                                        </td>
                                                <td class="th_text"  
align="left" >
                                                <xsl:for-each select="data">
-                                                       <a 
href="{$link_destination_type}&amp;id={id}"  
onMouseover="window.status='{//lang_destination_statustext}';return true;" 
onMouseout="window.status='';return true;"><xsl:value-of select="id"/></a>
+                                                       <a href="{link}"  
title="{//lang_target_statustext}" style ="cursor:help"><xsl:value-of 
select="id"/></a>
                                                        <xsl:text> </xsl:text>
                                                </xsl:for-each>
                                        </td>
                                </tr>
                        </xsl:for-each>
-<!--
-                       <xsl:for-each select="entity_origin_list" >
-                       <tr>
-                               <td class="th_text">
-                                       <xsl:value-of select="name"/>
-                               </td>
-                               <td class="th_text">
-                                       <xsl:for-each select="link_info" >
-                                               <xsl:variable 
name="link_entity_origin"><xsl:value-of select="link"/>&amp;id=<xsl:value-of 
select="id"/></xsl:variable>
-                                               <xsl:variable 
name="lang_entity_statustext"><xsl:value-of select="entry_date"/></xsl:variable>
-                                               <a href="{$link_entity_origin}" 
onMouseover="window.status='{$lang_entity_statustext}';return true;" 
onMouseout="window.status='';return true;"><xsl:value-of select="id"/></a>
-                                               <xsl:text> </xsl:text>
-                                       </xsl:for-each>
-                               </td>
-                       </tr>                           
-                       </xsl:for-each>
-                       <xsl:choose>
-                               <xsl:when test="value_request_id!=''">
-                                       <tr>
-                                               <td  class="th_text" 
align="left" valign="top">
-                                                       <xsl:value-of 
select="//lang_request"/>
-                                               </td>
-                                               <td class="th_text"  
align="left">
-                                                       <xsl:for-each 
select="value_request_id" >
-                                                                       
<xsl:variable name="link_request"><xsl:value-of 
select="//link_request"/>&amp;id=<xsl:value-of select="id"/></xsl:variable>
-                                                                       
<xsl:variable name="lang_request_statustext"><xsl:value-of 
select="//lang_request_statustext"/>-<xsl:value-of 
select="entry_date"/></xsl:variable>
-                                                                       <a 
href="{$link_request}" 
onMouseover="window.status='{$request_statustext}';return true;" 
onMouseout="window.status='';return true;"><xsl:value-of select="id"/></a>
-                                                                       
<xsl:text> </xsl:text>
-                                                       </xsl:for-each>
-                                               </td>
-                                       </tr>
-                               </xsl:when>
-                       </xsl:choose>
-                       <xsl:choose>
-                               <xsl:when test="value_project_id!=''">
-                                       <tr>
-                                               <td class="th_text" 
align="left" valign="top">
-                                                       <xsl:value-of 
select="//lang_project"/>
-                                               </td>
-                                               <td class="th_text"  
align="left">
-                                                       <xsl:for-each 
select="value_project_id" >
-                                                                       
<xsl:variable name="link_project"><xsl:value-of 
select="//link_project"/>&amp;id=<xsl:value-of select="id"/></xsl:variable>
-                                                                       
<xsl:variable name="project_statustext"><xsl:value-of 
select="//lang_project_statustext"/>-<xsl:value-of 
select="entry_date"/></xsl:variable>
-                                                                       <a 
href="{$link_project}" 
onMouseover="window.status='{$project_statustext}';return true;" 
onMouseout="window.status='';return true;"><xsl:value-of select="id"/></a>
-                                                                       
<xsl:text> </xsl:text>
-                                                       </xsl:for-each>
-                                               </td>
-                                       </tr>
-                               </xsl:when>
-                       </xsl:choose>
-               -->
 
-
                        <tr>
                                <td class="th_text" valign="top">
                                        <xsl:value-of select="lang_details"/>
@@ -1293,14 +1238,13 @@
                        </tr>
 
                        <xsl:for-each select="value_origin" >
-                               <xsl:variable 
name="link_origin_type"><xsl:value-of select="link"/></xsl:variable>
                                <tr>
                                        <td class="th_text" valign ="top">
                                                <xsl:value-of select="descr"/>
                                        </td>
                                                <td class="th_text"  
align="left" >
                                                <xsl:for-each select="data">
-                                                       <a 
href="{$link_origin_type}&amp;id={id}"  
onMouseover="window.status='{//lang_origin_statustext}';return true;" 
onMouseout="window.status='';return true;"><xsl:value-of select="id"/></a>
+                                                       <a href="{link}"  
title="{//lang_origin_statustext}" style ="cursor:help"><xsl:value-of 
select="id"/></a>
                                                        <xsl:text> </xsl:text>
                                                </xsl:for-each>
                                        </td>

Modified: trunk/property/tutorials/property/examples/install.apache.sh
===================================================================
--- trunk/property/tutorials/property/examples/install.apache.sh        
2008-08-02 18:25:56 UTC (rev 18653)
+++ trunk/property/tutorials/property/examples/install.apache.sh        
2008-08-27 18:20:24 UTC (rev 18654)
@@ -41,16 +41,16 @@
 #  * 
 #  * @var               string APACHE, APACHETAR
 #  */
-APACHETAR="httpd-2.2.8.tar.gz"
-APACHE="httpd-2.2.8"
+APACHETAR="httpd-2.2.9.tar.gz"
+APACHE="httpd-2.2.9"
 
 #/**
 #  * Name of the PHP tarball e.g php-5.2.tar.gz
 #  * 
 #  * @var               string PHP, PHPTAR
 #  */
-PHPTAR="php-5.2.5.tar.bz2"
-PHP="php-5.2.5"
+PHPTAR="php-5.2.6.tar.bz2"
+PHP="php-5.2.6"
 
 #/**
 #  * Name of the EACCELERATOR tarball e.g eaccelerator-0.9.5.tar.bz2
@@ -139,7 +139,12 @@
  --enable-shmop\
  --enable-sysvsem\
  --enable-sysvshm\
- --enable-calendar &&\
+ --enable-calendar\
+ --enable-pdo=shared\
+ --with-pdo-sqlite=shared\
+ --with-sqlite=shared\
+ --with-openssl\
+ --enable-mbstring &&\
 make &&\
 make install &&\
 cd ../$EACCELERATOR &&\






reply via email to

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