fmsystem-commits
[Top][All Lists]
Advanced

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

[Fmsystem-commits] [13226] more on controller integration


From: Sigurd Nes
Subject: [Fmsystem-commits] [13226] more on controller integration
Date: Tue, 19 May 2015 14:09:21 +0000

Revision: 13226
          http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=13226
Author:   sigurdne
Date:     2015-05-19 14:09:20 +0000 (Tue, 19 May 2015)
Log Message:
-----------
more on controller integration

Modified Paths:
--------------
    trunk/bim/setup/setup.inc.php
    trunk/bim/setup/tables_current.inc.php
    trunk/bim/setup/tables_update.inc.php
    trunk/catch/setup/setup.inc.php
    trunk/catch/setup/tables_current.inc.php
    trunk/catch/setup/tables_update.inc.php
    trunk/controller/inc/class.socontrol.inc.php
    trunk/controller/inc/class.uicalendar.inc.php
    trunk/controller/inc/class.uicomponent.inc.php
    trunk/controller/inc/component/class.check_list_status_manager.inc.php
    trunk/controller/inc/component/class.year_calendar.inc.php
    trunk/controller/templates/base/component.xsl
    trunk/property/inc/class.boentity.inc.php
    trunk/property/inc/class.bolocation.inc.php
    trunk/property/inc/class.menu.inc.php
    trunk/property/inc/class.soadmin_entity.inc.php
    trunk/property/inc/class.soentity.inc.php
    trunk/property/inc/class.sogeneric.inc.php
    trunk/property/inc/class.solocation.inc.php
    trunk/property/inc/class.uiadmin_entity.inc.php
    trunk/property/setup/setup.inc.php
    trunk/property/setup/tables_current.inc.php
    trunk/property/setup/tables_update.inc.php
    trunk/property/templates/base/admin_entity.xsl

Modified: trunk/bim/setup/setup.inc.php
===================================================================
--- trunk/bim/setup/setup.inc.php       2015-05-19 07:12:53 UTC (rev 13225)
+++ trunk/bim/setup/setup.inc.php       2015-05-19 14:09:20 UTC (rev 13226)
@@ -12,7 +12,7 @@
        */
 
        $setup_info['bim']['name']                      = 'bim';
-       $setup_info['bim']['version']           = '0.9.17.508';
+       $setup_info['bim']['version']           = '0.9.17.509';
        $setup_info['bim']['app_order']         = 8;
        $setup_info['bim']['enable']            = 1;
        $setup_info['bim']['app_group']         = 'office';

Modified: trunk/bim/setup/tables_current.inc.php
===================================================================
--- trunk/bim/setup/tables_current.inc.php      2015-05-19 07:12:53 UTC (rev 
13225)
+++ trunk/bim/setup/tables_current.inc.php      2015-05-19 14:09:20 UTC (rev 
13226)
@@ -61,6 +61,7 @@
                                'entry_date' => array('type' => 
'int','precision' => '4','nullable' => True),
                                'user_id' => array('type' => 'int','precision' 
=> '4','nullable' => True),
                                'org_unit_id' => array('type' => 
'int','precision' => '4','nullable' => True),
+                               'entity_group_id' => array('type' => 
'int','precision' => '4','nullable' => True),
                        ),
                        'pk' => array('type','id'),
                        'fk' => array(

Modified: trunk/bim/setup/tables_update.inc.php
===================================================================
--- trunk/bim/setup/tables_update.inc.php       2015-05-19 07:12:53 UTC (rev 
13225)
+++ trunk/bim/setup/tables_update.inc.php       2015-05-19 14:09:20 UTC (rev 
13226)
@@ -199,4 +199,21 @@
                        $GLOBALS['setup_info']['bim']['currentver'] = 
'0.9.17.508';
                        return $GLOBALS['setup_info']['bim']['currentver'];
                }
+       }
+
+       /**
+       * Update bim version from 0.9.17.508 to 0.9.17.509
+       */
+       $test[] = '0.9.17.508';
+       function bim_upgrade0_9_17_508()
+       {
+               $GLOBALS['phpgw_setup']->oProc->m_odb->transaction_begin();
+
+               
$GLOBALS['phpgw_setup']->oProc->AddColumn('fm_bim_item','entity_group_id', 
array('type' => 'int', 'precision' => 4,'nullable' => true));
+
+               if($GLOBALS['phpgw_setup']->oProc->m_odb->transaction_commit())
+               {
+                       $GLOBALS['setup_info']['bim']['currentver'] = 
'0.9.17.509';
+                       return $GLOBALS['setup_info']['bim']['currentver'];
+               }
        }
\ No newline at end of file

Modified: trunk/catch/setup/setup.inc.php
===================================================================
--- trunk/catch/setup/setup.inc.php     2015-05-19 07:12:53 UTC (rev 13225)
+++ trunk/catch/setup/setup.inc.php     2015-05-19 14:09:20 UTC (rev 13226)
@@ -27,7 +27,7 @@
         */
 
        $setup_info['catch']['name']                    = 'catch';
-       $setup_info['catch']['version']                 = '0.9.17.519';
+       $setup_info['catch']['version']                 = '0.9.17.520';
        $setup_info['catch']['app_order']               = 20;
        $setup_info['catch']['enable']                  = 1;
        $setup_info['catch']['globals_checked'] = True;

Modified: trunk/catch/setup/tables_current.inc.php
===================================================================
--- trunk/catch/setup/tables_current.inc.php    2015-05-19 07:12:53 UTC (rev 
13225)
+++ trunk/catch/setup/tables_current.inc.php    2015-05-19 14:09:20 UTC (rev 
13226)
@@ -64,7 +64,8 @@
                                'jasperupload' => array('type' => 
'int','precision' => 2,'nullable' => True),
                                'parent_id' => array('type' => 
'int','precision' => '4','nullable' => True),
                                'level' => array('type' => 'int','precision' => 
'4','nullable' => True),
-                               'department' => array('type' => 
'int','precision' => '2','nullable' => True),
+                               'org_unit' => array('type' => 'int','precision' 
=> '2','nullable' => True),
+                               'entity_group_id' => array('type' => 
'int','precision' => '4','nullable' => True),
                        ),
                        'pk' => array('entity_id','id'),
                        'fk' => array(),

Modified: trunk/catch/setup/tables_update.inc.php
===================================================================
--- trunk/catch/setup/tables_update.inc.php     2015-05-19 07:12:53 UTC (rev 
13225)
+++ trunk/catch/setup/tables_update.inc.php     2015-05-19 14:09:20 UTC (rev 
13226)
@@ -607,3 +607,17 @@
                        return $GLOBALS['setup_info']['catch']['currentver'];
                }
        }
+
+       $test[] = '0.9.17.519';
+       function catch_upgrade0_9_17_519()
+       {
+               $GLOBALS['phpgw_setup']->oProc->m_odb->transaction_begin();
+               
$GLOBALS['phpgw_setup']->oProc->RenameColumn('fm_catch_category','department','org_unit');
+               
$GLOBALS['phpgw_setup']->oProc->AddColumn('fm_catch_category','entity_group_id',array('type'
 => 'int','precision' => 4,'nullable' => True));
+
+               if($GLOBALS['phpgw_setup']->oProc->m_odb->transaction_commit())
+               {
+                       $GLOBALS['setup_info']['catch']['currentver'] = 
'0.9.17.520';
+                       return $GLOBALS['setup_info']['catch']['currentver'];
+               }
+       }

