fmsystem-commits
[Top][All Lists]
Advanced

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

[Fmsystem-commits] [15000]


From: nelson . guerra
Subject: [Fmsystem-commits] [15000]
Date: Thu, 12 May 2016 00:32:15 +0000 (UTC)

Revision: 15000
          http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=15000
Author:   nelson224
Date:     2016-05-12 00:32:14 +0000 (Thu, 12 May 2016)
Log Message:
-----------


Modified Paths:
--------------
    branches/dev-syncromind-2/property/inc/class.sogeneric_document.inc.php

Modified: 
branches/dev-syncromind-2/property/inc/class.sogeneric_document.inc.php
===================================================================
--- branches/dev-syncromind-2/property/inc/class.sogeneric_document.inc.php     
2016-05-12 00:31:46 UTC (rev 14999)
+++ branches/dev-syncromind-2/property/inc/class.sogeneric_document.inc.php     
2016-05-12 00:32:14 UTC (rev 15000)
@@ -50,6 +50,7 @@
                        $allrows = isset($data['allrows']) ? $data['allrows'] : 
'';
                        $dry_run = isset($data['dry_run']) ? $data['dry_run'] : 
'';
                        $user_id = isset($data['user_id']) && $data['user_id'] 
? (int)$data['user_id'] : 0;
+                       $cat_id = isset($data['cat_id']) && $data['cat_id'] ? 
(int)$data['cat_id'] : 0;
                        $mime_type = isset($data['mime_type']) ? 
$data['mime_type'] : '';
                        $start_date = isset($data['start_date']) ? 
$data['start_date'] : 0;
                        $end_date = isset($data['end_date']) ? 
$data['end_date'] : 0;
@@ -70,23 +71,29 @@
                                                $_order = $order;
                                }
 
-                               $ordermethod = " ORDER BY $_order $sort";
+                               $ordermethod = " ORDER BY a.{$_order} {$sort}";
                        }
                        else
                        {
-                               $ordermethod = ' ORDER BY file_id ASC';
+                               $ordermethod = ' ORDER BY a.file_id ASC';
                        }
+                       
+                       $filtermethod = "WHERE a.mime_type != 'Directory' AND 
a.mime_type != 'journal' AND a.mime_type != 'journal-deleted'";
 
-                       $filtermethod = "WHERE mime_type != 'Directory' AND 
mime_type != 'journal' AND mime_type != 'journal-deleted'";
+                       if ($cat_id)
+                       {
+                               $joinmethod = "{$this->join} phpgw_vfs_filedata 
b ON ( a.file_id = b.file_id )";
+                               $filtermethod .= " AND b.metadata @> 
'{\"cat_id\":\"{$cat_id}\"}'";
+                       } 
 
                        if ($user_id)
                        {
-                               $filtermethod .= " AND createdby_id = 
{$user_id}";
+                               $filtermethod .= " AND a.createdby_id = 
{$user_id}";
                        }
 
                        if ($mime_type)
                        {
-                               $filtermethod .= " AND mime_type = 
'{$mime_type}'";
+                               $filtermethod .= " AND a.mime_type = 
'{$mime_type}'";
                        }
 
                        if ($start_date)
@@ -94,15 +101,15 @@
                                $date_format = $this->db->date_format();
                                $start_date = date($date_format, $start_date);
                                $end_date = date($date_format, $end_date);
-                               $filtermethod .= " AND phpgw_vfs.created >= 
'$start_date' AND phpgw_vfs.created <= '$end_date'";
+                               $filtermethod .= " AND a.created >= 
'$start_date' AND a.created <= '$end_date'";
                        }
 
                        if ($location)
                        {
-                               $filtermethod .= " AND phpgw_vfs.directory 
{$this->like} '%{$location}%'";
+                               $filtermethod .= " AND a.directory 
{$this->like} '%{$location}%'";
                        }
 
-                       $sql = "SELECT * FROM  phpgw_vfs" ." {$filtermethod} ";
+                       $sql = "SELECT a.* FROM phpgw_vfs a " ." {$joinmethod} 
"." {$filtermethod} ";
                        $this->db->query($sql, __LINE__, __FILE__);
                        $this->total_records = $this->db->num_rows();
 




reply via email to

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