fmsystem-commits
[Top][All Lists]
Advanced

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

[Fmsystem-commits] [16854] property: more on generic documents


From: sigurdne
Subject: [Fmsystem-commits] [16854] property: more on generic documents
Date: Thu, 8 Jun 2017 13:36:30 -0400 (EDT)

Revision: 16854
          http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=16854
Author:   sigurdne
Date:     2017-06-08 13:36:29 -0400 (Thu, 08 Jun 2017)
Log Message:
-----------
property: more on generic documents

Modified Paths:
--------------
    trunk/property/inc/class.sogeneric_document.inc.php
    trunk/property/inc/class.uilocation.inc.php

Modified: trunk/property/inc/class.sogeneric_document.inc.php
===================================================================
--- trunk/property/inc/class.sogeneric_document.inc.php 2017-06-08 13:45:07 UTC 
(rev 16853)
+++ trunk/property/inc/class.sogeneric_document.inc.php 2017-06-08 17:36:29 UTC 
(rev 16854)
@@ -91,10 +91,12 @@
 
                        if ($location_id)
                        {
-                               $joinmethod .= " {$this->join} 
phpgw_vfs_file_relation c ON ( a.file_id = c.file_id )";
                                $filtermethod .= " AND c.location_id = 
{$location_id}";
                        } 
-                       
+                       $joinmethod .= " {$this->left_join} 
phpgw_vfs_file_relation c ON ( a.file_id = c.file_id )";
+                       $joinmethod .= " {$this->left_join} fm_entity_category 
ON ( c.location_id = fm_entity_category.location_id )";
+
+
                        if($location_item_id)
                        {
                                $filtermethod .= " AND c.location_item_id = 
{$location_item_id}";
@@ -128,7 +130,8 @@
                        {
                                $query = $this->db->db_addslashes($query);
                                $querymethod = " AND (a.name $this->like 
'%{$query}%'";
-                               $querymethod .= " OR metadata->>'path' ilike 
'%{$query}%')";
+                               $querymethod .= " OR metadata->>'path' ilike 
'%{$query}%'";
+                               $querymethod .= " OR fm_entity_category.name 
ilike '%{$query}%')";
                        }
                        
                        $sql = "SELECT DISTINCT a.file_id, a.*, 
metadata->>'path' as path FROM phpgw_vfs a " ." {$joinmethod} "." 
{$filtermethod} "." {$querymethod} ";
@@ -148,12 +151,14 @@
                                        $this->db->query($sql . $ordermethod, 
__LINE__, __FILE__);
                                }
                                $dateformat = 
$GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat'];
-
+                               $ids = array();
                                while ($this->db->next_record())
                                {
+                                       $id = $this->db->f('file_id');
+                                       $ids[] = $id;
                                        $values[] = array
                                                (
-                                               'id' => $this->db->f('file_id'),
+                                               'id' => $id,
                                                'owner_id' => 
$this->db->f('owner_id'),
                                                'createdby_id' => 
$this->db->f('createdby_id'),
                                                'modifiedby_id' => 
$this->db->f('modifiedby_id'),
@@ -170,6 +175,24 @@
                                                'path'  =>  
$this->db->f('path'),
                                        );
                                }
+
+                               $locations= array();
+                               if($ids)
+                               {
+                                       $sql = "SELECT file_id, 
fm_entity_category.name as location_name"
+                                               . " FROM fm_entity_category 
{$this->join} phpgw_vfs_file_relation ON fm_entity_category.location_id = 
phpgw_vfs_file_relation.location_id"
+                                               . " WHERE file_id IN (" . 
implode(',', $ids) . ')';
+                                       $this->db->query($sql, __LINE__, 
__FILE__);
+                                       while ($this->db->next_record())
+                                       {
+                                               
$locations[$this->db->f('file_id')][] = $this->db->f('location_name');
+                                       }
+
+                                       foreach ($values as & $entry)
+                                       {
+                                               $entry['location_names'] = 
array_unique((array)$locations[$entry['id']]);
+                                       }
+                               }
                        }
 
                        return $values;

Modified: trunk/property/inc/class.uilocation.inc.php
===================================================================
--- trunk/property/inc/class.uilocation.inc.php 2017-06-08 13:45:07 UTC (rev 
16853)
+++ trunk/property/inc/class.uilocation.inc.php 2017-06-08 17:36:29 UTC (rev 
16854)
@@ -1725,7 +1725,7 @@
                                if($item['path'])
                                {
                                        $temp = json_decode($item['path']);
-                                       $title = implode('<br/>', $temp);
+                                       $title = implode('<br/>', 
array_merge($item['location_names'],$temp));
                                }
 
                                $document_name = '<a 
href="'.self::link(array('menuaction'=>'property.uigeneric_document.view_file', 
'file_id'=>$item['id'])).'" target="_blank">'.$item['name'].'</a>';
@@ -2163,7 +2163,7 @@
                                        $documents_def = array(
                                                array('key' => 'id', 'label' => 
lang('id'), 'sortable' => false, 'resizeable' => true),
                                                array('key' => 'document_name', 
'label' => lang('name'), 'sortable' => true, 'resizeable' => true),
-                                               array('key' => 'title', 'label' 
=> lang('title'), 'sortable' => true, 'resizeable' => true),
+                                               array('key' => 'title', 'label' 
=> 'Info', 'sortable' => true, 'resizeable' => true),
                                                array('key' => 'document_date', 
'label' => lang('date'), 'sortable' => true, 'resizeable' => true),
                                        );
 




reply via email to

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