Modified: trunk/controller/inc/class.socontrol.inc.php
===================================================================
--- trunk/controller/inc/class.socontrol.inc.php        2015-05-19 07:12:53 UTC 
(rev 13225)
+++ trunk/controller/inc/class.socontrol.inc.php        2015-05-19 14:09:20 UTC 
(rev 13226)
@@ -598,7 +598,8 @@
                /**
                 * Get locations that a control should be carried out for
                 *
-                * @param $control_id control id
+                * @param int $control_id control id
+                * @param array $location_code_filter
                 * @return array with arrays of location info  
                 */
                function get_locations_for_control($control_id)
@@ -607,10 +608,11 @@
 
                        $controls_array = array();
 
-                       $sql =  "SELECT c.id, c.title, cll.location_code "; 
-                       $sql .= "FROM controller_control c, 
controller_control_location_list cll ";
+                       $sql =  "SELECT c.id, c.title, cll.location_code, 
fm_locations.name as loc_name ";
+                       $sql .= "FROM controller_control c, 
controller_control_location_list cll, fm_locations ";
                        $sql .= "WHERE cll.control_id = {$control_id} ";
-                       $sql .= "AND cll.control_id = c.id";
+                       $sql .= "AND cll.control_id = c.id ";
+                       $sql .= "AND cll.location_code = 
fm_locations.location_code";
 
                        $this->db->query($sql);
 
@@ -619,7 +621,10 @@
                                $control_id = 
$this->unmarshal($this->db->f('id'), 'int');
                                $title = $this->unmarshal($this->db->f('title', 
true), 'string');
                                $location_code = 
$this->unmarshal($this->db->f('location_code', true), 'string');
+                               $loc_name = $this->db->f('loc_name', true);
+                               $loc_name_arr = explode(', ', $loc_name);
 
+/*
                                $location_array = 
execMethod('property.bolocation.read_single', array('location_code' => 
$location_code,'extra' => array('noattrib' => true)));
 
                                $location_arr = explode('-', $location_code);
@@ -630,14 +635,14 @@
                                        $loc_name_arr[] = 
$location_array["loc{$i}_name"];
                                        $i++;
                                }
-
+*/
                                $controls_array[] = array
                                (
                                        'id'                    => $control_id, 
                                        'title'                 => $title, 
                                        'location_code' => $location_code, 
-                                       'loc1_name'             => 
$location_array['loc1_name'],
-                                       'loc_name'              => implode(', 
', $loc_name_arr)
+                                       'loc1_name'             => 
$loc_name_arr[0],
+                                       'loc_name'              => $loc_name
                                );
                        }
 

Modified: trunk/controller/inc/class.uicalendar.inc.php
===================================================================
--- trunk/controller/inc/class.uicalendar.inc.php       2015-05-19 07:12:53 UTC 
(rev 13225)
+++ trunk/controller/inc/class.uicalendar.inc.php       2015-05-19 14:09:20 UTC 
(rev 13226)
@@ -472,7 +472,6 @@
 
                        $user_id = $GLOBALS['phpgw_info']['user']['account_id'];
 
-                       $bookmark_locations      = array();
                        $bookmarks                       = 
phpgwapi_cache::user_get('controller', "location_bookmark", $user_id);
                        if(is_array($bookmarks))
                        {

Modified: trunk/controller/inc/class.uicomponent.inc.php
===================================================================
--- trunk/controller/inc/class.uicomponent.inc.php      2015-05-19 07:12:53 UTC 
(rev 13225)
+++ trunk/controller/inc/class.uicomponent.inc.php      2015-05-19 14:09:20 UTC 
(rev 13226)
@@ -82,29 +82,19 @@
                        $this->account                  = 
$GLOBALS['phpgw_info']['user']['account_id'];
                }
 
-               /**
-                * Fetches controls and returns to datatable
-                *
-                * @param HTTP::phpgw_return_as specifies how data should be 
returned
-                * @return data array
-                */
-               public function index()
+               private function get_location_filter()
                {
-                       if(phpgw::get_var('phpgw_return_as') == 'json')
-                       {
-                               return $this->query();
-                       }
-                       phpgwapi_jquery::load_widget('core');
+                       $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}");
 
-                       $component_type = 
'';//phpgwapi_cache::session_get('controller', 'component_type');
-                       $sort_key = array();
-                       if(!$component_type)
+                       if(!$location_filter)
                        {
                                $this->soadmin_entity   = 
CreateObject('property.soadmin_entity');
                                $entity_list    = 
$this->soadmin_entity->read(array('allrows' => true));
 
-                               $component_type = array();
+                               $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));
@@ -113,8 +103,12 @@
 
                                                
if($category['enable_controller'])
                                                {
+                                                       if($entity_group_id && 
! $category['entity_group_id'])
+                                                       {
+                                                               continue;
+                                                       }
                                                        $sort_arr = explode(' 
', $category['name']);
-                                                       $component_type[] = 
array
+                                                       $location_filter[] = 
array
                                                        (
                                                                'id' => 
$category['location_id'],
                                                                'name'=> 
"{$entry['name']}::{$category['name']}",
@@ -124,16 +118,35 @@
                                        }
                                }
                                // Obtain a list of columns
-                               foreach ($component_type as $key => $row)
+                               foreach ($location_filter as $key => $row)
                                {
                                        $id[$key]  = $row['sort_key'];
                                }
 
-                               array_multisort($id,SORT_ASC, SORT_STRING, 
$component_type);
-                               array_unshift($component_type, array('id' => 
'', 'name' => lang('select value')));
-//                             phpgwapi_cache::session_set('controller', 
'component_type', $component_type);
+                               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;
+                       }
+                       return $location_filter;
+               }
 
+               /**
+                * Fetches controls and returns to datatable
+                *
+                * @param HTTP::phpgw_return_as specifies how data should be 
returned
+                * @return data array
+                */
+               public function index()
+               {
+                       if(phpgw::get_var('phpgw_return_as') == 'json')
+                       {
+                               return $this->query();
+                       }
+                       phpgwapi_jquery::load_widget('core');
+
                        $users = 
$GLOBALS['phpgw']->acl->get_user_list_right(PHPGW_ACL_EDIT, '.control');
                        $user_list = array();
                        foreach($users as $user)
@@ -183,7 +196,10 @@
                                );
                        }
 
+                       $location_filter = $this->get_location_filter();
+                       array_unshift($location_filter, array('id' => '', 
'name' => lang('select value')));
 
