fmsystem-commits
[Top][All Lists]
Advanced

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

[Fmsystem-commits] [17278] Stable: Merge 17215:17277 from trunk


From: sigurdne
Subject: [Fmsystem-commits] [17278] Stable: Merge 17215:17277 from trunk
Date: Tue, 7 Nov 2017 10:52:20 -0500 (EST)

Revision: 17278
          http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=17278
Author:   sigurdne
Date:     2017-11-07 10:52:19 -0500 (Tue, 07 Nov 2017)
Log Message:
-----------
Stable: Merge 17215:17277 from trunk

Modified Paths:
--------------
    branches/Version-2_0-branch/controller/inc/class.menu.inc.php
    branches/Version-2_0-branch/controller/inc/class.socheck_list.inc.php
    branches/Version-2_0-branch/controller/inc/class.uicase.inc.php
    branches/Version-2_0-branch/controller/inc/class.uicheck_list.inc.php
    branches/Version-2_0-branch/controller/inc/class.uicomponent.inc.php
    branches/Version-2_0-branch/controller/setup/phpgw_no.lang
    
branches/Version-2_0-branch/controller/templates/base/case/create_case_message.xsl
    
branches/Version-2_0-branch/controller/templates/base/case/view_case_message.xsl
    
branches/Version-2_0-branch/controller/templates/base/check_list/fragments/check_list_top_section.xsl
    
branches/Version-2_0-branch/controller/templates/base/check_list/fragments/nav_control_plan.xsl
    branches/Version-2_0-branch/phpgwapi/inc/class.login.inc.php
    branches/Version-2_0-branch/phpgwapi/inc/class.uicommon_jquery.inc.php
    branches/Version-2_0-branch/phpgwapi/inc/functions.inc.php
    branches/Version-2_0-branch/property/inc/class.bolocation.inc.php
    branches/Version-2_0-branch/property/inc/class.controller_helper.inc.php
    branches/Version-2_0-branch/property/inc/class.custom_fields.inc.php
    branches/Version-2_0-branch/property/inc/class.solocation.inc.php
    branches/Version-2_0-branch/property/inc/class.soresponsible.inc.php
    branches/Version-2_0-branch/property/inc/class.uiadmin_entity.inc.php
    branches/Version-2_0-branch/property/inc/class.uientity.inc.php
    branches/Version-2_0-branch/property/inc/class.uilocation.inc.php
    branches/Version-2_0-branch/property/inc/class.uitts.inc.php
    
branches/Version-2_0-branch/property/js/portico/admin_entity.edit_category.js
    branches/Version-2_0-branch/property/js/portico/entity.edit.js
    branches/Version-2_0-branch/property/js/portico/location.edit.js
    branches/Version-2_0-branch/property/templates/base/admin_entity.xsl
    branches/Version-2_0-branch/property/templates/base/location.xsl
    branches/Version-2_0-branch/setup/accounts.php

Property Changed:
----------------
    branches/Version-2_0-branch/

Index: branches/Version-2_0-branch
===================================================================
--- branches/Version-2_0-branch 2017-11-07 12:56:13 UTC (rev 17277)
+++ branches/Version-2_0-branch 2017-11-07 15:52:19 UTC (rev 17278)

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
\ 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
\ No newline at end of property
Modified: branches/Version-2_0-branch/controller/inc/class.menu.inc.php
===================================================================
--- branches/Version-2_0-branch/controller/inc/class.menu.inc.php       
2017-11-07 12:56:13 UTC (rev 17277)
+++ branches/Version-2_0-branch/controller/inc/class.menu.inc.php       
2017-11-07 15:52:19 UTC (rev 17278)
@@ -110,6 +110,11 @@
                                'url' => $GLOBALS['phpgw']->link('/index.php', 
array('menuaction' => 'controller.uicomponent.index')),
                                'image' => array('property', 'location_1'),
                        );
+                       $menus['navigation']['status_locations'] = array(
+                               'text' => lang('status locations'),
+                               'url' => $GLOBALS['phpgw']->link('/index.php', 
array('menuaction' => 'controller.uicomponent.index', 'get_locations' => true)),
+                               'image' => array('property', 'location_1'),
+                       );
 
                        if ($GLOBALS['phpgw']->acl->check('run', 
phpgwapi_acl::READ, 'admin') || $GLOBALS['phpgw']->acl->check('admin', 
phpgwapi_acl::ADD, 'controller'))
                        {

Modified: branches/Version-2_0-branch/controller/inc/class.socheck_list.inc.php
===================================================================
--- branches/Version-2_0-branch/controller/inc/class.socheck_list.inc.php       
2017-11-07 12:56:13 UTC (rev 17277)
+++ branches/Version-2_0-branch/controller/inc/class.socheck_list.inc.php       
2017-11-07 15:52:19 UTC (rev 17278)
@@ -686,7 +686,7 @@
 
                        if ($repeat_type != null)
                        {
-                               $sql .= "AND c.repeat_type = $repeat_type ";
+                               $sql .= "AND cs.repeat_type = $repeat_type ";
                        }
 
 //             if($user_id)

Modified: branches/Version-2_0-branch/controller/inc/class.uicase.inc.php
===================================================================
--- branches/Version-2_0-branch/controller/inc/class.uicase.inc.php     
2017-11-07 12:56:13 UTC (rev 17277)
+++ branches/Version-2_0-branch/controller/inc/class.uicase.inc.php     
2017-11-07 15:52:19 UTC (rev 17278)
@@ -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: branches/Version-2_0-branch/controller/inc/class.uicheck_list.inc.php
===================================================================
--- branches/Version-2_0-branch/controller/inc/class.uicheck_list.inc.php       
2017-11-07 12:56:13 UTC (rev 17277)
+++ branches/Version-2_0-branch/controller/inc/class.uicheck_list.inc.php       
2017-11-07 15:52:19 UTC (rev 17278)
@@ -110,8 +110,8 @@
                }
 
                /**
-                * Public function for displaying checklists  
-                * 
+                * Public function for displaying checklists
+                *
                 * @param HTTP:: phpgw_return_as
                 * @return data array
                 */
@@ -208,7 +208,7 @@
 
                /**
                 * Public function for displaying the add check list form
-                * 
+                *
                 * @param HTTP:: location code, control id, date
                 * @return data array
                 */
@@ -268,6 +268,7 @@
                                $level = 
$this->location_finder->get_location_level($location_code);
                        }
 
+                       $get_locations = false;
 
                        if ($type == "component")
                        {
@@ -279,28 +280,47 @@
                                        
$check_list->set_component_id($component_id);
                                }
 
-                               $component_arr = 
execMethod('property.soentity.read_single_eav', array('location_id' => 
$location_id,
-                                       'id' => $component_id));
 
-                               $location_code = 
$component_arr['location_code'];
+                               $location_info = 
$GLOBALS['phpgw']->locations->get_name($location_id);
 
-                               $check_list->set_location_code($location_code);
-                               $location_array = 
execMethod('property.bolocation.read_single', array('location_code' => 
$check_list->get_location_code()));
-                               $level = 
$this->location_finder->get_location_level($location_code);
+                               if (substr($location_info['location'], 1, 8) == 
'location')
+                               {
+                                       $get_locations = true;
 
-                               $location_name = 
execMethod('property.bolocation.get_location_name', 
$component_arr['location_code']);
+                                       $type_info = explode('.', 
$location_info['location']);
+                                       $level = $type_info[2];
+                                       $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_code = 
$component_arr['location_code'];
+                                       
$check_list->set_location_code($location_code);
+                                       $location_array = 
execMethod('property.bolocation.read_single', array('location_code' => 
$check_list->get_location_code()));
+                                       $level = 
$this->location_finder->get_location_level($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));
+
+                               }
+
                                $component = new controller_component();
                                $component->set_id($component_id);
                                $component->set_location_id($location_id);
-                               
$component->set_location_code($component_arr['location_code']);
+                               $component->set_location_code($location_code);
                                $component->set_xml_short_desc($short_desc);
 
                                $component_array = $component->toArray();
-                               $building_location_code = 
$this->location_finder->get_building_location_code($component_arr['location_code']);
+                               $building_location_code = 
$this->location_finder->get_building_location_code($location_code);
 
                                $type = "component";
                        }
@@ -372,6 +392,7 @@
                                'user_list' => array('options' => 
$user_list_options),
                                'location_array' => $location_array,
                                'component_array' => $component_array,
+                               'get_locations' => $get_locations,
                                'control' => $control,
                                'check_list' => $check_list,
                                'buildings_on_property' => 
$buildings_on_property,
@@ -400,8 +421,8 @@
                }
 
                /**
-                * Public function for displaying the edit check list form  
-                * 
+                * Public function for displaying the edit check list form
+                *
                 * @param HTTP:: check list id
                 * @return data array
                 */
@@ -435,6 +456,7 @@
                        }
 
                        $component_id = $check_list->get_component_id();
+                       $get_locations = false;
 
                        if ($component_id > 0)
                        {
@@ -441,13 +463,33 @@
                                $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']);
 
-                               $short_desc = $location_name . '::' . 
execMethod('property.soentity.get_short_description', array(
-                                               'location_id' => $location_id, 
'id' => $component_id));
+                               $location_info = 
$GLOBALS['phpgw']->locations->get_name($location_id);
 
+                               if (substr($location_info['location'], 1, 8) == 
'location')
+                               {
+                                       $get_locations = true;
+                                       $type_info = explode('.', 
$location_info['location']);
+                                       $level = $type_info[2];
+                                       $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_code = 
$component_arr['location_code'];
+                                       $location_name = 
execMethod('property.bolocation.get_location_name', $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_id($component_id);
                                $component->set_location_id($location_id);
@@ -456,7 +498,7 @@
                                $component_array = $component->toArray();
 
                                $type = 'component';
-                               $building_location_code = 
$this->location_finder->get_building_location_code($component_arr['location_code']);
+                               $building_location_code = 
$this->location_finder->get_building_location_code($location_code);
                        }
                        else
                        {
@@ -500,7 +542,8 @@
                                'user_list' => array('options' => 
$user_list_options),
                                'control' => $control,
                                'check_list' => $check_list,
-                               '$buildings_on_property' => 
$buildings_on_property,
+                               'buildings_on_property' => 
$buildings_on_property,
+                               'get_locations' => $get_locations,
                                'location_array' => $location_array,
                                'component_array' => $component_array,
                                'type' => $type,
@@ -661,8 +704,8 @@
 
                /**
                 * Public function for saving a check list
-                * 
-                * @param HTTP:: location code, control id, status etc.. (check 
list details) 
+                *
+                * @param HTTP:: location code, control id, status etc.. (check 
list details)
                 * @return data array
                 */
                function save_check_list()
@@ -813,12 +856,29 @@
 
                                        if ($check_list->get_component_id() > 0)
                                        {
-                                               $component_arr = 
execMethod('property.soentity.read_single_eav', array('location_id' => 
$check_list->get_location_id(),
-                                                       'id' => 
$check_list->get_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_info = 
$GLOBALS['phpgw']->locations->get_name($check_list->get_location_id());
+
+                                               if 
(substr($location_info['location'], 1, 8) == 'location')
+                                               {
+                                                       $type_info = 
explode('.', $location_info['location']);
+                                                       $level = $type_info[2];
+                                                       $item_arr = 
createObject('property.solocation')->read_single('', array('location_id' => 
$check_list->get_location_id(),
+                                                               'id' => 
$component_id), true);
+                                                       $location_code = 
$item_arr['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' => 
$check_list->get_location_id(),
+                                                               'id' => 
$check_list->get_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' 
=> $check_list->get_location_id(), 'id' => $check_list->get_component_id()));
-                                               $location = $location_name;
+                                               }
+
                                        }
 
                                        $repeat_type_array = array
@@ -959,10 +1019,10 @@
                                        'document_date' => 
$GLOBALS['phpgw']->common->show_date($entry['document_date'], 
$GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat']),
                                );
                        }
-               
+
                        $generic_document = 
CreateObject('property.sogeneric_document');
                        $params['location_id'] = $location_id;
-                       $params['order'] = 'name';              
+                       $params['order'] = 'name';
                        $params['allrows'] = true;
                        $generic_document_list = array();
                        foreach ($doc_types as $doc_type)
@@ -973,7 +1033,7 @@
                                        $generic_document_list = 
array_merge($generic_document_list, $generic_document->read($params));
                                }
                        }
-                       
+
                        foreach ($generic_document_list as $entry)
                        {
                                $link_file_data = array
@@ -989,8 +1049,8 @@
                                        'file_name' => '<a href="' . 
$GLOBALS['phpgw']->link('/index.php', $link_file_data) . "\" target='_blank' 
title='{$lang_view}'>{$entry['name']}</a>"
                                );
                        }
-                               
-                       
+
+
                        return $values;
                }
 
@@ -1060,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);
@@ -1109,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,
@@ -1210,7 +1288,7 @@
                                        'control_items' => $saved_control_items
                                        );
                        }
-       
+
                        $data = array
                                (
                                'saved_groups_with_items_array' => 
$saved_groups_with_items_array,
@@ -1232,7 +1310,7 @@
                        return json_encode($check_list);
                }
 
