[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Fmsystem-commits] [17367] Stable: Merge 17362:17366 from trunk
From: |
sigurdne |
Subject: |
[Fmsystem-commits] [17367] Stable: Merge 17362:17366 from trunk |
Date: |
Mon, 27 Nov 2017 04:23:03 -0500 (EST) |
Revision: 17367
http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=17367
Author: sigurdne
Date: 2017-11-27 04:23:03 -0500 (Mon, 27 Nov 2017)
Log Message:
-----------
Stable: Merge 17362:17366 from trunk
Modified Paths:
--------------
branches/Version-2_0-branch/controller/inc/class.socontrol.inc.php
branches/Version-2_0-branch/controller/inc/class.uicomponent.inc.php
branches/Version-2_0-branch/controller/inc/class.uiprocedure.inc.php
branches/Version-2_0-branch/controller/inc/model/class.procedure.inc.php
branches/Version-2_0-branch/controller/js/controller/component.index.js
branches/Version-2_0-branch/controller/setup/phpgw_no.lang
branches/Version-2_0-branch/controller/templates/base/component.xsl
branches/Version-2_0-branch/controller/templates/base/procedure/procedure_item.xsl
branches/Version-2_0-branch/property/inc/class.soentity.inc.php
branches/Version-2_0-branch/property/inc/class.solocation.inc.php
Property Changed:
----------------
branches/Version-2_0-branch/
Index: branches/Version-2_0-branch
===================================================================
--- branches/Version-2_0-branch 2017-11-26 14:07:03 UTC (rev 17366)
+++ branches/Version-2_0-branch 2017-11-27 09:23:03 UTC (rev 17367)
Property changes on: branches/Version-2_0-branch
___________________________________________________________________
Modified: svn:mergeinfo
## -1,4 +1,4 ##
/branches/dev-syncromind:13653
/branches/dev-syncromind-2:14933-16846
/branches/stavangerkommune:12743-12875,12986
-/trunk:14721-14732,14734-14735,14737,14739,14741,14743-14744,14746-14749,14751,14753,14755-14757,14759,14761-14764,14766-14768,14770-14783,14785-14792,14794-14813,14815-14816,14818,14820-14822,14824-14825,14827-14829,14831-14834,14836,14838,14840-14842,14844-14845,14847,14849-14866,14868-14869,14871,14873-14875,14877-14878,14880-14884,14886-14896,14898,14900-14902,14904,14906-14909,14911-14915,14917-14919,14921-14922,14924-14978,14980-15258,15260-15261,15263-15264,15266-15285,15287-15288,15290-15291,15293,15295,15297,15299-15305,15307-15310,15312-15335,15337-15352,15354,15356,15358,15360-15541,15543-15566,15568-15569,15571,15573-15581,15583,15585-15617,15619,15621-15630,15632-15635,15637-15639,15641-15643,15645,15647-15665,15667-15668,15670-15671,15673-15693,15695-15712,15714-15764,15766-15767,15769-15787,15789-15802,15804-15811,15813-15814,15816-15818,15820-15849,15851-15887,15889-15900,15902-16046,16048-16051,16053,16055,16057-16063,16065-16071,16073-16077,16079-16081,16083-16099,16101-16130,16132-16140,16142,16144-16212,16214-16219,16221,16223-16224,16226,16228-16229,16231,16233,16235,16237,16239-16240,16242,16244-16246,16248,16250-16251,16253-16255,16257-16259,16261,16263,16265,16267,16269-16276,16278,16280-16283,16285,16287-16288,16290,16292-16295,16297-16305,16307-16314,16316-16318,16320-16322,16324,16326-16330,16332,16334,16336,16338-16339,16341-16342,16344,16346,16348,16350,16352-16353,16355-16358,16360,16362,16364-16369,16371,16373,16375-16378,16380,16382-16383,16385,16387,16389,16391,16393-16395,16397,16399-16402,16404,16406,16408,16410-16415,16417,16419-16420,16422-16425,16427,16429-16440,16442,16444,16446,16448-16449,16451,16453,16455-16463,16465-16472,16474-16475,16477-16484,16486,16488,16490-16497,16499,16501-16503,16505-16512,16514-16517,16519,16521,16523,16525,16527-16532,16534,16536-16541,16543,16545-16554,16556,16558-16565,16567-16575,16577-16584,16586-16588,16590,16592-16593,16595-16596,16598,16600-16601,16603-16608,16610-16614,16616-16618,16620-16621,16623-16624,16626,16628,16630,16632-16638,16640,16642,16644,16646-16651,16653-16663,16665,16667,16669,16671,16673,16675,16677,16679-16680,16682,16684,16686,16688-16692,16694-16695,16697-16699,16701,16703,16705-16706,16708,16710,16712,16714,16716-16718,16720-16728,16730-16732,16734-16739,16741,16743-16746,16748-16750,16752-16755,16757,16759-16761,16763,16765,16767,16769-16774,16776,16778-16783,16785-16788,16790,16792,16794,16796-16802,16804-16807,16809,16811-16817,16819,16821-16825,16827-16831,16833,16835-16836,16838,16840-16844,16846-16847,16849,16851,16853-16854,16856-16859,16861,16863-16865,16867,16869-16871,16873,16875-16876,16878,16880-16881,16883,16885,16887-16888,16890,16892,16894-16900,16902,16904,16906,16908-16909,16911-16916,16918-16919,16921,16923,16925,16927,16929-16930,16932,16934,16936-16937,16939-16942,16944,16946,16948,16950,16952-16953,16955-16959,16961,16963,16965-16970,16972,16974-16977,16979-16982,16984,16986,16988-16999,17001,17003,17005-17018,17020-17023,17025-17026,17028-17033,17035,17037,17039-17040,17042-17050,17052-17053,17055,17057-17058,17060,17062-17064,17066,17068-17074,17076-17088,17090,17092,17094,17096,17098,17100-17101,17103-17104,17106-17108,17110-17121,17123-17124,17126-17132,17134-17143,17145-17150,17152-17157,17159,17161-17162,17164,17166-17167,17169-17173,17175-17188,17190-17195,17197-17205,17207-17212,17214,17216-17277,17279,17281,17283-17285,17287-17288,17290-17301,17303-17311,17313-17314,17316-17317,17319,17321-17330,17332-17333,17335-17340,17342,17344-17346,17349-17351,17353-17354,17356-17357,17359,17361
\ No newline at end of property
+/trunk:14721-14732,14734-14735,14737,14739,14741,14743-14744,14746-14749,14751,14753,14755-14757,14759,14761-14764,14766-14768,14770-14783,14785-14792,14794-14813,14815-14816,14818,14820-14822,14824-14825,14827-14829,14831-14834,14836,14838,14840-14842,14844-14845,14847,14849-14866,14868-14869,14871,14873-14875,14877-14878,14880-14884,14886-14896,14898,14900-14902,14904,14906-14909,14911-14915,14917-14919,14921-14922,14924-14978,14980-15258,15260-15261,15263-15264,15266-15285,15287-15288,15290-15291,15293,15295,15297,15299-15305,15307-15310,15312-15335,15337-15352,15354,15356,15358,15360-15541,15543-15566,15568-15569,15571,15573-15581,15583,15585-15617,15619,15621-15630,15632-15635,15637-15639,15641-15643,15645,15647-15665,15667-15668,15670-15671,15673-15693,15695-15712,15714-15764,15766-15767,15769-15787,15789-15802,15804-15811,15813-15814,15816-15818,15820-15849,15851-15887,15889-15900,15902-16046,16048-16051,16053,16055,16057-16063,16065-16071,16073-16077,16079-16081,16083-16099,16101-16130,16132-16140,16142,16144-16212,16214-16219,16221,16223-16224,16226,16228-16229,16231,16233,16235,16237,16239-16240,16242,16244-16246,16248,16250-16251,16253-16255,16257-16259,16261,16263,16265,16267,16269-16276,16278,16280-16283,16285,16287-16288,16290,16292-16295,16297-16305,16307-16314,16316-16318,16320-16322,16324,16326-16330,16332,16334,16336,16338-16339,16341-16342,16344,16346,16348,16350,16352-16353,16355-16358,16360,16362,16364-16369,16371,16373,16375-16378,16380,16382-16383,16385,16387,16389,16391,16393-16395,16397,16399-16402,16404,16406,16408,16410-16415,16417,16419-16420,16422-16425,16427,16429-16440,16442,16444,16446,16448-16449,16451,16453,16455-16463,16465-16472,16474-16475,16477-16484,16486,16488,16490-16497,16499,16501-16503,16505-16512,16514-16517,16519,16521,16523,16525,16527-16532,16534,16536-16541,16543,16545-16554,16556,16558-16565,16567-16575,16577-16584,16586-16588,16590,16592-16593,16595-16596,16598,16600-16601,16603-16608,16610-16614,16616-16618,16620-16621,16623-16624,16626,16628,16630,16632-16638,16640,16642,16644,16646-16651,16653-16663,16665,16667,16669,16671,16673,16675,16677,16679-16680,16682,16684,16686,16688-16692,16694-16695,16697-16699,16701,16703,16705-16706,16708,16710,16712,16714,16716-16718,16720-16728,16730-16732,16734-16739,16741,16743-16746,16748-16750,16752-16755,16757,16759-16761,16763,16765,16767,16769-16774,16776,16778-16783,16785-16788,16790,16792,16794,16796-16802,16804-16807,16809,16811-16817,16819,16821-16825,16827-16831,16833,16835-16836,16838,16840-16844,16846-16847,16849,16851,16853-16854,16856-16859,16861,16863-16865,16867,16869-16871,16873,16875-16876,16878,16880-16881,16883,16885,16887-16888,16890,16892,16894-16900,16902,16904,16906,16908-16909,16911-16916,16918-16919,16921,16923,16925,16927,16929-16930,16932,16934,16936-16937,16939-16942,16944,16946,16948,16950,16952-16953,16955-16959,16961,16963,16965-16970,16972,16974-16977,16979-16982,16984,16986,16988-16999,17001,17003,17005-17018,17020-17023,17025-17026,17028-17033,17035,17037,17039-17040,17042-17050,17052-17053,17055,17057-17058,17060,17062-17064,17066,17068-17074,17076-17088,17090,17092,17094,17096,17098,17100-17101,17103-17104,17106-17108,17110-17121,17123-17124,17126-17132,17134-17143,17145-17150,17152-17157,17159,17161-17162,17164,17166-17167,17169-17173,17175-17188,17190-17195,17197-17205,17207-17212,17214,17216-17277,17279,17281,17283-17285,17287-17288,17290-17301,17303-17311,17313-17314,17316-17317,17319,17321-17330,17332-17333,17335-17340,17342,17344-17346,17349-17351,17353-17354,17356-17357,17359,17361,17363-17366
\ No newline at end of property
Modified: branches/Version-2_0-branch/controller/inc/class.socontrol.inc.php
===================================================================
--- branches/Version-2_0-branch/controller/inc/class.socontrol.inc.php
2017-11-26 14:07:03 UTC (rev 17366)
+++ branches/Version-2_0-branch/controller/inc/class.socontrol.inc.php
2017-11-27 09:23:03 UTC (rev 17367)
@@ -782,11 +782,12 @@
return $this->db->next_record();
}
- public function get_assigned_control_components( $from_date,
$to_date, $assigned_to = 0 )
+ public function get_assigned_control_components( $from_date,
$to_date, $assigned_to = 0 , $control_id = 0)
{
$assigned_to = (int)$assigned_to;
$location_id = (int)$location_id;
$component_id = (int)$component_id;
+ $control_id = (int)$control_id;
$sql = "SELECT DISTINCT ccl.component_id,
ccl.location_id";
$sql .= " FROM controller_control_component_list ccl ,
controller_control_serie cs";
@@ -798,6 +799,11 @@
// $sql .= " OR (cs.start_date <= $to_date AND cs.end_date
> $from_date ))";
$sql .= " AND cs.start_date <= $to_date";
+ if($control_id)
+ {
+ $sql .= " AND ccl.control_id = {$control_id}";
+ }
+
$this->db->query($sql, __LINE__, __FILE__);
$components = array();
@@ -1125,7 +1131,7 @@
* @return array controls assosiated with a component
* @throws Exception if missing valid input
*/
- function get_controls_at_component2( $data )
+ function get_controls_at_component2( $data , $control_id = 0)
{
if (!isset($data['location_id']) ||
!$data['location_id'])
{
@@ -1136,6 +1142,13 @@
throw new
Exception("controller_socontrol::get_controls_at_component - Missing
component_id in input");
}
+ $control_id = (int) $control_id;
+
+ if($control_id)
+ {
+ $filter_control = "AND controller_control.id =
{$control_id}";
+ }
+
static $users = array(); // cache result
$location_id = (int)$data['location_id'];
@@ -1152,7 +1165,7 @@
. " FROM controller_control_component_list"
. " {$this->db->join} controller_control ON
controller_control.id = controller_control_component_list.control_id"
. " {$this->db->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')"
- . " WHERE location_id = {$location_id} AND
component_id = {$component_id}"
+ . " WHERE location_id = {$location_id} AND
component_id = {$component_id} {$filter_control}"
. " ORDER BY repeat_type, repeat_interval";
// _debug_array($sql);
$this->db->query($sql, __LINE__, __FILE__);
@@ -1638,7 +1651,7 @@
function add_controll_to_component_from_master(
$master_component, $targets = array() )
{
$master_component_arr = explode('_', $master_component);
- if (count($master_component_arr) != 2)
+ if (count($master_component_arr) != 3)
{
throw new
Exception("controller_socontrol::add_controll_to_component_from_master -
Missing master component");
}
@@ -1645,12 +1658,16 @@
$location_id = (int)$master_component_arr[0];
$component_id = (int)$master_component_arr[1];
+ $control_id = (int)$master_component_arr[2];
$sql = "SELECT * FROM controller_control_component_list"
. " {$this->db->join} controller_control_serie"
. " ON
controller_control_serie.control_relation_id =
controller_control_component_list.id"
. " AND
controller_control_serie.control_relation_type = 'component'"
- . " WHERE location_id = {$location_id} AND
component_id = {$component_id} AND controller_control_serie.enabled = 1";
+ . " WHERE location_id = {$location_id}"
+ . " AND component_id = {$component_id}"
+ . " AND control_id = {$control_id}"
+ . " AND controller_control_serie.enabled = 1";
$this->db->query($sql, __LINE__, __FILE__);
Modified: branches/Version-2_0-branch/controller/inc/class.uicomponent.inc.php
===================================================================
--- branches/Version-2_0-branch/controller/inc/class.uicomponent.inc.php
2017-11-26 14:07:03 UTC (rev 17366)
+++ branches/Version-2_0-branch/controller/inc/class.uicomponent.inc.php
2017-11-27 09:23:03 UTC (rev 17367)
@@ -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()
@@ -313,6 +318,18 @@
{
$filter_component =
phpgw::get_var('location_id', 'int') . '_' . phpgw::get_var('component_id',
'int');
}
+
+ $control_types =
createObject('controller.socontrol')->get(0, 0, 'title', true, '', '', array());
+
+ $control_types_arr = array(array('id'=>'', 'name' =>
lang('select')));
+ foreach ($control_types as $control_type)
+ {
+ $control_types_arr[] = array(
+ 'id' => $control_type->get_id(),
+ 'name' => $control_type->get_title()
+ );
+ }
+ // _debug_array($control_types_arr);
$data = array(
'datatable_name' =>
phpgw::get_var('get_locations', 'bool') ? lang('status locations') :
lang('status components'),
'form' => array(
@@ -332,6 +349,12 @@
'onchange' =>
'update_table();'
),
array('type' =>
'filter',
+ 'name' =>
'control_id',
+ 'text' =>
lang('control types'),
+ 'list' =>
$control_types_arr,
+ 'onchange' =>
'update_table();'
+ ),
+ array('type' =>
'filter',
'name' =>
'entity_group_id',
'text' =>
lang('entity group'),
'list' =>
execMethod('property.bogeneric.get_list', array('type' => 'entity_group',
@@ -424,6 +447,7 @@
private function get_fields( $filter_component = '' )
{
+
$fields = array
(
array(
@@ -433,10 +457,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,10 +639,16 @@
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');
+ $filter_control_id = phpgw::get_var('control_id',
'int');
$location_id = phpgw::get_var('location_id', 'int');
$location_code = phpgw::get_var('location_code',
'string');
+ $location_name = phpgw::get_var('location_name',
'string');
+ if(!$location_name)
+ {
+ $location_code = '';
+ }
$control_area = phpgw::get_var('control_area', 'int');
$user_id = phpgw::get_var('user_id', 'int');
$district_id = phpgw::get_var('district_id', 'int');
@@ -631,6 +666,11 @@
$location_id = $filter_component_arr[0];
$filter_component = $filter_component_arr[1];
}
+ else
+ {
+ $filter_component = array();
+ }
+
if ($org_unit_id = phpgw::get_var('org_unit_id', 'int'))
{
$_subs =
execMethod('property.sogeneric.read_tree', array('node_id' => $org_unit_id,
@@ -686,7 +726,7 @@
$all_items = false;
$keep_only_assigned_to = $user_id;
- $assigned_items =
$so_control->get_assigned_control_components($from_date_ts, $to_date_ts,
$assigned_to = $user_id);
+ $assigned_items =
$so_control->get_assigned_control_components($from_date_ts, $to_date_ts,
$assigned_to = $user_id, $filter_control_id);
if(empty($get_locations))
{
@@ -695,6 +735,7 @@
$_items =
execMethod('property.soentity.read', array(
'filter_entity_group'
=> $entity_group_id,
'location_id' =>
$_location_id,
+ 'control_id' =>
$filter_control_id,
'district_id' =>
$district_id,
'location_code' =>
$location_code,
'allrows' => true,
@@ -711,6 +752,7 @@
$_items =
execMethod('property.solocation.read', array(
'filter_entity_group'
=> $entity_group_id,
'location_id' =>
$_location_id,
+ 'control_id' =>
$filter_control_id,
'district_id' =>
$district_id,
'location_code' =>
$location_code,
'allrows' => true,
@@ -754,6 +796,7 @@
$_items =
execMethod('property.soentity.read', array(
'filter_entity_group'
=> $entity_group_id,
'location_id' =>
$_location_id,
+ 'control_id' =>
$filter_control_id,
'district_id' =>
$district_id,
'location_code' =>
$location_code,
'org_units' =>
$this->org_units,
@@ -771,9 +814,11 @@
$_items =
execMethod('property.solocation.read', array(
'filter_entity_group'
=> $entity_group_id,
'location_id' =>
$_location_id,
+ 'control_id' =>
$filter_control_id,
'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(),
)
@@ -789,6 +834,7 @@
'entity_group_id' =>
$entity_group_id,
'exclude_locations' =>
$exclude_locations,
'location_id' => $_location_id,
+ 'control_id' =>
$filter_control_id,
'district_id' => $district_id,
'location_code' =>
$location_code,
'org_units' => $this->org_units,
@@ -802,6 +848,8 @@
}
$all_components = array();
+ $control_names = array();
+
$components_with_calendar_array = array();
// _debug_array($items);
foreach ($items as $_item)
@@ -830,7 +878,7 @@
{
continue;
}
- $controls_at_component =
$so_control->get_controls_at_component2($_item);
+ $controls_at_component =
$so_control->get_controls_at_component2($_item, $filter_control_id);
foreach ($controls_at_component as $component)
{
@@ -842,6 +890,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 +922,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 +982,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 +1006,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 +1034,8 @@
);
}
+ $data['control_id'] = $type_array[2];
+ $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 +1170,9 @@
$short_description .= ' [' .
$component['loc1_name'] . ']';
}
+
+ $data['control_id'] = 0;
+ $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 +1189,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'] = '';
@@ -1146,7 +1202,7 @@
}
else if ($choose_master)
{
- $row['choose'] = "<input
id=\"master_component\" type=\"radio\" name=\"master_component\" value =
\"{$entry['location_id']}_{$entry['component_id']}\" >";
+ $row['choose'] = "<input
id=\"master_component\" type=\"radio\" name=\"master_component\" value =
\"{$entry['location_id']}_{$entry['component_id']}_{$entry['control_id']}\" >";
}
$row['year'] = $year;
$row['descr'] =
"Frekvens<br/>Status<br/>Utførende<br/>Tidsbruk";
Modified: branches/Version-2_0-branch/controller/inc/class.uiprocedure.inc.php
===================================================================
--- branches/Version-2_0-branch/controller/inc/class.uiprocedure.inc.php
2017-11-26 14:07:03 UTC (rev 17366)
+++ branches/Version-2_0-branch/controller/inc/class.uiprocedure.inc.php
2017-11-27 09:23:03 UTC (rev 17367)
@@ -208,6 +208,8 @@
'id' => $procedure_id));
}
+ $error = false;
+
if (isset($_POST['save_procedure'])) // The user has
pressed the save button
{
if (!$this->add && !$this->edit)
@@ -217,6 +219,13 @@
'id' => $procedure_id));
}
+ $start_date = phpgw::get_var('start_date',
'date');
+ if (!$start_date)
+ {
+
phpgwapi_cache::message_set(lang('missing start date'), 'error');
+ $error = true;
+ }
+
if (isset($procedure)) // Edit procedure
{
$description_txt =
phpgw::get_var('description', 'html');
@@ -233,7 +242,7 @@
$procedure->set_description($description_txt);
$procedure->set_reference($reference_txt);
$procedure->set_attachment(phpgw::get_var('attachment'));
-
$procedure->set_start_date(phpgw::get_var('start_date', 'date'));
+ $procedure->set_start_date($start_date);
$procedure->set_end_date(phpgw::get_var('end_date', 'date'));
$procedure->set_revision_date(phpgw::get_var('revision_date', 'date'));
$procedure->set_control_area_id(phpgw::get_var('control_area'));
@@ -251,12 +260,24 @@
if (isset($procedure_id) &&
$procedure_id > 0)
{
$proc_id = $procedure_id;
+ $this->so->transaction_begin();
if
($this->so->store($procedure))
{
+ $revised_procedures =
$this->so->get_other_revisions($procedure->get_id());
+ $old_revision_arr =
end($revised_procedures);
+
if(!empty($old_revision_arr['id']))
+ {
+ $old_revision =
$this->so->get_single($old_revision_arr['id']);
+
$old_revision->set_end_date($procedure->get_start_date());
+
$this->so->store($old_revision);
+
+ }
$message =
lang('messages_saved_form');
+
$this->so->transaction_commit();
}
else
{
+
$this->so->transaction_abort();
$error =
lang('messages_form_error');
}
}
@@ -445,8 +466,8 @@
$GLOBALS['phpgw']->jqcal->add_listener('end_date');
$GLOBALS['phpgw']->jqcal->add_listener('revision_date');
- $end_date =
$GLOBALS['phpgw']->common->show_date($procedure->get_end_date(), $dateformat);
- $revision_date =
$GLOBALS['phpgw']->common->show_date($procedure->get_revision_date(),
$dateformat);
+ $end_date =
$GLOBALS['phpgw']->common->show_date($procedure->get_end_date(),
$this->dateformat);
+ $revision_date =
$GLOBALS['phpgw']->common->show_date($procedure->get_revision_date(),
$this->dateformat);
$data = array
@@ -454,7 +475,7 @@
'tabs' =>
phpgwapi_jquery::tabview_generate($tabs, 'procedure', 'procedure_tabview'),
'view' => "view_procedure",
'value_id' => !empty($procedure) ?
$procedure->get_id() : 0,
- 'start_date' =>
$GLOBALS['phpgw']->common->show_date($procedure->get_start_date() ?
$procedure->get_start_date() : time(), $dateformat),
+ 'start_date' =>
$GLOBALS['phpgw']->common->show_date($procedure->get_start_date() ?
$procedure->get_start_date() : time(), $this->dateformat),
'end_date' => $end_date ? $end_date :
'',
'revision_date' => $revision_date ?
$revision_date : '',
'editable' => true,
@@ -465,6 +486,7 @@
$GLOBALS['phpgw_info']['flags']['app_header'] =
lang('controller') . '::' . lang('Procedure');
+
phpgwapi_jquery::formvalidator_generate(array('date', 'security','file'));
$this->use_yui_editor(array('responsibility',
'description', 'reference'));
Modified:
branches/Version-2_0-branch/controller/inc/model/class.procedure.inc.php
===================================================================
--- branches/Version-2_0-branch/controller/inc/model/class.procedure.inc.php
2017-11-26 14:07:03 UTC (rev 17366)
+++ branches/Version-2_0-branch/controller/inc/model/class.procedure.inc.php
2017-11-27 09:23:03 UTC (rev 17367)
@@ -265,4 +265,16 @@
$this->documents[$new_document_id] =
$new_document;
}
}
+
+ public function validates()
+ {
+ if (!$this->get_start_date())
+ {
+// phpgwapi_cache::message_set(lang('missing start
date'), 'error');
+// return false;
+ }
+
+ return true;
+ }
+
}
\ No newline at end of file
Modified:
branches/Version-2_0-branch/controller/js/controller/component.index.js
===================================================================
--- branches/Version-2_0-branch/controller/js/controller/component.index.js
2017-11-26 14:07:03 UTC (rev 17366)
+++ branches/Version-2_0-branch/controller/js/controller/component.index.js
2017-11-27 09:23:03 UTC (rev 17367)
@@ -40,6 +40,15 @@
{
update_table();
+ $("#location_name").focusout(function ()
+ {
+ if($("#location_code").val() && $(this).val() == false)
+ {
+ $("#location_code").val('');
+ update_table('');
+ }
+ });
+
$("#location_name").on("autocompleteselect", function (event, ui)
{
var location_code = ui.item.value;
@@ -232,6 +241,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: branches/Version-2_0-branch/controller/setup/phpgw_no.lang
===================================================================
--- branches/Version-2_0-branch/controller/setup/phpgw_no.lang 2017-11-26
14:07:03 UTC (rev 17366)
+++ branches/Version-2_0-branch/controller/setup/phpgw_no.lang 2017-11-27
09:23:03 UTC (rev 17367)
@@ -407,4 +407,5 @@
document types controller no Dokumenttyper
Do not edit archived version controller no Du kan ikke endre
arkiverte versjoner
choose a location controller no Velg en lokasjon
-deadline end of year controller no Frist på slutten av året for
årskontroller
\ No newline at end of file
+deadline end of year controller no Frist på slutten av året for
årskontroller
+missing start date controller no Mangler startdato
\ No newline at end of file
Modified: branches/Version-2_0-branch/controller/templates/base/component.xsl
===================================================================
--- branches/Version-2_0-branch/controller/templates/base/component.xsl
2017-11-26 14:07:03 UTC (rev 17366)
+++ branches/Version-2_0-branch/controller/templates/base/component.xsl
2017-11-27 09:23:03 UTC (rev 17367)
@@ -296,6 +296,8 @@
</td>
<td id='total_records'>
</td>
+ <td id='control_text'>
+ </td>
<td id='sum_text'>
</td>
<td id='month0'>
Modified:
branches/Version-2_0-branch/controller/templates/base/procedure/procedure_item.xsl
===================================================================
---
branches/Version-2_0-branch/controller/templates/base/procedure/procedure_item.xsl
2017-11-26 14:07:03 UTC (rev 17366)
+++
branches/Version-2_0-branch/controller/templates/base/procedure/procedure_item.xsl
2017-11-27 09:23:03 UTC (rev 17367)
@@ -9,7 +9,7 @@
<div class="yui-content">
<div id="details">
- <form action="#" method="post">
+ <form action="#" method="post" id="form">
<input type="hidden" name="id" value =
"{value_id}">
</input>
<dl class="proplist-col">
@@ -62,6 +62,12 @@
<xsl:choose>
<xsl:when
test="editable">
<input
type="text" id="start_date" name="start_date" size="10" value="{start_date}"
readonly="readonly">
+
<xsl:attribute name="data-validation">
+
<xsl:text>required</xsl:text>
+
</xsl:attribute>
+
<xsl:attribute name="data-validation-error-msg">
+
<xsl:value-of select="php:function('lang','missing start date')" />
+
</xsl:attribute>
</input>
</xsl:when>
<xsl:otherwise>
Modified: branches/Version-2_0-branch/property/inc/class.soentity.inc.php
===================================================================
--- branches/Version-2_0-branch/property/inc/class.soentity.inc.php
2017-11-26 14:07:03 UTC (rev 17366)
+++ branches/Version-2_0-branch/property/inc/class.soentity.inc.php
2017-11-27 09:23:03 UTC (rev 17367)
@@ -867,6 +867,8 @@
if ($check_for_control && !$control_registered)
{
+ $filtermethod .= " $where (control_id =
$control_id OR control_id IS NULL)";
+ $where = 'AND';
$sql .= "{$this->left_join} {$join_control}";
$sql_custom_field .= ',count(control_id) AS
has_control';
Modified: branches/Version-2_0-branch/property/inc/class.solocation.inc.php
===================================================================
--- branches/Version-2_0-branch/property/inc/class.solocation.inc.php
2017-11-26 14:07:03 UTC (rev 17366)
+++ branches/Version-2_0-branch/property/inc/class.solocation.inc.php
2017-11-27 09:23:03 UTC (rev 17367)
@@ -293,7 +293,7 @@
$this->db->query($sql, __LINE__, __FILE__);
$attribs = array();
-
+
while ($this->db->next_record())
{
$id = $this->db->f('id');
@@ -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;
@@ -392,7 +393,7 @@
$sql = $this->socommon->fm_cache('sql_' . $type_id .
'_lt' . $lookup_tenant . '_l' . $lookup . '_f' . !!$filter_role_on_contact);
if(empty($location_id))
{
- $location_id =
$GLOBALS['phpgw']->locations->get_id('property', ".location.{$type_id}");
+ $location_id =
$GLOBALS['phpgw']->locations->get_id('property', ".location.{$type_id}");
}
// $choice_table = 'phpgw_cust_choice';
@@ -665,30 +666,75 @@
$sub_query_street =
$this->socommon->fm_cache('sub_query_street_' . $type_id . '_' . $lookup_tenant
. '_' . $lookup);
}
+ $items_with_control = array();
$filtermethod = '';
$where = 'WHERE';
- if ($control_registered && $control_id)
+ /**
+ * From old scheme:
controller.uicontrol_register_to_location.index
+ */
+ 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)
+ }// from new scheme controller.uicomponent.index
+ else if ($check_for_control)
{
- $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_with_control = "SELECT DISTINCT
fm_location{$type_id}.id as item_id"
+ . " FROM fm_location{$type_id} {$this->join}
controller_control_component_list"
+ . " ON
controller_control_component_list.component_id = fm_location{$type_id}.id"
+ . " {$this->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)";
+
+ if($control_id)
+ {
+ $sql_with_control .= " WHERE control_id
= {$control_id}";
+ }
+
+ $this->db->query($sql_with_control);
+ $items_with_control = array_merge(array(-1),
$filter_item);
while ($this->db->next_record())
{
- $items[] = $this->db->f('item_id');
+ $items_with_control[] =
(int)$this->db->f('item_id');
}
- $filtermethod .= " $where
fm_location{$type_id}.id IN (". implode(',', $items) . ')';
+
+ /**
+ * reset for later use
+ */
+ $filter_item = array();
+
+ if($control_registered)
+ {
+ $filtermethod .= " $where
fm_location{$type_id}.id IN (". implode(',', $items_with_control) . ')';
+
+ }
+ else
+ {
+ $sql_without_control = "SELECT DISTINCT
fm_location{$type_id}.id as item_id"
+ . " FROM fm_location{$type_id}
{$this->left_join} controller_control_component_list"
+ . " ON
controller_control_component_list.component_id = fm_location{$type_id}.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_without_control = array();
+ while ($this->db->next_record())
+ {
+ $items_without_control[] =
(int)$this->db->f('item_id');
+ }
+
+ $filtermethod .= " $where
fm_location{$type_id}.id IN (". implode(',',
array_merge($items_without_control, $items_with_control)) . ')';
+ }
+
$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 +1105,7 @@
{
return array();
}
-
+// _debug_array($sql);
if (!$allrows)
{
$this->db->limit_query($sql . $ordermethod,
$start, __LINE__, __FILE__, $results);
@@ -1105,6 +1151,15 @@
$this->db->set_fetch_single(false);
$values = $this->custom->translate_value($dataset,
$location_id, $location_count);
+
+ if ($check_for_control)
+ {
+ foreach ($values as &$value)
+ {
+ $value['has_control'] =
!!in_array($value['id'], $items_with_control);
+ }
+ }
+
return $values;
}
@@ -1302,7 +1357,7 @@
$location_array = explode('-', $location_code);
$type_id = count($location_array);
-
+
$location_id = !empty($values['location_id']) ? (int)
$values['location_id'] : null;
/**
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Fmsystem-commits] [17367] Stable: Merge 17362:17366 from trunk,
sigurdne <=