+
                        $data = array(
                                'datatable_name' => lang('status components'),
                                'form'                   => array(
@@ -191,11 +207,16 @@
                                        'method'        => 'POST',
                                        'toolbar' => array(
                                                'item' => array(
-                                                       //as categories
                                                        array('type'     => 
'filter',
+                                                               'name'   => 
'entity_group_id',
+                                                               'text'   => 
lang('entity group'),
+                                                               'list'   => 
execMethod('property.bogeneric.get_list',array('type' => 'entity_group', 
'selected' => phpgw::get_var('entity_group_id'), 'add_empty' => true)),
+                                                               'onchange'      
=> 'update_table();'
+                                                       ),
+                                                       array('type'     => 
'filter',
                                                                'name'   => 
'location_id',
                                                                'text'   => 
lang('component'),
-                                                               'list'   => 
$component_type,
+                                                               'list'   => 
$location_filter,
                                                                'onchange'      
=> 'update_table();'
                                                        ),/*
                                                        array('type'     => 
'filter',
@@ -330,6 +351,7 @@
                public function query()
                {
                        static $_location_name = array();
+                       $entity_group_id = phpgw::get_var('entity_group_id', 
'int');
                        $location_id = phpgw::get_var('location_id', 'int');
                        $control_area = phpgw::get_var('control_area', 'int');
                        $user_id = phpgw::get_var('user_id', 'int');
@@ -349,15 +371,63 @@
                        // Gets timestamp of first day in next year
                        $to_date_ts = 
execMethod('controller.uicalendar.get_end_date_year_ts',$year);
 
-                       $components = 
execMethod('property.soentity.read',array('location_id' => $location_id, 
'district_id' => $district_id, 'allrows' => true));
+                       $location_filter = $this->get_location_filter();
+
+                       foreach ($location_filter as $_location)
+                       {
+                               $location_type_name[$_location['id']] = 
$_location['name'];
+                       }
+//                     _debug_array($location_type_name);
+                       $components = array();
+
+                       if($location_id == -1 && !$entity_group_id)
+                       {
+                               //nothing
+                       }
+                       else
+                       {
+                               foreach($location_filter as $_location_filter)
+                               {
+                                       if($location_id > 0 && 
$_location_filter['id'] != $location_id)
+                                       {
+                                               continue;
+                                       }
+                                       $_location_id = $_location_filter['id'];
+
+                                       $_components = 
execMethod('property.soentity.read',array('entity_group_id' => 
$entity_group_id,'location_id' => $_location_id, 'district_id' => $district_id, 
'allrows' => true));
+                                       $components = array_merge($components, 
$_components);
+                               }
+                       }
+
                        $total_records = count($components);
                        $all_components = array();
                        $components_with_calendar_array = array();
 //                     _debug_array($components);
                        foreach($components as $_component)
                        {
+                               $location_id = $_component['location_id'];
                                $component_id = $_component['id'];
                                $all_components[$component_id] = $_component;
+
+                               $short_desc_arr = 
execMethod('property.soentity.get_short_description', array(
+                               'location_id' => $location_id, 'id' => 
$component_id));
+
+                               
if(!isset($_location_name[$_component['location_code']]))
+                               {
+                                       $_location               = 
execMethod('property.solocation.read_single', $_component['location_code']);
+                                       $location_arr    = explode('-', 
$_component['location_code']);
+                                       $i                               = 1;
+                                       $name_arr                = array();
+                                       foreach($location_arr as $_dummy)
+                                       {
+                                               $name_arr[] = 
$_location["loc{$i}_name"];
+                                               $i++;
+                                       }
+
+                                       
$_location_name[$_component['location_code']] = implode('::', $name_arr);
+                               }
+                               $short_desc_arr .= ' [' . 
$_location_name[$_component['location_code']] . ']';
+
                                $controls = 
execMethod('controller.socontrol.get_controls_at_component', 
array('location_id' => $location_id, 'component_id' => $component_id));
 //_debug_array($controls);
                                foreach($controls as $_control)
@@ -377,27 +447,8 @@
                                                // COMPONENTS: Process 
aggregated values for controls with repeat type day or week
                                                
foreach($components_for_control_array as $component)
                                                {
-                                                       $short_desc_arr = 
execMethod('property.soentity.get_short_description', array(
-                                                               'location_id' 
=> $component->get_location_id(), 'id' => $component->get_id()));
-                                                       
if(!isset($_location_name[$component->get_location_code()]))
-                                                       {
-                                                               $_location      
         = execMethod('property.solocation.read_single', 
$component->get_location_code());
-                                                               $location_arr   
 = explode('-', $component->get_location_code());
-                                                               $i              
                 = 1;
-                                                               $name_arr       
         = array();
-                                                               
foreach($location_arr as $_dummy)
-                                                               {
-                                                                       
$name_arr[] = $_location["loc{$i}_name"];
-                                                                       $i++;
-                                                               }
+                                                       
$component->set_xml_short_desc(" 
{$location_type_name[$location_id]}</br>{$short_desc_arr}");
 
-                                                               
$_location_name[$component->get_location_code()] = implode('::', $name_arr);
-                                                       }
-
-                                                       $short_desc_arr .= ' [' 
. $_location_name[$component->get_location_code()] . ']';
-
-                                                       
$component->set_xml_short_desc($short_desc_arr);
-
                                                        $repeat_type            
                 = $control->get_repeat_type();
                                                        
$component_with_check_lists      = 
$this->so->get_check_lists_for_control_and_component($control_id, 
$component->get_location_id(), $component->get_id(), $from_date_ts, 
$to_date_ts, $repeat_type);
 
@@ -423,32 +474,8 @@
                                        {
                                                
foreach($components_for_control_array as $component)
                                                {
-                                                       $short_desc_arr = 
execMethod('property.soentity.get_short_description', array(
-                                                               'location_id' 
=> $component->get_location_id(), 'id' => $component->get_id()));
+                                                       
$component->set_xml_short_desc(" 
{$location_type_name[$location_id]}</br>{$short_desc_arr}");
 
-                                                       //FIXME - make generic
-
-                                                       /* => */
-                                                       
if(!isset($_location_name[$component->get_location_code()]))
-                                                       {
-                                                               $_location      
         = execMethod('property.solocation.read_single', 
$component->get_location_code());
-                                                               $location_arr   
 = explode('-', $component->get_location_code());
-                                                               $i              
                 = 1;
-                                                               $name_arr       
         = array();
-                                                               
foreach($location_arr as $_dummy)
-                                                               {
-                                                                       
$name_arr[] = $_location["loc{$i}_name"];
-                                                                       $i++;
-                                                               }
-
-                                                               
$_location_name[$component->get_location_code()] = implode('::', $name_arr);
-                                                       }
-
-                                                       $short_desc_arr .= ' [' 
. $_location_name[$component->get_location_code()] . ']';
-                                                       /* <= */
-
-                                                       
$component->set_xml_short_desc($short_desc_arr);
-
                                                        $repeat_type            
                 = $control->get_repeat_type();
                                                        
$component_with_check_lists      = 
$this->so->get_check_lists_for_control_and_component($control_id, 
$component->get_location_id(), $component->get_id(), $from_date_ts, 
$to_date_ts, $repeat_type);// ,$user_id);
 
@@ -497,7 +524,7 @@
                                        }
                                }
                        }
-                       _debug_array($components_with_calendar_array);
+//                     _debug_array($components_with_calendar_array);
                        unset($component_id);
 //                     _debug_array($components_with_calendar_array[1]);
 //                     _debug_array($components);
@@ -515,7 +542,7 @@
                        {
                                unset($all_components[$component_id]);
                                $data = array();
-
+                               $location_id = 
$entry[0]['component']['location_id'];
                                $component_link_data = array
                                (
                                        'menuaction'    => 
'property.uientity.edit',
@@ -577,6 +604,7 @@
                                foreach($all_components as $component_id => 
$component)
                                {
                                        $data = array();
+                                       $location_id = 
$component['location_id'];
 
                                        $component_link_data = array
                                        (
@@ -586,10 +614,8 @@
                                                'active_tab'    => 'controller'
                                        );
 
-
-                                       ///////
                                        $short_desc_arr = 
execMethod('property.soentity.get_short_description', array(
-                                               'location_id' => $location_id, 
'id' => $component['id']));
+                                               'location_id' => $location_id, 
'id' => $component['id'], 'entity_id' =>$component['entity_id'], 'cat_id' => 
$component['cat_id']));
 
                                        
if(!isset($_location_name[$component['location_code']]))
                                        {
@@ -606,10 +632,9 @@
                                                
$_location_name[$component['location_code']] = implode('::', $name_arr);
                                        }
 
-                                       $short_desc_arr .= ' [' . 
$_location_name[$component['location_code']] . ']';
+                                       $short_desc_arr .= "[ 
{$_location_name[$component['location_code']]} ]";
 
-                                       //////                                  
-                                       $data['component_id'] = '<a 
href="'.$GLOBALS['phpgw']->link('/index.php',$component_link_data)."\" 
target='_blank'>{$component_id}{$short_desc_arr}</a>";
+                                       $data['component_id'] = '<a 
href="'.$GLOBALS['phpgw']->link('/index.php',$component_link_data)."\" 
target='_blank'>{$component_id} 
{$location_type_name[$location_id]}</br>{$short_desc_arr}</a>";
                                        $data['missing_control'] = true;
                                        $values[] = $data;
 
@@ -629,7 +654,7 @@
                                if(!isset($entry['missing_control']))
                                {
                                        $row['year'] = $year;
-                                       $row['descr'] = 
"Frekvens<br/>Status<br/>Ansvarlig<br/>Utførende<br/>service tid<br/>kontroll 
tid";
+                                       $row['descr'] = 
"Frekvens<br/>Status<br/>Utførende<br/>Tidsbruk";
                                }
 
                                for ( $_month=1; $_month < 13; $_month++ )
@@ -694,6 +719,8 @@
                        $result['time_sum'][0] = $sum_year;
                        $result['total_records'] = $total_records;
 
+                       $result['location_filter'] = $location_filter;
+
                        return $result;
                }
 
