fmsystem-commits
[Top][All Lists]
Advanced

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

[Fmsystem-commits] [10521] property: show title on related items


From: Sigurd Nes
Subject: [Fmsystem-commits] [10521] property: show title on related items
Date: Tue, 20 Nov 2012 08:10:37 +0000

Revision: 10521
          http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=10521
Author:   sigurdne
Date:     2012-11-20 08:10:37 +0000 (Tue, 20 Nov 2012)
Log Message:
-----------
property: show title on related items

Modified Paths:
--------------
    trunk/property/inc/class.interlink.inc.php
    trunk/property/inc/class.uientity.inc.php

Modified: trunk/property/inc/class.interlink.inc.php
===================================================================
--- trunk/property/inc/class.interlink.inc.php  2012-11-19 22:55:28 UTC (rev 
10520)
+++ trunk/property/inc/class.interlink.inc.php  2012-11-20 08:10:37 UTC (rev 
10521)
@@ -115,7 +115,9 @@
                                foreach ($entry['data'] as &$data)
                                {
                                        $data['link'] = 
$this->get_relation_link($linkend_location, $data['id']);
-                                       $data['statustext'] = 
$this->get_relation_info($linkend_location, $data['id']);
+                                       $relation_info = 
$this->get_relation_info($linkend_location, $data['id']);
+                                       $data['statustext'] = 
$relation_info['statustext'];
+                                       $data['title'] = 
$relation_info['title'];
                                }
                        }
                        return $relation;