-               // Returns open cases for a check list as JSON 
+               // Returns open cases for a check list as JSON
                public function get_cases_for_check_list()
                {
                        $check_list_id = phpgw::get_var('check_list_id');
@@ -1244,7 +1322,7 @@
 
                /**
                 * Public function for updateing status for a check list
-                * 
+                *
                 * @return json encoded array with status saved or not saved
                 */
                public function update_status()
@@ -1448,7 +1526,7 @@
                }
 
                /**
-                * 
+                *
                 * @param string $from_name
                 * @param string $from_address
                 * @param string $to_name

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-07 12:56:13 UTC (rev 17277)
+++ branches/Version-2_0-branch/controller/inc/class.uicomponent.inc.php        
2017-11-07 15:52:19 UTC (rev 17278)
@@ -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,42 +129,80 @@
                        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))
                        {
-                               $this->soadmin_entity = 
CreateObject('property.soadmin_entity');
-                               $entity_list = 
$this->soadmin_entity->read(array('allrows' => true));
+                               $location_filter = array();
 
-                               $location_filter = array();
-                               foreach ($entity_list as $entry)
+                               if ($this->is_location($location_id))
                                {
-                                       $categories = 
$this->soadmin_entity->read_category(array('entity_id' => $entry['id'],
-                                               'order' => 'name', 'sort' => 
'asc', 'enable_controller' => true, 'allrows' => true));
-                                       foreach ($categories as $category)
+                                       $location_types = 
CreateObject('property.soadmin_location')->read(array('allrows' => true));
+                                       foreach ($location_types as 
$location_type)
                                        {
-
-                                               if 
($category['enable_controller'])
+                                               if 
($location_type['enable_controller'])
                                                {
-                                                       if ($entity_group_id && 
$category['entity_group_id'] != $entity_group_id)
-                                                       {
-                                                               continue;
-                                                       }
-                                                       $sort_arr = explode(' 
', $category['name']);
                                                        $location_filter[] = 
array
                                                                (
-                                                               'id' => 
$category['location_id'],
-                                                               'name' => 
"{$entry['name']}::{$category['name']}",
-                                                               'sort_key' => 
trim($sort_arr[0])
+                                                               'id' => 
$GLOBALS['phpgw']->locations->get_id('property', 
".location.{$location_type['id']}"),
+                                                               'name' => 
$location_type['name'],
+                                                               'sort_key' => 
$location_type['id']
                                                        );
                                                }
                                        }
                                }
+                               else
+                               {
+                                       $this->soadmin_entity = 
CreateObject('property.soadmin_entity');
+                                       $entity_list = 
$this->soadmin_entity->read(array('allrows' => true));
+
+                                       $location_filter = array();
+                                       foreach ($entity_list as $entry)
+                                       {
+                                               $categories = 
$this->soadmin_entity->read_category(array('entity_id' => $entry['id'],
+                                                       'order' => 'name', 
'sort' => 'asc', 'enable_controller' => true, 'allrows' => true));
+                                               foreach ($categories as 
$category)
+                                               {
+
+                                                       if 
($category['enable_controller'])
+                                                       {
+                                                               if 
($entity_group_id && $category['entity_group_id'] != $entity_group_id)
+                                                               {
+                                                                       
continue;
+                                                               }
+                                                               $sort_arr = 
explode(' ', $category['name']);
+                                                               
$location_filter[] = array
+                                                                       (
+                                                                       'id' => 
$category['location_id'],
+                                                                       'name' 
=> "{$entry['name']}::{$category['name']}",
+                                                                       
'sort_key' => trim($sort_arr[0])
+                                                               );
+                                                       }
+                                               }
+                                       }
+                               }
+
                                // Obtain a list of columns
                                foreach ($location_filter as $key => $row)
                                {
@@ -164,6 +212,7 @@
                                array_multisort($id, SORT_ASC, SORT_STRING, 
$location_filter);
                                phpgwapi_cache::session_set('controller', 
"location_filter_{$entity_group_id}", $location_filter);
                        }
+
                        foreach ($location_filter as &$location)
                        {
                                $location['selected'] = $location['id'] == 
$location_id ? 1 : 0;
@@ -242,7 +291,8 @@
 
                        $year_list = array();
 
-                       $year = date('Y');
+                       $year = phpgw::get_var('year', 'int');
+                       $year = $year ? $year : date('Y');
                        for ($_year = ($year - 2); $_year < ($year + 5); 
$_year++)
                        {
                                $year_list[] = array
@@ -266,7 +316,10 @@
                        $data = array(
                                'datatable_name' => lang('status components'),
                                'form' => array(
-                                       'action' => 
self::link(array('menuaction' => 'controller.uicomponent.index')),
+                                       'action' => 
self::link(array('menuaction' => 'controller.uicomponent.index',
+                                               'get_locations' => 
phpgw::get_var('get_locations', 'bool'),
+                                               )
+                                       ),
                                        'method' => 'POST',
                                        'toolbar' => array(
                                                'item' => array(
@@ -273,7 +326,8 @@
                                                        array('type' => 
'filter',
                                                                'name' => 
'report_type',
                                                                'text' => 
lang('report type'),
-                                                               'list' => 
array(array('id' => 'components', 'name' => lang('components')),
+                                                               'list' => array(
+                                                                       
array('id' => 'components', 'name' => lang('details')),
                                                                        
array('id' => 'summary', 'name' => lang('summary'))),
                                                                'onchange' => 
'update_table();'
                                                        ),
@@ -290,7 +344,7 @@
                                                        ),
                                                        array('type' => 
'filter',
                                                                'name' => 
'location_id',
-                                                               'text' => 
lang('component'),
+                                                               'text' => 
'Register',
                                                                'list' => 
array(),
                                                                'onchange' => 
'update_table();'
                                                        ),
@@ -556,6 +610,7 @@
 
                public function query()
                {
+                       $get_locations = phpgw::get_var('get_locations', 
'bool');
                        $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');
@@ -612,12 +667,19 @@
                                $location_type_name[$_location['id']] = 
$_location['name'];
                        }
 //                     _debug_array($location_type_name);
-                       $components = array();
+                       $items = array();
                        $keep_only_assigned_to = 0;
 
 //                     $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;
@@ -624,20 +686,40 @@
                                $all_items = false;
 
                                $keep_only_assigned_to = $user_id;
-                               $assigned_components = 
$so_control->get_assigned_control_components($from_date_ts, $to_date_ts, 
$assigned_to = $user_id);
-                               foreach ($assigned_components as $_location_id 
=> $component_list)
+                               $assigned_items = 
$so_control->get_assigned_control_components($from_date_ts, $to_date_ts, 
$assigned_to = $user_id);
+
+                               if(empty($get_locations))
                                {
-                                       $_components = 
execMethod('property.soentity.read', array(
-                                               'filter_entity_group' => 
$entity_group_id,
-                                               'location_id' => $_location_id,
-                                               'district_id' => $district_id,
-                                               'location_code' => 
$location_code,
-                                               'allrows' => true,
-                                               'filter_item' => $component_list
-                                               )
-                                       );
-                                       $components = array_merge($components, 
$_components);
+                                       foreach ($assigned_items as 
$_location_id => $item_list)
+                                       {
+                                               $_items = 
execMethod('property.soentity.read', array(
+                                                       'filter_entity_group' 
=> $entity_group_id,
+                                                       'location_id' => 
$_location_id,
+                                                       'district_id' => 
$district_id,
+                                                       'location_code' => 
$location_code,
+                                                       'allrows' => true,
+                                                       'filter_item' => 
$item_list
+                                                       )
+                                               );
+                                               $items = array_merge($items, 
$_items);
+                                       }
                                }
+                               else
+                               {
+                                       foreach ($assigned_items as 
$_location_id => $item_list)
+                                       {
+                                               $_items = 
execMethod('property.solocation.read', array(
+                                                       'filter_entity_group' 
=> $entity_group_id,
+                                                       'location_id' => 
$_location_id,
+                                                       'district_id' => 
$district_id,
+                                                       'location_code' => 
$location_code,
+                                                       'allrows' => true,
+                                                       'filter_item' => 
$item_list
+                                                       )
+                                               );
+                                               $items = array_merge($items, 
$_items);
+                                       }
+                               }
                        }
                        else if (!$location_id)
                        {
@@ -664,28 +746,46 @@
                                        $_location_id = 
(int)$_location_filter['id'];
                                        $exclude_locations[] = $_location_id;
 
-                                       $location_filter_options = 
$this->_get_location_filter_options($_location_id);
 
-                                       $_components = 
execMethod('property.soentity.read', array(
-                                               'filter_entity_group' => 
$entity_group_id,
-                                               'location_id' => $_location_id,
-                                               'district_id' => $district_id,
-                                               'location_code' => 
$location_code,
-                                               'org_units' => $this->org_units,
-                                               'allrows' => true,
-                                               'control_registered' => 
!$all_items,
-                                               'check_for_control' => true,
-                                               'filter_item' => 
$filter_component ? array($filter_component) : array(),
-                                               'attrib_filter' => 
$this->_get_attrib_filter($_location_id)
-                                               )
-                                       );
-                                       $components = array_merge($components, 
$_components);
+                                       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,
+                                                       'district_id' => 
$district_id,
+                                                       'location_code' => 
$location_code,
+                                                       'org_units' => 
$this->org_units,
+                                                       'allrows' => true,
+                                                       'control_registered' => 
!$all_items,
+                                                       'check_for_control' => 
true,
+                                                       'filter_item' => 
$filter_component ? array($filter_component) : array(),
+                                                       'attrib_filter' => 
$this->_get_attrib_filter($_location_id)
+                                                       )
+                                               );
+                                               $items = array_merge($items, 
$_items);
+                                       }
+                                       else
+                                       {
+                                               $_items = 
execMethod('property.solocation.read', array(
+                                                       'filter_entity_group' 
=> $entity_group_id,
+                                                       '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(),
+                                                       )
+                                               );
+                                               $items = array_merge($items, 
$_items);
+                                       }
+
                                }
 
                                if ($lookup_stray_items)
                                {
-                                       $_components = 
execMethod('property.soentity.read_entity_group', array(
+                                       $_items = 
execMethod('property.soentity.read_entity_group', array(
                                                'entity_group_id' => 
$entity_group_id,
                                                'exclude_locations' => 
$exclude_locations,
                                                'location_id' => $_location_id,
@@ -697,27 +797,40 @@
                                                'check_for_control' => true
                                                )
                                        );
-                                       $components = array_merge($components, 
$_components);
+                                       $items = array_merge($items, $_items);
                                }
                        }
 
                        $all_components = array();
                        $components_with_calendar_array = array();
-//                     _debug_array($components);
-                       foreach ($components as $_component)
+//                     _debug_array($items);
+                       foreach ($items as $_item)
                        {
-                               $location_id = $_component['location_id'];
-                               $component_id = $_component['id'];
-                               
$all_components["{$location_id}_{$component_id}"] = $_component;
+                               $location_id = $_item['location_id'];
+                               $item_id = $_item['id'];
+                               $all_components["{$location_id}_{$item_id}"] = 
$_item;
 
-                               $short_description = 
$_component['short_description'];
-                               $short_description .= ' [' . 
$_component['location_name'] . ']';
+                               if(empty($get_locations))
+                               {
+                                       $short_description = 
$_item['short_description'];
+                                       $short_description .= ' [' . 
$_item['location_name'] . ']';
+                               }
+                               else
+                               {
+                                       $short_description = 
$_item['location_code'];
+                                       $short_description .= ' [' . 
$_item['loc1_name'] . ']';
 
-                               if ($all_items && !$_component['has_control'])
+                               }
+
+                               if (empty($get_locations) && ($all_items && 
!$_item['has_control']))
                                {
                                        continue;
                                }
-                               $controls_at_component = 
$so_control->get_controls_at_component2($_component);
+                               if (!$_item['id'])
+                               {
+                                       continue;
+                               }
+                               $controls_at_component = 
$so_control->get_controls_at_component2($_item);
 
                                foreach ($controls_at_component as $component)
                                {
@@ -759,7 +872,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}_{$component_id}"][] = array(
+                                               
$components_with_calendar_array["{$location_id}_{$item_id}"][] = array(
                                                        "component" => 
$component->toArray(),
                                                        "calendar_array" => 
$calendar_array);
                                        }
@@ -814,12 +927,12 @@
                                                        }
                                                        if (!$found_assigned_to)
                                                        {
-                                                               
unset($all_components["{$location_id}_{$component_id}"]);
+                                                               
unset($all_components["{$location_id}_{$item_id}"]);
                                                                continue;
                                                        }
                                                }
 
-                                               
$components_with_calendar_array["{$location_id}_{$component_id}"][] = array(
+                                               
$components_with_calendar_array["{$location_id}_{$item_id}"][] = array(
                                                        "component" => 
$component->toArray(),
                                                        "calendar_array" => 
$calendar_array);
                                        }
@@ -828,9 +941,9 @@
                        $total_records = count($all_components);
 
 //                     _debug_array($components_with_calendar_array);
-                       unset($component_id);
+                       unset($item_id);
 //                     _debug_array($components_with_calendar_array[1]);
-//                     _debug_array($components);
+//                     _debug_array($items);
 //                     
_debug_array(array_keys($components_with_calendar_array));
                        $repeat_type_array = array
                                (
@@ -844,21 +957,36 @@
                        foreach ($components_with_calendar_array as $dummy => 
$entry)
                        {
                                $location_id = 
$entry[0]['component']['location_id'];
-                               $component_id = $entry[0]['component']['id'];
+                               $item_id = $entry[0]['component']['id'];
+                               $_location_code = 
$entry[0]['component']['location_code'];
 
-                               
unset($all_components["{$location_id}_{$component_id}"]);
+                               
unset($all_components["{$location_id}_{$item_id}"]);
                                $data = array();
-                               $component_link_data = array
-                                       (
-                                       'menuaction' => 
'property.uientity.edit',
-                                       'location_id' => $location_id,
-                                       'id' => $component_id,
-                                       'active_tab' => 'controller'
-                               );
 
-                               $data['component_url'] = '<a href="' . 
$GLOBALS['phpgw']->link('/index.php', $component_link_data) . "\" 
target='_blank'>{$component_id}{$entry[0]['component']['xml_short_desc']}</a>";
-                               $data['component_id'] = $component_id;
+                               if(empty($get_locations))
+                               {
+                                       $item_link_data = array
+                                               (
+                                               'menuaction' => 
'property.uientity.edit',
+                                               'location_id' => $location_id,
+                                               'id' => $item_id,
+                                               'active_tab' => 'controller'
+                                       );
+                               }
+                               else
+                               {
+                                       $item_link_data = array
+                                               (
+                                               'menuaction' => 
'property.uilocation.edit',
+                                               'location_code' => 
$_location_code,
+                                               'active_tab' => 'controller'
+                                       );
+                               }
+
+                               $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;
+                               $data['location_code'] = $_location_code;
 
 
                                $max_interval_length = 0; //number of months
@@ -937,7 +1065,7 @@
                                $values[] = $data;
                        }
                        unset($entry);
-                       unset($component_id);
+                       unset($item_id);
                        unset($component);
 
                        if ($report_type == 'summary')
@@ -957,27 +1085,42 @@
                        $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();
                                        $location_id = 
$component['location_id'];
-                                       $component_id = $component['id'];
+                                       $item_id = $component['id'];
+                                       $_location_code= 
$component['location_code'];
 
-                                       $component_link_data = array
-                                               (
-                                               'menuaction' => 
'property.uientity.edit',
-                                               'location_id' => $location_id,
-                                               'id' => $component_id,
-                                               'active_tab' => 'controller'
-                                       );
+                                       if(empty($get_locations))
+                                       {
+                                               $item_link_data = array
+                                                       (
+                                                       'menuaction' => 
'property.uientity.edit',
+                                                       'location_id' => 
$location_id,
+                                                       'id' => $item_id,
+                                                       'active_tab' => 
'controller'
+                                               );
+                                               $short_description = 
$component['short_description'];
+                                               $short_description .= ' [' . 
$component['location_name'] . ']';
+                                       }
+                                       else
+                                       {
+                                               $item_link_data = array
+                                                       (
+                                                       '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', $component_link_data) . "\" 
target='_blank'>{$component_id} 
{$location_type_name[$location_id]}</br>{$short_description}</a>";
-                                       $data['component_id'] = $component_id;
+                                       $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;
+                                       $data['location_code'] = 
$_location_code;
                                        $data['missing_control'] = true;
                                        $values[] = $data;
                                }
@@ -1015,7 +1158,7 @@
                                $found_at_least_one = false;
                                for ($_month = 1; $_month < 13; $_month++)
                                {
-                                       $row[$_month] = 
$this->translate_calendar_info($entry[$_month], $year, $_month, $filter_status, 
$found_at_least_one, $keep_only_assigned_to);
+                                       $row[$_month] = 
$this->translate_calendar_info($entry[$_month], $year, $_month, $filter_status, 
$found_at_least_one, $keep_only_assigned_to, $entry['location_code']);
                                        if(true)// ($row[$_month] && (!$user_id 
|| $entry[$_month]['info']['assigned_to'] == $user_id))
                                        {
                                                $row_sum[$_month] = 
(float)$entry[$_month]['info']['service_time'] + 
(float)$entry[$_month]['info']['controle_time'];
@@ -1124,7 +1267,7 @@
                        );
                }
 
-               private function translate_calendar_info( $param = array(), 
$year, $month, $filter_status = '', &$found_at_least_one = false, 
$keep_only_assigned_to )
+               private function translate_calendar_info( $param = array(), 
$year, $month, $filter_status = '', &$found_at_least_one = false, 
$keep_only_assigned_to, $location_code ='' )
                {
                        if (!isset($param['repeat_type']))
                        {
@@ -1227,6 +1370,7 @@
                                        'serie_id' => 
$param['info']['serie_id'],
                                        'deadline_ts' => mktime(23, 59, 00, 
$month, date('t', strtotime($a_date)), $year),
                                        'type' => 
$param['info']['component_id'] ? 'component' : '',
+                                       'location_code' => $location_code,
                                        'assigned_to' => 
$param['info']['assigned_to']
                                );
                        }
@@ -1323,7 +1467,7 @@
                                Status
                                </th>
                                <th>
-                                       
+
                                </th>
 HTML;
 

Modified: branches/Version-2_0-branch/controller/setup/phpgw_no.lang
===================================================================
--- branches/Version-2_0-branch/controller/setup/phpgw_no.lang  2017-11-07 
12:56:13 UTC (rev 17277)
+++ branches/Version-2_0-branch/controller/setup/phpgw_no.lang  2017-11-07 
15:52:19 UTC (rev 17278)
@@ -383,6 +383,7 @@
 Status done controller no      Status: Utført
 planned date   common  no      Planlagt Dato
 status components      controller      no      Status komponenter
+status locations       controller      no      Status lokasjoner
 controle time  common  no      Kontrolltid
 service time   common  no      Servicetid
 total time     common  no      Totaltid

Modified: 
branches/Version-2_0-branch/controller/templates/base/case/create_case_message.xsl
===================================================================
--- 
branches/Version-2_0-branch/controller/templates/base/case/create_case_message.xsl
  2017-11-07 12:56:13 UTC (rev 17277)
+++ 
branches/Version-2_0-branch/controller/templates/base/case/create_case_message.xsl
  2017-11-07 15:52:19 UTC (rev 17278)
@@ -1,185 +1,197 @@
 <!-- $Id: edit_check_list.xsl 8374 2011-12-20 07:45:04Z vator $ -->
 <xsl:template match="data" name="view_check_list" 
xmlns:php="http://php.net/xsl";>
 
-<div id="main_content" class="medium">
-       
-       <div id="check-list-heading">
-               <div class="box-1">
-                       <h1>Kontroll: <xsl:value-of 
select="control/title"/></h1>
-                       <xsl:choose>
-                               <xsl:when test="type = 'component'">
-                                       <h2><xsl:value-of 
select="component_array/xml_short_desc"/></h2>
-                               </xsl:when>
-                               <xsl:otherwise>
-                                       <xsl:choose>
-                                               <xsl:when test="location_level 
= 1">
-                                                       <h2>Eiendom: 
<xsl:value-of select="location_array/loc1_name"/></h2>
-                                               </xsl:when>
-                                               <xsl:otherwise>
+       <div id="main_content" class="medium">
+
+               <div id="check-list-heading">
+                       <div class="box-1">
+                               <h1>Kontroll: <xsl:value-of 
select="control/title"/></h1>
+                               <xsl:choose>
+                                       <xsl:when test="type = 'component'">
+                                               <h2>
+                                                       <xsl:value-of 
select="component_array/xml_short_desc"/>
+                                               </h2>
+                                       </xsl:when>
+                                       <xsl:otherwise>
+                                               <xsl:choose>
+                                                       <xsl:when 
test="location_level = 1">
+                                                               <h2>Eiendom: 
<xsl:value-of select="location_array/loc1_name"/></h2>
+                                                       </xsl:when>
+                                                       <xsl:otherwise>
                                                                <h2>Bygg: 
<xsl:value-of select="location_array/loc2_name"/></h2>
-                                               </xsl:otherwise>
-                                       </xsl:choose>
-                               </xsl:otherwise>
-                       </xsl:choose>
+                                                       </xsl:otherwise>
+                                               </xsl:choose>
+                                       </xsl:otherwise>
+                               </xsl:choose>
+                       </div>
+                       <div class="box-2 select-box">
+                               <xsl:choose>
+                                       <xsl:when test="type = 'component'">
+                                               <a>
+                                                       <xsl:attribute 
name="href">
+                                                               <xsl:value-of 
select="php:function('get_phpgw_link', '/index.php', 
'menuaction:controller.uicomponent.index' )" />
+                                                               
<xsl:text>&amp;year=</xsl:text>
+                                                               <xsl:value-of 
select="current_year"/>
+                                                               
<xsl:text>&amp;location_id=</xsl:text>
+                                                               <xsl:value-of 
select="component_array/location_id"/>
+                                                               
<xsl:text>&amp;component_id=</xsl:text>
+                                                               <xsl:value-of 
select="component_array/id"/>
+                                                               
<xsl:text>&amp;get_locations=</xsl:text>
+                                                               <xsl:value-of 
select="get_locations"/>
+                                                       </xsl:attribute>
+                                                       Kontrollplan for 
komponent (Ã¥r)
+                                               </a>
+                                       </xsl:when>
+                                       <xsl:otherwise>
+                                               <a>
+                                                       <xsl:attribute 
name="href">
+                                                               <xsl:value-of 
select="php:function('get_phpgw_link', '/index.php', 
'menuaction:controller.uicalendar.view_calendar_for_year' )" />
+                                                               
<xsl:text>&amp;year=</xsl:text>
+                                                               <xsl:value-of 
select="current_year"/>
+                                                               
<xsl:text>&amp;location_code=</xsl:text>
+                                                               <xsl:value-of 
select="location_array/location_code"/>
+                                                       </xsl:attribute>
+                                                       Kontrollplan for 
bygg/eiendom (Ã¥r)
+                                               </a>
+
+                                               <a class="last">
+                                                       <xsl:attribute 
name="href">
+                                                               <xsl:value-of 
select="php:function('get_phpgw_link', '/index.php', 
'menuaction:controller.uicalendar.view_calendar_for_month' )" />
+                                                               
<xsl:text>&amp;year=</xsl:text>
+                                                               <xsl:value-of 
select="current_year"/>
+                                                               
<xsl:text>&amp;month=</xsl:text>
+                                                               <xsl:value-of 
select="current_month_nr"/>
+                                                               
<xsl:text>&amp;location_code=</xsl:text>
+                                                               <xsl:value-of 
select="location_array/location_code"/>
+                                                       </xsl:attribute>
+                                                       Kontrolplan for 
bygg/eiendom (måned)
+                                               </a>
+                                       </xsl:otherwise>
+                               </xsl:choose>
+                       </div>
+
+                       <!-- ==================  CHECKLIST TAB MENU  
===================== -->
+                       <xsl:call-template name="check_list_menu" />
                </div>
-               <div class="box-2 select-box">
-                       <xsl:choose>
-                         <xsl:when test="type = 'component'">
-                               <a>
-                                       <xsl:attribute name="href">
-                                               <xsl:value-of 
select="php:function('get_phpgw_link', '/index.php', 
'menuaction:controller.uicomponent.index' )" />
-                                               <xsl:text>&amp;year=</xsl:text>
-                                               <xsl:value-of 
select="current_year"/>
-                                               
<xsl:text>&amp;location_id=</xsl:text>
-                                               <xsl:value-of 
select="component_array/location_id"/>
-                                               
<xsl:text>&amp;component_id=</xsl:text>
-                                               <xsl:value-of 
select="component_array/id"/>
-                                       </xsl:attribute>
-                                       Kontrollplan for komponent (Ã¥r)
-                               </a>
-                       </xsl:when>
-                       <xsl:otherwise>
-                               <a>
-                                       <xsl:attribute name="href">
-                                               <xsl:value-of 
select="php:function('get_phpgw_link', '/index.php', 
'menuaction:controller.uicalendar.view_calendar_for_year' )" />
-                                               <xsl:text>&amp;year=</xsl:text>
-                                               <xsl:value-of 
select="current_year"/>
-                                               
<xsl:text>&amp;location_code=</xsl:text>
-                                               <xsl:value-of 
select="location_array/location_code"/>
-                                       </xsl:attribute>
-                                       Kontrollplan for bygg/eiendom (Ã¥r)
-                               </a>
 
-                               <a class="last">
-                                       <xsl:attribute name="href">
-                                               <xsl:value-of 
select="php:function('get_phpgw_link', '/index.php', 
'menuaction:controller.uicalendar.view_calendar_for_month' )" />
-                                               <xsl:text>&amp;year=</xsl:text>
-                                               <xsl:value-of 
select="current_year"/>
-                                               <xsl:text>&amp;month=</xsl:text>
-                                               <xsl:value-of 
select="current_month_nr"/>
-                                               
<xsl:text>&amp;location_code=</xsl:text>
-                                               <xsl:value-of 
select="location_array/location_code"/>
-                                       </xsl:attribute>
-                                       Kontrolplan for bygg/eiendom (måned)
-                               </a>
-                               </xsl:otherwise>
-                       </xsl:choose>
-               </div>
-               
-               <!-- ==================  CHECKLIST TAB MENU  
===================== -->
-               <xsl:call-template name="check_list_menu" />
-       </div>
-       
                <!-- =======================  INFO ABOUT MESSAGE  
========================= -->
                <h3 class="box_header ext">Registrer melding</h3>
                <div id="caseMessage" class="box ext">
                        <xsl:choose>
                                <xsl:when 
test="check_items_and_cases/child::node()">
-                               
-                               <xsl:variable name="action_url">
-                                       <xsl:value-of 
select="php:function('get_phpgw_link', '/index.php', 
'menuaction:controller.uicase.send_case_message')" />
-                               </xsl:variable>
-               
-                               <form ENCTYPE="multipart/form-data" 
id="frmRegCaseMessage" action="{$action_url}" method="post">
-                                       <input>
-                                               <xsl:attribute 
name="name">check_list_id</xsl:attribute>
-                                           <xsl:attribute 
name="type">hidden</xsl:attribute>
-                                           <xsl:attribute name="value">
-                                               <xsl:value-of 
select="check_list/id"/>
-                                           </xsl:attribute>
-                                       </input>
+
+                                       <xsl:variable name="action_url">
+                                               <xsl:value-of 
select="php:function('get_phpgw_link', '/index.php', 
'menuaction:controller.uicase.send_case_message')" />
+                                       </xsl:variable>
+
+                                       <form ENCTYPE="multipart/form-data" 
id="frmRegCaseMessage" action="{$action_url}" method="post">
                                                <input>
-                                               <xsl:attribute 
name="name">location_code</xsl:attribute>
-                                           <xsl:attribute 
name="type">hidden</xsl:attribute>
-                                           <xsl:attribute name="value">
-                                                       <xsl:choose>
-                                                         <xsl:when test="type 
= 'component'">
-                                                                 <xsl:value-of 
select="component_array/location_code"/>
-                                                               </xsl:when>
-                                                               <xsl:otherwise>
-                                                                 <xsl:value-of 
select="location_array/location_code"/>
-                                                               </xsl:otherwise>
-                                                       </xsl:choose>
-                                         </xsl:attribute>
-                                       </input>
-                                       
-                                       <!-- === TITLE === -->
-                                   <div class="row">
-                                               <label>Tittel på 
melding:</label>
-                                               <input name="message_title" 
type="text" class="required" />
-                                       </div>
-                                                                       
-                                       <!-- === CATEGORY === -->
-                                       <div class="row">
-                                               <label>Kategori:</label>
-                                                <select name="message_cat_id" 
class="required">
-                                                       <option value="0">Velg 
kategori</option>
-                                                       <xsl:for-each 
select="categories/cat_list">
-                                                               <xsl:variable 
name="cat_id"><xsl:value-of select="./cat_id"/></xsl:variable>
-                                                               <option 
value="{$cat_id}">
-                                                                       
<xsl:value-of select="./name"/>
-                                                               </option>       
                
+                                                       <xsl:attribute 
name="name">check_list_id</xsl:attribute>
+                                                       <xsl:attribute 
name="type">hidden</xsl:attribute>
+                                                       <xsl:attribute 
name="value">
+                                                               <xsl:value-of 
select="check_list/id"/>
+                                                       </xsl:attribute>
+                                               </input>
+                                               <input>
+                                                       <xsl:attribute 
name="name">location_code</xsl:attribute>
+                                                       <xsl:attribute 
name="type">hidden</xsl:attribute>
+                                                       <xsl:attribute 
name="value">
+                                                               <xsl:choose>
+                                                                       
<xsl:when test="type = 'component'">
+                                                                               
<xsl:value-of select="component_array/location_code"/>
+                                                                       
</xsl:when>
+                                                                       
<xsl:otherwise>
+                                                                               
<xsl:value-of select="location_array/location_code"/>
+                                                                       
</xsl:otherwise>
+                                                               </xsl:choose>
+                                                       </xsl:attribute>
+                                               </input>
+
+                                               <!-- === TITLE === -->
+                                               <div class="row">
+                                                       <label>Tittel på 
melding:</label>
+                                                       <input 
name="message_title" type="text" class="required" />
+                                               </div>
+
+                                               <!-- === CATEGORY === -->
+                                               <div class="row">
+                                                       <label>Kategori:</label>
+                                                       <select 
name="message_cat_id" class="required">
+                                                               <option 
value="0">Velg kategori</option>
+                                                               <xsl:for-each 
select="categories/cat_list">
+                                                                       
<xsl:variable name="cat_id">
+                                                                               
<xsl:value-of select="./cat_id"/>
+                                                                       
</xsl:variable>
+                                                                       <option 
value="{$cat_id}">
+                                                                               
<xsl:value-of select="./name"/>
+                                                                       
</option>
+                                                               </xsl:for-each>
+                                                       </select>
+                                               </div>
+                                               <!-- === UPLOAD FILE === -->
+                                               <div class="row">
+                                                       
<label>Filvedlegg:</label>
+                                                       <input type="file" 
id="file" name="file" >
+                                                               <xsl:attribute 
name="accept">image/*</xsl:attribute>
+                                                               <xsl:attribute 
name="capture">camera</xsl:attribute>
+                                                       </input>
+                                               </div>
+
+                                               <h3>Velg hvilke saker meldingen 
gjelder</h3>
+                                               <ul class="cases">
+                                                       <xsl:for-each 
select="check_items_and_cases">
+                                                               <xsl:choose>
+                                                                       
<xsl:when test="cases_array/child::node()">
+                                                                               
<li class="check_item">
+                                                                               
        <h4>
+                                                                               
                <span>
+                                                                               
                        <xsl:value-of select="control_item/control_group_name"/>
+                                                                               
                        <xsl:text>::</xsl:text>
+                                                                               
                        <xsl:value-of select="control_item/title"/>
+
+                                                                               
                </span>
+                                                                               
        </h4>
+                                                                               
        <ul>
+                                                                               
                <xsl:for-each select="cases_array">
+                                                                               
                        <xsl:variable name="cases_id">
+                                                                               
                                <xsl:value-of select="id"/>
+                                                                               
                        </xsl:variable>
+                                                                               
                        <li>
+                                                                               
                                <input type="checkbox"  name="case_ids[]" 
value="{$cases_id}" />
+                                                                               
                                <xsl:choose>
+                                                                               
                                        <xsl:when test="component_descr != ''">
+                                                                               
                                                <div class="row">
+                                                                               
                                                        <label>
+                                                                               
                                                                <xsl:value-of 
select="php:function('lang','component')" />
+                                                                               
                                                        </label>
+                                                                               
                                                </div>
+                                                                               
                                                <div class="component_descr">
+                                                                               
                                                        <xsl:value-of 
select="component_descr"/>
+                                                                               
                                                </div>
+                                                                               
                                        </xsl:when>
+                                                                               
                                </xsl:choose>
+                                                                               
                                <div class="row">
+                                                                               
                                        <label>Beskrivelse:</label>
+                                                                               
                                </div>
+                                                                               
                                <div class="case_descr">
+                                                                               
                                        <xsl:value-of select="descr"/>
+                                                                               
                                </div>
+                                                                               
                        </li>
+                                                                               
                </xsl:for-each>
+                                                                               
        </ul>
+                                                                               
</li>
+                                                                       
</xsl:when>
+                                                               </xsl:choose>
                                                        </xsl:for-each>
-                                               </select>
-                                       </div>
-                                       <!-- === UPLOAD FILE === -->
-                                       <div class="row">
-                                               <label>Filvedlegg:</label>
-                                               <input type="file" id="file" 
name="file" >
-                                                       <xsl:attribute 
name="accept">image/*</xsl:attribute>
-                                                       <xsl:attribute 
name="capture">camera</xsl:attribute>                                
-                                               </input>
-                                       </div>
-                       
-                                       <h3>Velg hvilke saker meldingen 
gjelder</h3>                                    
-                                       <ul class="cases">
-                                               <xsl:for-each 
select="check_items_and_cases">
-                                                       <xsl:choose>
-                                                               <xsl:when 
test="cases_array/child::node()">
-                                                                       <li 
class="check_item">
-                                                                               
<h4><span>
-                                                                               
<xsl:value-of select="control_item/control_group_name"/>
-                                                                               
<xsl:text>::</xsl:text>
-                                                                               
<xsl:value-of select="control_item/title"/>
-                                                                               
-                                                                               
</span></h4>
-                                                                               
<ul>            
-                                                                               
        <xsl:for-each select="cases_array">
-                                                                               
                <xsl:variable name="cases_id"><xsl:value-of 
select="id"/></xsl:variable>
-                                                                               
                <li>
-                                                                               
                        <input type="checkbox"  name="case_ids[]" 
value="{$cases_id}" />
-                                                                               
                         <xsl:choose>
-                                                                               
                                  <xsl:when test="component_descr != ''">
-                                                                               
                                          <div class="row">
-                                                                               
                                                <label>
-                                                                               
                                                        <xsl:value-of 
select="php:function('lang','component')" />
-                                                                               
                                                </label> 
-                                                                               
                                          </div>
-                                                                               
                                           <div class="component_descr">
-                                                                               
                                                <xsl:value-of 
select="component_descr"/>
-                                                                               
                                          </div>
-                                                                               
                                 </xsl:when>
-                                                                               
                        </xsl:choose>
-                                                                               
                        <div class="row">
-                                                                               
                                <label>Beskrivelse:</label> 
-                                                                               
                        </div>
-                                                                               
                        <div class="case_descr">
-                                                                               
                                <xsl:value-of select="descr"/>
-                                                                               
                        </div>
-                                                                               
                </li>
-                                                                               
        </xsl:for-each>
-                                                                               
</ul>
-                                                                       </li>
-                                                               </xsl:when>
-                                                       </xsl:choose>
-                                               </xsl:for-each>
-                                       </ul>
-                                       
-                                       <div class="form-buttons">
-                                               <xsl:variable 
name="lang_save"><xsl:value-of select="php:function('lang', 'save')" 
/></xsl:variable>
-                                               <input class="btn" 
type="submit" name="save_control" value="Send melding" title="{$lang_save}" />
-                                       </div>
-                               </form>                 
+                                               </ul>
+
+                                               <div class="form-buttons">
+                                                       <xsl:variable 
name="lang_save">
+                                                               <xsl:value-of 
select="php:function('lang', 'save')" />
+                                                       </xsl:variable>
+                                                       <input class="btn" 
type="submit" name="save_control" value="Send melding" title="{$lang_save}" />
+                                               </div>
+                                       </form>
                                </xsl:when>
                                <xsl:otherwise>
                                        Ingen registrerte saker eller det er 
blitt registrert en melding for alle registrerte saker
@@ -186,6 +198,6 @@
                                </xsl:otherwise>
                        </xsl:choose>
                </div>
-                       
-</div>
+
+       </div>
 </xsl:template>

Modified: 
branches/Version-2_0-branch/controller/templates/base/case/view_case_message.xsl
===================================================================
--- 
branches/Version-2_0-branch/controller/templates/base/case/view_case_message.xsl
    2017-11-07 12:56:13 UTC (rev 17277)
+++ 
branches/Version-2_0-branch/controller/templates/base/case/view_case_message.xsl
    2017-11-07 15:52:19 UTC (rev 17278)
@@ -37,6 +37,8 @@
                                                                <xsl:value-of 
select="component_array/location_id"/>
                                                                
<xsl:text>&amp;component_id=</xsl:text>
                                                                <xsl:value-of 
select="component_array/id"/>
+                                                               
<xsl:text>&amp;get_locations=</xsl:text>
+                                                               <xsl:value-of 
select="get_locations"/>
                                                        </xsl:attribute>
                                                        Kontrollplan for 
komponent (Ã¥r)
                                                </a>

Modified: 
branches/Version-2_0-branch/controller/templates/base/check_list/fragments/check_list_top_section.xsl
===================================================================
--- 
branches/Version-2_0-branch/controller/templates/base/check_list/fragments/check_list_top_section.xsl
       2017-11-07 12:56:13 UTC (rev 17277)
+++ 
branches/Version-2_0-branch/controller/templates/base/check_list/fragments/check_list_top_section.xsl
       2017-11-07 15:52:19 UTC (rev 17278)
@@ -1,14 +1,19 @@
 <xsl:template name="check_list_top_section" xmlns:php="http://php.net/xsl";>
-<xsl:param name="active_tab" />
-<xsl:variable name="session_url"><xsl:text>&amp;</xsl:text><xsl:value-of 
select="php:function('get_phpgw_session_url')" /></xsl:variable>
+       <xsl:param name="active_tab" />
+       <xsl:variable name="session_url">
+               <xsl:text>&amp;</xsl:text>
+               <xsl:value-of select="php:function('get_phpgw_session_url')" />
+       </xsl:variable>
 
-<!-- ==================  CHECKLIST DETAILS INFO  ========================= -->
+       <!-- ==================  CHECKLIST DETAILS INFO  
========================= -->
        <div id="check-list-heading">
                <div class="box-1">
                        <h1>Kontroll: <xsl:value-of 
select="control/title"/></h1>
                        <xsl:choose>
                                <xsl:when test="type = 'component'">
-                                       <h2><xsl:value-of 
select="component_array/xml_short_desc"/></h2>
+                                       <h2>
+                                               <xsl:value-of 
select="component_array/xml_short_desc"/>
+                                       </h2>
                                </xsl:when>
                                <xsl:otherwise>
                                        <xsl:choose>
@@ -25,61 +30,63 @@
                
                
                
-    <!-- ==================  CHANGE STATUS FOR CHECKLIST  
===================== -->
-               <xsl:choose>
-                       <xsl:when test="check_list/id != 0">
-               <div class="box-2 select-box">
-            <xsl:call-template name="nav_control_plan" />
-                     <xsl:variable name="action_url"><xsl:value-of 
select="php:function('get_phpgw_link', '/index.php', 
'menuaction:controller.uicheck_list.update_status,phpgw_return_as:json')" 
/></xsl:variable>
-                             <form id="update-check-list-status" class="done" 
action="{$action_url}" method="post">
-                                       <input type="hidden" 
name="check_list_id" value="{check_list/id}" /> 
+               <!-- ==================  CHANGE STATUS FOR CHECKLIST  
===================== -->
+               <!--xsl:choose>
+                       <xsl:when test="check_list/id != 0"-->
+                               <div class="box-2 select-box">
+                                       <xsl:call-template 
name="nav_control_plan" />
+                                       <xsl:variable name="action_url">
+                                               <xsl:value-of 
select="php:function('get_phpgw_link', '/index.php', 
'menuaction:controller.uicheck_list.update_status,phpgw_return_as:json')" />
+                                       </xsl:variable>
+                                       <form id="update-check-list-status" 
class="done" action="{$action_url}" method="post">
+                                               <input type="hidden" 
name="check_list_id" value="{check_list/id}" />
                                                <xsl:choose>
                                                        <xsl:when 
test="check_list/status = 0">
-                                                       <input 
id='update-check-list-status-value' type="hidden" name="status" value="1" />
-                                                       <input 
id="status_submit" type="submit" class="btn">
-                                                         <xsl:attribute 
name="value">
-                                                           <xsl:value-of 
select="php:function('lang', 'Status not done')" />
-                                                         </xsl:attribute>
-                                                       </input>
+                                                               <input 
id='update-check-list-status-value' type="hidden" name="status" value="1" />
+                                                               <input 
id="status_submit" type="submit" class="btn">
+                                                                       
<xsl:attribute name="value">
+                                                                               
<xsl:value-of select="php:function('lang', 'Status not done')" />
+                                                                       
</xsl:attribute>
+                                                               </input>
                                                        </xsl:when>
                                                        <xsl:otherwise>
-                                                       <input 
id='update-check-list-status-value' type="hidden" name="status" value="0" />
-                                                       <input type="submit" 
class="btn">
-                                                         <xsl:attribute 
name="value">
-                                                           <xsl:value-of 
select="php:function('lang', 'is_executed')" />
-                                                         </xsl:attribute>
-                                                       </input>
+                                                               <input 
id='update-check-list-status-value' type="hidden" name="status" value="0" />
+                                                               <input 
type="submit" class="btn">
+                                                                       
<xsl:attribute name="value">
+                                                                               
<xsl:value-of select="php:function('lang', 'is_executed')" />
+                                                                       
</xsl:attribute>
+                                                               </input>
                                                        </xsl:otherwise>
                                                </xsl:choose>
-<!--
-                                                <div id 
='update-check-list-status-icon' class="not_done">
-                                                       <div class="icon">
-                                                               <img 
src="controller/images/red_ring.png" />
-                                                       </div>
-                                               </div>
-                                               <div id 
='update-check-list-status-icon-done' class="done">
-                                                       <div class="icon">
-                                                               <img 
src="controller/images/green_ring.png" />
-                                                       </div>
-                                               </div>
--->
-                             </form>
-                     </div>
-                               </xsl:when>
-                       </xsl:choose>
+                                               <!--
+                                               <div id 
='update-check-list-status-icon' class="not_done">
+                                                  <div class="icon">
+                                                          <img 
src="controller/images/red_ring.png" />
+                                                  </div>
+                                          </div>
+                                          <div id 
='update-check-list-status-icon-done' class="done">
+                                                  <div class="icon">
+                                                          <img 
src="controller/images/green_ring.png" />
+                                                  </div>
+                                          </div>
+                                               -->
+                                       </form>
+                               </div>
+                       <!--/xsl:when>
+               </xsl:choose-->
                <!-- ==================  CHECKLIST TAB MENU  
===================== -->
-        <xsl:choose>
-        <xsl:when test="count(check_list_type) = 0 or check_list_type != 
'add_check_list'">
-            <xsl:call-template name="check_list_menu">
-                <xsl:with-param name="active_tab">
-                       <xsl:value-of select="$active_tab" />
-                       </xsl:with-param>
-            </xsl:call-template>
-        </xsl:when>
-        <xsl:otherwise>
-            <xsl:call-template name="add_check_list_menu" />
-        </xsl:otherwise>
-        </xsl:choose>
+               <xsl:choose>
+                       <xsl:when test="count(check_list_type) = 0 or 
check_list_type != 'add_check_list'">
+                               <xsl:call-template name="check_list_menu">
+                                       <xsl:with-param name="active_tab">
+                                               <xsl:value-of 
select="$active_tab" />
+                                       </xsl:with-param>
+                               </xsl:call-template>
+                       </xsl:when>
+                       <xsl:otherwise>
+                               <xsl:call-template name="add_check_list_menu" />
+                       </xsl:otherwise>
+               </xsl:choose>
        </div>
                
 </xsl:template>

Modified: 
branches/Version-2_0-branch/controller/templates/base/check_list/fragments/nav_control_plan.xsl
===================================================================
--- 
branches/Version-2_0-branch/controller/templates/base/check_list/fragments/nav_control_plan.xsl
     2017-11-07 12:56:13 UTC (rev 17277)
+++ 
branches/Version-2_0-branch/controller/templates/base/check_list/fragments/nav_control_plan.xsl
     2017-11-07 15:52:19 UTC (rev 17278)
@@ -14,6 +14,8 @@
                                        <xsl:value-of 
select="component_array/location_id"/>
                                        <xsl:text>&amp;component_id=</xsl:text>
                                        <xsl:value-of 
select="component_array/id"/>
+                                       <xsl:text>&amp;get_locations=</xsl:text>
+                                       <xsl:value-of select="get_locations"/>
                                </xsl:attribute>
                                Kontrollplan for komponent (Ã¥r)
                        </a>

Modified: branches/Version-2_0-branch/phpgwapi/inc/class.login.inc.php
===================================================================
--- branches/Version-2_0-branch/phpgwapi/inc/class.login.inc.php        
2017-11-07 12:56:13 UTC (rev 17277)
+++ branches/Version-2_0-branch/phpgwapi/inc/class.login.inc.php        
2017-11-07 15:52:19 UTC (rev 17278)
@@ -172,6 +172,12 @@
 
                        //------------------Start login ntlm
 
+                               $logindomain = phpgw::get_var('domain', 
'string', 'GET');
+                               if (strstr($login, '#') === false && 
$logindomain)
+                               {
+                                       $login .= "#{$logindomain}";
+                               }
+
                                $GLOBALS['sessionid'] = 
$GLOBALS['phpgw']->session->create($login, $passwd);
 
                                if (!isset($GLOBALS['sessionid']) || 
!$GLOBALS['sessionid'])
@@ -271,6 +277,13 @@
                                                'account_lid' => $login
                                        );
                                        
$GLOBALS['phpgw']->hooks->process('auto_addaccount', array('frontend', 
'helpdesk'));
+
+                                       $logindomain = phpgw::get_var('domain', 
'string', 'GET');
+                                       if (strstr($login, '#') === false && 
$logindomain)
+                                       {
+                                               $login .= "#{$logindomain}";
+                                       }
+
                                        $GLOBALS['sessionid'] = 
$GLOBALS['phpgw']->session->create($login, '');
                                }
 

Modified: branches/Version-2_0-branch/phpgwapi/inc/class.uicommon_jquery.inc.php
===================================================================
--- branches/Version-2_0-branch/phpgwapi/inc/class.uicommon_jquery.inc.php      
2017-11-07 12:56:13 UTC (rev 17277)
+++ branches/Version-2_0-branch/phpgwapi/inc/class.uicommon_jquery.inc.php      
2017-11-07 15:52:19 UTC (rev 17278)
@@ -396,7 +396,7 @@
                        $this->add_template_file('helpers');
                }
 
-               public function render_template_xsl( $files, $data, 
$xsl_rootdir = '' )
+               public function render_template_xsl( $files, $data, 
$xsl_rootdir = '' , $base = 'data')
                {
                        $GLOBALS['phpgw_info']['flags']['xslt_app'] = true;
 
@@ -431,7 +431,7 @@
                        $output = phpgw::get_var('output', 'string', 'REQUEST', 
'html');
                        $GLOBALS['phpgw']->xslttpl->set_output($output);
                        $this->add_template_file($files);
-                       $GLOBALS['phpgw']->xslttpl->set_var('phpgw', 
array('data' => $data));
+                       $GLOBALS['phpgw']->xslttpl->set_var('phpgw', 
array($base => $data));
                }
 
                // Add link key to a result array

Modified: branches/Version-2_0-branch/phpgwapi/inc/functions.inc.php
===================================================================
--- branches/Version-2_0-branch/phpgwapi/inc/functions.inc.php  2017-11-07 
12:56:13 UTC (rev 17277)
+++ branches/Version-2_0-branch/phpgwapi/inc/functions.inc.php  2017-11-07 
15:52:19 UTC (rev 17278)
@@ -835,6 +835,11 @@
 //                             $cd_array['lightbox'] = true;
                        }
 
+                       if(!empty($_GET['domain']))
+                       {
+                               $cd_array['domain'] = $_GET['domain'];
+                       }
+
                        if(phpgw::get_var('phpgw_return_as', 'string') == 
'json')
                        {
                                header('Content-Type: application/json'); 

Modified: branches/Version-2_0-branch/property/inc/class.bolocation.inc.php
===================================================================
--- branches/Version-2_0-branch/property/inc/class.bolocation.inc.php   
2017-11-07 12:56:13 UTC (rev 17277)
+++ branches/Version-2_0-branch/property/inc/class.bolocation.inc.php   
2017-11-07 15:52:19 UTC (rev 17278)
@@ -870,14 +870,15 @@
                                $location_code = $data;
                        }
 
-                       $location_array = explode('-', $location_code);
-                       $type_id = count($location_array);
-
-                       if (!$type_id)
+                       if (!$location_code)
                        {
                                return;
                        }
 
+                       $location_array = explode('-', $location_code);
+                       $type_id = count($location_array);
+
+
                        if (!isset($extra['noattrib']) || !$extra['noattrib'])
                        {
                                $values['attributes'] = 
$this->custom->find('property', '.location.' . $type_id, 0, '', 'ASC', 
'attrib_sort', true, true);

Modified: 
branches/Version-2_0-branch/property/inc/class.controller_helper.inc.php
===================================================================
--- branches/Version-2_0-branch/property/inc/class.controller_helper.inc.php    
2017-11-07 12:56:13 UTC (rev 17277)
+++ branches/Version-2_0-branch/property/inc/class.controller_helper.inc.php    
2017-11-07 15:52:19 UTC (rev 17278)
@@ -50,6 +50,8 @@
                        'get_cases' => true,
                        'get_checklists'=>true,
                        'get_cases_for_checklist' => true,
+                       'add_control' => true,
+                       'update_control_serie' => true
                );
 
                function __construct($data = array())
@@ -62,6 +64,12 @@
                        $this->type = !empty($data['type']) ? $data['type'] : 
false;
                }
 
+
+               public function get_check_lst_time_span()
+               {
+                       return $this->check_lst_time_span;
+               }
+
                public function jquery_results( $result = array() )
                {
                        if (!$result)
@@ -134,7 +142,7 @@
 
                public function get_controls_at_component( $location_id = 0, 
$id = 0, $skip_json = false )
                {
-                       $location_id = $location_id ? $location_id : 
phpgw::get_var('location_id', 'int'); 
+                       $location_id = $location_id ? $location_id : 
phpgw::get_var('location_id', 'int');
 
                        if (!$location_id)
                        {
@@ -499,4 +507,188 @@
                        }
                        return $_check_list;
                }
+
+               public function add_control()
+               {
+                       $location_id = phpgw::get_var('location_id', 'int');
+                       $id = phpgw::get_var('id', 'int');
+                       $control_id = phpgw::get_var('control_id', 'int');
+                       $assigned_to = phpgw::get_var('control_responsible', 
'int');
+                       $start_date = phpgw::get_var('control_start_date', 
'string');
+                       $repeat_type = phpgw::get_var('repeat_type', 'int');
+                       $repeat_interval = phpgw::get_var('repeat_interval', 
'int');
+                       $repeat_interval = $repeat_interval ? $repeat_interval 
: 1;
+                       $controle_time = phpgw::get_var('controle_time', 
'float');
+                       $service_time = phpgw::get_var('service_time', 'float');
+
+//                     $location_info = 
$GLOBALS['phpgw']->locations->get_name($location_id);
+//
+//                     if (substr($location_info['location'], 1, 6) == 
'entity')
+//                     {
+//                             $type = 'entity';
+//                             $type_info = explode('.', 
$location_info['location']);
+//                             $entity_id = $type_info[2];
+//                             $cat_id = $type_info[3];
+//                             $component_arr = 
$this->so->read_single(array('entity_id' => $entity_id, 'cat_id' => $cat_id, 
'id' => $id));
+//                             $link = array
+//                                     (
+//                                     'menuaction' => 
"property.uientity.{$function}",
+//                                     'entity_id' => $entity_id,
+//                                     'cat_id' => $cat_id,
+//                                     'id' => $id
+//                             );
+//                     }
+//
+//                     $location_code = $component_arr['location_code'];
+
+                       if ($start_date)
+                       {
+                               phpgw::import_class('phpgwapi.datetime');
+                               $start_date = 
phpgwapi_datetime::date_to_timestamp($start_date);
+                       }
+
+                       $result = array
+                               (
+                               'status_kode' => 'error',
+                               'status' => lang('error'),
+                               'msg' => lang('Missing input')
+                       );
+
+                       if ($control_id && $assigned_to && $id)
+                       {
+                               if (!$GLOBALS['phpgw']->acl->check('.admin', 
PHPGW_ACL_EDIT, 'property'))
+                               {
+                                       $receipt['error'][] = true;
+                                       $result = array
+                                               (
+                                               'status_kode' => 'error',
+                                               'status' => lang('error'),
+                                               'msg' => lang('you are not 
approved for this task')
+                                       );
+                               }
+                               if (!$receipt['error'])
+                               {
+                                       $so_control = 
CreateObject('controller.socontrol');
+                                       $values = array
+                                               (
+                                               'register_component' => 
array("{$control_id}_{$location_id}_{$id}"),
+                                               'assigned_to' => $assigned_to,
+                                               'start_date' => $start_date,
+                                               'repeat_type' => $repeat_type,
+                                               'repeat_interval' => 
$repeat_interval,
+                                               'controle_time' => 
$controle_time,
+                                               'service_time' => $service_time,
+                                               'duplicate' => true
+                                       );
+                                       //                              
_debug_array($values);
+                                       if ($add = 
$so_control->register_control_to_component($values))
+                                       {
+                                               $result = array
+                                                       (
+                                                       'status_kode' => 'ok',
+                                                       'status' => 'Ok',
+                                                       'msg' => lang('updated')
+                                               );
+                                       }
+                                       else
+                                       {
+                                               $result = array
+                                                       (
+                                                       'status_kode' => 
'error',
+                                                       'status' => 
lang('error'),
+                                                       'msg' => 'Noe gikk galt'
+                                               );
+                                       }
+                               }
+                       }
+                       return $result;
+               }
+
+               function add_check_list( $data = array() )
+               {
+                       phpgw::import_class('controller.socheck_list');
+                       include_class('controller', 'check_list', 'inc/model/');
+
+                       $control_id = $data['control_id'];
+                       $type = 'component';
+                       $comment = '';
+                       $assigned_to = $data['assigned_to'];
+                       $billable_hours = phpgw::get_var('billable_hours', 
'float');
+
+                       $deadline_date_ts = $data['start_date'];
+                       $planned_date_ts = $deadline_date_ts;
+                       $completed_date_ts = 0;
+
+                       $check_list = new controller_check_list();
+                       $check_list->set_control_id($control_id);
+                       $check_list->set_location_code($data['location_code']);
+                       $check_list->set_location_id($data['location_id']);
+                       $check_list->set_component_id($data['component_id']);
+
+                       $status = controller_check_list::STATUS_NOT_DONE;
+                       $check_list->set_status($status);
+                       $check_list->set_comment($comment);
+                       $check_list->set_deadline($deadline_date_ts);
+                       $check_list->set_planned_date($planned_date_ts);
+                       $check_list->set_completed_date($completed_date_ts);
+                       $check_list->set_assigned_to($assigned_to);
+                       $check_list->set_billable_hours($billable_hours);
+
+                       $socheck_list = CreateObject('controller.socheck_list');
+
+                       if ($check_list->validate() && $check_list_id = 
$socheck_list->store($check_list))
+                       {
+                               return $check_list_id;
+                       }
+                       else
+                       {
+                               return false;
+                       }
+               }
+
+               function update_control_serie()
+               {
+                       if ($start_date = phpgw::get_var('control_start_date', 
'string'))
+                       {
+                               phpgw::import_class('phpgwapi.datetime');
+                               $start_date = 
phpgwapi_datetime::date_to_timestamp($start_date);
+                       }
+
+                       $so_control = CreateObject('controller.socontrol');
+
+                       $values = array
+                               (
+                               'ids' => phpgw::get_var('ids', 'int'),
+                               'action' => phpgw::get_var('action', 'string'),
+                               'assigned_to' => 
phpgw::get_var('control_responsible', 'int'),
+                               'start_date' => $start_date,
+//                             'repeat_type'           => 
phpgw::get_var('repeat_type', 'int'),
+                               'repeat_interval' => 
phpgw::get_var('repeat_interval', 'int'),
+                               'controle_time' => 
phpgw::get_var('controle_time', 'float'),
+                               'service_time' => 
phpgw::get_var('service_time', 'float')
+                       );
+                       $ret = $so_control->update_control_serie($values);
+
+                       if ($ret)
+                       {
+                               $result = array
+                                       (
+                                       'status_kode' => 'ok',
+                                       'status' => 'Ok',
+                                       'msg' => lang('updated')
+                               );
+                       }
+                       else
+                       {
+                               $result = array
+                                       (
+                                       'status_kode' => 'error',
+                                       'status' => lang('error'),
+                                       'msg' => 'Noe gikk galt'
+                               );
+                       }
+
+                       return $result;
+               }
+
        }
\ No newline at end of file

Modified: branches/Version-2_0-branch/property/inc/class.custom_fields.inc.php
===================================================================
--- branches/Version-2_0-branch/property/inc/class.custom_fields.inc.php        
2017-11-07 12:56:13 UTC (rev 17277)
+++ branches/Version-2_0-branch/property/inc/class.custom_fields.inc.php        
2017-11-07 15:52:19 UTC (rev 17278)
@@ -835,6 +835,7 @@
                                                $_location_count = 0;
                                        }
                                }
+                               $ret[$j]['location_id'] = $location_id;
                                $j++;
                        }
                        return $ret;

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-07 12:56:13 UTC (rev 17277)
+++ branches/Version-2_0-branch/property/inc/class.solocation.inc.php   
2017-11-07 15:52:19 UTC (rev 17278)
@@ -352,10 +352,24 @@
                        $results = $data['results'] ? (int)$data['results'] : 0;
                        $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;
+                       $filter_item = isset($data['filter_item']) && 
$data['filter_item'] ? (array)$data['filter_item'] : array();
 
+                       if($location_id && !$type_id)
+                       {
+                               $location_info = 
$GLOBALS['phpgw']->locations->get_name($location_id);
+
+                               if (substr($location_info['location'], 1, 8) == 
'location')
+                               {
+                                       $type_info = explode('.', 
$location_info['location']);
+                                       $type_id = $type_info[2];
+                               }
+                       }
+
+
                        if (!$type_id)
                        {
-                               return;
+                               return array();
                        }
 
                        if ($order == 'undefined')
@@ -376,7 +390,10 @@
 
 
                        $sql = $this->socommon->fm_cache('sql_' . $type_id . 
'_lt' . $lookup_tenant . '_l' . $lookup . '_f' . !!$filter_role_on_contact);
-                       $location_id = 
$GLOBALS['phpgw']->locations->get_id('property', ".location.{$type_id}");
+                       if(empty($location_id))
+                       {
+                               $location_id = 
$GLOBALS['phpgw']->locations->get_id('property', ".location.{$type_id}");       
                 
+                       }
 
 //                     $choice_table = 'phpgw_cust_choice';
                        $attribute_table = 'phpgw_cust_attribute';
@@ -650,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
@@ -785,6 +816,11 @@
                                $where = 'AND';
                        }
 
+                       if($filter_item)
+                       {
+                               $filtermethod .= " {$where} 
fm_location{$type_id}.id IN (" . implode(', ', $filter_item) . ')';
+                               $where = 'AND';
+                       }
                        if ($filter > 0)
                        {
                                //address@hidden 16/09/08       validacion is 
added to avoid notice
@@ -1266,7 +1302,28 @@
 
                        $location_array = explode('-', $location_code);
                        $type_id = count($location_array);
+                       
+                       $location_id = !empty($values['location_id']) ? (int) 
$values['location_id'] : null;
 
+                       /**
+                        * Override
+                        */
+                       if($location_id)
+                       {
+                               $location_info = 
$GLOBALS['phpgw']->locations->get_name($location_id);
+
+                               if (substr($location_info['location'], 1, 8) == 
'location')
+                               {
+                                       $type_info = explode('.', 
$location_info['location']);
+                                       $type_id = $type_info[2];
+                               }
+                               $id = !empty($values['id']) ? (int) 
$values['id'] : null;
+                               if(!$id && !$location_code)
+                               {
+                                       $type_id = false;
+                               }
+                       }
+
                        if (!$type_id)
                        {
                                return;
@@ -1334,7 +1391,14 @@
                        //FIXME: Make sure all locations are linked to a valid 
category
                        $sql .= " {$this->left_join} 
fm_location{$type_id}_category ON (fm_location{$type_id}.category = 
fm_location{$type_id}_category.id)";
 
-                       $sql .= " WHERE 
fm_location$type_id.location_code='$location_code' ";
+                       if($location_code)
+                       {
+                               $sql .= " WHERE 
fm_location$type_id.location_code='$location_code' ";
+                       }
+                       else
+                       {
+                               $sql .= " WHERE fm_location$type_id.id=" . 
(int) $id;
+                       }
 
                        $this->db->query($sql, __LINE__, __FILE__);
 
@@ -1359,18 +1423,25 @@
                                                }
                                        }
                                }
