fmsystem-commits
[Top][All Lists]
Advanced

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

[Fmsystem-commits] [9645]


From: Torstein
Subject: [Fmsystem-commits] [9645]
Date: Fri, 22 Jun 2012 10:19:58 +0000

Revision: 9645
          http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=9645
Author:   vator
Date:     2012-06-22 10:19:58 +0000 (Fri, 22 Jun 2012)
Log Message:
-----------


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

Modified: trunk/controller/inc/class.socontrol.inc.php
===================================================================
--- trunk/controller/inc/class.socontrol.inc.php        2012-06-22 10:19:46 UTC 
(rev 9644)
+++ trunk/controller/inc/class.socontrol.inc.php        2012-06-22 10:19:58 UTC 
(rev 9645)
@@ -228,13 +228,15 @@
                        }
                }
                
-               public function get_controls_by_component($location_code, 
$from_date, $to_date, $repeat_type = null, $return_type = "return_object")
+               public function get_controls_by_component($location_code, 
$from_date, $to_date, $repeat_type = '', $return_type = "return_object", 
$role_id = '')
                {
                        $controls_array = array();
                        
                        $sql   = "SELECT c.id as control_id, c.*, ";
                        $sql  .= "bim_item.type as component_type, bim_item.id 
as component_id, bim_item.location_code, bim_item.address, ";
-                       $sql  .= 
"xpath('descendant-or-self::*/beskrivelse/text()', bim_item.xml_representation) 
as xml ";
+                       //$sql  .= "cast(xpath('*/text()', xml_representation) 
as text[]) AS xml ";
+                       //$sql  .= "xpath('/', bim_item.xml_representation) as 
xml ";
+                       $sql  .= "bim_item.xml_representation as xml ";
                        $sql  .= "FROM controller_control_component_list cl ";
                        $sql  .= "JOIN fm_bim_item bim_item on cl.component_id 
= bim_item.id ";
                        $sql  .= "JOIN fm_bim_type bim_type on cl.location_id = 
bim_type.location_id ";
@@ -242,10 +244,13 @@
                        $sql  .= "AND bim_item.type = bim_type.id ";
                        $sql  .= "AND bim_item.location_code LIKE 
'$location_code%' ";
                        
-                       if( $repeat_type != null){
+                       if( is_numeric($repeat_type)){
                                $sql .= "AND c.repeat_type = $repeat_type ";
                        }
-                       
+                       if( is_numeric($role_id)){
+                           $sql .= "AND c.responsibility_id = $role_id ";
+                       }
+                           
                        $sql .= "AND (c.start_date <= $from_date AND c.end_date 
IS NULL ";
                        $sql .= "OR c.start_date > $from_date AND c.start_date 
< $to_date) ";
                        




reply via email to

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