fmsystem-commits
[Top][All Lists]
Advanced

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

[Fmsystem-commits] [16816]


From: nelson . guerra
Subject: [Fmsystem-commits] [16816]
Date: Thu, 1 Jun 2017 00:44:27 -0400 (EDT)

Revision: 16816
          http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=16816
Author:   nelson224
Date:     2017-06-01 00:44:27 -0400 (Thu, 01 Jun 2017)
Log Message:
-----------


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

Modified: branches/dev-syncromind-2/property/inc/class.uireport.inc.php
===================================================================
--- branches/dev-syncromind-2/property/inc/class.uireport.inc.php       
2017-06-01 04:44:14 UTC (rev 16815)
+++ branches/dev-syncromind-2/property/inc/class.uireport.inc.php       
2017-06-01 04:44:27 UTC (rev 16816)
@@ -63,7 +63,6 @@
                        $this->operators = $this->bo->operators;
                        
                        $this->operators_equal = $this->bo->operators_equal;
-                       $this->operators_between = $this->bo->operators_between;
                        $this->operators_like = $this->bo->operators_like;
                        $this->operators_in = $this->bo->operators_in;
                        $this->operators_null = $this->bo->operators_null;      
                        
@@ -365,7 +364,6 @@
                                'operators' => json_encode($this->operators),
                                
                                'operators_equal' => 
json_encode($this->operators_equal),
-                               'operators_between' => 
json_encode($this->operators_between),
                                'operators_like' => 
json_encode($this->operators_like),
                                'operators_in' => 
json_encode($this->operators_in),
                                'operators_null' => 
json_encode($this->operators_null),         
@@ -387,6 +385,54 @@
                        self::render_template_xsl(array('report'), array('edit' 
=> $data));
                }
                
+               private function _validate_criteria ()
+               {
+                       $values = phpgw::get_var('values');
+
+                       if ($values)
+                       {
+                               $restricted_values = 
$values['cbo_restricted_value'];
+                               $operators = $values['cbo_operator'];
+                               $values_1 = $values['txt_value1'];
+                               $conector = $values['cbo_conector'];
+                       }
+                       else {
+                               $restricted_values = 
phpgw::get_var('cbo_restricted_value');
+                               $operators = phpgw::get_var('cbo_operator');
+                               $values_1 = phpgw::get_var('txt_value1');
+                               $conector = phpgw::get_var('cbo_conector');
+                       }
+                       
+                       $criteria = array();
+                       foreach ($restricted_values as $k => $field) 
+                       {
+                               if ($field && $operators[$k])
+                               {
+                                       $criteria[] = array('field'=>$field, 
'operator'=>$operators[$k], 'value1'=>trim($values_1[$k]), 
'conector'=>$conector[$k]);
+                               }
+                       }                       
+                       
+                       $n = 0;
+                       $result = array();
+                       $last = count($criteria) - 1;
+                       foreach ($criteria as $item)
+                       {
+                               if ($n == $last)
+                               {
+                                       $item['conector'] = '';
+                                       $result[] = $item;
+                               }
+                               else if ($item['conector'] != '')
+                               {
+                                       $result[] = $item;
+                               }
+                               
+                               $n++;
+                       }
+                       
+                       return $result;
+               }
+               
                private function _populate( $data = array() )
                {
                        $report_id = phpgw::get_var('report_id');
@@ -399,21 +445,8 @@
                        $aggregate = phpgw::get_var('aggregate');
                        $cbo_aggregate = phpgw::get_var('cbo_aggregate');
                        
-                       $restricted_values = 
phpgw::get_var('cbo_restricted_value');
-                       $operators = phpgw::get_var('cbo_operator');
-                       $values_1 = phpgw::get_var('txt_value1');
-                       $conector = phpgw::get_var('cbo_conector');
-                       $values_2 = phpgw::get_var('txt_value2');
+                       $criteria = $this->_validate_criteria();
                        
-                       $criteria = array();
-                       foreach ($restricted_values as $k => $field) 
-                       {
-                               if ($field && $operators[$k])
-                               {
-                                       $criteria[] = array('field'=>$field, 
'operator'=>$operators[$k], 'value1'=>trim($values_1[$k]), 
'conector'=>$conector[$k], 'value2'=>trim($values_2[$k]));
-                               }
-                       }
-                       
                        $group = array($group_by => $group_by);
                        $order = array($order_by => $order_by);
                        
@@ -776,20 +809,8 @@
                        $data['aggregate'] = $values['aggregate'];
                        $data['cbo_aggregate'] = $values['cbo_aggregate'];      
        
 
-                       $restricted_values = $values['cbo_restricted_value'];
-                       $operators = $values['cbo_operator'];
-                       $values_1 = $values['txt_value1'];
-                       $conector = $values['cbo_conector'];
-                       $values_2 = $values['txt_value2'];
+                       $criteria = $this->_validate_criteria();
                        
-                       $criteria = array();
-                       foreach ($restricted_values as $k => $field) 
-                       {
-                               if ($field && $operators[$k])
-                               {
-                                       $criteria[] = array('field'=>$field, 
'operator'=>$operators[$k], 'value1'=>trim($values_1[$k]), 
'conector'=>$conector[$k], 'value2'=>trim($values_2[$k]));
-                               }
-                       }
                        $data['criteria'] = $criteria;
                        
                        $list = $this->bo->read_to_export($dataset_id, $data);
@@ -817,7 +838,7 @@
                        
                }
                
-               public function get_operators()
+               /*public function get_operators()
                {
                        $operators = array(
                                'equal' => '=', 
@@ -839,5 +860,5 @@
                        );
                        
                        return $operators;
-               }
+               }*/
        }
\ No newline at end of file




reply via email to

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