-                       }
 
-                       //_debug_array($cols_return);
-                       if(empty($values['id']))
-                       {
-                               //In case old version of property-app
-                               if(isset($metadata['id']))
+                               if(!$location_code)
                                {
-                                       $this->update_location();
+                                       $location_code = 
$this->db->f('location_code');
                                }
                        }
 
+/**
+ * Loop on add...
+ */
+//                     if(empty($values['id']))
+//                     {
+//                             //In case old version of property-app
+//                             if(isset($metadata['id']))
+//                             {
+//                                     $this->update_location();
+//                             }
+//                     }
+
                        $location[$location_code] = $values;
                        return $values;
                }

Modified: branches/Version-2_0-branch/property/inc/class.soresponsible.inc.php
===================================================================
--- branches/Version-2_0-branch/property/inc/class.soresponsible.inc.php        
2017-11-07 12:56:13 UTC (rev 17277)
+++ branches/Version-2_0-branch/property/inc/class.soresponsible.inc.php        
2017-11-07 15:52:19 UTC (rev 17278)
@@ -887,7 +887,6 @@
                                        throw new 
exception('soresponsible::get_responsible(): location-input needs to be an 
array');
                                }
 
-                               $location_filter[] = ''; // when the 
responsibility is generic - not located to any location
                                $location_code = '';
                                $location_array = array();
                                foreach ($data['location'] as $location)