@@ -282,44 +284,55 @@
 
                public function get_relation_info($linkend_location, $id)
                {
+                       $relation_info = array();
                        $id = (int)$id;
                        $type = $linkend_location['location'];
                        if($type == '.ticket')
                        {
-                               $this->_db->query("SELECT status FROM 
fm_tts_tickets WHERE id = {$id}",__LINE__,__FILE__);
+                               $this->_db->query("SELECT status, subject as 
title FROM fm_tts_tickets WHERE id = {$id}",__LINE__,__FILE__);
                                $this->_db->next_record();
                                $status_code = $this->_db->f('status');
+                               $relation_info['title'] = 
$this->_db->f('title');
 
                                static $status_text;
                                if(!$status_text)
                                {
                                        $status_text = 
execMethod('property.botts.get_status_text');
                                }
-                               return $status_text[$status_code];
+                               $relation_info['statustext'] = 
$status_text[$status_code];
+                               return $relation_info;
                        }
                        else if($type == '.project.workorder')
                        {
-                               $this->_db->query("SELECT 
fm_workorder_status.descr as status FROM fm_workorder {$this->_join} 
fm_workorder_status ON fm_workorder.status = fm_workorder_status.id WHERE 
fm_workorder.id = {$id}",__LINE__,__FILE__);
+                               $this->_db->query("SELECT 
fm_workorder_status.descr as status, fm_workorder.title FROM fm_workorder 
{$this->_join} fm_workorder_status ON fm_workorder.status = 
fm_workorder_status.id WHERE fm_workorder.id = {$id}",__LINE__,__FILE__);
                                $this->_db->next_record();
-                               return $this->_db->f('status');
+                               $relation_info['statustext'] = 
$this->_db->f('status');
+                               $relation_info['title'] = 
$this->_db->f('title');
+                               return $relation_info;
                        }
                        else if($type == '.project.request')
                        {
-                               $this->_db->query("SELECT 
fm_request_status.descr as status FROM fm_request {$this->_join} 
fm_request_status ON fm_request.status = fm_request_status.id WHERE 
fm_request.id = {$id}",__LINE__,__FILE__);                               
+                               $this->_db->query("SELECT fm_request.title, 
fm_request_status.descr as status FROM fm_request {$this->_join} 
fm_request_status ON fm_request.status = fm_request_status.id WHERE 
fm_request.id = {$id}",__LINE__,__FILE__);                             
                                $this->_db->next_record();
-                               return $this->_db->f('status');
+                               $relation_info['statustext'] = 
$this->_db->f('status');
+                               $relation_info['title'] = 
$this->_db->f('title');
+                               return $relation_info;
+
                        }
                        else if($type == '.project')
                        {               
-                               $this->_db->query("SELECT 
fm_project_status.descr as status FROM fm_project {$this->_join} 
fm_project_status ON fm_project.status = fm_project_status.id WHERE 
fm_project.id = {$id}",__LINE__,__FILE__);
+                               $this->_db->query("SELECT fm_project.name as 
title, fm_project_status.descr as status FROM fm_project {$this->_join} 
fm_project_status ON fm_project.status = fm_project_status.id WHERE 
fm_project.id = {$id}",__LINE__,__FILE__);
                                $this->_db->next_record();
-                               return $this->_db->f('status');
+                               $relation_info['statustext'] = 
$this->_db->f('status');
+                               $relation_info['title'] = 
$this->_db->f('title');
+                               return $relation_info;
                        }
                        else if( substr($type, 1, 6) == 'entity' )
                        {
                                $type           = explode('.',$type);
                                $entity_id      = $type[2];
                                $cat_id         = $type[3];
+                               $location_id    = 
$GLOBALS['phpgw']->locations->get_id('property', 
".entity.{$entity_id}.{$cat_id}");
                                $metadata = 
$this->_db->metadata("fm_entity_{$entity_id}_{$cat_id}");
                                if(isset($metadata['status']))
                                {
@@ -327,7 +340,6 @@
                                        
$this->_db->query($sql,__LINE__,__FILE__);
                                        $this->_db->next_record();
                                        $status_id = 
(int)$this->_db->f('status');
-                                       $location_id    = 
$GLOBALS['phpgw']->locations->get_id('property', 
".entity.{$entity_id}.{$cat_id}");
 
                                        $sql = "SELECT phpgw_cust_choice.value 
as status FROM phpgw_cust_attribute"
                                                . " {$this->_join} 
phpgw_cust_choice ON phpgw_cust_attribute.location_id = 
phpgw_cust_choice.location_id "
@@ -335,8 +347,17 @@
                                                . " AND phpgw_cust_choice.id = 
{$status_id} AND phpgw_cust_attribute.location_id = {$location_id}";
                                        
$this->_db->query($sql,__LINE__,__FILE__);
                                        $this->_db->next_record();
-                                       return $this->_db->f('status');
+                                       $relation_info['statustext'] = 
$this->_db->f('status');
                                }
+       
+                               $relation_info['title'] = 'N∕A';
+
+                               if($short_desc = 
execMethod('property.soentity.get_short_description',  array('location_id' => 
$location_id, 'id' => $id)))
+                               {
+                                       $relation_info['title'] = $short_desc;
+                               }
+
+                               return $relation_info;
                        }
                        else if( substr($type, 1, 5) == 'catch' )
                        {

Modified: trunk/property/inc/class.uientity.inc.php
===================================================================
--- trunk/property/inc/class.uientity.inc.php   2012-11-19 22:55:28 UTC (rev 
10520)
+++ trunk/property/inc/class.uientity.inc.php   2012-11-20 08:10:37 UTC (rev 
10521)
@@ -1981,6 +1981,7 @@
                                                        (
                                                                'url'           
=> "<a href=\"{$_target_entry['link']}\" > {$_target_entry['id']}</a>",
                                                                'type'          
=> $_target_section['descr'],
+                                                               'title'         
=> $_target_entry['title'],
                                                                'status'        
=> $_target_entry['statustext'],
                                                                'user'          
=> $GLOBALS['phpgw']->accounts->get($_target_entry['account_id'])->__toString(),
                                                                'entry_date'=> 
$GLOBALS['phpgw']->common->show_date($_target_entry['entry_date'],$GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat']),
@@ -2022,6 +2023,7 @@
                                        'values'        =>      
json_encode(array(      
                                                array('key' => 
'url','label'=>lang('id'),'sortable'=>false,'resizeable'=>true),
                                                array('key' => 
'type','label'=>lang('type'),'sortable'=>true,'resizeable'=>true),
+                                               array('key' => 
'title','label'=>lang('title'),'sortable'=>false,'resizeable'=>true),
                                                array('key' => 
'status','label'=>lang('status'),'sortable'=>false,'resizeable'=>true),
                                                array('key' => 
'user','label'=>lang('user'),'sortable'=>true,'resizeable'=>true),
                                                array('key' => 
'entry_date','label'=>lang('entry date'),'sortable'=>false,'resizeable'=>true),




reply via email to

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