@@ -707,27 +734,35 @@
                        {
                                case "CONTROL_NOT_DONE":
                                        $status = 'Ikke utført';
+                                       $img = "<img height=\"15\" 
src=\"controller/images/status_icon_red_cross.png\" title=\"{$status}\"/>";
                                        break;
                                case "CONTROL_REGISTERED":
                                        $status = 'Registrert';
+                                       $img = "<img height=\"15\" 
src=\"controller/images/status_icon_yellow_ring.png\" title=\"{$status}\"/>";
                                        break;
                                case "CONTROL_PLANNED":
                                        $status = 'Planlagt';
+                                       $img = "<img height=\"15\" 
src=\"controller/images/status_icon_yellow.png\" title=\"{$status}\"/>";
                                        break;
                                case "CONTROL_NOT_DONE_WITH_PLANNED_DATE":
                                        $status = 'Forsinket, Ikke utført';
+                                       $img = "<img height=\"15\" 
src=\"controller/images/status_icon_red_cross.png\" title=\"{$status}\"/>";
                                        break;
                                case "CONTROL_DONE_OVER_TIME_WITHOUT_ERRORS":
                                        $status = 'Senere enn planagt';
+                                       $img = "<img height=\"15\" 
src=\"controller/images/status_icon_light_green.png\" title=\"{$status}\"/>";
                                        break;
                                case "CONTROL_DONE_IN_TIME_WITHOUT_ERRORS":
                                        $status = 'Utført uten avvik';
+                                       $img = "<img height=\"15\" 
src=\"controller/images/status_icon_dark_green.png\" title=\"{$status}\"/>";
                                        break;
                                case "CONTROL_DONE_WITH_ERRORS":
                                        $status = "Utført med 
{$param['info']['num_open_cases']} åpne avvik";
+                                       $img = "<img height=\"15\" 
src=\"controller/images/status_icon_yellow_ring.png\" title=\"{$status}\"/> 
({$param['info']['num_open_cases']})";
                                        break;
                                case "CONTROL_CANCELED":
                                        $status = 'Kansellert';
+                                       $img = "<img height=\"15\" 
src=\"controller/images/status_icon_black_cross.png\" title=\"{$status}\"/>";
                                        break;
                                default:
                                        $status = '';
@@ -743,6 +778,7 @@
                        }
                        else
                        {
+/*
                                $menuaction     = 
'controller.uicalendar.view_calendar_year_for_locations';
                                if($param['info']['repeat_type'] < 2)
                                {
@@ -759,15 +795,32 @@
                                        'year'                  => $year,
                                        'month'                 => $month
                                );
+*/
+                               $menuaction     = 
'controller.uicheck_list.add_check_list';
+                               $control_link_data = array
+                               (
+                                       'menuaction'    => $menuaction,
+                                       'control_id'    => 
$param['info']['control_id'],
+                                       'location_id'   => 
$param['info']['location_id'],
+                                       'component_id'  => 
$param['info']['component_id'],
+                                       'serie_id'              => 
$param['info']['serie_id'],
+                                       'deadline_ts'   => mktime(23, 59, 00, 
$month, date('t', $month), $year),
+                                       'type'                  => 
$param['info']['component_id'] ? 'component' : ''
+                               );
+
+
+
                        }
-                       $repeat_type = '<a 
href="'.$GLOBALS['phpgw']->link('/index.php',$control_link_data).'" 
target="_blank">'. $param['repeat_type'].'</a>';
+                       $link = "<a 
href=\"".$GLOBALS['phpgw']->link('/index.php',$control_link_data)."\" 
target=\"_blank\">{$img}</a>";
 
-               //      $repeat_type = $param['repeat_type'];
-                       $responsible = '---';
-                       $assigned_to = $param['info']['assigned_to'] > 0 ? 
$GLOBALS['phpgw']->accounts->id2name($param['info']['assigned_to']) : '&nbsp;';
-                       $service_time = $param['info']['service_time'] ? 
$param['info']['service_time'] : '&nbsp;';
-                       $controle_time = $param['info']['controle_time'] ? 
$param['info']['controle_time'] : '&nbsp;';
+                       $repeat_type = $param['repeat_type'];
+               //      $responsible = '---';
+                       $assigned_to = $param['info']['assigned_to'] > 0 ? 
$GLOBALS['phpgw']->accounts->id2lid($param['info']['assigned_to']) : '&nbsp;';
+               //      $service_time = $param['info']['service_time'] ? 
$param['info']['service_time'] : '&nbsp;';
+               //      $controle_time = $param['info']['controle_time'] ? 
$param['info']['controle_time'] : '&nbsp;';
+                       $time = $param['info']['service_time'] + 
$param['info']['controle_time'];
+                       $time = $time ? $time : '&nbsp;';
 
-                       return 
"{$repeat_type}<br/>{$status}<br/>{$responsible}<br/>{$assigned_to}<br/>{$service_time}<br/>{$controle_time}";
+                       return 
"{$repeat_type}<br/>{$link}<br/>{$assigned_to}<br/>{$time}";
                }
        }
\ No newline at end of file

