fmsystem-commits
[Top][All Lists]
Advanced

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

[Fmsystem-commits] [11768] property: Fix sql on empty filter


From: Sigurd Nes
Subject: [Fmsystem-commits] [11768] property: Fix sql on empty filter
Date: Fri, 28 Feb 2014 20:45:23 +0000

Revision: 11768
          http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=11768
Author:   sigurdne
Date:     2014-02-28 20:45:22 +0000 (Fri, 28 Feb 2014)
Log Message:
-----------
property: Fix sql on empty filter

Modified Paths:
--------------
    trunk/property/inc/class.soproject.inc.php

Modified: trunk/property/inc/class.soproject.inc.php
===================================================================
--- trunk/property/inc/class.soproject.inc.php  2014-02-28 12:26:19 UTC (rev 
11767)
+++ trunk/property/inc/class.soproject.inc.php  2014-02-28 20:45:22 UTC (rev 
11768)
@@ -3088,6 +3088,10 @@
                                $ids[] = $id;
                                phpgwapi_cache::system_clear('property', 
"budget_order_{$id}");
                        }
+                       if(!$ids)
+                       {
+                               return false;
+                       }
                        $this->db->query("SELECT sum(budget) AS budget FROM 
fm_workorder_budget WHERE year = {$year} AND order_id IN (" . implode(',', 
$ids) . ')', __LINE__, __FILE__);
                        $this->db->next_record();
                        $workorder_budget = $this->db->f('budget');
@@ -3134,15 +3138,18 @@
                        {
                                $ids[] = $this->db->f('id');
                        }
-                       $this->db->query("SELECT DISTINCT year FROM 
fm_workorder_budget WHERE order_id IN (" . implode(',', $ids) . ')', __LINE__, 
__FILE__);
-                       while ($this->db->next_record())
+                       if($ids)
                        {
-                               $years[] = $this->db->f('year');
+                               $this->db->query("SELECT DISTINCT year FROM 
fm_workorder_budget WHERE order_id IN (" . implode(',', $ids) . ')', __LINE__, 
__FILE__);
+                               while ($this->db->next_record())
+                               {
+                                       $years[] = $this->db->f('year');
+                               }
+                               foreach($years as $_year)
+                               {
+                                       
$this->check_and_update_project_budget($project_id, $_year);
+                               }
                        }
-                       foreach($years as $_year)
-                       {
-                               
$this->check_and_update_project_budget($project_id, $_year);
-                       }
                }
 
        }       
\ No newline at end of file




reply via email to

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