@@ -913,7 +912,7 @@
                                $role_filter = ' AND fm_responsibility_role.id 
=' . (int) $data['role_id'];
                        }
 
-                       $sql = "SELECT contact_id FROM 
fm_responsibility_contact"
+                       $sql = "SELECT DISTINCT contact_id FROM 
fm_responsibility_contact"
                                . " {$this->join} fm_responsibility_role ON 
fm_responsibility_contact.responsibility_role_id = fm_responsibility_role.id"
                                . " {$this->join} fm_responsibility ON 
fm_responsibility_role.responsibility_id = fm_responsibility.id"
                                . " {$this->join} fm_responsibility_module ON 
fm_responsibility.id = fm_responsibility_module.responsibility_id"

Modified: branches/Version-2_0-branch/property/inc/class.uiadmin_entity.inc.php
===================================================================
--- branches/Version-2_0-branch/property/inc/class.uiadmin_entity.inc.php       
2017-11-07 12:56:13 UTC (rev 17277)
+++ branches/Version-2_0-branch/property/inc/class.uiadmin_entity.inc.php       
2017-11-07 15:52:19 UTC (rev 17278)
@@ -659,6 +659,7 @@
                                        }
                                }
 
+                               $msgbox_data = 
$this->bocommon->msgbox_data($this->receipt);
                                $message = 