Modified: trunk/controller/inc/component/class.check_list_status_manager.inc.php
===================================================================
--- trunk/controller/inc/component/class.check_list_status_manager.inc.php      
2015-05-19 07:12:53 UTC (rev 13225)
+++ trunk/controller/inc/component/class.check_list_status_manager.inc.php      
2015-05-19 14:09:20 UTC (rev 13226)
@@ -38,11 +38,11 @@
                public function __construct($check_list, $type = '')
                {
                        $this->check_list        = $check_list;
-                       $this->type                      = $type;
                        if(!$type)
                        {
                                $check_list->get_component_id() ? 'component' : 
'';
                        }
+                       $this->type                      = $type;
                }
 
                function get_status_for_check_list()

Modified: trunk/controller/inc/component/class.year_calendar.inc.php
===================================================================
--- trunk/controller/inc/component/class.year_calendar.inc.php  2015-05-19 
07:12:53 UTC (rev 13225)
+++ trunk/controller/inc/component/class.year_calendar.inc.php  2015-05-19 
14:09:20 UTC (rev 13226)
@@ -16,7 +16,7 @@
        private $calendar_array = array();
        private $control_relation = array();
        
-  public function __construct($control, $year, $component, $location_code, 
$type, $control_relation)
+  public function __construct($control, $year, $component, $location_code, 
$type, $control_relation = array())
   {
     $this->year = $year;
     $this->control = $control;
@@ -100,7 +100,7 @@
                        $month_nr = date("n", 
$check_list_status_info->get_deadline_date_ts());
                        
                        $repeat_type = $check_list->get_repeat_type();
-                       if( !isset($this->calendar_array[ $month_nr ]) || 
$repeat_type > $this->calendar_array[ $month_nr ]['repeat_type'])
+       //              if( !isset($this->calendar_array[ $month_nr ]) || 
$repeat_type > $this->calendar_array[ $month_nr ]['repeat_type'])
                        {
                                $this->calendar_array[ $month_nr 
]['repeat_type'] = $repeat_type;
                                $this->calendar_array[ $month_nr ]["status"] = 
$check_list_status_info->get_status();

Modified: trunk/controller/templates/base/component.xsl
===================================================================
--- trunk/controller/templates/base/component.xsl       2015-05-19 07:12:53 UTC 
(rev 13225)
+++ trunk/controller/templates/base/component.xsl       2015-05-19 14:09:20 UTC 
(rev 13226)
@@ -210,7 +210,40 @@
                                                
$("#month10").html(time_sum[10]);
                                                
$("#month11").html(time_sum[11]);
                                                
$("#month12").html(time_sum[12]);
+                                               if(data.location_filter)
+                                               {
+                                                       var obj = 
data.location_filter;
+                                                       var htmlString  = 
"<option value=''>" + obj.length + " register funnet</option>";
+                                                       var entity_group_id = 
$("#entity_group_id").val();
+                                                       var location_id = 
$("#location_id").val();
+
+                                                       if(entity_group_id)
+                                                       {
+                                                               var selected = 
'';
+                                                               if(location_id 
== -1)
+                                                               {
+                                                                       
selected = ' selected';
+                                                               }
+                                                               htmlString  += 
"<option value='-1'" + selected + ">Velg alle</option>";
+                                                       }
+
+                                                       $.each(obj, function(i)
+                                                       {
+                                                               var selected = 
'';
+                                                               
if(obj[i].selected == 1)
+                                                               {
+                                                                       
selected = ' selected';
+                                                               }
+
+                                                               htmlString  += 
"<option value='" + obj[i].id + "'" + selected + ">" + obj[i].name + 
"</option>";
+
+                                                       });
+
+                                                       $("#location_id").html( 
htmlString );
+
+                                               }
                                        }
+
                                }
                        });
 

Modified: trunk/property/inc/class.boentity.inc.php
===================================================================
--- trunk/property/inc/class.boentity.inc.php   2015-05-19 07:12:53 UTC (rev 
13225)
+++ trunk/property/inc/class.boentity.inc.php   2015-05-19 14:09:20 UTC (rev 
13226)
@@ -965,11 +965,12 @@
        //                              _debug_array($values);
                                        if($add = 
$so_control->register_control_to_component($values))
                                        {
+/*
                                                if($add == PHPGW_ACL_ADD)
                                                {
                                                        
$this->add_check_list(array('location_id'=>$location_id, 'component_id' => $id, 
'control_id' => $control_id, 'assigned_to' => $assigned_to, 'start_date' => 
$start_date, 'location_code' => $location_code));
                                                }
-
+*/
                                                $result =  array
                                                (
                                                        'status_kode'=> 'ok',
@@ -1050,7 +1051,7 @@
                                '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_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')

Modified: trunk/property/inc/class.bolocation.inc.php
===================================================================
--- trunk/property/inc/class.bolocation.inc.php 2015-05-19 07:12:53 UTC (rev 
13225)
+++ trunk/property/inc/class.bolocation.inc.php 2015-05-19 14:09:20 UTC (rev 
13226)
@@ -790,7 +790,7 @@
                        }
                        else
                        {
-                               $values = 
$this->so->read_single($location_code);
+                               $values = 
$this->so->read_single($location_code, array(), true);
                        }
 
 

Modified: trunk/property/inc/class.menu.inc.php
===================================================================
--- trunk/property/inc/class.menu.inc.php       2015-05-19 07:12:53 UTC (rev 
13225)
+++ trunk/property/inc/class.menu.inc.php       2015-05-19 14:09:20 UTC (rev 
13226)
@@ -107,6 +107,12 @@
                                                'url'   => 
$GLOBALS['phpgw']->link('/index.php', array('menuaction' => 
'property.uiadmin_entity.convert_to_eav') )
                                );
 
+                               $admin_children_entity['entity_group'] = array
+                               (
+                                                       'text'  => lang('entity 
group'),
+                                                       'url'   => 
$GLOBALS['phpgw']->link('/index.php', array('menuaction' => 
'property.uigeneric.index', 'type' => 'entity_group') )
+                               );
+
                                $admin_children_tenant = array
                                        (
                                                'tenant_cats'   => array

Modified: trunk/property/inc/class.soadmin_entity.inc.php
===================================================================
--- trunk/property/inc/class.soadmin_entity.inc.php     2015-05-19 07:12:53 UTC 
(rev 13225)
+++ trunk/property/inc/class.soadmin_entity.inc.php     2015-05-19 14:09:20 UTC 
(rev 13226)
@@ -509,6 +509,7 @@
                                        'parent_id'                             
        => $this->db->f('parent_id'),
                                        'level'                                 
        => $this->db->f('level'),
                                        'org_unit'                              
        => $this->db->f('org_unit'),
+                                       'entity_group_id'                       
=> $this->db->f('entity_group_id'),
                                        'location_id'                           
=> $location_id
                                );
                        }
@@ -602,6 +603,7 @@
                        $fd['entry_date'] = array('type' => 'int', 'precision' 
=> 4, 'nullable' => true);
                        $fd['user_id'] = array('type' => 'int', 'precision' => 
4, 'nullable' => true);
                        $fd['org_unit_id'] = array('type' => 'int', 'precision' 
=> 4, 'nullable' => true);
+                       $fd['entity_group_id'] = array('type' => 'int', 
'precision' => 4, 'nullable' => true);
                        return $fd;
                }
 
@@ -653,12 +655,13 @@
                                        $values['jasperupload'],
                                        $values['parent_id'],
                                        $values['org_unit'],
