[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Fmsystem-commits] [13235] more on controller integration
From: |
Sigurd Nes |
Subject: |
[Fmsystem-commits] [13235] more on controller integration |
Date: |
Wed, 20 May 2015 08:52:54 +0000 |
Revision: 13235
http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=13235
Author: sigurdne
Date: 2015-05-20 08:52:53 +0000 (Wed, 20 May 2015)
Log Message:
-----------
more on controller integration
Modified Paths:
--------------
trunk/controller/inc/class.uicomponent.inc.php
trunk/property/inc/class.soentity.inc.php
Modified: trunk/controller/inc/class.uicomponent.inc.php
===================================================================
--- trunk/controller/inc/class.uicomponent.inc.php 2015-05-19 22:05:45 UTC
(rev 13234)
+++ trunk/controller/inc/class.uicomponent.inc.php 2015-05-20 08:52:53 UTC
(rev 13235)
@@ -380,10 +380,14 @@
// _debug_array($location_type_name);
$components = array();
- if($location_id == -1 && !$entity_group_id)
+ if(!$location_id)
{
//nothing
}
+ else if($location_id == -1 && !$entity_group_id)
+ {
+ //nothing
+ }
else if(!$location_id && $entity_group_id)
{
//still nothing
@@ -398,7 +402,15 @@
}
$_location_id = $_location_filter['id'];
- $_components =
execMethod('property.soentity.read',array('entity_group_id' =>
$entity_group_id,'location_id' => $_location_id, 'district_id' => $district_id,
'allrows' => true));
+ $_components =
execMethod('property.soentity.read',array(
+ 'entity_group_id' =>
$entity_group_id,
+ 'location_id' => $_location_id,
+ 'district_id' => $district_id,
+ 'allrows' => true,
+ 'control_registered' =>
!!$user_id,
+ 'check_for_control' => true
+ )
+ );
$components = array_merge($components,
$_components);
}
}
@@ -432,6 +444,10 @@
}
$short_desc_arr .= ' [' .
$_location_name[$_component['location_code']] . ']';
+ if (!$user_id && !$_component['has_control'])
+ {
+ continue;
+ }
$controls =
execMethod('controller.socontrol.get_controls_at_component',
array('location_id' => $location_id, 'component_id' => $component_id));
//_debug_array($controls);
foreach($controls as $_control)
@@ -442,6 +458,7 @@
}
$control_id
= $_control['control_id'];
$control
= $so_control->get_single($_control['control_id']);
+ // one for each serie
$components_for_control_array =
$so_control->get_components_for_control($control_id, $location_id,
$component_id,0);//,$user_id);
// LOCATIONS: Process aggregated values
for controls with repeat type day or week
Modified: trunk/property/inc/class.soentity.inc.php
===================================================================
--- trunk/property/inc/class.soentity.inc.php 2015-05-19 22:05:45 UTC (rev
13234)
+++ trunk/property/inc/class.soentity.inc.php 2015-05-20 08:52:53 UTC (rev
13235)
@@ -441,6 +441,7 @@
$p_num = isset($data['p_num']) ?
$data['p_num'] : '';
$custom_condition= isset($data['custom_condition']) ?
$data['custom_condition'] : '';
$control_registered= isset($data['control_registered'])
? $data['control_registered'] : '';
+ $check_for_control= isset($data['check_for_control']) ?
$data['check_for_control'] : '';
$control_id = isset($data['control_id']) &&
$data['control_id'] ? $data['control_id'] : 0;
$org_units = isset($data['org_units']) &&
is_array($data['org_units']) ? $data['org_units'] : array();
$location_id = isset($data['location_id']) &&
$data['location_id'] ? (int)$data['location_id'] : 0;
@@ -735,18 +736,40 @@
}
$sql = "SELECT fm_bim_item.* __XML-ORDER__ FROM
fm_bim_item {$this->join} fm_bim_type ON (fm_bim_item.type = fm_bim_type.id)";
+ $join_control = "controller_control_component_list ON
(fm_bim_item.id = controller_control_component_list.component_id AND
controller_control_component_list.location_id = fm_bim_type.location_id)";
+
if($control_registered)
{
- $sql .= "{$this->join}
controller_control_component_list ON (fm_bim_item.id =
controller_control_component_list.component_id AND
controller_control_component_list.location_id = fm_bim_type.location_id)";
- $sql_cnt_control_fields = ',control_id ';
- $filtermethod .= " $where
controller_control_component_list.control_id = $control_id";
- $where = 'AND';
+ $sql .= "{$this->join} {$join_control}";
+ if($control_id)
+ {
+ $sql_cnt_control_fields = ',control_id
';
+ $filtermethod .= " $where
controller_control_component_list.control_id = $control_id";
+ $where = 'AND';
+ }
}
else
{
$sql_cnt_control_fields = '';
}
+ if($check_for_control && !$control_registered)
+ {
+ $sql .= "{$this->left_join} {$join_control}";
+
+ $sql_check_control_field = ',count(control_id)
AS has_control';
+ $this->uicols['input_type'][] =
'hidden';
+ $this->uicols['name'][]
= 'has_control';
+ $this->uicols['descr'][]
= '';
+ $this->uicols['statustext'][] = '';
+ $this->uicols['align'][]
= '';
+ $this->uicols['datatype'][]
= '';
+ $this->uicols['sortable'][]
= true;
+ $this->uicols['exchange'][]
= false;
+ $this->uicols['formatter'][] = '';
+ $this->uicols['classname'][] = '';
+ }
+
if(isset($category['location_level']) &&
$category['location_level'])
{
$sql .= "{$this->join} fm_location1 ON
(fm_bim_item.loc1 = fm_location1.loc1)";
@@ -837,6 +860,12 @@
}
$sql = str_replace('__XML-ORDER__', $xml_order, $sql);
+
+ if($sql_check_control_field)
+ {
+ $sql = str_replace("SELECT fm_bim_item.*",
"SELECT fm_bim_item.* {$sql_check_control_field}", $sql);
+ $sql .= 'GROUP BY
fm_bim_item.location_id,fm_bim_item.id,fm_bim_item.type';
+ }
//_debug_array($sql);
if(!$allrows)
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Fmsystem-commits] [13235] more on controller integration,
Sigurd Nes <=