$GLOBALS['phpgw']->common->msgbox($msgbox_data);
                                
phpgwapi_cache::message_set($message[0]['msgbox_text'], 'message');
                                $GLOBALS['phpgw']->redirect_link('/index.php', 
array('menuaction' => 'property.uiadmin_entity.edit',
@@ -818,6 +819,7 @@
                                        }
                                }
 
+                               $msgbox_data = 
$this->bocommon->msgbox_data($this->receipt);
                                $message = 
$GLOBALS['phpgw']->common->msgbox($msgbox_data);
 
                                
phpgwapi_cache::message_set($message[0]['msgbox_text'], 'message');

Modified: branches/Version-2_0-branch/property/inc/class.uientity.inc.php
===================================================================
--- branches/Version-2_0-branch/property/inc/class.uientity.inc.php     
2017-11-07 12:56:13 UTC (rev 17277)
+++ branches/Version-2_0-branch/property/inc/class.uientity.inc.php     
2017-11-07 15:52:19 UTC (rev 17278)
@@ -48,6 +48,7 @@
                var $sub;
                var $currentapp;
                var $check_lst_time_span = array();
+               var $controller_helper;
                var $public_functions = array
                        (
                        'columns' => true,
@@ -136,6 +137,14 @@
                        $this->acl_edit = 
$this->acl->check($acl_check_location, PHPGW_ACL_EDIT, 
$this->type_app[$this->type]);
                        $this->acl_delete = 
$this->acl->check($acl_check_location, PHPGW_ACL_DELETE, 
$this->type_app[$this->type]);
 
+                       $this->controller_helper = 
CreateObject('property.controller_helper', array(
+                               'acl_location' => $acl_check_location,
+                               'acl_read' => $this->acl_read,
+                               'acl_add' => $this->acl_add,
+                               'acl_edit' => $this->acl_edit,
+                               'acl_delete' => $this->acl_delete,
+                       ));
+
                        $GLOBALS['phpgw_info']['flags']['menu_selection'] = 
"{$this->type_app[$this->type]}::entity_{$this->entity_id}";
                        if ($this->cat_id > 0)
                        {
@@ -2385,7 +2394,7 @@
                                        );
 
                                        $_checklists = 
$this->get_checklists($location_id, $id, date('Y'));
-                                       $check_lst_time_span = 
$this->check_lst_time_span;
+                                       $check_lst_time_span = 
$this->controller_helper->get_check_lst_time_span();
 
                                        $_checklists_def = array
                                                (
@@ -2708,59 +2717,59 @@
                        $this->edit(null, $mode = 'view');
                }
 
-               function get_assigned_history()
-               {
-                       $GLOBALS['phpgw_info']['flags']['noframework'] = true;
-                       $GLOBALS['phpgw_info']['flags']['xslt_app'] = false;
+//             function get_assigned_history()
+//             {
+//                     $GLOBALS['phpgw_info']['flags']['noframework'] = true;
+//                     $GLOBALS['phpgw_info']['flags']['xslt_app'] = false;
+//
+//                     if ($this->acl_read)
+//                     {
+//                             $this->bocommon->no_access();
+//                             return;
+//                     }
+//                     $serie_id = phpgw::get_var('serie_id', 'int');
+//                     $history = 
execMethod('controller.socontrol.get_assigned_history', array('serie_id' => 
$serie_id));
+//                     $lang_user = lang('user');
+//                     $lang_date = lang('date');
+//
+//                     $ret = <<<HTML
+//                     <html>
+//                             <head>
+//                             </head>
+//                             <body>
+//                                     <table style="width:90%" align = 
'center'>
+//                                             <tr align = 'left'>
+//                                                     <th>
+//                                                             {$lang_user}
+//                                                     </th>
+//                                                     <th>
+//                                                             {$lang_date}
+//                                                     </th>
+//                                             </tr>
+//
+//HTML;
+//                     foreach ($history as $entry)
+//                     {
+//                             $date = 
$GLOBALS['phpgw']->common->show_date($entry['assigned_date']);
+//                             $ret .= <<<HTML
+//                                             <tr align = 'left'>
+//                                                     <td>
+//                                                             
{$entry['assigned_to_name']}
+//                                                     </td>
+//                                                     <td>
+//                                                             {$date}
+//                                                     </td>
+//                                             </tr>
+//HTML;
+//                     }
+//                     $ret .= <<<HTML
+//                                     </table>
+//                             </body>
+//                     </html>
+//HTML;
+//                     echo $ret;
+//             }
 
-                       if ($this->acl_read)
-                       {
-                               $this->bocommon->no_access();
-                               return;
-                       }
-                       $serie_id = phpgw::get_var('serie_id', 'int');
-                       $history = 
execMethod('controller.socontrol.get_assigned_history', array('serie_id' => 
$serie_id));
-                       $lang_user = lang('user');
-                       $lang_date = lang('date');
-
-                       $ret = <<<HTML
-                       <html>
-                               <head>
-                               </head>
-                               <body>
-                                       <table style="width:90%" align = 
'center'>
-                                               <tr align = 'left'>
-                                                       <th>
-                                                               {$lang_user}
-                                                       </th>
-                                                       <th>
-                                                               {$lang_date}
-                                                       </th>
-                                               </tr>
-
-HTML;
-                       foreach ($history as $entry)
-                       {
-                               $date = 
$GLOBALS['phpgw']->common->show_date($entry['assigned_date']);
-                               $ret .= <<<HTML
-                                               <tr align = 'left'>
-                                                       <td>
-                                                               
{$entry['assigned_to_name']}
-                                                       </td>
-                                                       <td>
-                                                               {$date}
-                                                       </td>
-                                               </tr>
-HTML;
-                       }
-                       $ret .= <<<HTML
-                                       </table>
-                               </body>
-                       </html>
-HTML;
-                       echo $ret;
-               }
-
                function attrib_history()
                {
                        $GLOBALS['phpgw_info']['flags']['noframework'] = true;
@@ -3442,77 +3451,77 @@
                        $GLOBALS['phpgw']->common->phpgw_exit();
                }
 
-               public function get_controls_at_component( $location_id = 0, 
$id = 0, $skip_json = false )
-               {
-                       if (!$location_id)
-                       {
-                               $entity_id = phpgw::get_var('entity_id', 'int');
-                               $cat_id = phpgw::get_var('cat_id', 'int');
-                               $type = phpgw::get_var('type', 'string', 
'REQUEST', 'entity');
+//             public function get_controls_at_component( $location_id = 0, 
$id = 0, $skip_json = false )
+//             {
+//                     if (!$location_id)
+//                     {
+//                             $entity_id = phpgw::get_var('entity_id', 'int');
+//                             $cat_id = phpgw::get_var('cat_id', 'int');
+//                             $type = phpgw::get_var('type', 'string', 
'REQUEST', 'entity');
+//
+//                             $location_id = 
$GLOBALS['phpgw']->locations->get_id($this->type_app[$type], 
".{$type}.{$entity_id}.{$cat_id}");
+//                     }
+//
+//                     $id = $id ? $id : phpgw::get_var('id', 'int');
+//                     if (!$id)
+//                     {
+//                             return array();
+//                     }
+//
+//                     if (!$this->acl_read)
+//                     {
+//                             echo lang('No Access');
+//                             $GLOBALS['phpgw']->common->phpgw_exit();
+//                     }
+//
+//                     $repeat_type_array = array
+//                             (
+//                             "0" => lang('day'),
+//                             "1" => lang('week'),
+//                             "2" => lang('month'),
+//                             "3" => lang('year')
+//                     );
+//
+//                     $lang_history = lang('history');
+//                     $controls = 
execMethod('controller.socontrol.get_controls_at_component', array(
+//                             'location_id' => $location_id, 'component_id' 
=> $id));
+//                     foreach ($controls as &$entry)
+//                     {
+//                             $menuaction = 'controller.uicomponent.index';
+//
+//                             $control_link_data = array
+//                                     (
+//                                     'menuaction' => $menuaction,
+//                                     'location_id' => $location_id,
+//                                     'component_id' => $id,
+//                             );
+//
+//                             $entry['title_text'] = $entry['title'];
+//                             $entry['title'] = '<a href="' . 
$GLOBALS['phpgw']->link('/index.php', $control_link_data) . '" 
target="_blank">' . $entry['title'] . '</a>';
+//                             $entry['assigned_to_name'] = "<a 
title=\"{$lang_history}\" 
onclick='javascript:showlightbox_assigned_history({$entry['serie_id']});'>{$entry['assigned_to_name']}</a>";
+//
+//                             $entry['start_date'] = 
$GLOBALS['phpgw']->common->show_date($entry['start_date'], 
$GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat']);
+//                             $entry['repeat_type'] = 
$repeat_type_array[$entry['repeat_type']];
+//                             $entry['total_time'] = $entry['service_time'] + 
$entry['controle_time'];
+//                     }
+//
+//                     $phpgw_return_as = phpgw::get_var('phpgw_return_as');
+//
+//                     if (($phpgw_return_as == 'json' && $skip_json) || 
$phpgw_return_as != 'json')
+//                     {
+//                             return $controls;
+//                     }
+//
+//                     $result_data = array
+//                             (
+//                             'results' => $controls,
+//                             'total_records' => count($controls),
+//                             'draw' => phpgw::get_var('draw', 'int')
+//                     );
+//
+//                     return $this->jquery_results($result_data);
+//             }
 
-                               $location_id = 
$GLOBALS['phpgw']->locations->get_id($this->type_app[$type], 
".{$type}.{$entity_id}.{$cat_id}");
-                       }
-
-                       $id = $id ? $id : phpgw::get_var('id', 'int');
-                       if (!$id)
-                       {
-                               return array();
-                       }
-
-                       if (!$this->acl_read)
-                       {
-                               echo lang('No Access');
-                               $GLOBALS['phpgw']->common->phpgw_exit();
-                       }
-
-                       $repeat_type_array = array
-                               (
-                               "0" => lang('day'),
-                               "1" => lang('week'),
-                               "2" => lang('month'),
-                               "3" => lang('year')
-                       );
-
-                       $lang_history = lang('history');
-                       $controls = 
execMethod('controller.socontrol.get_controls_at_component', array(
-                               'location_id' => $location_id, 'component_id' 
=> $id));
-                       foreach ($controls as &$entry)
-                       {
-                               $menuaction = 'controller.uicomponent.index';
-
-                               $control_link_data = array
-                                       (
-                                       'menuaction' => $menuaction,
-                                       'location_id' => $location_id,
-                                       'component_id' => $id,
-                               );
-
-                               $entry['title_text'] = $entry['title'];
-                               $entry['title'] = '<a href="' . 
$GLOBALS['phpgw']->link('/index.php', $control_link_data) . '" 
target="_blank">' . $entry['title'] . '</a>';
-                               $entry['assigned_to_name'] = "<a 
title=\"{$lang_history}\" 
onclick='javascript:showlightbox_assigned_history({$entry['serie_id']});'>{$entry['assigned_to_name']}</a>";
-
-                               $entry['start_date'] = 
$GLOBALS['phpgw']->common->show_date($entry['start_date'], 
$GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat']);
-                               $entry['repeat_type'] = 
$repeat_type_array[$entry['repeat_type']];
-                               $entry['total_time'] = $entry['service_time'] + 
$entry['controle_time'];
-                       }
-
-                       $phpgw_return_as = phpgw::get_var('phpgw_return_as');
-
-                       if (($phpgw_return_as == 'json' && $skip_json) || 
$phpgw_return_as != 'json')
-                       {
-                               return $controls;
-                       }
-
-                       $result_data = array
-                               (
-                               'results' => $controls,
-                               'total_records' => count($controls),
-                               'draw' => phpgw::get_var('draw', 'int')
-                       );
-
-                       return $this->jquery_results($result_data);
-               }
-
                /**
                 * Get controller cases related to this item.
                 * @param integer $location_id
@@ -3520,202 +3529,202 @@
                 * @param integer $year
                 * @return string
                 */