+                                       $values['entity_group_id'],
                                        $level
                                );
 
                        $values_insert  = 
$this->db->validate_insert($values_insert);
 
-                       $this->db->query("INSERT INTO {$table} 
(location_id,entity_id,id,name, 
descr,prefix,lookup_tenant,tracking,location_level,location_link_level,fileupload,loc_link,start_project,start_ticket,is_eav,enable_bulk,enable_controller,jasperupload,parent_id,org_unit,level
 ) "
+                       $this->db->query("INSERT INTO {$table} 
(location_id,entity_id,id,name, 
descr,prefix,lookup_tenant,tracking,location_level,location_link_level,fileupload,loc_link,start_project,start_ticket,is_eav,enable_bulk,enable_controller,jasperupload,parent_id,org_unit,entity_group_id,level
 ) "
                                . "VALUES ($values_insert)",__LINE__,__FILE__);
 
 
@@ -876,7 +879,8 @@
                                                'jasperupload'                  
        => $entity['jasperupload'],
                                                'parent_id'                     
                => $entity['parent_id'],
                                                'level'                         
                => $level,
-                                               'org_unit'                      
        => $entity['org_unit']
+                                               'org_unit'                      
                => $entity['org_unit'],
+                                               'entity_group_id'               
        => $entity['entity_group_id'],
                                        );
 
                                $value_set      = 
$this->db->validate_update($value_set);

Modified: trunk/property/inc/class.soentity.inc.php
===================================================================
--- trunk/property/inc/class.soentity.inc.php   2015-05-19 07:12:53 UTC (rev 
13225)
+++ trunk/property/inc/class.soentity.inc.php   2015-05-19 14:09:20 UTC (rev 
13226)
@@ -882,6 +882,12 @@
 
                                $dataset[$j]['num']['value'] = 
$dataset[$j]['id']['value'];
 
+                               $dataset[$j]['location_id'] = array
+                                       (
+                                               'value'         => $location_id,
+                                               'datatype'      => false,
+                                               'attrib_id'     => false
+                                       );
                                $dataset[$j]['entity_id'] = array
                                        (
                                                'value'         => $entity_id,
@@ -1177,7 +1183,66 @@
 
                }
 
+               /**
+                * FIXME
+                * @param type $data
+                * @return type
+                */
+               function read_entity_group($data)
+               {
+                       $location_id    = isset($data['location_id']) && 
$data['location_id'] ? (int)$data['location_id'] : 0;
+                       $entity_group_id        = 
isset($data['entity_group_id']) && $data['entity_group_id'] ? 
(int)$data['entity_group_id'] : 0;
 
+                       $location_filter = array();
+
+                       if($entity_group_id)
+                       {
+                               if($location_id < 0)
+                               {
+                                       $entity_list    = 
$admin_entity->read(array('allrows' => true));
+
+                                       foreach($entity_list as $entry)
+                                       {
+                                               $categories = 
$admin_entity->read_category(array('entity_id' => $entry['id'],'order' => 
'name','sort' => 'asc','enable_controller' => true, 'allrows' => true));
+                                               foreach($categories as 
$category)
+                                               {
+
+                                                       
if($category['entity_group_id'])
+                                                       {
+                                                               
$location_filter[] = $category['location_id'];
+                                                       }
+                                               }
+                                       }
+                               }
+                               else
+                               {
+                                       $location_filter[] = $location_id;
+                               }
+                       }
+//                     _debug_array($location_filter);
+                       $values = array();
+                       if($category['is_eav'] || $location_filter)
+                       {
+                               if($location_filter)
+                               {
+                                       foreach($location_filter as 
$location_id)
+                                       {
+                                               
$this->get_cols($category,$entity_id,$cat_id,$lookup,$location_id);
+                                               $data['location_id'] = 
$location_id;
+                                               $values = array_merge($values, 
$this->read_eav($data));
+
+                                       }
+                               }
+                               else
+                               {
+                                       $values = $this->read_eav($data);
+                               }
+                               return $values;
+                       }
+
+               }
+
+
                function read($data)
                {
                        $start                  = isset($data['start']) && 
$data['start'] ? $data['start'] : 0;
@@ -1230,16 +1295,6 @@
                                $location_id = 
$GLOBALS['phpgw']->locations->get_id($this->type_app[$this->type], 
".{$this->type}.{$entity_id}.{$cat_id}");
                        }
 
-                       $grants         = 
$GLOBALS['phpgw']->session->appsession("grants_entity_{$entity_id}_{$cat_id}",$this->type_app[$this->type]);
-
-                       if(!$grants)
-                       {
-                               $this->acl      = & $GLOBALS['phpgw']->acl;
-                               $this->acl->set_account_id($this->account);
-                               $grants         = 
$this->acl->get_grants($this->type_app[$this->type],".{$this->type}.{$entity_id}.{$cat_id}");
-                               
$GLOBALS['phpgw']->session->appsession("grants_entity_{$entity_id}_{$cat_id}", 
$this->type_app[$this->type], $grants);
-                       }
-
                        $admin_entity   = 
CreateObject('property.soadmin_entity');
                        $admin_entity->type = $this->type;
 
@@ -1265,6 +1320,16 @@
                                return;
                        }
 
+                       $grants         = 
$GLOBALS['phpgw']->session->appsession("grants_entity_{$entity_id}_{$cat_id}",$this->type_app[$this->type]);
+
+                       if(!$grants)
+                       {
+                               $this->acl      = & $GLOBALS['phpgw']->acl;
+                               $this->acl->set_account_id($this->account);
+                               $grants         = 
$this->acl->get_grants($this->type_app[$this->type],".{$this->type}.{$entity_id}.{$cat_id}");
+                               
$GLOBALS['phpgw']->session->appsession("grants_entity_{$entity_id}_{$cat_id}", 
$this->type_app[$this->type], $grants);
+                       }
+
                        //_debug_array($cols_return_extra);
 
                        if ($order)
@@ -1595,6 +1660,12 @@
 
                                        );
                                }
+                               $dataset[$j]['location_id'] = array
+                                       (
+                                               'value'         => $location_id,
+                                               'datatype'      => false,
+                                               'attrib_id'     => false
+                                       );
                                $dataset[$j]['entity_id'] = array
                                        (
                                                'value'         => $entity_id,

Modified: trunk/property/inc/class.sogeneric.inc.php
===================================================================
--- trunk/property/inc/class.sogeneric.inc.php  2015-05-19 07:12:53 UTC (rev 
13225)
+++ trunk/property/inc/class.sogeneric.inc.php  2015-05-19 14:09:20 UTC (rev 
13226)
@@ -2620,6 +2620,50 @@
 
                                break;
 
+                       case 'entity_group':
+                               $info = array
+                                       (
+                                               'table'                         
=> 'fm_entity_group',
+                                               'id'                            
=> array('name' => 'id', 'type' => 'auto'),
+                                               'fields'                        
=> array
+                                               (
+                                                       array
+                                                       (
+                                                               'name' => 
'name',
+                                                               'descr' => 
lang('name'),
+                                                               'type' => 
'varchar'
+                                                       ),
+                                                       array
+                                                       (
+                                                               'name' => 
'descr',
+                                                               'descr' => 
lang('descr'),
+                                                               'type' => 
'varchar'
+                                                       ),
+                                                       array
+                                                       (
+                                                               'name' => 
'active',
+                                                               'descr' => 
lang('active'),
+                                                               'type' => 
'checkbox',
+                                                               'default' => 
'checked'
+                                                       )
+                                               ),
+                                               'edit_msg'                      
=> lang('edit'),
+                                               'add_msg'                       
=> lang('add'),
+                                               'name'                          
=> lang('entity group'),
+                                               'acl_app'                       
=> 'property',
+                                               'acl_location'          => 
'.admin.entity',
+                                               'menu_selection'        => 
'admin::property::entity::entity_group',
+                                               'default'                       
=> array
+                                               (
+                                                       'user_id'               
=> array('add'  => '$this->account'),
+                                                       'entry_date'    => 
array('add'  => 'time()'),
+                                                       'modified_date' => 
array('add'  => 'time()', 'edit'     => 'time()'),
+                                               ),
+                                               'check_grant'           => false
+                                       );
+
+                               break;
+
 // START BOOKING TABLES
                        case 'bb_office':
                                $info = array

Modified: trunk/property/inc/class.solocation.inc.php
===================================================================
--- trunk/property/inc/class.solocation.inc.php 2015-05-19 07:12:53 UTC (rev 
13225)
+++ trunk/property/inc/class.solocation.inc.php 2015-05-19 14:09:20 UTC (rev 
13226)
@@ -1178,7 +1178,7 @@
                        return $sql;
                }
 
