[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Fmsystem-commits] [17363] more on controller, differentiate on control-
From: |
sigurdne |
Subject: |
[Fmsystem-commits] [17363] more on controller, differentiate on control-type |
Date: |
Fri, 24 Nov 2017 10:55:39 -0500 (EST) |
Revision: 17363
http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=17363
Author: sigurdne
Date: 2017-11-24 10:55:38 -0500 (Fri, 24 Nov 2017)
Log Message:
-----------
more on controller, differentiate on control-type
Modified Paths:
--------------
trunk/controller/inc/class.uicomponent.inc.php
trunk/controller/js/controller/component.index.js
trunk/controller/templates/base/component.xsl
trunk/property/inc/class.solocation.inc.php
Modified: trunk/controller/inc/class.uicomponent.inc.php
===================================================================
--- trunk/controller/inc/class.uicomponent.inc.php 2017-11-24 12:37:15 UTC
(rev 17362)
+++ trunk/controller/inc/class.uicomponent.inc.php 2017-11-24 15:55:38 UTC
(rev 17363)
@@ -58,6 +58,7 @@
private $delete;
private $org_units;
private $custom;
+ private $get_locations;
public $public_functions = array
(
'index' => true,
@@ -80,8 +81,13 @@
$this->_category_acl =
isset($config->config_data['acl_at_control_area']) &&
$config->config_data['acl_at_control_area'] == 1 ? true : false;
$location_id = phpgw::get_var('location_id', 'int');
+ $this->get_locations = phpgw::get_var('get_locations',
'bool');
+ if ($this->is_location($location_id))
+ {
+ $this->get_locations = true;
+ }
- if(($location_id && $this->is_location($location_id))
|| phpgw::get_var('get_locations', 'bool'))
+ if(($location_id && $this->is_location($location_id))
|| $this->get_locations)
{
self::set_active_menu('controller::status_locations');
}
@@ -97,7 +103,6 @@
$GLOBALS['phpgw_info']['flags']['noframework']
= true;
}
$this->custom = createObject('phpgwapi.custom_fields');
-
}
public function add_controll_from_master()
@@ -424,6 +429,7 @@
private function get_fields( $filter_component = '' )
{
+
$fields = array
(
array(
@@ -433,10 +439,15 @@
),
array(
'key' => 'component_url',
- 'label' => lang('component'),
+ 'label' => $this->get_locations ?
lang('location') : lang('component'),
'sortable' => true,
),
array(
+ 'key' => 'control_type',
+ 'label' => lang('type'),
+ 'sortable' => true,
+ ),
+ array(
'key' => 'year',
'label' => lang('year'),
'sortable' => true,
@@ -610,7 +621,7 @@
public function query()
{
- $get_locations = phpgw::get_var('get_locations',
'bool');
+ $get_locations = $this->get_locations;
$entity_group_id = phpgw::get_var('entity_group_id',
'int');
$location_id = phpgw::get_var('location_id', 'int');
$location_code = phpgw::get_var('location_code',
'string');
@@ -774,6 +785,7 @@
'district_id' =>
$district_id,
'location_code' =>
$location_code,
'control_registered' =>
!$all_items,
+ 'check_for_control' =>
true,
'allrows' => true,
'filter_item' =>
$filter_component ? array($filter_component) : array(),
)
@@ -802,6 +814,8 @@
}
$all_components = array();
+ $control_names = array();
+
$components_with_calendar_array = array();
// _debug_array($items);
foreach ($items as $_item)
@@ -842,6 +856,7 @@
}
$control_id =
$control_relation['control_id'];
$control =
$so_control->get_single($control_id);
+ $control_names[$control_id] =
$control->get_title();
// $repeat_type =
$control->get_repeat_type();
$repeat_type =
(int)$control_relation['repeat_type'];
@@ -873,7 +888,7 @@
$year_calendar_agg = new
year_calendar_agg($control, $year, $location_code,
"VIEW_LOCATIONS_FOR_CONTROL");
$calendar_array =
$year_calendar_agg->build_calendar($agg_open_cases_pr_month_array);
-
$components_with_calendar_array["{$location_id}_{$item_id}"][] = array(
+
$components_with_calendar_array["{$location_id}_{$item_id}_{$control_id}"][] =
array(
"component" =>
$component->toArray(),
"calendar_array" =>
$calendar_array);
}
@@ -933,7 +948,7 @@
}
}
-
$components_with_calendar_array["{$location_id}_{$item_id}"][] = array(
+
$components_with_calendar_array["{$location_id}_{$item_id}_{$control_id}"][] =
array(
"component" =>
$component->toArray(),
"calendar_array" =>
$calendar_array);
}
@@ -957,6 +972,7 @@
$values = array();
foreach ($components_with_calendar_array as $dummy =>
$entry)
{
+ $type_array = explode('_', $dummy);
$location_id =
$entry[0]['component']['location_id'];
$item_id = $entry[0]['component']['id'];
$_location_code =
$entry[0]['component']['location_code'];
@@ -984,6 +1000,7 @@
);
}
+ $data['control_type'] =
$control_names[$type_array[2]];
$data['component_url'] = '<a href="' .
$GLOBALS['phpgw']->link('/index.php', $item_link_data) . "\"
target='_blank'>{$item_id}{$entry[0]['component']['xml_short_desc']}</a>";
$data['component_id'] = $item_id;
$data['location_id'] = $location_id;
@@ -1118,6 +1135,7 @@
$short_description .= ' [' .
$component['loc1_name'] . ']';
}
+ $data['control_type'] = '';
$data['component_url'] = '<a href="' .
$GLOBALS['phpgw']->link('/index.php', $item_link_data) . "\"
target='_blank'>{$item_id}
{$location_type_name[$location_id]}</br>{$short_description}</a>";
$data['component_id'] = $item_id;
$data['location_id'] = $location_id;
@@ -1134,6 +1152,7 @@
$row = array();
$row_sum = array();
$row_sum_actual = array();//billable_hours
+ $row['control_type'] = $entry['control_type'];
$row['component_url'] = $entry['component_url'];
$row['year'] = '';
$row['descr'] = '';
Modified: trunk/controller/js/controller/component.index.js
===================================================================
--- trunk/controller/js/controller/component.index.js 2017-11-24 12:37:15 UTC
(rev 17362)
+++ trunk/controller/js/controller/component.index.js 2017-11-24 15:55:38 UTC
(rev 17363)
@@ -232,6 +232,7 @@
$("#checkall").html(components_data.checkall);
$("#total_records").html(components_data.total_records);
+ $("#control_text").html('type');
$("#sum_text").html('Sum');
$("#month0").html(time_sum[0] + '/' +
time_sum_actual[0]);
$("#month1").html(time_sum[1] + '/' +
time_sum_actual[1]);
Modified: trunk/controller/templates/base/component.xsl
===================================================================
--- trunk/controller/templates/base/component.xsl 2017-11-24 12:37:15 UTC
(rev 17362)
+++ trunk/controller/templates/base/component.xsl 2017-11-24 15:55:38 UTC
(rev 17363)
@@ -296,6 +296,8 @@
</td>
<td id='total_records'>
</td>
+ <td id='control_text'>
+ </td>
<td id='sum_text'>
</td>
<td id='month0'>
Modified: trunk/property/inc/class.solocation.inc.php
===================================================================
--- trunk/property/inc/class.solocation.inc.php 2017-11-24 12:37:15 UTC (rev
17362)
+++ trunk/property/inc/class.solocation.inc.php 2017-11-24 15:55:38 UTC (rev
17363)
@@ -350,6 +350,7 @@
$filter_role_on_contact =
$data['filter_role_on_contact'] ? (int)$data['filter_role_on_contact'] : 0;
$role_id = $data['role_id'] ? (int)$data['role_id'] : 0;
$results = $data['results'] ? (int)$data['results'] : 0;
+ $check_for_control = isset($data['check_for_control'])
? $data['check_for_control'] : false;
$control_registered =
isset($data['control_registered']) ? $data['control_registered'] : '';
$control_id = isset($data['control_id']) &&
$data['control_id'] ? $data['control_id'] : 0;
$location_id = isset($data['location_id']) &&
$data['location_id'] ? (int)$data['location_id'] : 0;
@@ -667,28 +668,38 @@
$filtermethod = '';
$where = 'WHERE';
- if ($control_registered && $control_id)
+ if ($check_for_control && $control_registered &&
$control_id)
{
$sql .= "{$this->join}
controller_control_location_list ON (fm_location{$type_id}.location_code =
controller_control_location_list.location_code )";
$filtermethod .= " $where
controller_control_location_list.control_id = $control_id";
$where = 'AND';
}
- else if ($control_registered)
+ else if ($check_for_control && !$control_registered)
{
- $this->db->query("SELECT DISTINCT component_id
as item_id"
- . " FROM controller_control_component_list"
- // . " WHERE control_id = {$control_id}"
- . " WHERE location_id = {$location_id}");
- $items = array(-1);
+
+ $sql_without_control = "SELECT DISTINCT
fm_location2.id as item_id"
+ . " FROM fm_location2 {$this->left_join}
controller_control_component_list"
+ . " ON
controller_control_component_list.component_id = fm_location2.id"
+ . " {$this->left_join}
controller_control_serie"
+ . " ON
(controller_control_component_list.id =
controller_control_serie.control_relation_id"
+ . " AND
controller_control_serie.control_relation_type = 'component'"
+ . " AND
controller_control_component_list.location_id = {$location_id}"
+ . " AND
controller_control_serie.enabled = 1)"
+ . " WHERE
controller_control_component_list.location_id IS NULL";
+
+ $this->db->query($sql_without_control);
+ $items = array_merge(array(-1), $filter_item);
while ($this->db->next_record())
{
- $items[] = $this->db->f('item_id');
+ $items[] =
(int)$this->db->f('item_id');
}
+
+ $filter_item = array();
+
$filtermethod .= " $where
fm_location{$type_id}.id IN (". implode(',', $items) . ')';
$where = 'AND';
}
-
//---------------------start custom user cols
$user_columns =
isset($GLOBALS['phpgw_info']['user']['preferences']['property']['location_columns_'
. $type_id . !!$lookup]) ?
$GLOBALS['phpgw_info']['user']['preferences']['property']['location_columns_' .
$type_id . !!$lookup] : array();
@@ -1059,7 +1070,7 @@
{
return array();
}
-
+// _debug_array($sql);
if (!$allrows)
{
$this->db->limit_query($sql . $ordermethod,
$start, __LINE__, __FILE__, $results);
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Fmsystem-commits] [17363] more on controller, differentiate on control-type,
sigurdne <=