fmsystem-commits
[Top][All Lists]
Advanced

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

[Fmsystem-commits] [12807] filter on components


From: Sigurd Nes
Subject: [Fmsystem-commits] [12807] filter on components
Date: Mon, 02 Mar 2015 08:45:05 +0000

Revision: 12807
          http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=12807
Author:   sigurdne
Date:     2015-03-02 08:45:03 +0000 (Mon, 02 Mar 2015)
Log Message:
-----------
filter on components

Modified Paths:
--------------
    trunk/controller/inc/class.socontrol.inc.php
    trunk/controller/inc/class.uicalendar.inc.php

Modified: trunk/controller/inc/class.socontrol.inc.php
===================================================================
--- trunk/controller/inc/class.socontrol.inc.php        2015-02-27 23:36:34 UTC 
(rev 12806)
+++ trunk/controller/inc/class.socontrol.inc.php        2015-03-02 08:45:03 UTC 
(rev 12807)
@@ -657,7 +657,7 @@
                 * @param $control_id control id
                 * @return array with arrays of component info  
                 */
-               function get_components_for_control($control_id)
+               function get_components_for_control($control_id, $location_id = 
0, $component_id = 0)
                {
                        $control_id = (int) $control_id;
 
@@ -670,6 +670,11 @@
                        $sql .= "AND ccl.location_id = bim_type.location_id ";
                        $sql .= "AND bim_type.id = bim_item.type";
 
+                       if($location_id && $component_id)
+                       {
+                               $sql .= " AND ccl.location_id = {$location_id} 
AND ccl.component_id = {$component_id}";
+                       }
+
                        $this->db->query($sql);
 
                        while($this->db->next_record())
@@ -827,6 +832,7 @@
                */
                function register_control_to_component($data)
                {
+                       $ret = 0;
                        $assigned_to    = isset($data['assigned_to']) && 
$data['assigned_to'] ? $data['assigned_to'] : null;
                        $start_date                     = 
isset($data['start_date']) && $data['start_date'] ? $data['start_date'] : null;
 
@@ -874,6 +880,7 @@
 
                                                $this->db->query("INSERT INTO 
controller_control_component_list (" . implode(',',array_keys($values_insert)) 
. ') VALUES ('
                                                 . 
$this->db->validate_insert(array_values($values_insert)) . 
')',__LINE__,__FILE__);
+                                               $ret = PHPGW_ACL_ADD; // Bit - 
add
                                        }
                                }
                        }
@@ -895,9 +902,11 @@
                                        $sql =  "DELETE FROM 
controller_control_component_list WHERE control_id = {$control_id} AND 
location_id = {$location_id} AND component_id = {$component_id}";
                                        $this->db->query($sql);
                                }
+                               $ret += PHPGW_ACL_DELETE; //bit - delete
                        }
-
-                       return $this->db->transaction_commit();
+ 
+                       $this->db->transaction_commit();
+                       return $ret;
                }
 
                /**

Modified: trunk/controller/inc/class.uicalendar.inc.php
===================================================================
--- trunk/controller/inc/class.uicalendar.inc.php       2015-02-27 23:36:34 UTC 
(rev 12806)
+++ trunk/controller/inc/class.uicalendar.inc.php       2015-03-02 08:45:03 UTC 
(rev 12807)
@@ -462,6 +462,8 @@
                        $control_id = phpgw::get_var('control_id', 'int');
                        $control = $this->so_control->get_single($control_id);
                        $year = phpgw::get_var('year', 'int');
+                       $location_id = phpgw::get_var('location_id');
+                       $component_id = phpgw::get_var('component_id');
 
                        $user_id = $GLOBALS['phpgw_info']['user']['account_id'];
 
@@ -482,7 +484,7 @@
                        if (is_numeric($control_id) & $control_id > 0)
                        {
                                $locations_for_control_array = 
$this->so_control->get_locations_for_control($control_id);
-                               $components_for_control_array = 
$this->so_control->get_components_for_control($control_id);
+                               $components_for_control_array = 
$this->so_control->get_components_for_control($control_id, $location_id, 
$component_id);
                                foreach ($locations_for_control_array as 
$location)
                                {
                                        $locations_list[] = array
@@ -689,6 +691,9 @@
                                $month = date('m');
                        }
 
+                       $location_id = phpgw::get_var('location_id');
+                       $component_id = phpgw::get_var('component_id');
+
                        $user_id = $GLOBALS['phpgw_info']['user']['account_id'];
 
                        $bookmark_locations  = array();
@@ -706,7 +711,7 @@
                        if (is_numeric($control_id) & $control_id > 0)
                        {
                                $locations_for_control_array = 
$this->so_control->get_locations_for_control($control_id);
-                               $components_for_control_array = 
$this->so_control->get_components_for_control($control_id);
+                               $components_for_control_array = 
$this->so_control->get_components_for_control($control_id, $location_id, 
$component_id);
                                foreach ($locations_for_control_array as 
$location)
                                {
                                        $locations_list[] = array




reply via email to

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