-               function read_single($location_code='',$values = array())
+               function read_single($location_code='',$values = array(), 
$skip_attribs = false)
                {
                        //cache result
                        static $location = array();
@@ -1196,7 +1196,7 @@
                                return $location[$location_code];
                        }
 
-                       if(!isset($values['attributes']) || ! 
$values['attributes'])
+                       if(!$skip_attribs && (!isset($values['attributes']) || 
! $values['attributes']))
                        {
                                $values['attributes'] = 
$this->custom->find('property','.location.' . $type_id, 0, '', 'ASC', 
'attrib_sort', true, true);
                        }
@@ -1321,6 +1321,7 @@
 
                        $sql    = "INSERT INTO fm_locations (level, 
location_code, loc1) VALUES ({$type_id}, '{$location['location_code']}', 
'{$location['loc1']}')";
                        $this->db->query($sql,__LINE__,__FILE__);
+                       $this->update_location_name($location['location_code']);
 
                        $this->db->transaction_commit();
                        $receipt['message'][] = array('msg'=>lang('Location %1 
has been saved',$location['location_code']));
@@ -1413,8 +1414,10 @@
                        $this->db->query($sql,__LINE__,__FILE__);
 
                        $sql = "UPDATE fm_location$type_id SET $value_set WHERE 
location_code='" . $location['location_code'] . "'";
+                       $this->db->query($sql,__LINE__,__FILE__);
 
-                       $this->db->query($sql,__LINE__,__FILE__);
+                       $this->update_location_name($location['location_code']);
+
                        $this->db->transaction_commit();
                        $receipt['message'][] = array('msg'=>lang('Location %1 
has been edited',$location['location_code']));
                        $receipt['location_code'] = $location['location_code'];
@@ -1518,6 +1521,7 @@
                        {
                                $this->db->transaction_begin();
                        }
+                       set_time_limit(0);
 
                        $this->db->query('SELECT max(id) as levels FROM 
fm_location_type');
                        $this->db->next_record();
@@ -1606,6 +1610,20 @@
                                }
                        }
 
+                       $this->db->query("SELECT location_code FROM 
fm_locations WHERE name IS NULL");
+
+                       $locations = array();
+
+                       while ($this->db->next_record())
+                       {
+                               $locations[] = $this->db->f('location_code');
+                       }
+
+                       foreach($locations as $location_code)
+                       {
+                               $this->update_location_name($location_code);
+                       }
+
                        if ( !$this->global_lock )
                        {
                                if( $this->db->transaction_commit() )
@@ -1619,6 +1637,22 @@
                        }
                }
 
+               function update_location_name($location_code)
+               {
+                       $location_array = $this->read_single($location_code);
+
+                       $location_arr = explode('-', $location_code);
+                       $loc_name_arr = array();
+                       $i = 1;
+                       foreach ($location_arr as $_part)
+                       {
+                               $loc_name_arr[] = 
$location_array["loc{$i}_name"];
+                               $i++;
+                       }
+                       $name   = $this->db->db_addslashes(implode(', ', 
$loc_name_arr));
+                       $this->db->query("UPDATE fm_locations SET name = 
'{$name}' WHERE location_code = '{$location_code}'");
+               }
+
                function read_summary($data='')
                {
                        if(is_array($data))

Modified: trunk/property/inc/class.uiadmin_entity.inc.php
===================================================================
--- trunk/property/inc/class.uiadmin_entity.inc.php     2015-05-19 07:12:53 UTC 
(rev 13225)
+++ trunk/property/inc/class.uiadmin_entity.inc.php     2015-05-19 14:09:20 UTC 
(rev 13226)
@@ -559,6 +559,9 @@
                        $uicols['descr'][6]     = lang('enable bulk');
                        $uicols['name'][7]      = 'enable_controller';
                        $uicols['descr'][7]     = lang('enable controller');
+                       $uicols['name'][8]      = 'entity_group_id';
+                       $uicols['descr'][8]     = lang('entity group');
+
                        $j = 0;
                        $count_uicols_name = count($uicols['name']);
 
@@ -1203,6 +1206,7 @@
                                        'value_enable_bulk'                     
                => $values['enable_bulk'],
                                        'value_enable_controller'               
        => $values['enable_controller'],
                                        'jasperupload'                          
                => true,
+                                       'entity_group_list'                     
                => array('options' => 
execMethod('property.bogeneric.get_list',array('type' => 'entity_group', 
'selected' => $values['entity_group_id'], 'add_empty' => true))),
                                        'category_list'                         
                => $category_list,
                                        'parent_list'                           
                => $parent_list
                                );

Modified: trunk/property/setup/setup.inc.php
===================================================================
--- trunk/property/setup/setup.inc.php  2015-05-19 07:12:53 UTC (rev 13225)
+++ trunk/property/setup/setup.inc.php  2015-05-19 14:09:20 UTC (rev 13226)
@@ -12,7 +12,7 @@
        */
 
        $setup_info['property']['name']                 = 'property';
-       $setup_info['property']['version']              = '0.9.17.689';
+       $setup_info['property']['version']              = '0.9.17.690';
        $setup_info['property']['app_order']    = 8;
        $setup_info['property']['enable']               = 1;
        $setup_info['property']['app_group']    = 'office';
@@ -180,6 +180,7 @@
                'fm_entity_category',
                'fm_entity_lookup',
                'fm_entity_history',
+               'fm_entity_group',
                'fm_custom',
                'fm_custom_cols',
                'fm_orders',

Modified: trunk/property/setup/tables_current.inc.php
===================================================================
--- trunk/property/setup/tables_current.inc.php 2015-05-19 07:12:53 UTC (rev 
13225)
+++ trunk/property/setup/tables_current.inc.php 2015-05-19 14:09:20 UTC (rev 
13226)
@@ -162,7 +162,8 @@
                                'id' => array('type' => 'auto','precision' => 
'4','nullable' => False),
                                'level' => array('type' => 'int','precision' => 
'4','nullable' => False),
                                'location_code' => array('type' => 
'varchar','precision' => '50','nullable' => False),
-                               'loc1' => array('type' => 'varchar','precision' 
=> '6','nullable' => False)
+                               'loc1' => array('type' => 'varchar','precision' 
=> '6','nullable' => False),
+                               'name' => array('type' => 'text','nullable' => 
True),
                        ),
                        'pk' => array('id'),
                        'fk' => array(),
@@ -1959,7 +1960,8 @@
                                'jasperupload' => array('type' => 
'int','precision' => '2','nullable' => True),
                                'parent_id' => array('type' => 
'int','precision' => '4','nullable' => True),
                                'level' => array('type' => 'int','precision' => 
'4','nullable' => True),
-                               'department' => array('type' => 
'int','precision' => '2','nullable' => True),
+                               'org_unit' => array('type' => 'int','precision' 
=> '2','nullable' => True),
+                               'entity_group_id' => array('type' => 
'int','precision' => '4','nullable' => True),
                        ),
                        'pk' => array('entity_id','id'),
                        'fk' => array(),
@@ -1994,6 +1996,21 @@
                        'ix' => array(),
                        'uc' => array()
                ),
+               'fm_entity_group' => array(
+                       'fd' => array(
+                               'id' => array('type' => 'auto','precision' => 
4,'nullable' => False),
+                               'name' => array('type' => 'varchar', 
'precision' => 100,'nullable' => False),
+                               'descr' => array('type' => 'text','nullable' => 
true),
+                               'active' => array('type' => 'int','precision' 
=> 2,'nullable' => True,'default' => 0),
+                               'user_id' => array('type' => 'int','precision' 
=> 4,'nullable' => False),
+                               'entry_date' => array('type' => 
'int','precision' => 8,'nullable' => False),
+                               'modified_date' => array('type' => 
'int','precision' => 8,'nullable' => False)
+                       ),
+                       'pk' => array('id'),
+                       'fk' => array(),
+                       'ix' => array(),
+                       'uc' => array()
+               ),
                'fm_entity_1_1' => array(
                        'fd' => array(
                                'id' => array('type' => 'auto','precision' => 
'4','nullable' => False),

Modified: trunk/property/setup/tables_update.inc.php
===================================================================
--- trunk/property/setup/tables_update.inc.php  2015-05-19 07:12:53 UTC (rev 
13225)
+++ trunk/property/setup/tables_update.inc.php  2015-05-19 14:09:20 UTC (rev 
13226)
@@ -8307,7 +8307,7 @@
                }
        }
 /**
-       * Update property version from 0.9.17.685 to 0.9.17.686
+       * Update property version from 0.9.17.687 to 0.9.17.688
        * Add controller-flag to entities
        */
        $test[] = '0.9.17.687';
@@ -8329,7 +8329,7 @@
                }
        }
        /**
-       * Update property version from 0.9.17.687 to 0.9.17.688
+       * Update property version from 0.9.17.688 to 0.9.17.689
        * Add generic history
        */
        $test[] = '0.9.17.688';
