[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Fmsystem-commits] [17275] more on controller
From: |
sigurdne |
Subject: |
[Fmsystem-commits] [17275] more on controller |
Date: |
Mon, 6 Nov 2017 10:22:53 -0500 (EST) |
Revision: 17275
http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=17275
Author: sigurdne
Date: 2017-11-06 10:22:53 -0500 (Mon, 06 Nov 2017)
Log Message:
-----------
more on controller
Modified Paths:
--------------
trunk/controller/inc/class.uicase.inc.php
trunk/controller/inc/class.uicheck_list.inc.php
trunk/controller/inc/class.uicomponent.inc.php
trunk/property/inc/class.solocation.inc.php
Modified: trunk/controller/inc/class.uicase.inc.php
===================================================================
--- trunk/controller/inc/class.uicase.inc.php 2017-11-06 09:42:23 UTC (rev
17274)
+++ trunk/controller/inc/class.uicase.inc.php 2017-11-06 15:22:53 UTC (rev
17275)
@@ -122,6 +122,7 @@
$control_groups_with_items_array = array();
$component_id = $check_list->get_component_id();
+ $get_locations = false;
if ($component_id > 0)
{
@@ -128,14 +129,28 @@
$location_id = $check_list->get_location_id();
$component_id = $check_list->get_component_id();
- $component_arr =
execMethod('property.soentity.read_single_eav', array('location_id' =>
$location_id,
- 'id' => $component_id));
+ $location_info =
$GLOBALS['phpgw']->locations->get_name($location_id);
- $location_name =
execMethod('property.bolocation.get_location_name',
$component_arr['location_code']);
+ if (substr($location_info['location'], 1, 8) ==
'location')
+ {
+ $get_locations = true;
+ $item_arr =
createObject('property.solocation')->read_single('', array('location_id' =>
$location_id,
+ 'id' => $component_id), true);
+ $location_code =
$item_arr['location_code'];
+
$check_list->set_location_code($location_code);
+ $location_name =
execMethod('property.bolocation.get_location_name', $location_code);
+ $short_desc = $location_name;
+ }
+ else
+ {
+ $component_arr =
execMethod('property.soentity.read_single_eav', array('location_id' =>
$location_id,
+ 'id' => $component_id));
- $short_desc = $location_name . '::' .
execMethod('property.soentity.get_short_description', array(
- 'location_id' => $location_id,
'id' => $component_id));
+ $location_name =
execMethod('property.bolocation.get_location_name',
$component_arr['location_code']);
+ $short_desc = $location_name . '::' .
execMethod('property.soentity.get_short_description', array(
+ 'location_id' =>
$location_id, 'id' => $component_id));
+ }
$component = new controller_component();
$component->set_location_code($component_arr['location_code']);
$component->set_xml_short_desc($short_desc);
@@ -287,7 +302,8 @@
'component_array' => $component_array,
'control_groups_with_items_array' =>
$control_groups_with_items_array,
'type' => $type,
- 'location_code' => $location_code
+ 'location_code' => $location_code,
+ 'get_locations' => $get_locations
);
return $data;
@@ -330,6 +346,7 @@
'mandatory_location' => $mandatory_location,
'location_required' => $mandatory_location,
'cases_view' => 'add_case',
+ 'get_locations' => $case_data['get_locations']
);
phpgwapi_jquery::load_widget('core');
@@ -503,8 +520,21 @@
$component_id =
$case->get_component_id();
if ($component_id)
{
- $short_desc =
execMethod('property.soentity.get_short_description', array(
- 'location_id' =>
$component_location_id, 'id' => $component_id));
+ $location_info =
$GLOBALS['phpgw']->locations->get_name($component_location_id);
+
+ if
(substr($location_info['location'], 1, 8) == 'location')
+ {
+ $item_arr =
createObject('property.solocation')->read_single('', array('location_id' =>
$component_location_id,
+ 'id' =>
$component_id), true);
+ $location_code =
$item_arr['location_code'];
+ $short_desc =
execMethod('property.bolocation.get_location_name', $location_code);
+ }
+ else
+ {
+ $short_desc =
execMethod('property.soentity.get_short_description', array(
+ 'location_id'
=> $component_location_id, 'id' => $component_id));
+ }
+
$case->set_component_descr($short_desc);
}
}
@@ -521,21 +551,33 @@
$component_id = $check_list->get_component_id();
+ $get_locations = false;
+
if ($component_id > 0)
{
$location_id = $check_list->get_location_id();
$component_id = $check_list->get_component_id();
+ $location_info =
$GLOBALS['phpgw']->locations->get_name($location_id);
- $component_arr =
execMethod('property.soentity.read_single_eav', array('location_id' =>
$location_id,
- 'id' => $component_id));
+ if (substr($location_info['location'], 1, 8) ==
'location')
+ {
+ $get_locations = true;
+ $item_arr =
createObject('property.solocation')->read_single('', array('location_id' =>
$location_id,
+ 'id' => $component_id), true);
+ $location_code =
$item_arr['location_code'];
+
$check_list->set_location_code($location_code);
+ $location_name =
execMethod('property.bolocation.get_location_name', $location_code);
+ $short_desc = $location_name;
+ }
+ else
+ {
+ $component_arr =
execMethod('property.soentity.read_single_eav', array('location_id' =>
$location_id,
+ 'id' => $component_id));
+ $location_name =
execMethod('property.bolocation.get_location_name',
$component_arr['location_code']);
+ $short_desc = $location_name . '::' .
execMethod('property.soentity.get_short_description', array(
+ 'location_id' =>
$location_id, 'id' => $component_id));
+ }
- $location_name =
execMethod('property.bolocation.get_location_name',
$component_arr['location_code']);
-
- $short_desc = $location_name . '::' .
execMethod('property.soentity.get_short_description', array(
- 'location_id' => $location_id,
'id' => $component_id));
-
- // $short_desc =
execMethod('property.soentity.get_short_description', array('location_id' =>
$location_id, 'id' => $component_id));
-
$component = new controller_component();
$component->set_id($component_id);
$component->set_location_id($location_id);
@@ -553,7 +595,7 @@
$type = 'location';
}
- $level = $this->location_finder->get_location_level();
+ $level =
$this->location_finder->get_location_level($location_code);
$year = date("Y", $check_list->get_deadline());
$month = date("n", $check_list->get_deadline());
@@ -570,6 +612,7 @@
'current_year' => $year,
'current_month_nr' => $month,
'type' => $type,
+ 'get_locations' => $get_locations,
'location_level' => $level,
);
@@ -642,8 +685,20 @@
if ($component_id = $case->get_component_id())
{
- $short_desc =
execMethod('property.soentity.get_short_description', array('location_id' =>
$component_location_id,
- 'id' => $component_id));
+ $location_info =
$GLOBALS['phpgw']->locations->get_name($component_location_id);
+
+ if (substr($location_info['location'],
1, 8) == 'location')
+ {
+ $item_arr =
createObject('property.solocation')->read_single('', array('location_id' =>
$component_location_id,
+ 'id' => $component_id),
true);
+ $location_code =
$item_arr['location_code'];
+ $short_desc =
execMethod('property.bolocation.get_location_name', $location_code);
+ }
+ else
+ {
+ $short_desc =
execMethod('property.soentity.get_short_description', array('location_id' =>
$component_location_id,
+ 'id' => $component_id));
+ }
$message_details .= "Hvor:
{$short_desc}\n";
}
@@ -738,21 +793,33 @@
$component_id = $check_list->get_component_id();
+ $get_locations = false;
if ($component_id > 0)
{
$location_id = $check_list->get_location_id();
$component_id = $check_list->get_component_id();
- $component_arr =
execMethod('property.soentity.read_single_eav', array('location_id' =>
$location_id,
- 'id' => $component_id));
+ $location_info =
$GLOBALS['phpgw']->locations->get_name($location_id);
- $location_name =
execMethod('property.bolocation.get_location_name',
$component_arr['location_code']);
+ if (substr($location_info['location'], 1, 8) ==
'location')
+ {
+ $get_locations = true;
+ $item_arr =
createObject('property.solocation')->read_single('', array('location_id' =>
$location_id,
+ 'id' => $component_id), true);
+ $location_code =
$item_arr['location_code'];
+
$check_list->set_location_code($location_code);
+ $location_name =
execMethod('property.bolocation.get_location_name', $location_code);
+ $short_desc = $location_name;
+ }
+ else
+ {
+ $component_arr =
execMethod('property.soentity.read_single_eav', array('location_id' =>
$location_id,
+ 'id' => $component_id));
+ $location_name =
execMethod('property.bolocation.get_location_name',
$component_arr['location_code']);
+ $short_desc = $location_name . '::' .
execMethod('property.soentity.get_short_description', array(
+ 'location_id' =>
$location_id, 'id' => $component_id));
+ }
- $short_desc = $location_name . '::' .
execMethod('property.soentity.get_short_description', array(
- 'location_id' => $location_id,
'id' => $component_id));
-
-// $short_desc =
execMethod('property.soentity.get_short_description', array('location_id' =>
$location_id, 'id' => $component_id));
-
$component = new controller_component();
$component->set_id($component_id);
$component->set_location_id($location_id);
@@ -789,7 +856,8 @@
'current_month_nr' => $month,
'type' => $type,
'building_location_code' =>
$building_location_code,
- 'location_level' => $level
+ 'location_level' => $level,
+ 'get_locations' => $get_locations
);
phpgwapi_jquery::load_widget('core');
@@ -918,22 +986,33 @@
$check_list_location_code =
$check_list->get_location_code();
$component_id = $check_list->get_component_id();
+ $get_locations = false;
if ($component_id > 0)
{
$location_id = $check_list->get_location_id();
$component_id = $check_list->get_component_id();
+ $location_info =
$GLOBALS['phpgw']->locations->get_name($location_id);
- $component_arr =
execMethod('property.soentity.read_single_eav', array('location_id' =>
$location_id,
- 'id' => $component_id));
+ if (substr($location_info['location'], 1, 8) ==
'location')
+ {
+ $get_locations = true;
+ $item_arr =
createObject('property.solocation')->read_single('', array('location_id' =>
$location_id,
+ 'id' => $component_id), true);
+ $location_code =
$item_arr['location_code'];
+
$check_list->set_location_code($location_code);
+ $location_name =
execMethod('property.bolocation.get_location_name', $location_code);
+ $short_desc = $location_name;
+ }
+ else
+ {
+ $component_arr =
execMethod('property.soentity.read_single_eav', array('location_id' =>
$location_id,
+ 'id' => $component_id));
+ $location_name =
execMethod('property.bolocation.get_location_name',
$component_arr['location_code']);
+ $short_desc = $location_name . '::' .
execMethod('property.soentity.get_short_description', array(
+ 'location_id' =>
$location_id, 'id' => $component_id));
+ }
- $location_name =
execMethod('property.bolocation.get_location_name',
$component_arr['location_code']);
-
- $short_desc = $location_name . '::' .
execMethod('property.soentity.get_short_description', array(
- 'location_id' => $location_id,
'id' => $component_id));
-
-// $short_desc =
execMethod('property.soentity.get_short_description', array('location_id' =>
$location_id, 'id' => $component_id));
-
$component = new controller_component();
$component->set_id($component_id);
$component->set_location_id($location_id);
@@ -982,8 +1061,20 @@
$component_id =
$case->get_component_id();
if ($component_id)
{
- $short_desc =
execMethod('property.soentity.get_short_description', array(
- 'location_id' =>
$component_location_id, 'id' => $component_id));
+ $location_info =
$GLOBALS['phpgw']->locations->get_name($component_location_id);
+
+ if
(substr($location_info['location'], 1, 8) == 'location')
+ {
+ $item_arr =
createObject('property.solocation')->read_single('', array('location_id' =>
$component_location_id,
+ 'id' =>
$component_id), true);
+ $location_code =
$item_arr['location_code'];
+ $short_desc =
execMethod('property.bolocation.get_location_name', $location_code);
+ }
+ else
+ {
+ $short_desc =
execMethod('property.soentity.get_short_description', array(
+ 'location_id'
=> $component_location_id, 'id' => $component_id));
+ }
$case->set_component_descr($short_desc);
}
}
@@ -1001,6 +1092,7 @@
'component_array' => $component_array,
'type' => $type,
'location_level' => $level,
+ 'get_locations' => $get_locations,
// 'building_location_code'
=> $case_location_code,
'current_year' => $year,
'current_month_nr' => $month,
@@ -1031,20 +1123,35 @@
$component_id = $check_list->get_component_id();
+ $get_locations = false;
+
if ($component_id > 0)
{
$location_id = $check_list->get_location_id();
$component_id = $check_list->get_component_id();
- $component_arr =
execMethod('property.soentity.read_single_eav', array('location_id' =>
$location_id,
- 'id' => $component_id));
- $location_name =
execMethod('property.bolocation.get_location_name',
$component_arr['location_code']);
+ $location_info =
$GLOBALS['phpgw']->locations->get_name($location_id);
- $short_desc = $location_name . '::' .
execMethod('property.soentity.get_short_description', array(
- 'location_id' => $location_id,
'id' => $component_id));
+ if (substr($location_info['location'], 1, 8) ==
'location')
+ {
+ $get_locations = true;
+ $item_arr =
createObject('property.solocation')->read_single('', array('location_id' =>
$location_id,
+ 'id' => $component_id), true);
+ $location_code =
$item_arr['location_code'];
+
$check_list->set_location_code($location_code);
+ $location_name =
execMethod('property.bolocation.get_location_name', $location_code);
+ $short_desc = $location_name;
+ }
+ else
+ {
+ $component_arr =
execMethod('property.soentity.read_single_eav', array('location_id' =>
$location_id,
+ 'id' => $component_id));
+ $location_name =
execMethod('property.bolocation.get_location_name',
$component_arr['location_code']);
-// $short_desc =
execMethod('property.soentity.get_short_description', array('location_id' =>
$location_id, 'id' => $component_id));
+ $short_desc = $location_name . '::' .
execMethod('property.soentity.get_short_description', array(
+ 'location_id' =>
$location_id, 'id' => $component_id));
+ }
$component = new controller_component();
$component->set_id($component_id);
$component->set_location_id($location_id);
@@ -1093,8 +1200,20 @@
$component_id =
$case->get_component_id();
if ($component_id)
{
- $short_desc =
execMethod('property.soentity.get_short_description', array(
- 'location_id' =>
$component_location_id, 'id' => $component_id));
+ $location_info =
$GLOBALS['phpgw']->locations->get_name($component_location_id);
+
+ if
(substr($location_info['location'], 1, 8) == 'location')
+ {
+ $item_arr =
createObject('property.solocation')->read_single('', array('location_id' =>
$component_location_id,
+ 'id' =>
$component_id), true);
+ $location_code =
$item_arr['location_code'];
+ $short_desc =
execMethod('property.bolocation.get_location_name', $location_code);
+ }
+ else
+ {
+ $short_desc =
execMethod('property.soentity.get_short_description', array(
+ 'location_id'
=> $component_location_id, 'id' => $component_id));
+ }
$case->set_component_descr($short_desc);
}
}
@@ -1114,6 +1233,7 @@
'component_array' => $component_array,
'type' => $type,
'location_level' => $level,
+ 'get_locations' => $get_locations,
// 'building_location_code'
=> $building_location_code,
'current_year' => $year,
'current_month_nr' => $month,
Modified: trunk/controller/inc/class.uicheck_list.inc.php
===================================================================
--- trunk/controller/inc/class.uicheck_list.inc.php 2017-11-06 09:42:23 UTC
(rev 17274)
+++ trunk/controller/inc/class.uicheck_list.inc.php 2017-11-06 15:22:53 UTC
(rev 17275)
@@ -1120,20 +1120,37 @@
$control =
$this->so_control->get_single($check_list->get_control_id());
$component_id = $check_list->get_component_id();
+ $get_locations = false;
if ($component_id > 0)
{
$location_id = $check_list->get_location_id();
$component_id = $check_list->get_component_id();
+ $location_info =
$GLOBALS['phpgw']->locations->get_name($location_id);
- $component_arr =
execMethod('property.soentity.read_single_eav', array('location_id' =>
$location_id,
- 'id' => $component_id));
+ if (substr($location_info['location'], 1, 8) ==
'location')
+ {
+ $get_locations = true;
+ $item_arr =
createObject('property.solocation')->read_single('', array('location_id' =>
$location_id,
+ 'id' => $component_id), true);
+ $location_code =
$item_arr['location_code'];
+
$check_list->set_location_code($location_code);
+ $location_name =
execMethod('property.bolocation.get_location_name', $location_code);
+ $short_desc = $location_name;
+ }
+ else
+ {
+ $component_arr =
execMethod('property.soentity.read_single_eav', array('location_id' =>
$location_id,
+ 'id' => $component_id));
- $location_name =
execMethod('property.bolocation.get_location_name',
$component_arr['location_code']);
+ $location_name =
execMethod('property.bolocation.get_location_name',
$component_arr['location_code']);
- $short_desc = $location_name . '::' .
execMethod('property.soentity.get_short_description', array(
- 'location_id' => $location_id,
'id' => $component_id));
+ $short_desc = $location_name . '::' .
execMethod('property.soentity.get_short_description', array(
+ 'location_id' =>
$location_id, 'id' => $component_id));
+ }
+
+
$component = new controller_component();
$component->set_id($component_id);
$component->set_location_id($location_id);
@@ -1169,6 +1186,7 @@
'location_array' => $location_array,
'component_array' => $component_array,
'type' => $type,
+ 'get_locations' => $get_locations,
'current_year' => $year,
'current_month_nr' => $month,
'building_location_code' =>
$building_location_code,
Modified: trunk/controller/inc/class.uicomponent.inc.php
===================================================================
--- trunk/controller/inc/class.uicomponent.inc.php 2017-11-06 09:42:23 UTC
(rev 17274)
+++ trunk/controller/inc/class.uicomponent.inc.php 2017-11-06 15:22:53 UTC
(rev 17275)
@@ -79,7 +79,17 @@
$config->read();
$this->_category_acl =
isset($config->config_data['acl_at_control_area']) &&
$config->config_data['acl_at_control_area'] == 1 ? true : false;
- self::set_active_menu('controller::status_components');
+ $location_id = phpgw::get_var('location_id', 'int');
+
+ if(($location_id && $this->is_location($location_id))
|| phpgw::get_var('get_locations', 'bool'))
+ {
+
self::set_active_menu('controller::status_locations');
+ }
+ else
+ {
+
self::set_active_menu('controller::status_components');
+ }
+
$this->account =
$GLOBALS['phpgw_info']['user']['account_id'];
if (phpgw::get_var('noframework', 'bool'))
@@ -119,19 +129,34 @@
return $result;
}
+ private function is_location( $location_id )
+ {
+ $location_info =
$GLOBALS['phpgw']->locations->get_name($location_id);
+ if (substr($location_info['location'], 1, 8) ==
'location')
+ {
+ return true;
+ }
+ else
+ {
+ return false;
+ }
+ }
+
private function get_location_filter()
{
$entity_group_id = phpgw::get_var('entity_group_id',
'int');
$location_id = phpgw::get_var('location_id', 'int');
- $location_filter =
phpgwapi_cache::session_get('controller', "location_filter_{$entity_group_id}");
+ if($entity_group_id)
+ {
+ $location_filter =
phpgwapi_cache::session_get('controller', "location_filter_{$entity_group_id}");
+ }
- if (!$location_filter)
+ if (empty($location_filter))
{
$location_filter = array();
- $location_info =
$GLOBALS['phpgw']->locations->get_name($location_id);
- if (substr($location_info['location'], 1, 8) ==
'location')
+ if ($this->is_location($location_id))
{
$location_types =
CreateObject('property.soadmin_location')->read(array('allrows' => true));
foreach ($location_types as
$location_type)
@@ -648,6 +673,13 @@
// $lookup_stray_items = false;
$lookup_stray_items = !!$entity_group_id;
+ if($location_id && $this->is_location($location_id))
+ {
+ $get_locations = true;
+ }
+
+ $location_filter_options = array();
+
if ($user_id < 0)
{
$user_id = $user_id * -1;
@@ -714,10 +746,11 @@
$_location_id =
(int)$_location_filter['id'];
$exclude_locations[] = $_location_id;
- $location_filter_options =
$this->_get_location_filter_options($_location_id);
if(empty($get_locations))
{
+ $location_filter_options =
$this->_get_location_filter_options($_location_id);
+
$_items =
execMethod('property.soentity.read', array(
'filter_entity_group'
=> $entity_group_id,
'location_id' =>
$_location_id,
@@ -740,6 +773,7 @@
'location_id' =>
$_location_id,
'district_id' =>
$district_id,
'location_code' =>
$location_code,
+ 'control_registered' =>
!$all_items,
'allrows' => true,
'filter_item' =>
$filter_component ? array($filter_component) : array(),
)
@@ -788,7 +822,7 @@
}
- if ($all_items && !$_item['has_control'])
+ if (empty($get_locations) && ($all_items &&
!$_item['has_control']))
{
continue;
}
@@ -1051,7 +1085,7 @@
$choose_master = false;
if ($all_components && count($all_components))
{
- $choose_master = true;
+ $choose_master = $all_items ? true : false;
foreach ($all_components as $dummy =>
$component)
{
$data = array();
@@ -1068,21 +1102,21 @@
'id' => $item_id,
'active_tab' =>
'controller'
);
+ $short_description =
$component['short_description'];
+ $short_description .= ' [' .
$component['location_name'] . ']';
}
else
{
$item_link_data = array
(
- 'menuaction' =>
'property.uientity.edit',
+ 'menuaction' =>
'property.uilocation.edit',
'location_code' =>
$_location_code,
'active_tab' =>
'controller'
);
-
+ $short_description =
$component['location_code'];
+ $short_description .= ' [' .
$component['loc1_name'] . ']';
}
- $short_description =
$component['short_description'];
- $short_description .= "[
{$component['location_name']} ]";
-
$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;
Modified: trunk/property/inc/class.solocation.inc.php
===================================================================
--- trunk/property/inc/class.solocation.inc.php 2017-11-06 09:42:23 UTC (rev
17274)
+++ trunk/property/inc/class.solocation.inc.php 2017-11-06 15:22:53 UTC (rev
17275)
@@ -369,7 +369,7 @@
if (!$type_id)
{
- return;
+ return array();
}
if ($order == 'undefined')
@@ -667,12 +667,26 @@
$filtermethod = '';
$where = 'WHERE';
- if ($control_registered)
+ if ($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)
+ {
+ $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);
+ while ($this->db->next_record())
+ {
+ $items[] = $this->db->f('item_id');
+ }
+ $filtermethod .= " $where
fm_location{$type_id}.id IN (". implode(',', $items) . ')';
+ $where = 'AND';
+ }
//---------------------start custom user cols
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Fmsystem-commits] [17275] more on controller,
sigurdne <=