fmsystem-commits
[Top][All Lists]
Advanced

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

[Fmsystem-commits] [16798]


From: nelson . guerra
Subject: [Fmsystem-commits] [16798]
Date: Tue, 30 May 2017 12:53:22 -0400 (EDT)

Revision: 16798
          http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=16798
Author:   nelson224
Date:     2017-05-30 12:53:21 -0400 (Tue, 30 May 2017)
Log Message:
-----------


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

Modified: branches/dev-syncromind-2/property/inc/class.soreport.inc.php
===================================================================
--- branches/dev-syncromind-2/property/inc/class.soreport.inc.php       
2017-05-30 16:53:07 UTC (rev 16797)
+++ branches/dev-syncromind-2/property/inc/class.soreport.inc.php       
2017-05-30 16:53:21 UTC (rev 16798)
@@ -287,6 +287,7 @@
                                        if ($param['conector'] && 
$param['value2'] != '')
                                        {
                                                $result .= " 
".$param['conector']." ".$param['field']." 
".$this->operators[$param['operator']]." '".$param['value2']."'";
+                                               $result = '('.$result.')';
                                        }
                                        break;
                                case 'integer':
@@ -298,6 +299,7 @@
                                                if ($param['conector'] && 
is_numeric(['value2']))
                                                {
                                                        $result .= " 
".$param['conector']." ".$param['field']." 
".$this->operators[$param['operator']]." ".$param['value2'];
+                                                       $result = 
'('.$result.')';
                                                }
                                        }
                                        break;
@@ -309,6 +311,7 @@
                                                if ($param['conector'] && 
$this->_is_date($param['value2']))
                                                {
                                                        $result .= " 
".$param['conector']." ".$param['field']." 
".$this->operators[$param['operator']]." '".$param['value1']."'";
+                                                       $result = 
'('.$result.')';
                                                }
                                        }
                        }                               
@@ -346,6 +349,7 @@
                                                        if ($param['conector'] 
&& $param['value2'] != '')
                                                        {
                                                                $result .= " 
".$param['conector']." ".$param['field']."::text 
".$this->operators[$param['operator']]." '%".$param['value2']."%'";
+                                                               $result = 
'('.$result.')';
                                                        }                       
                                
                                                }
                                                break;
@@ -358,6 +362,13 @@
                                                        $values = 
array_map('trim', explode(',', $param['value1']));
                                                        $_string = 
"'".implode("','", $values)."'";
                                                        $result =  
$param['field']."::text ".$this->operators[$param['operator']]." 
(".$_string.")";
+                                                       if ($param['conector'] 
&& $param['value2'] != '')
+                                                       {
+                                                               $values_2 = 
array_map('trim', explode(',', $param['value2']));
+                                                               $_string_2 = 
"'".implode("','", $values_2)."'";                                              
           
+                                                               $result .= " 
".$param['conector']." ".$param['field']."::text 
".$this->operators[$param['operator']]." (".$_string_2.")";
+                                                               $result = 
'('.$result.')';
+                                                       }
                                                }
                                                break;
                                }               
@@ -389,7 +400,13 @@
                        $string_columns = implode(',', $jsonB['columns']);
                        
                        $group = implode(',', $jsonB['group']);
-                       $order = 'ORDER BY '.$group.' ASC';
+                       $order = implode(',', $jsonB['order']);
+                       $ordering = 'ORDER BY '.$group.' ASC';
+                       if (($group != $order) && $order != '')
+                       {
+                               $ordering = $ordering.', '.$order.' ASC';
+                       }
+               
                        $cond = $this->_build_conditions($jsonB['criteria'], 
$id);
                        
                        if ($cond)
@@ -397,7 +414,7 @@
                                $where = 'WHERE '.implode(' AND ', $cond);
                        }
                        
-                       $sql = "SELECT ".$string_columns." FROM 
".$dataset['view_name']." ".$where." ".$order;
+                       $sql = "SELECT ".$string_columns." FROM 
".$dataset['view_name']." ".$where." ".$ordering;
 
                        if (count($data))
                        {




reply via email to

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