@@ -8364,3 +8364,75 @@
                        return $GLOBALS['setup_info']['property']['currentver'];
                }
        }
+
+       /**
+       * Update property version from 0.9.17.689 to 0.9.17.690
+       * Add generic history
+       */
+       $test[] = '0.9.17.689';
+       function property_upgrade0_9_17_689()
+       {
+               $GLOBALS['phpgw_setup']->oProc->m_odb->transaction_begin();
+
+               $GLOBALS['phpgw_setup']->oProc->CreateTable(
+                       'fm_entity_group', array(
+                               'fd' => array(
+                                       'id' => array('type' => 
'auto','precision' => 4,'nullable' => False),
+                                       'name' => array('type' => 'varchar', 
'precision' => 100,'nullable' => False),
+                                       'descr' => array('type' => 
'text','nullable' => true),
+                                       'active' => array('type' => 
'int','precision' => '2','nullable' => True,'default' => 0),
+                                       'user_id' => array('type' => 
'int','precision' => 4,'nullable' => False),
+                                       'entry_date' => array('type' => 
'int','precision' => 4,'nullable' => False),
+                                       'modified_date' => array('type' => 
'int','precision' => 4,'nullable' => False)
+                               ),
+                               'pk' => array('id'),
+                               'fk' => array(),
+                               'ix' => array(),
+                               'uc' => array()
+                       )
+               );
+
+               
$GLOBALS['phpgw_setup']->oProc->AddColumn('fm_entity_category','entity_group_id',array(
+                       'type' => 'int',
+                       'precision' => 4,
+                       'nullable' => True
+                       )
+               );
+
+               
$GLOBALS['phpgw_setup']->oProc->AddColumn('fm_locations','name',array(
+                       'type'          => 'text',
+                       'nullable'      => true
+                       )
+               );
+
+               $GLOBALS['phpgw_setup']->oProc->query("SELECT location_code 
FROM fm_locations");
+
+               $locations = array();
+
+               while ($GLOBALS['phpgw_setup']->oProc->next_record())
+               {
+                       $locations[] = 
$GLOBALS['phpgw_setup']->oProc->f('location_code');
+               }
+
+               foreach($locations as $location_code)
+               {
+                       $location_array = 
execMethod('property.bolocation.read_single', array('location_code' => 
$location_code,'extra' => array('noattrib' => true)));
+
+                       $location_arr = explode('-', $location_code);
+                       $loc_name_arr = array();
+                       $i = 1;
+                       foreach ($location_arr as $_part)
+                       {
+                               $loc_name_arr[] = 
$location_array["loc{$i}_name"];
+                               $i++;
+                       }
+                       $name   = 
$GLOBALS['phpgw_setup']->oProc->m_odb->db_addslashes(implode(', ', 
$loc_name_arr));
+                       $GLOBALS['phpgw_setup']->oProc->query("UPDATE 
fm_locations SET name = '{$name}' WHERE location_code = '{$location_code}'");
+               }
+
+               if($GLOBALS['phpgw_setup']->oProc->m_odb->transaction_commit())
+               {
+                       $GLOBALS['setup_info']['property']['currentver'] = 
'0.9.17.690';
+                       return $GLOBALS['setup_info']['property']['currentver'];
+               }
+       }

Modified: trunk/property/templates/base/admin_entity.xsl
===================================================================
--- trunk/property/templates/base/admin_entity.xsl      2015-05-19 07:12:53 UTC 
(rev 13225)
+++ trunk/property/templates/base/admin_entity.xsl      2015-05-19 14:09:20 UTC 
(rev 13226)
@@ -897,6 +897,19 @@
                                                        </tr>
                                                </xsl:when>
                                        </xsl:choose>
+                                       <tr>
+                                               <xsl:variable 
name="lang_entity_group">
+                                                       <xsl:value-of 
select="php:function('lang', 'entity group')"/>
+                                               </xsl:variable>
+                                               <td>
+                                                       <xsl:value-of 
select="$lang_entity_group"/>
+                                               </td>
+                                               <td valign="top">
+                                                       <select 
name="values[entity_group_id]" title="$lang_entity_group">
+                                                               
<xsl:apply-templates select="entity_group_list/options"/>
+                                                       </select>
+                                               </td>
+                                       </tr>
                                        <xsl:choose>
                                                <xsl:when test="category_list 
!= '' and value_id = ''">
                                                        <tr>




reply via email to

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