-               public function get_cases( $location_id = 0, $id = 0, $year = 0 
)
-               {
-                       if (!$location_id)
-                       {
-                               $location_id = phpgw::get_var('location_id', 
'int');
-                       }
-                       if (!$id)
-                       {
-                               $id = phpgw::get_var('id', 'int');
-                       }
-                       if (!$year)
-                       {
-                               $year = phpgw::get_var('year', 'int');
-                       }
+//             public function get_cases( $location_id = 0, $id = 0, $year = 0 
)
+//             {
+//                     if (!$location_id)
+//                     {
+//                             $location_id = phpgw::get_var('location_id', 
'int');
+//                     }
+//                     if (!$id)
+//                     {
+//                             $id = phpgw::get_var('id', 'int');
+//                     }
+//                     if (!$year)
+//                     {
+//                             $year = phpgw::get_var('year', 'int');
+//                     }
+//
+////                   $year = $year ? $year : -1; //all
+//
+//                     $_controls = 
$this->get_controls_at_component($location_id, $id, $skip_json = true);
+//
+//                     $socase = CreateObject('controller.socase');
+//                     $controller_cases = 
$socase->get_cases_by_component($location_id, $id);
+//                     $_statustext = array();
+//                     $_statustext[0] = lang('open');
+//                     $_statustext[1] = lang('closed');
+//                     $_statustext[2] = lang('pending');
+//
+//                     $_cases = array();
+//                     foreach ($controller_cases as $case)
+//                     {
+//                             $_case_year = date('Y', $case['modified_date']);
+//
+//                             if ($_case_year != $year && $year != -1)
+//                             {
+//                                     continue;
+//                             }
+//
+//                             $socheck_list = 
CreateObject('controller.socheck_list');
+//                             $control_id = 
$socheck_list->get_single($case['check_list_id'])->get_control_id();
+//                             foreach ($_controls as $_control)
+//                             {
+//                                     if ($_control['control_id'] == 
$control_id)
+//                                     {
+//                                             $_control_name = 
$_control['title_text'];
+//                                             break;
+//                                     }
+//                             }
+////                                           _debug_array($check_list);die();
+//
+//                             switch ($case['status'])
+//                             {
+//                                     case 0:
+//                                     case 2:
+//                                             $_method = 'view_open_cases';
+//                                             break;
+//                                     case 1:
+//                                             $_method = 'view_closed_cases';
+//                                             break;
+//                                     default:
+//                                             $_method = 'view_open_cases';
+//                             }
+//
+//                             $_link = $GLOBALS['phpgw']->link('/index.php', 
array
+//                                     (
+//                                     'menuaction' => 
"controller.uicase.{$_method}",
+//                                     'check_list_id' => 
$case['check_list_id']
+//                                     )
+//                             );
+//
+//
+//                             $_value_arr = array();
+//
+//                             if($case['measurement'])
+//                             {
+//                                     $_value_arr[] = $case['measurement'];
+//                             }
+//                             if($case['descr'])
+//                             {
+//                                     $_value_arr[] = $case['descr'];
+//                             }
+//
+//                             $_cases[] = array
+//                                     (
+//                                     'url' => "<a href=\"{$_link}\" > 
{$case['check_list_id']}</a>",
+//                                     'type' => $_control_name,
+//                                     'title' => "<a href=\"{$_link}\" > 
{$case['title']}</a>",
+//                                     'value' => implode('</br>', 
$_value_arr),
+//                                     'status' => 
$_statustext[$case['status']],
+//                                     'user' => 
$GLOBALS['phpgw']->accounts->get($case['user_id'])->__toString(),
+//                                     'entry_date' => 
$GLOBALS['phpgw']->common->show_date($case['modified_date'], 
$GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat']),
+//                             );
+//                             unset($_link);
+//                     }
+//
+//                     if (phpgw::get_var('phpgw_return_as') == 'json')
+//                     {
+//                             $result_data = array
+//                                     (
+//                                     'results' => $_cases,
+//                                     'total_records' => count($_cases),
+//                                     'draw' => phpgw::get_var('draw', 'int')
+//                             );
+//
+//                             return $this->jquery_results($result_data);
+//                     }
+//                     return $_cases;
+//             }
 
-//                     $year = $year ? $year : -1; //all
-
-                       $_controls = 
$this->get_controls_at_component($location_id, $id, $skip_json = true);
-
-                       $socase = CreateObject('controller.socase');
-                       $controller_cases = 
$socase->get_cases_by_component($location_id, $id);
-                       $_statustext = array();
-                       $_statustext[0] = lang('open');
-                       $_statustext[1] = lang('closed');
-                       $_statustext[2] = lang('pending');
-
-                       $_cases = array();
-                       foreach ($controller_cases as $case)
-                       {
-                               $_case_year = date('Y', $case['modified_date']);
-
-                               if ($_case_year != $year && $year != -1)
-                               {
-                                       continue;
-                               }
-
-                               $socheck_list = 
CreateObject('controller.socheck_list');
-                               $control_id = 
$socheck_list->get_single($case['check_list_id'])->get_control_id();
-                               foreach ($_controls as $_control)
-                               {
-                                       if ($_control['control_id'] == 
$control_id)
-                                       {
-                                               $_control_name = 
$_control['title_text'];
-                                               break;
-                                       }
-                               }
-//                                             _debug_array($check_list);die();
-
-                               switch ($case['status'])
-                               {
-                                       case 0:
-                                       case 2:
-                                               $_method = 'view_open_cases';
-                                               break;
-                                       case 1:
-                                               $_method = 'view_closed_cases';
-                                               break;
-                                       default:
-                                               $_method = 'view_open_cases';
-                               }
-
-                               $_link = $GLOBALS['phpgw']->link('/index.php', 
array
-                                       (
-                                       'menuaction' => 
"controller.uicase.{$_method}",
-                                       'check_list_id' => 
$case['check_list_id']
-                                       )
-                               );
-
-
-                               $_value_arr = array();
-
-                               if($case['measurement'])
-                               {
-                                       $_value_arr[] = $case['measurement'];
-                               }
-                               if($case['descr'])
-                               {
-                                       $_value_arr[] = $case['descr'];
-                               }
-
-                               $_cases[] = array
-                                       (
-                                       'url' => "<a href=\"{$_link}\" > 
{$case['check_list_id']}</a>",
-                                       'type' => $_control_name,
-                                       'title' => "<a href=\"{$_link}\" > 
{$case['title']}</a>",
-                                       'value' => implode('</br>', 
$_value_arr),
-                                       'status' => 
$_statustext[$case['status']],
-                                       'user' => 
$GLOBALS['phpgw']->accounts->get($case['user_id'])->__toString(),
-                                       'entry_date' => 
$GLOBALS['phpgw']->common->show_date($case['modified_date'], 
$GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat']),
-                               );
-                               unset($_link);
-                       }
-
-                       if (phpgw::get_var('phpgw_return_as') == 'json')
-                       {
-                               $result_data = array
-                                       (
-                                       'results' => $_cases,
-                                       'total_records' => count($_cases),
-                                       'draw' => phpgw::get_var('draw', 'int')
-                               );
-
-                               return $this->jquery_results($result_data);
-                       }
-                       return $_cases;
-               }
-
                /**
                 * Get controller cases related to this item and a spesific 
checklist.
                 * @return array
                 */
-               public function get_cases_for_checklist()
-               {
-                       $check_list_id = phpgw::get_var('check_list_id', 'int');
-                       $so_check_item = 
CreateObject('controller.socheck_item');
-                       $controller_cases = 
$so_check_item->get_check_items_with_cases($check_list_id, $_type = null, 
'all', null, null);
+//             public function get_cases_for_checklist()
+//             {
+//                     $check_list_id = phpgw::get_var('check_list_id', 'int');
+//                     $so_check_item = 
CreateObject('controller.socheck_item');
+//                     $controller_cases = 
$so_check_item->get_check_items_with_cases($check_list_id, $_type = null, 
'all', null, null);
+//
+//                     $_statustext = array();
+//                     $_statustext[0] = lang('open');
+//                     $_statustext[1] = lang('closed');
+//                     $_statustext[2] = lang('pending');
+//
+//                     $_case_years = array();
+//                     $_cases = array();
+//
+//                     $socheck_list = CreateObject('controller.socheck_list');
+//                     $socontrol = CreateObject('controller.socontrol');
+//
+//                     foreach ($controller_cases as $check_item)
+//                     {
+//                             $checklist_id = 
$check_item->get_check_list_id();
+//                             $control_id = 
$socheck_list->get_single($checklist_id)->get_control_id();
+//
+//                             $_control_name = 
$socontrol->get_single($control_id)->get_title();
+//
+//                             $cases_array = $check_item->get_cases_array();
+//                             foreach ($cases_array as $case)
+//                             {
+//                                     switch ($case->get_status())
+//                                     {
+//                                             case 0:
+//                                             case 2:
+//                                                     $_method = 
'view_open_cases';
+//                                                     break;
+//                                             case 1:
+//                                                     $_method = 
'view_closed_cases';
+//                                                     break;
+//                                             default:
+//                                                     $_method = 
'view_open_cases';
+//                                     }
+//
+//                                     $_link = 
$GLOBALS['phpgw']->link('/index.php', array
+//                                             (
+//                                             'menuaction' => 
"controller.uicase.{$_method}",
+//                                             'check_list_id' => 
$check_list_id
+//                                             )
+//                                     );
+//                                     $_value_arr = array();
+//
+//                                     if($case->get_measurement())
+//                                     {
+//                                             $_value_arr[] = 
$case->get_measurement();
+//                                     }
+//                                     if($case->get_descr())
+//                                     {
+//                                             $_value_arr[] = 
$case->get_descr();
+//                                     }
+//
+//                                     $_cases[] = array
+//                                             (
+//                                             'url' => "<a href=\"{$_link}\" 
> {$check_list_id}</a>",
+//                                             'type' => $_control_name,
+//                                             'title' => "<a 
href=\"{$_link}\" >" . $check_item->get_control_item()->get_title() . "</a>",
+//                                             'value' => implode('</br>', 
$_value_arr),
+//                                             'status' => 
$_statustext[$case->get_status()],
+//                                             'user' => 
$GLOBALS['phpgw']->accounts->get($case->get_user_id())->__toString(),
+//                                             'entry_date' => 
$GLOBALS['phpgw']->common->show_date($case->get_modified_date(), 
$GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat']),
+//                                     );
+//                                     unset($_link);
+//                             }
+//                     }
+//
+//                     if (phpgw::get_var('phpgw_return_as') == 'json')
+//                     {
+//                             $result_data = array
+//                                     (
+//                                     'results' => $_cases,
+//                                     'total_records' => count($_cases),
+//                                     'draw' => phpgw::get_var('draw', 'int')
+//                             );
+//
+//                             return $this->jquery_results($result_data);
+//                     }
+//                     return $_cases;
+//             }
 
-                       $_statustext = array();
-                       $_statustext[0] = lang('open');
-                       $_statustext[1] = lang('closed');
-                       $_statustext[2] = lang('pending');
-
-                       $_case_years = array();
-                       $_cases = array();
-
-                       $socheck_list = CreateObject('controller.socheck_list');
-                       $socontrol = CreateObject('controller.socontrol');
-
-                       foreach ($controller_cases as $check_item)
-                       {
-                               $checklist_id = 
$check_item->get_check_list_id();
-                               $control_id = 
$socheck_list->get_single($checklist_id)->get_control_id();
-
-                               $_control_name = 
$socontrol->get_single($control_id)->get_title();
-
-                               $cases_array = $check_item->get_cases_array();
-                               foreach ($cases_array as $case)
-                               {
-                                       switch ($case->get_status())
-                                       {
-                                               case 0:
-                                               case 2:
-                                                       $_method = 
'view_open_cases';
-                                                       break;
-                                               case 1:
-                                                       $_method = 
'view_closed_cases';
-                                                       break;
-                                               default:
-                                                       $_method = 
'view_open_cases';
-                                       }
-
-                                       $_link = 
$GLOBALS['phpgw']->link('/index.php', array
-                                               (
-                                               'menuaction' => 
"controller.uicase.{$_method}",
-                                               'check_list_id' => 
$check_list_id
-                                               )
-                                       );
-                                       $_value_arr = array();
-
-                                       if($case->get_measurement())
-                                       {
-                                               $_value_arr[] = 
$case->get_measurement();
-                                       }
-                                       if($case->get_descr())
-                                       {
-                                               $_value_arr[] = 
$case->get_descr();
-                                       }
-
-                                       $_cases[] = array
-                                               (
-                                               'url' => "<a href=\"{$_link}\" 
> {$check_list_id}</a>",
-                                               'type' => $_control_name,
-                                               'title' => "<a 
href=\"{$_link}\" >" . $check_item->get_control_item()->get_title() . "</a>",
-                                               'value' => implode('</br>', 
$_value_arr),
-                                               'status' => 
$_statustext[$case->get_status()],
-                                               'user' => 
$GLOBALS['phpgw']->accounts->get($case->get_user_id())->__toString(),
-                                               'entry_date' => 
$GLOBALS['phpgw']->common->show_date($case->get_modified_date(), 
$GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat']),
-                                       );
-                                       unset($_link);
-                               }
-                       }
-
-                       if (phpgw::get_var('phpgw_return_as') == 'json')
-                       {
-                               $result_data = array
-                                       (
-                                       'results' => $_cases,
-                                       'total_records' => count($_cases),
-                                       'draw' => phpgw::get_var('draw', 'int')
-                               );
-
-                               return $this->jquery_results($result_data);
-                       }
-                       return $_cases;
-               }
-
                /**
                 * Get controller checklists related to this item.
                 * @param integer $location_id
@@ -3723,89 +3732,116 @@
                 * @param integer $year
                 * @return string
                 */
-               public function get_checklists( $location_id = 0, $id = 0, 
$year = 0 )
+//             public function get_checklists( $location_id = 0, $id = 0, 
$year = 0 )
+//             {
+//                     if (!$location_id)
+//                     {
+//                             $location_id = phpgw::get_var('location_id', 
'int');
+//                     }
+//                     if (!$id)
+//                     {
+//                             $id = phpgw::get_var('id', 'int');
+//                     }
+//                     if (!$year)
+//                     {
+//                             $year = phpgw::get_var('year', 'int', 
'REQUEST', date('Y'));
+//                     }
+//                     $socheck_list = CreateObject('controller.socheck_list');
+//
+//                     $start_and_end = 
$socheck_list->get_start_and_end_for_component($location_id, $id);
+//                     $start_year = date('Y', 
$start_and_end['start_timestamp']);
+//                     $end_year = date('Y', $start_and_end['end_timestamp']);
+//                     if (!$year)
+//                     {
+//                             $year = $end_year;
+//                     }
+//
+//                     for ($j = $start_year; $j < ($end_year + 1); $j++)
+//                     {
+//                             $this->check_lst_time_span[] = array(
+//                                     'id' => $j,
+//                                     'name' => $j,
+//                                     'selected' => $j == date('Y') ? 1 : 0
+//                             );
+//                     }
+//
+//                     $from_date_ts = mktime(0, 0, 0, 1, 1, $year);
+//                     $to_date_ts = mktime(23, 59, 59, 12, 31, $year);
+//                     $socontrol = CreateObject('controller.socontrol');
+//
+//                     $control_id_with_check_list_array = 
$socheck_list->get_check_lists_for_component($location_id, $id, $from_date_ts, 
$to_date_ts);
+//
+//                     $_statustext = array();
+//                     $_statustext[0] = lang('open');
+//                     $_statustext[1] = lang('closed');
+//                     $_statustext[2] = lang('pending');
+//                     $_check_list = array();
+//                     foreach ($control_id_with_check_list_array as $control)
+//                     {
+//                             $_control_name = 
$socontrol->get_single($control->get_id())->get_title();
+//                             $check_lists = 
$control->get_check_lists_array();
+//
+//                             foreach ($check_lists as $check_list)
+//                             {
+//                                     $_link = self::link(array(
+//                                                     'menuaction' => 
"controller.uicheck_list.edit_check_list",
+//                                                     'check_list_id' => 
$check_list->get_id()
+//                                                     )
+//                                     );
+//                                     $_check_list[] = array
+//                                             (
+//                                             'id' => $check_list->get_id(),
+//                                             'control_name' => "<a 
href=\"{$_link}\" >{$_control_name}</a>",
+//                                             'status' => 
$_statustext[$check_list->get_status()],
+//                                             'user' => 
$GLOBALS['phpgw']->accounts->get($check_list->get_assigned_to())->__toString(),
+//                                             'deadline' => 
$GLOBALS['phpgw']->common->show_date($check_list->get_deadline(), 
$GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat']),
+//                                             'planned_date' => 
$GLOBALS['phpgw']->common->show_date($check_list->get_planned_date(), 
$GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat']),
+//                                             'completed_date' => 
$GLOBALS['phpgw']->common->show_date($check_list->get_completed_date(), 
$GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat']),
+//                                             'num_open_cases' => 
$check_list->get_num_open_cases(),
+//                                             'num_pending_cases' => 
$check_list->get_num_pending_cases(),
+//                                     );
+//                                     unset($_link);
+//                             }
+//                     }
+//
+//                     if (phpgw::get_var('phpgw_return_as') == 'json')
+//                     {
+//                             $result_data = array
+//                                     (
+//                                     'results' => $_check_list,
+//                                     'total_records' => count($_check_list),
+//                                     'draw' => phpgw::get_var('draw', 'int')
+//                             );
+//
+//                             return $this->jquery_results($result_data);
+//                     }
+//                     return $_check_list;
+//             }
+
+               public function get_controls_at_component( $location_id = 0, 
$id = 0, $skip_json = false )
                {
-                       if (!$location_id)
-                       {
-                               $location_id = phpgw::get_var('location_id', 
'int');
-                       }
-                       if (!$id)
-                       {
-                               $id = phpgw::get_var('id', 'int');
-                       }
-                       if (!$year)
-                       {
-                               $year = phpgw::get_var('year', 'int', 
'REQUEST', date('Y'));
-                       }
-                       $socheck_list = CreateObject('controller.socheck_list');
+                       return 
$this->controller_helper->get_controls_at_component($location_id, $id, 
$skip_json);
+               }
 
-                       $start_and_end = 
$socheck_list->get_start_and_end_for_component($location_id, $id);
-                       $start_year = date('Y', 
$start_and_end['start_timestamp']);
-                       $end_year = date('Y', $start_and_end['end_timestamp']);
-                       if (!$year)
-                       {
-                               $year = $end_year;
-                       }
+               public function get_cases( $location_id = 0, $id = 0, $year = 0 
)
+               {
+                       return 
$this->controller_helper->get_cases($location_id, $id, $year);
+               }
 
-                       for ($j = $start_year; $j < ($end_year + 1); $j++)
-                       {
-                               $this->check_lst_time_span[] = array(
-                                       'id' => $j,
-                                       'name' => $j,
-                                       'selected' => $j == date('Y') ? 1 : 0
-                               );
-                       }
+               public function get_cases_for_checklist()
+               {
+                       return 
$this->controller_helper->get_cases_for_checklist();
+               }
 
-                       $from_date_ts = mktime(0, 0, 0, 1, 1, $year);
-                       $to_date_ts = mktime(23, 59, 59, 12, 31, $year);
-                       $socontrol = CreateObject('controller.socontrol');
+               public function get_checklists( $location_id = 0, $id = 0, 
$year = 0 )
+               {
+                       return 
$this->controller_helper->get_checklists($location_id, $id, $year);
 
-                       $control_id_with_check_list_array = 
$socheck_list->get_check_lists_for_component($location_id, $id, $from_date_ts, 
$to_date_ts);
+               }
 
-                       $_statustext = array();
-                       $_statustext[0] = lang('open');
-                       $_statustext[1] = lang('closed');
-                       $_statustext[2] = lang('pending');
-                       $_check_list = array();
-                       foreach ($control_id_with_check_list_array as $control)
-                       {
-                               $_control_name = 
$socontrol->get_single($control->get_id())->get_title();
-                               $check_lists = 
$control->get_check_lists_array();
+               function get_assigned_history()
+               {
+                       return $this->controller_helper->get_assigned_history();
+               }
 
-                               foreach ($check_lists as $check_list)
-                               {
-                                       $_link = self::link(array(
-                                                       'menuaction' => 
"controller.uicheck_list.edit_check_list",
-                                                       'check_list_id' => 
$check_list->get_id()
-                                                       )
-                                       );
-                                       $_check_list[] = array
-                                               (
-                                               'id' => $check_list->get_id(),
-                                               'control_name' => "<a 
href=\"{$_link}\" >{$_control_name}</a>",
-                                               'status' => 
$_statustext[$check_list->get_status()],
-                                               'user' => 
$GLOBALS['phpgw']->accounts->get($check_list->get_assigned_to())->__toString(),
-                                               'deadline' => 
$GLOBALS['phpgw']->common->show_date($check_list->get_deadline(), 
$GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat']),
-                                               'planned_date' => 
$GLOBALS['phpgw']->common->show_date($check_list->get_planned_date(), 
$GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat']),
-                                               'completed_date' => 
$GLOBALS['phpgw']->common->show_date($check_list->get_completed_date(), 
$GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat']),
-                                               'num_open_cases' => 
$check_list->get_num_open_cases(),
-                                               'num_pending_cases' => 
$check_list->get_num_pending_cases(),
-                                       );
-                                       unset($_link);
-                               }
-                       }
-
-                       if (phpgw::get_var('phpgw_return_as') == 'json')
-                       {
-                               $result_data = array
-                                       (
-                                       'results' => $_check_list,
-                                       'total_records' => count($_check_list),
-                                       'draw' => phpgw::get_var('draw', 'int')
-                               );
-
-                               return $this->jquery_results($result_data);
-                       }
-                       return $_check_list;
-               }
        }
\ No newline at end of file

Modified: branches/Version-2_0-branch/property/inc/class.uilocation.inc.php
===================================================================
--- branches/Version-2_0-branch/property/inc/class.uilocation.inc.php   
2017-11-07 12:56:13 UTC (rev 17277)
+++ branches/Version-2_0-branch/property/inc/class.uilocation.inc.php   
2017-11-07 15:52:19 UTC (rev 17278)
@@ -2547,7 +2547,7 @@
                                        );
 
                                        $_checklists = 
$this->get_checklists($location_id, $id, date('Y'));
-                                       $check_lst_time_span = 
$this->check_lst_time_span;
+                                       $check_lst_time_span = 
$this->controller_helper->get_check_lst_time_span();
 
                                        $_checklists_def = array
                                                (
@@ -2605,9 +2605,18 @@
 
                        unset($values['attributes']);
 
+                       $repeat_types = array();
+//                     $repeat_types[] = array('id'=> -1, 'name' => 
lang('day'));
+//                     $repeat_types[] = array('id'=> 1, 'name' => 
lang('weekly'));
+                       $repeat_types[] = array('id' => 2, 'name' => 
lang('month'));
+                       $repeat_types[] = array('id' => 3, 'name' => 
lang('year'));
+
                        $data = array
                                (
                                'datatable_def' => $datatable_def,
+                               'repeat_types' => array('options' => 
$repeat_types),
+                               'location_id'   => $location_id,
+                               'item_id'               => (int)$id,
                                'integration' => $integration,
                                'controller' => $_enable_controller && 
$location_code,
                                'roles' => $roles,

Modified: branches/Version-2_0-branch/property/inc/class.uitts.inc.php
===================================================================
--- branches/Version-2_0-branch/property/inc/class.uitts.inc.php        
2017-11-07 12:56:13 UTC (rev 17277)
+++ branches/Version-2_0-branch/property/inc/class.uitts.inc.php        
2017-11-07 15:52:19 UTC (rev 17278)
@@ -1708,10 +1708,7 @@
                        phpgwapi_jquery::formvalidator_generate(array('date', 
'security','file'));
                        $this->_insert_custom_js();
                        $GLOBALS['phpgw_info']['flags']['app_header'] = 
lang('property') . ' - ' . $appname . ': ' . $function_msg;
-                       self::add_jquery_translation($data);
-                       $GLOBALS['phpgw']->xslttpl->add_file(array('tts', 
'files', 'attributes_form'));
-                       $GLOBALS['phpgw']->xslttpl->set_var('phpgw', 
array('add' => $data));
-                       //      $GLOBALS['phpgw']->xslttpl->pp();
+                       self::render_template_xsl( array('tts', 'files', 
'attributes_form'), $data, $xsl_rootdir = '' , 'add');
                }
 
                function update_data()
@@ -1823,9 +1820,6 @@
                                $receipt = array();
                        }
 
-                       $GLOBALS['phpgw']->xslttpl->add_file(array('tts', 
'files', 'attributes_form',
-                               'datatable_inline'));
-
                        $historylog = CreateObject('property.historylog', 
'tts');
 
                        $order_read = $this->acl->check('.ticket.order', 
PHPGW_ACL_READ, 'property');
@@ -3115,8 +3109,8 @@
                        $appname = lang('helpdesk');
                        $function_msg = lang('view ticket detail');
                        $GLOBALS['phpgw_info']['flags']['app_header'] = 
lang('property') . ' - ' . $appname . ': ' . $function_msg;
-                       self::add_jquery_translation($data);
-                       $GLOBALS['phpgw']->xslttpl->set_var('phpgw', 
array('view' => $data));
+                       self::render_template_xsl( array('tts', 'files', 
'attributes_form',
+                               'datatable_inline'), $data, $xsl_rootdir = '' , 
'view');
                }
 
                function view_file()

Modified: 
branches/Version-2_0-branch/property/js/portico/admin_entity.edit_category.js
===================================================================
--- 
branches/Version-2_0-branch/property/js/portico/admin_entity.edit_category.js   
    2017-11-07 12:56:13 UTC (rev 17277)
+++ 
branches/Version-2_0-branch/property/js/portico/admin_entity.edit_category.js   
    2017-11-07 15:52:19 UTC (rev 17278)
@@ -35,11 +35,9 @@
                values_tophp.push($(this).val());
        });
 
-       if($("#template_attrib") && values_tophp)
+       if(values_tophp.length > 0)
        {
-
-               $("#template_attrib").val(values_tophp);
-       //      document.form.template_attrib.value = values_tophp;
+               document.form.template_attrib.value = values_tophp;
        }
        document.form.submit();
 }

Modified: branches/Version-2_0-branch/property/js/portico/entity.edit.js
===================================================================
--- branches/Version-2_0-branch/property/js/portico/entity.edit.js      
2017-11-07 12:56:13 UTC (rev 17277)
+++ branches/Version-2_0-branch/property/js/portico/entity.edit.js      
2017-11-07 15:52:19 UTC (rev 17278)
@@ -106,7 +106,7 @@
 
        if (ids.length > 0)
        {
-               var data = {"ids": ids, "action": action};
+               var data = {ids: ids, action: action};
                data.repeat_interval = $("#repeat_interval").val();
                data.controle_time = $("#controle_time").val();
                data.service_time = $("#service_time").val();
@@ -114,14 +114,8 @@
                data.control_start_date = $("#control_start_date").val();
                data.repeat_type = $("#repeat_type").val();
 
-               var formUrl = $("#form").attr("action");
-               var Url = parseURL(formUrl);
-               oArgs = Url.searchObject;
-               delete oArgs.click_history;
-               oArgs.menuaction = 'property.boentity.update_control_serie';
-
+               var oArgs = {menuaction: 
'property.controller_helper.update_control_serie', location_id : location_id, 
id: item_id };
                var requestUrl = phpGWLink('index.php', oArgs, true);
-
                $.ajax({
                        type: 'POST',
                        dataType: 'json',
@@ -141,7 +135,7 @@
                });
 
 
-               var oArgs2 = {menuaction: 
'property.uientity.get_controls_at_component', type: oArgs.type, entity_id: 
oArgs.entity_id, cat_id: oArgs.cat_id, id: oArgs.id};
+               var oArgs2 = {menuaction: 
'property.uientity.get_controls_at_component', location_id : location_id, id: 
item_id};
                var requestUrl2 = phpGWLink('index.php', oArgs2, true);
                JqueryPortico.updateinlineTableHelper('datatable-container_4', 
requestUrl2);
        }
@@ -175,11 +169,8 @@
 
 add_control = function ()
 {
-       var formUrl = $("#form").attr("action");
-       var Url = parseURL(formUrl);
-       oArgs = Url.searchObject;
-       delete oArgs.click_history;
-       oArgs.menuaction = 'property.boentity.add_control';
+       oArgs = {location_id:location_id, id: item_id};
+       oArgs.menuaction = 'property.controller_helper.add_control';
        oArgs.control_id = $("#control_id").val();
        oArgs.control_responsible = $("#control_responsible").val();
        oArgs.control_start_date = $("#control_start_date").val();
@@ -219,7 +210,7 @@
                }
        });
 
-       var oArgs2 = {menuaction: 
'property.uientity.get_controls_at_component', type: oArgs.type, entity_id: 
oArgs.entity_id, cat_id: oArgs.cat_id, id: oArgs.id};
+       var oArgs2 = {menuaction: 
'property.uientity.get_controls_at_component', location_id: location_id, id: 
item_id};
        var requestUrl2 = phpGWLink('index.php', oArgs2, true);
        JqueryPortico.updateinlineTableHelper('datatable-container_4', 
requestUrl2);
 };

Modified: branches/Version-2_0-branch/property/js/portico/location.edit.js
===================================================================
--- branches/Version-2_0-branch/property/js/portico/location.edit.js    
2017-11-07 12:56:13 UTC (rev 17277)
+++ branches/Version-2_0-branch/property/js/portico/location.edit.js    
2017-11-07 15:52:19 UTC (rev 17278)
@@ -61,4 +61,192 @@
                        window.open(requestUrl, '_blank');
                });
        }
-};
\ No newline at end of file
+};
+
+this.onActionsClick = function (action)
+{
+       $("#controller_receipt").html("");
+       if (action === 'add')
+       {
+               add_control();
+       }
+
+       var api = $('#datatable-container_4').dataTable().api();
+       var selected = api.rows({selected: true}).data();
+
+       var numSelected = selected.length;
+
+       if (numSelected == 0)
+       {
+               alert('None selected');
+               return false;
+       }
+       var ids = [];
+       for (var n = 0; n < selected.length; ++n)
+       {
+               var aData = selected[n];
+               ids.push(aData['serie_id']);
+       }
+
+       if (ids.length > 0)
+       {
+               var data = {ids: ids, action: action};
+               data.repeat_interval = $("#repeat_interval").val();
+               data.controle_time = $("#controle_time").val();
+               data.service_time = $("#service_time").val();
+               data.control_responsible = $("#control_responsible").val();
+               data.control_start_date = $("#control_start_date").val();
+               data.repeat_type = $("#repeat_type").val();
+
+               var oArgs = {menuaction: 
'property.controller_helper.update_control_serie', location_id : location_id, 
id: item_id };
+               var requestUrl = phpGWLink('index.php', oArgs, true);
+               $.ajax({
+                       type: 'POST',
+                       dataType: 'json',
+                       url: requestUrl,
+                       data: data,
+                       success: function (data)
+                       {
+                               if (data != null)
+                               {
+                                       
$("#controller_receipt").html(data.status + '::' + data.msg);
+                                       if (data.status_kode == 'ok')
+                                       {
+
+                                       }
+                               }
+                       }
+               });
+
+
+               var oArgs2 = {menuaction: 
'property.uilocation.get_controls_at_component', location_id : location_id, id: 
item_id};
+               var requestUrl2 = phpGWLink('index.php', oArgs2, true);
+               JqueryPortico.updateinlineTableHelper('datatable-container_4', 
requestUrl2);
+       }
+}
+
+function parseURL(url)
+{
+       var parser = document.createElement('a'),
+               searchObject = {},
+               queries, split, i;
+       // Let the browser do the work
+       parser.href = url;
+       // Convert query string to object
+       queries = parser.search.replace(/^\?/, '').split('&');
+       for (i = 0; i < queries.length; i++)
+       {
+               split = queries[i].split('=');
+               searchObject[split[0]] = split[1];
+       }
+       return {
+               protocol: parser.protocol,
+               host: parser.host,
+               hostname: parser.hostname,
+               port: parser.port,
+               pathname: parser.pathname,
+               search: parser.search,
+               searchObject: searchObject,
+               hash: parser.hash
+       };
+}
+
+add_control = function ()
+{
+       oArgs = {location_id:location_id, id: item_id};
+       oArgs.menuaction = 'property.controller_helper.add_control';
+       oArgs.control_id = $("#control_id").val();
+       oArgs.control_responsible = $("#control_responsible").val();
+       oArgs.control_start_date = $("#control_start_date").val();
+       oArgs.repeat_type = $("#repeat_type").val();
+       if (!oArgs.repeat_type)
+       {
+               alert('velg type serie');
+               return;
+       }
+
+       oArgs.repeat_interval = $("#repeat_interval").val();
+       oArgs.controle_time = $("#controle_time").val();
+       oArgs.service_time = $("#service_time").val();
+       var requestUrl = phpGWLink('index.php', oArgs, true);
+//                                                             
alert(requestUrl);
+
+       $("#controller_receipt").html("");
+
+       $.ajax({
+               type: 'POST',
+               dataType: 'json',
+               url: requestUrl,
+               success: function (data)
+               {
+                       if (data != null)
+                       {
+                               $("#controller_receipt").html(data.status + 
'::' + data.msg);
+                               if (data.status_kode == 'ok')
+                               {
+                                       $("#control_id").val('');
+                                       $("#control_name").val('');
+                                       $("#control_responsible").val('');
+                                       
$("#control_responsible_user_name").val('');
+                                       $("#control_start_date").val('');
+                               }
+                       }
+               }
+       });
+
+       var oArgs2 = {menuaction: 
'property.uilocation.get_controls_at_component', location_id: location_id, id: 
item_id};
+       var requestUrl2 = phpGWLink('index.php', oArgs2, true);
+       JqueryPortico.updateinlineTableHelper('datatable-container_4', 
requestUrl2);
+};
+
+function updateCaseTable(check_list_id)
+{
+       if (!check_list_id)
+       {
+               return;
+       }
+       var oArgs = {menuaction: 'property.uilocation.get_cases_for_checklist', 
check_list_id: check_list_id};
+       var requestUrl = phpGWLink('index.php', oArgs, true);
+       JqueryPortico.updateinlineTableHelper('datatable-container_6', 
requestUrl);
+}
+
+$(document).ready(function ()
+{
+
+       var click_action_on_table = false;
+       $("#check_lst_time_span").change(function ()
+       {
+               var oArgs = {menuaction: 'property.uilocation.get_checklists', 
location_id: location_id, id: item_id, year: $(this).val()};
+               var requestUrl = phpGWLink('index.php', oArgs, true);
+               var _oTable = 
JqueryPortico.updateinlineTableHelper('datatable-container_5', requestUrl);
+
+               oArgs = {menuaction: 'property.uilocation.get_cases', 
location_id: location_id, id: item_id, year: $(this).val()};
+               requestUrl = phpGWLink('index.php', oArgs, true);
+               JqueryPortico.updateinlineTableHelper('datatable-container_6', 
requestUrl);
+
+               if (click_action_on_table == false)
+               {
+                       $(_oTable).on("click", function (e)
+                       {
+                               var aTrs = _oTable.fnGetNodes();
+                               for (var i = 0; i < aTrs.length; i++)
+                               {
+                                       if ($(aTrs[i]).hasClass('selected'))
+                                       {
+                                               var check_list_id = $('td', 
aTrs[i]).eq(0).text();
+                                               updateCaseTable(check_list_id);
+                                       }
+                               }
+                       });
+                       click_action_on_table = true
+               }
+
+       });
+
+       $("#datatable-container_5 tr").on("click", function (e)
+       {
+               var check_list_id = $('td', this).eq(0).text();
+               updateCaseTable(check_list_id);
+       });
+
+});

Modified: branches/Version-2_0-branch/property/templates/base/admin_entity.xsl
===================================================================
--- branches/Version-2_0-branch/property/templates/base/admin_entity.xsl        
2017-11-07 12:56:13 UTC (rev 17277)
+++ branches/Version-2_0-branch/property/templates/base/admin_entity.xsl        
2017-11-07 15:52:19 UTC (rev 17278)
@@ -440,7 +440,7 @@
                <xsl:value-of select="lookup_functions"/>
                var base_java_url = <xsl:value-of select="base_java_url"/>;
        </script>
-       
+
        <xsl:choose>
                <xsl:when test="msgbox_data != ''">
                        <dl>
@@ -498,13 +498,13 @@
                                                <label>
                                                        <xsl:value-of 
select="php:function('lang', 'name')"/>
                                                </label>
-                                                               
+
                                                <input type="text" 
data-validation="required" name="values[name]" value="{value_name}">
                                                        <xsl:attribute 
name="title">
                                                                <xsl:value-of 
select="lang_name_standardtext"/>
                                                        </xsl:attribute>
                                                </input>
-                                                               
+
                                        </div>
                                        <div class="pure-control-group">
                                                <label>
@@ -898,11 +898,11 @@
                                                                                
</xsl:call-template>
                                                                        
</xsl:if>
                                                                </xsl:for-each>
-                                                               <input 
type="hidden" name="template_attrib" value=""/>
                                                        </div>
                                                </xsl:when>
                                        </xsl:choose>
                                        <div class="pure-controls">
+                                               <input type="hidden" 
name="template_attrib" value=""/>
                                                <input type="button" 
class="pure-button pure-button-primary" name="values[save]" value="{lang_save}" 
onClick="onActionsClick();">
                                                        <xsl:attribute 
name="title">
                                                                <xsl:value-of 
select="php:function('lang', 'save')"/>
@@ -1247,7 +1247,7 @@
                self.name="first_Window";
                <xsl:value-of select="lookup_functions"/>
        </script>
-       
+
        <dl>
                <xsl:choose>
                        <xsl:when test="msgbox_data != ''">
@@ -1264,7 +1264,7 @@
                <div id="tab-content">
                        <xsl:value-of disable-output-escaping="yes" 
select="tabs"/>
                        <div id="general">
-                                                   
+
                                <div class="pure-control-group">
                                        <label>
                                                <xsl:value-of 
select="lang_entity"/>

Modified: branches/Version-2_0-branch/property/templates/base/location.xsl
===================================================================
--- branches/Version-2_0-branch/property/templates/base/location.xsl    
2017-11-07 12:56:13 UTC (rev 17277)
+++ branches/Version-2_0-branch/property/templates/base/location.xsl    
2017-11-07 15:52:19 UTC (rev 17278)
@@ -585,6 +585,9 @@
                                                        
TINY.box.show({iframe:requestUrl, 
boxid:"frameless",width:750,height:450,fixed:false,maskid:"darkmask",maskopacity:40,
 mask:true, animate:true, close: true});
                                                        }
 
+                                                       var location_id = 
<xsl:value-of select="location_id"/>;
+                                                       var item_id = 
<xsl:value-of select="item_id"/>;
+
                                                </script>
                                                <div 
id="controller_receipt"></div>
                                                <fieldset>

Modified: branches/Version-2_0-branch/setup/accounts.php
===================================================================
--- branches/Version-2_0-branch/setup/accounts.php      2017-11-07 12:56:13 UTC 
(rev 17277)
+++ branches/Version-2_0-branch/setup/accounts.php      2017-11-07 15:52:19 UTC 
(rev 17278)
@@ -15,7 +15,7 @@
                'currentapp' => 'home',
                'noapi'      => true
        );
-       
+
        /**
         * Include setup functions
         */
@@ -32,7 +32,7 @@
 
        /**
         * Add account
-        * 
+        *
         * @param array  $acct    Account name and other information to use
         * @param string $type    Account type: u = user | g = group
         * @param array  $groups  Groups to add account to
@@ -87,7 +87,9 @@
                                'timeformat'    => 24,
                                'default_app'   => '',
                                'currency'              => '$',
-                               'show_help'             => 1
+                               'show_help'             => 0,
+                               'account_display'=> 'lastname',
+                               'rteditor'              => 'ckeditor'
                        ),
 
                        'addressbook' => array(),
@@ -114,7 +116,7 @@
        /**
         * Validate the data for the admin user account
         *
-        * @param string &$username the login id for the admin user - 
+        * @param string &$username the login id for the admin user -
         * @param string $passwd    the password for the new user
         * @param string $passwd2   the verification password for the new user
         * @param string $fname     the first name of the administrator
@@ -186,7 +188,7 @@
                $GLOBALS['phpgw_info']['server']['account_repository']          
= 'sql';
                $GLOBALS['phpgw_info']['server']['auth_type']                   
        = 'sql';
                $GLOBALS['phpgw_info']['server']['encryption_type']             
        = 'ssha';
-               $GLOBALS['phpgw_info']['server']['password_level']         = 
'NONALPHA'; 
+               $GLOBALS['phpgw_info']['server']['password_level']         = 
'NONALPHA';
                $GLOBALS['phpgw_info']['server']['account_min_id']              
        = 1000;
                $GLOBALS['phpgw_info']['server']['account_max_id']              
        = 65535;
                $GLOBALS['phpgw_info']['server']['group_min_id']                
        = 500;
@@ -207,7 +209,7 @@
                {
                        $GLOBALS['phpgw_info']['server'][$db->f('config_name', 
true)] = $db->f('config_value', true);
                }
-               
+
                $GLOBALS['phpgw'] = new phpgw;
                $GLOBALS['phpgw']->db       =& $db;
                $GLOBALS['phpgw']->accounts = CreateObject('phpgwapi.accounts');
@@ -230,12 +232,12 @@
                }
 
                $errors = validate_admin($username, $passwd, $passwd2, $fname, 
$lname);
-               
+
                if(in_array($username, array('admins', 'default')))
                {
                        $errors[] = lang('That loginid has already been taken');
                }
-               
+
                if ( !count($errors) )
                {
                        $admin_acct = array
@@ -308,7 +310,7 @@
                                'location'      => 'changepassword',
                                'rights'        => 1
                        );
-                       
+
                        $group = array('username' => 'default');
                        $defaultgroupid = add_account($group, 'g', array(), 
$modules);
 
@@ -324,7 +326,7 @@
                        exit;
                }
        }
-       
+
        $tpl_root = $GLOBALS['phpgw_setup']->html->setup_tpl_dir('setup');
        $setup_tpl = CreateObject('phpgwapi.Template',$tpl_root);
        $setup_tpl->set_file(array(
@@ -357,7 +359,7 @@
                $number_of_accounts = $db->f('cnt');
                if ( $number_of_accounts )
                {
-                       $account_creation_notice .= "\n" 
+                       $account_creation_notice .= "\n"
                                . lang('<b>!!!THIS WILL DELETE ALL EXISTING 
ACCOUNTS!!!</b><br>');
                }
        }




reply via email to

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