fmsystem-commits
[Top][All Lists]
Advanced

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

[Fmsystem-commits] [13482] Syncromind: Merge 13433:13481 from trunk


From: Sigurd Nes
Subject: [Fmsystem-commits] [13482] Syncromind: Merge 13433:13481 from trunk
Date: Tue, 23 Jun 2015 09:26:52 +0000

Revision: 13482
          http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=13482
Author:   sigurdne
Date:     2015-06-23 09:26:51 +0000 (Tue, 23 Jun 2015)
Log Message:
-----------
Syncromind: Merge 13433:13481 from trunk

Modified Paths:
--------------
    branches/dev-syncromind/booking/inc/class.boapplication.inc.php
    
branches/dev-syncromind/bookingfrontend/inc/custom/default/Altinn2_Bergen_kommune.php
    branches/dev-syncromind/controller/inc/class.socheck_list.inc.php
    branches/dev-syncromind/controller/inc/class.socontrol.inc.php
    branches/dev-syncromind/controller/inc/class.uicase.inc.php
    branches/dev-syncromind/controller/inc/class.uicomponent.inc.php
    branches/dev-syncromind/controller/setup/phpgw_no.lang
    branches/dev-syncromind/controller/templates/base/case/view_case_message.xsl
    
branches/dev-syncromind/controller/templates/base/check_list/fragments/add_check_list_menu.xsl
    
branches/dev-syncromind/controller/templates/base/check_list/fragments/check_list_menu.xsl
    branches/dev-syncromind/controller/templates/base/component.xsl
    branches/dev-syncromind/property/inc/class.soentity.inc.php
    branches/dev-syncromind/property/setup/phpgw_no.lang
    branches/dev-syncromind/rental/inc/class.socomposite.inc.php
    branches/dev-syncromind/rental/inc/class.soprice_item.inc.php
    branches/dev-syncromind/rental/inc/class.uiprice_item.inc.php
    branches/dev-syncromind/rental/inc/model/class.agresso_lg04.inc.php
    branches/dev-syncromind/rental/inc/model/class.price_item.inc.php
    branches/dev-syncromind/rental/setup/setup.inc.php
    branches/dev-syncromind/rental/setup/tables_current.inc.php
    branches/dev-syncromind/rental/setup/tables_update.inc.php
    branches/dev-syncromind/rental/templates/base/admin_price_item.php
    branches/dev-syncromind/rental/templates/base/admin_price_item_list.php

Property Changed:
----------------
    branches/dev-syncromind/
    branches/dev-syncromind/booking/
    branches/dev-syncromind/bookingfrontend/


Property changes on: branches/dev-syncromind
___________________________________________________________________
Modified: svn:mergeinfo
   - /branches/stavangerkommune:12743-12875,12986
/trunk:12111-12211,12213-12246,12250-12363,12366-12405,12407-12435,12437-12462,12464-12527,12530-12602,12604-12670,12672-12683,12686-12750,12753-12785,12787-12974,12987,12989-13177,13179-13344,13346-13399,13401-13432
   + /branches/stavangerkommune:12743-12875,12986
/trunk:12111-12211,12213-12246,12250-12363,12366-12405,12407-12435,12437-12462,12464-12527,12530-12602,12604-12670,12672-12683,12686-12750,12753-12785,12787-12974,12987,12989-13177,13179-13344,13346-13399,13401-13432,13434-13481


Property changes on: branches/dev-syncromind/booking
___________________________________________________________________
Modified: svn:mergeinfo
   - /branches/stavangerkommune/booking:9468-12740,12743-12875,12986
/trunk/booking:12111-12211,12213-12246,12250-12363,12366-12405,12407-12435,12437-12462,12464-12527,12530-12602,12604-12670,12672-12683,12686-12750,12753-12785,12787-12974,12987,13179-13344
   + /branches/stavangerkommune/booking:9468-12740,12743-12875,12986
/trunk/booking:12111-12211,12213-12246,12250-12363,12366-12405,12407-12435,12437-12462,12464-12527,12530-12602,12604-12670,12672-12683,12686-12750,12753-12785,12787-12974,12987,13179-13344,13434-13481

Modified: branches/dev-syncromind/booking/inc/class.boapplication.inc.php
===================================================================
--- branches/dev-syncromind/booking/inc/class.boapplication.inc.php     
2015-06-23 09:23:25 UTC (rev 13481)
+++ branches/dev-syncromind/booking/inc/class.boapplication.inc.php     
2015-06-23 09:26:51 UTC (rev 13482)
@@ -31,12 +31,12 @@
                                $body .= '<p><a href="'.$link.'">Link til 
'.$config->config_data['application_mail_systemname'].': søknad 
#'.$application['id'].'</a></p>';
 
                        } elseif ($application['status'] == 'PENDING') {
-                               $body = "<p>Din søknad i 
".$config->config_data['application_mail_systemname']." om leie/lån er 
".lang($application['status']);
-                               $body .= 
"</p><pre>".$config->config_data['application_mail_pending']."</pre>";
-                               $body .= '<p><a href="'.$link.'">Link til 
'.$config->config_data['application_mail_systemname'].': søknad 
#'.$application['id'].'</a></p>';
+                               $body = "<p>Din søknad i 
".$config->config_data['application_mail_systemname']." om leie/lån er 
".lang($application['status']) . '</p>';
                                if ($application['comment'] != '') {
                                        $body .= '<p>Kommentar fra 
saksbehandler:<br />'.$application['comment'].'</p>';
                                }
+                               $body .= 
"<pre>".$config->config_data['application_mail_pending']."</pre>";
+                               $body .= '<p><a href="'.$link.'">Link til 
'.$config->config_data['application_mail_systemname'].': søknad 
#'.$application['id'].'</a></p>';
                        }
                        elseif ($application['status'] == 'ACCEPTED')
                        {
@@ -70,8 +70,11 @@
                                        }
                                }
 
-                               $body = "<p>Din søknad i 
".$config->config_data['application_mail_systemname']." om leie/lån er 
".lang($application['status']);
-                               $body .= 
'</p><pre>'.$config->config_data['application_mail_accepted'].'<br /><a 
href="'.$link.'">Link til 
'.$config->config_data['application_mail_systemname'].': søknad 
#'.$application['id'].'</a></pre>';
+                               $body = "<p>Din søknad i 
".$config->config_data['application_mail_systemname']." om leie/lån er 
".lang($application['status']) . '</p>';
+                               if ($application['comment'] != '') {
+                                       $body .= "<p>Kommentar fra 
saksbehandler:<br />".$application['comment']."</p>";
+                               }
+                               $body .= 
'<pre>'.$config->config_data['application_mail_accepted'].'<br /><a 
href="'.$link.'">Link til 
'.$config->config_data['application_mail_systemname'].': søknad 
#'.$application['id'].'</a></pre>';
                                if($adates)
                                {
                                        $body .= 
"<pre>Godkjent:\n".$adates."</pre>";
@@ -81,9 +84,6 @@
                                        $body .= "<pre>Avvist: 
".$rdates."</pre>";
                                }
 
-                               if ($application['comment'] != '') {
-                                       $body .= "<p>Kommentar fra 
saksbehandler:<br />".$application['comment']."</p>";
-                               }
 
                                if (isset 
($config->config_data['application_notify_on_accepted']) && 
$config->config_data['application_notify_on_accepted'] ==1)
                                {
@@ -115,11 +115,11 @@
                                        }
                                }
                        } elseif ($application['status'] == 'REJECTED') {
-                               $body = "<p>Din søknad i 
".$config->config_data['application_mail_systemname']." om leie/lån er 
".lang($application['status']);
-                               $body .= 
'</p><pre>'.$config->config_data['application_mail_rejected'].' <a 
href="'.$link.'">Link til 
'.$config->config_data['application_mail_systemname'].': søknad 
#'.$application['id'].'</a></pre>';
+                               $body = "<p>Din søknad i 
".$config->config_data['application_mail_systemname']." om leie/lån er 
".lang($application['status']) . '</p>';
                                if ($application['comment'] != '') {
                                        $body .= '<p>Kommentar fra 
saksbehandler:<br />'.$application['comment'].'</p>';
                                }
+                               $body .= 
'<pre>'.$config->config_data['application_mail_rejected'].' <a 
href="'.$link.'">Link til 
'.$config->config_data['application_mail_systemname'].': søknad 
#'.$application['id'].'</a></pre>';
                        } else {
                 $subject = 
$config->config_data['application_comment_mail_subject'];
                 $body = 
"<pre><p>".$config->config_data['application_comment_added_mail']."</p>";


Property changes on: branches/dev-syncromind/bookingfrontend
___________________________________________________________________
Modified: svn:mergeinfo
   - /branches/stavangerkommune/bookingfrontend:9468-12740,12743-12875,12986
/trunk/bookingfrontend:12111-12211,12213-12246,12250-12363,12366-12405,12407-12435,12437-12462,12464-12527,12530-12602,12604-12670,12672-12683,12686-12750,12753-12785,12787-12974,12987,13346-13399
   + /branches/stavangerkommune/bookingfrontend:9468-12740,12743-12875,12986
/trunk/bookingfrontend:12111-12211,12213-12246,12250-12363,12366-12405,12407-12435,12437-12462,12464-12527,12530-12602,12604-12670,12672-12683,12686-12750,12753-12785,12787-12974,12987,13346-13399,13434-13481

Modified: 
branches/dev-syncromind/bookingfrontend/inc/custom/default/Altinn2_Bergen_kommune.php
===================================================================
--- 
branches/dev-syncromind/bookingfrontend/inc/custom/default/Altinn2_Bergen_kommune.php
       2015-06-23 09:23:25 UTC (rev 13481)
+++ 
branches/dev-syncromind/bookingfrontend/inc/custom/default/Altinn2_Bergen_kommune.php
       2015-06-23 09:26:51 UTC (rev 13482)
@@ -52,23 +52,14 @@
                                _debug_array($headers);
                        }
 
-                       $header_regular_expression =  '/^cn=(.*),cn=users.*$/';
-                       $header_key = 'Osso-User-Dn';
-                       $matches = array();
-                       
preg_match_all($header_regular_expression,$headers[$header_key], $matches);
-                       $fodsels_nr = $matches[1][0];
-                       $uid = $headers['uid'];
+                       $fodsels_nr = $headers['uid'];
 
                        if($this->debug)
                        {
                                echo 'fødselsnr:<br>';
                                _debug_array($fodsels_nr);
-                               echo 'uid:<br>';
-                               _debug_array($uid);
                        }
 
-                       $fodsels_nr = $uid ? $uid : $fodsels_nr;
-
                        $request =
                        "<soapenv:Envelope
                                 
xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\";
@@ -82,7 +73,6 @@
                                </soapenv:Body>
                        </soapenv:Envelope>";
 
-
                        $location_URL = 
isset($this->config->config_data['soap_location']) && 
$this->config->config_data['soap_location'] ? 
$this->config->config_data['soap_location'] : 
"http://wsm01e-t.usrv.ubergenkom.no:8888/gateway/services/AltinnReporteesService";;
 #A-test
 
                        $soap_login = $this->config->config_data['soap_login'];
@@ -98,7 +88,8 @@
 
                        try
                        {
-                               $response = 
$client->__doRequest($request,$location_URL,$location_URL,1);
+                               $action = "";
+                               $response = 
$client->__doRequest($request,$location_URL,$action,1);
                                $reader = new XMLReader();
                                $reader->xml($response);
 

Modified: branches/dev-syncromind/controller/inc/class.socheck_list.inc.php
===================================================================
--- branches/dev-syncromind/controller/inc/class.socheck_list.inc.php   
2015-06-23 09:23:25 UTC (rev 13481)
+++ branches/dev-syncromind/controller/inc/class.socheck_list.inc.php   
2015-06-23 09:26:51 UTC (rev 13482)
@@ -638,7 +638,7 @@
 
                $sql =  "SELECT cl.id as cl_id, cl.status as cl_status, 
cl.comment as cl_comment, deadline, planned_date, completed_date, 
cl.assigned_to, ";
                $sql .= "cl.component_id as cl_component_id, cl.location_id as 
cl_location_id,"
-               . " cl.location_code as cl_location_code, num_open_cases, 
num_pending_cases ,cl.serie_id, cs.repeat_type ";
+               . " cl.location_code as cl_location_code, num_open_cases, 
num_pending_cases ,cl.serie_id, cl.billable_hours, cs.repeat_type ";
                $sql .= "FROM controller_check_list cl ";
                $sql .= "LEFT JOIN controller_control c on cl.control_id = c.id 
";
                $sql .= "LEFT JOIN controller_control_serie cs on cl.serie_id = 
cs.id ";
@@ -677,7 +677,7 @@
                        
$check_list->set_assigned_to($this->unmarshal($this->db->f('assigned_to'), 
'int'));
                        $check_list->set_serie_id($this->db->f('serie_id'));
                        
$check_list->set_repeat_type($this->db->f('repeat_type'));
-
+                       
$check_list->set_billable_hours((float)$this->db->f('billable_hours'));
                        
                        $check_lists_array[] = $check_list;
                }

Modified: branches/dev-syncromind/controller/inc/class.socontrol.inc.php
===================================================================
--- branches/dev-syncromind/controller/inc/class.socontrol.inc.php      
2015-06-23 09:23:25 UTC (rev 13481)
+++ branches/dev-syncromind/controller/inc/class.socontrol.inc.php      
2015-06-23 09:26:51 UTC (rev 13482)
@@ -38,7 +38,9 @@
   class controller_socontrol extends controller_socommon
   {
                protected static $so;
+               protected $global_lock = false;
 
+
                /**
                 * Get a static reference to the storage object associated with 
this model object
                 *
@@ -775,17 +777,44 @@
                        $control_id             = (int) $control_id;
                        $location_id    = (int) $location_id;
                        $component_id   = (int) $component_id;
-                       
+
                        $sql  = "SELECT * ";
                        $sql .= "FROM controller_control_component_list ";
                        $sql .= "WHERE control_id = {$control_id} ";
                        $sql .= "AND location_id = {$location_id} ";
                        $sql .= "AND component_id = {$component_id}";
-                       
+
                        $this->db->query($sql, __LINE__, __FILE__);
                        return $this->db->next_record();
                }
 
+               public function get_assigned_control_components($from_date, 
$to_date, $assigned_to = 0)
+               {
+                       $assigned_to    = (int) $assigned_to;
+                       $location_id    = (int) $location_id;
+                       $component_id   = (int) $component_id;
+
+                       $sql  = "SELECT DISTINCT ccl.component_id, 
ccl.location_id";
+                       $sql .= " FROM controller_control_component_list ccl , 
controller_control_serie cs";
+                       $sql .= " WHERE ccl.id = cs.control_relation_id";
+                       $sql .= " AND cs.control_relation_type = 'component'";
+                       $sql .= " AND cs.assigned_to = {$assigned_to}";
+                       $sql .= " AND cs.enabled = 1";
+//                     $sql .= " AND ((cs.start_date <= $to_date AND 
cs.end_date IS NULL) ";
+//                     $sql .= " OR (cs.start_date <= $to_date AND cs.end_date 
> $from_date ))";
+                       $sql .= " AND cs.start_date <= $to_date";
+
+                       $this->db->query($sql, __LINE__, __FILE__);
+                       $components = array();
+
+                       while($this->db->next_record())
+                       {
+                               $location_id = $this->db->f('location_id');
+                               $components[$location_id][] = 
$this->db->f('component_id');
+                       }
+                       return $components;
+               }
+
                /**
                 * Register that a control should be carried out on a location
                 *
@@ -878,7 +907,14 @@
 
                        $delete_component = array();
                        $add_component = array();
-                       $this->db->transaction_begin();
+                       if ( $this->db->get_transaction() )
+                       {
+                               $this->global_lock = true;
+                       }
+                       else
+                       {
+                               $this->db->transaction_begin();
+                       }
 
                        if(isset($data['register_component']) && 
is_array($data['register_component']))
                        {
@@ -990,7 +1026,11 @@
                                $ret += PHPGW_ACL_DELETE; //bit - delete
                        }
  
-                       $this->db->transaction_commit();
+                       if ( !$this->global_lock )
+                       {
+                               $this->db->transaction_commit();
+                       }
+
                        return $ret;
                }
 
@@ -1451,4 +1491,71 @@
                                return PHPGW_ACL_EDIT; // Bit - edit
                        }
                }
+
+               function 
add_controll_to_component_from_master($master_component, $targets = array())
+               {
+                       $master_component_arr = explode('_', $master_component);
+                       if(count($master_component_arr) != 2)
+                       {
+                               throw new 
Exception("controller_socontrol::add_controll_to_component_from_master - 
Missing master component");
+                       }
+
+                       $location_id = (int)$master_component_arr[0];
+                       $component_id = (int)$master_component_arr[1];
+
+                       $sql = "SELECT * FROM controller_control_component_list"
+                       . " {$this->db->join} controller_control_serie"
+                       . " ON controller_control_serie.control_relation_id = 
controller_control_component_list.id"
+                       . " AND controller_control_serie.control_relation_type 
= 'component'"
+                       . " WHERE location_id = {$location_id} AND  
component_id = {$component_id}";
+
+                       $this->db->query($sql,__LINE__,__FILE__);
+
+                       $series = array();
+                       while($this->db->next_record())
+                       {
+                               $start_date             = 
$this->db->f('start_date');
+                               if($start_date < time())
+                               {
+                                       $start_date     = time();
+                               }
+                               $series[] = array(
+                                       'control_id'                    => 
$this->db->f('control_id'),
+                                       'assigned_to'                   => 
$this->db->f('assigned_to'),
+                                       'start_date'                    => 
$start_date,
+                                       'repeat_type'                   => 
$this->db->f('repeat_type'),
+                                       'repeat_interval'               => 
$this->db->f('repeat_interval'),
+                                       'service_time'                  => 
$this->db->f('service_time'),
+                                       'controle_time'                 => 
$this->db->f('controle_time'),
+                                       'duplicate'                             
=> true
+
+                               );
+                       }
+
+                       $this->db->transaction_begin();
+
+                       foreach($targets as $target)
+                       {
+                               $target_component_arr = explode('_', $target);
+
+                               $target_location_id = 
(int)$target_component_arr[0];
+                               $target_component_id = 
(int)$target_component_arr[1];
+                               foreach($series as $serie)
+                               {
+                                       $values = array
+                                       (
+                                               'register_component'    => 
array("{$serie['control_id']}_{$target_location_id}_{$target_component_id}"),
+                                               'assigned_to'                   
=> $serie['assigned_to'],
+                                               'start_date'                    
=> $serie['start_date'],
+                                               'repeat_type'                   
=> $serie['repeat_type'],
+                                               'repeat_interval'               
=> $serie['repeat_interval'],
+                                               'controle_time'                 
=> $serie['controle_time'],
+                                               'service_time'                  
=> $serie['service_time'],
+                                               'duplicate'                     
        => true
+                                       );
+                                       
$this->register_control_to_component($values);
+                               }
+                       }
+                       return $this->db->transaction_commit();
+               }
        }

Modified: branches/dev-syncromind/controller/inc/class.uicase.inc.php
===================================================================
--- branches/dev-syncromind/controller/inc/class.uicase.inc.php 2015-06-23 
09:23:25 UTC (rev 13481)
+++ branches/dev-syncromind/controller/inc/class.uicase.inc.php 2015-06-23 
09:26:51 UTC (rev 13482)
@@ -38,32 +38,32 @@
        phpgw::import_class('controller.socheck_list');
        phpgw::import_class('controller.socheck_item');
        phpgw::import_class('controller.socontrol');
-    phpgw::import_class('controller.socontrol_group_list');
-    phpgw::import_class('controller.socontrol_item_list');
+       phpgw::import_class('controller.socontrol_group_list');
+       phpgw::import_class('controller.socontrol_item_list');
        
        include_class('controller', 'check_item_case', 'inc/model/');
        include_class('controller', 'component', 'inc/model/');
-    include_class('controller', 'location_finder', 'inc/helper/');
+       include_class('controller', 'location_finder', 'inc/helper/');
                        
        class controller_uicase extends phpgwapi_uicommon_jquery
        {
                private $so;
                
-        private $so_control;
+               private $so_control;
                private $so_control_item;
                private $so_check_item;
                private $so_procedure;
                private $so_control_group_list;
                private $so_control_group;
                private $so_control_item_list;
-        private $so_check_list;
+               private $so_check_list;
 
-        private $location_finder;
+               private $location_finder;
 
-           private $read;
-           private $add;
-           private $edit;
-           private $delete;
+               private $read;
+               private $add;
+               private $edit;
+               private $delete;
    
                var $public_functions = array
                        (
@@ -86,21 +86,21 @@
                {
                        parent::__construct();
                        
-                       $this->so                                  = 
CreateObject('controller.socase');
+                       $this->so                                          = 
CreateObject('controller.socase');
                        $this->so_control                               = 
CreateObject('controller.socontrol');
                        $this->so_control_item                  = 
CreateObject('controller.socontrol_item');
                        $this->so_check_item                    = 
CreateObject('controller.socheck_item');
                        $this->so_procedure                             = 
CreateObject('controller.soprocedure');
-                       $this->so_control_group_list    = 
CreateObject('controller.socontrol_group_list');
+                       $this->so_control_group_list    = 
CreateObject('controller.socontrol_group_list');
                        $this->so_control_group                 = 
CreateObject('controller.socontrol_group');
-                       $this->so_control_item_list     = 
CreateObject('controller.socontrol_item_list');
+                       $this->so_control_item_list      = 
CreateObject('controller.socontrol_item_list');
                        $this->so_check_list                    = 
CreateObject('controller.socheck_list');
-      
-                       $this->location_finder          = new location_finder();
 
-                       $this->read    = 
$GLOBALS['phpgw']->acl->check('.checklist', PHPGW_ACL_READ, 'controller');//1 
-                       $this->add     = 
$GLOBALS['phpgw']->acl->check('.checklist', PHPGW_ACL_ADD, 'controller');//2 
-                       $this->edit    = 
$GLOBALS['phpgw']->acl->check('.checklist', PHPGW_ACL_EDIT, 'controller');//4 
+                       $this->location_finder            = new 
location_finder();
+
+                       $this->read     = 
$GLOBALS['phpgw']->acl->check('.checklist', PHPGW_ACL_READ, 'controller');//1
+                       $this->add       = 
$GLOBALS['phpgw']->acl->check('.checklist', PHPGW_ACL_ADD, 'controller');//2
+                       $this->edit     = 
$GLOBALS['phpgw']->acl->check('.checklist', PHPGW_ACL_EDIT, 'controller');//4
                        $this->delete  = 
$GLOBALS['phpgw']->acl->check('.checklist', PHPGW_ACL_DELETE, 'controller');//8 
                        if(phpgw::get_var('noframework', 'bool'))
                        {
@@ -137,10 +137,10 @@
                                $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 );
+                               $component->set_xml_short_desc( $short_desc );
                                $component_array = $component->toArray();
                                
                                $type = 'component';
@@ -288,7 +288,7 @@
                                'control'                                       
                => $control,
                                'check_list'                                    
        => $check_list,
                                'buildings_on_property'                         
=> $buildings_on_property,
-                           'location_array'                                    
=> $location_array,
+                               'location_array'                                
        => $location_array,
                                'component_array'                               
        => $component_array,
                                'control_groups_with_items_array'       => 
$control_groups_with_items_array,
                                'type'                                          
                => $type,
@@ -314,14 +314,14 @@
                                'control'                                       
                => $case_data['control'],
                                'check_list'                                    
        => $check_list,
                                'buildings_on_property'                         
=> $case_data['buildings_on_property'],
-                           'location_array'                                    
=> $case_data['location_array'],
+                               'location_array'                                
        => $case_data['location_array'],
                                'component_array'                               
        => $case_data['component_array'],
                                'control_groups_with_items_array'       => 
$case_data['control_groups_with_items_array'],
                                'type'                                          
                => $case_data['type'],
                                'location_level'                                
        => $level,
                                'current_year'                                  
        => $year,
                                'current_month_nr'                              
        => $month,
-                           'cases_view'                                        
        => 'add_case',
+                               'cases_view'                                    
        => 'add_case',
                        );
                        
                        phpgwapi_jquery::load_widget('core');
@@ -336,7 +336,7 @@
                                                                          
'check_list/fragments/check_list_top_section', 'case/add_case', 
                                                                          
'check_list/fragments/select_buildings_on_property'), $data);
                }
-    
+
                public function get_case_data_ajax()
                {
                        $check_list_id = phpgw::get_var('check_list_id');
@@ -378,7 +378,7 @@
                                $new_check_item = new controller_check_item();
                                $new_check_item->set_check_list_id( 
$check_list_id );
                                $new_check_item->set_control_item_id( 
$control_item_id );
-                                                               
+
                                $saved_check_item_id = 
$this->so_check_item->store( $new_check_item );
                                $check_item = 
$this->so_check_item->get_single($saved_check_item_id);
                        }
@@ -428,7 +428,7 @@
                                return json_encode( array( "status" => 
"not_saved" ) );
                        }
                }
-    
+
                function save_case()
                {
                        if(!$this->add && !$this->edit)
@@ -523,12 +523,12 @@
                                $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);
                                $component->set_location_code( 
$component_arr['location_code'] );
-                           $component->set_xml_short_desc( $short_desc );
+                               $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']);
@@ -554,7 +554,7 @@
                                'check_items_and_cases'         => 
$check_items_and_cases,
                                'location_array'                        => 
$location_array,
                                'component_array'                       => 
$component_array,
-                               'building_location_code'    => 
$building_location_code,
+                               'building_location_code'        => 
$building_location_code,
                                'current_year'                          => 
$year,
                                'current_month_nr'                      => 
$month,
                                'type'                                          
=> $type,
@@ -641,7 +641,7 @@
                        
                        $ticket = array
                        (
-                               'origin_id'         => $location_id,
+                               'origin_id'              => $location_id,
                                'origin_item_id'        => $check_list_id, 
                                'location_code'         => $location_code,
                                'cat_id'                        => 
$message_cat_id,
@@ -667,11 +667,11 @@
 
                                $interlink_data = array
                                (
-                                       'location1_id'      => 
$component_location_id,
+                                       'location1_id'    => 
$component_location_id,
                                        'location1_item_id' => $component_id,
-                                       'location2_id'      => 
$location_id_ticket,
+                                       'location2_id'    => 
$location_id_ticket,
                                        'location2_item_id' => 
$message_ticket_id,
-                                       'account_id'        => $user_id
+                                       'account_id'            => $user_id
                                );
 
                                execMethod('property.interlink.add', 
$interlink_data);
@@ -728,12 +728,12 @@
                                $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);
                                $component->set_location_code( 
$component_arr['location_code'] );
-                           $component->set_xml_short_desc( $short_desc );
+                               $component->set_xml_short_desc( $short_desc );
                                $component_array = $component->toArray();
                                                        
                                $type = 'component';
@@ -752,18 +752,18 @@
                        
                        $data = array
                        (
-                               'control'                              => 
$control->toArray(),
-                               'message_ticket_id'         => 
$message_ticket_id,
+                               'control'                                       
=> $control->toArray(),
+                               'message_ticket_id'                     => 
$message_ticket_id,
                                'message_ticket'                        => 
$message_ticket,
-                               'category'                            => 
$category[0]['name'],
+                               'category'                                      
=> $category[0]['name'],
                                'location_array'                        => 
$location_array,
-                               'component_array'           => $component_array,
-                               'control_array'                  => 
$control->toArray(),
-                               'check_list'                        => 
$check_list->toArray(),
-                               'check_items_and_cases'     => 
$check_items_and_cases,
-                               'current_year'                    => $year,
-                               'current_month_nr'          => $month,
-                               'type'                            => $type,
+                               'component_array'                       => 
$component_array,
+                               'control_array'                         => 
$control->toArray(),
+                               'check_list'                            => 
$check_list->toArray(),
+                               'check_items_and_cases'         => 
$check_items_and_cases,
+                               'current_year'                          => 
$year,
+                               'current_month_nr'                      => 
$month,
+                               'type'                                          
=> $type,
                                'building_location_code'        => 
$building_location_code,
                                'location_level'                        => 
$level
                        );
@@ -878,9 +878,9 @@
                                return json_encode( array( "status" => "false" 
) );
                        }
                }
-    
-        function view_open_cases()
-        {
+
+               function view_open_cases()
+               {
                        $check_list_id = phpgw::get_var('check_list_id');
                        $case_location_code = phpgw::get_var('location_code');
                        
@@ -888,7 +888,7 @@
                        $control = 
$this->so_control->get_single($check_list->get_control_id());                   
     
 
                        $check_list_location_code = 
$check_list->get_location_code();
-      
+
                        $component_id = $check_list->get_component_id();
 
                        if($component_id > 0)
@@ -903,12 +903,12 @@
                                $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);
                                $component->set_location_code( 
$component_arr['location_code'] );
-                           $component->set_xml_short_desc( $short_desc );
+                               $component->set_xml_short_desc( $short_desc );
                                $component_array = $component->toArray();
                                
                                $type = 'component';
@@ -923,8 +923,8 @@
                                // Fetches locations on property
                                $buildings_on_property = 
$this->location_finder->get_buildings_on_property($user_role, 
$check_list_location_code, $level);
                        }
-      
-      
+
+
                        $level = 
$this->location_finder->get_location_level($check_list_location_code);
                        $year = date("Y", $check_list->get_deadline());
                        $month = date("n", $check_list->get_deadline());
@@ -933,7 +933,7 @@
 
                        $open_check_items_and_cases = 
$this->so_check_item->get_check_items_with_cases($check_list_id, $_type = null, 
'open_or_waiting', null, $case_location_code);
 
-      
+
                        if( $buildings_on_property )
                        {
                                foreach ( $buildings_on_property as &$building)
@@ -941,7 +941,7 @@
                                        $building['selected'] = $building['id'] 
== $case_location_code ? 1 : 0;
                                }
                        }
-      
+
                        foreach($open_check_items_and_cases as $key => 
$check_item)
                        {
                                $control_item_with_options = 
$this->so_control_item->get_single_with_options( 
$check_item->get_control_item_id() );
@@ -957,30 +957,30 @@
                                        }
                                }
 
-                           $check_item->get_control_item()->set_options_array( 
$control_item_with_options->get_options_array() );
+                               
$check_item->get_control_item()->set_options_array( 
$control_item_with_options->get_options_array() );
                                $open_check_items_and_cases[$key] = $check_item;
                        }
-      
+
                        $data = array
                        (
-                           'control'                                           
=> $control,
+                               'control'                                       
        => $control,
                                'check_list'                                    
=> $check_list,
-                               'buildings_on_property'         => 
$buildings_on_property,
-                           'location_array'                            => 
$location_array,
+                               'buildings_on_property'          => 
$buildings_on_property,
+                               'location_array'                                
=> $location_array,
                                'component_array'                               
=> $component_array,
                                'type'                                          
        => $type,
                                'location_level'                                
=> $level,
                        //      'building_location_code'                => 
$case_location_code,
                                'current_year'                                  
=> $year,
                                'current_month_nr'                              
=> $month,
-                               'open_check_items_and_cases'    => 
$open_check_items_and_cases,
-                           'cases_view'                                => 
'open_cases'
+                               'open_check_items_and_cases'    => 
$open_check_items_and_cases,
+                               'cases_view'                                    
=> 'open_cases'
                        );
-      
+
                        phpgwapi_jquery::load_widget('core');
                        self::add_javascript('controller', 'controller', 
'case.js');
                        self::add_javascript('controller', 'controller', 
'check_list_update_status.js');
-      
+
                        self::render_template_xsl( 
array('check_list/fragments/check_list_menu', 'case/cases_tab_menu', 
'case/view_open_cases', 'case/case_row', 
                                                                           
'check_list/fragments/nav_control_plan', 
'check_list/fragments/check_list_top_section', 
                                                                           
'check_list/fragments/select_buildings_on_property'), $data );                  
     
@@ -992,11 +992,11 @@
                        $case_location_code = phpgw::get_var('location_code');
 
                        $check_list = 
$this->so_check_list->get_single($check_list_id);
-        
-                       // Check list top section info         
+
+                       // Check list top section info
                        $control = 
$this->so_control->get_single($check_list->get_control_id());                
                        $location_code = $check_list->get_location_code();
-      
+
                        $component_id = $check_list->get_component_id();
 
                        if($component_id > 0)
@@ -1010,12 +1010,12 @@
                                $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);
                                $component->set_location_code( 
$component_arr['location_code'] );
-                           $component->set_xml_short_desc( $short_desc );
+                               $component->set_xml_short_desc( $short_desc );
                                $component_array = $component->toArray();
                                
                                $type = 'component';
@@ -1031,7 +1031,7 @@
                                $buildings_on_property = 
$this->location_finder->get_buildings_on_property($user_role, $location_code, 
$level);
                        }
                        // Check list top section info
-      
+
                        $level = 
$this->location_finder->get_location_level($location_code);
                        $year = date("Y", $check_list->get_deadline());
                        $month = date("n", $check_list->get_deadline());
@@ -1067,10 +1067,10 @@
 
                        $data = array
                        (
-                           'control'                                           
=> $control,
+                               'control'                                       
        => $control,
                                'check_list'                                    
=> $check_list,
-                               'buildings_on_property'         => 
$buildings_on_property,
-                           'location_array'                            => 
$location_array,
+                               'buildings_on_property'          => 
$buildings_on_property,
+                               'location_array'                                
=> $location_array,
                                'component_array'                               
=> $component_array,
                                'type'                                          
        => $type,
                                'location_level'                                
=> $level,
@@ -1078,9 +1078,9 @@
                                'current_year'                                  
=> $year,
                                'current_month_nr'                              
=> $month,
                                'closed_check_items_and_cases'  => 
$closed_check_items_and_cases,
-                               'check_list'                            => 
$check_list,
-                           'cases_view'                                => 
'closed_cases',
-                           'building_location_code'        => 
$building_location_code
+                               'check_list'                                    
=> $check_list,
+                               'cases_view'                                    
=> 'closed_cases',
+                               'building_location_code'                => 
$building_location_code
                        );
 
                        phpgwapi_jquery::load_widget('core');                   
@@ -1088,8 +1088,8 @@
                        self::add_javascript('controller', 'controller', 
'check_list_update_status.js');
 
                        self::render_template_xsl( 
array('check_list/fragments/check_list_menu', 'case/cases_tab_menu', 
'case/view_closed_cases', 'case/case_row', 
-                                                                               
 'check_list/fragments/nav_control_plan', 
'check_list/fragments/check_list_top_section', 
-                                                                               
 'check_list/fragments/select_buildings_on_property'), $data );                 
+                                                                               
         'check_list/fragments/nav_control_plan', 
'check_list/fragments/check_list_top_section',
+                                                                               
         'check_list/fragments/select_buildings_on_property'), $data );
                }
                
                public function query(){}

Modified: branches/dev-syncromind/controller/inc/class.uicomponent.inc.php
===================================================================
--- branches/dev-syncromind/controller/inc/class.uicomponent.inc.php    
2015-06-23 09:23:25 UTC (rev 13481)
+++ branches/dev-syncromind/controller/inc/class.uicomponent.inc.php    
2015-06-23 09:26:51 UTC (rev 13482)
@@ -57,9 +57,11 @@
                private $add;
                private $edit;
                private $delete;
+               private $org_units;
                public $public_functions = array
                        (
-                       'index'                                                 
 => true,
+                       'index'                                         => true,
+                       'add_controll_from_master'      => true
                );
 
                public function __construct()
@@ -82,6 +84,35 @@
                        $this->account                  = 
$GLOBALS['phpgw_info']['user']['account_id'];
                }
 
+               public function add_controll_from_master()
+               {
+                       $master_component = phpgw::get_var('master_component', 
'string');
+                       $target = phpgw::get_var('target', 'string');//array of 
strings
+                       $result = array('status' => 'error', 'message' => '');
+
+                       if($this->manage)
+                       {
+                               $so_control     = 
CreateObject('controller.socontrol');
+                               try
+                               {
+                                       $result['status'] = 
$so_control->add_controll_to_component_from_master($master_component, $target);
+                                       $result['message'] = count($target) . ' 
' . lang('added');
+                               }
+                               catch(Exception $e)
+                               {
+                                       if ( $e )
+                                       {
+                                               $result['message'] = 
$e->getMessage();
+                                       }
+                               }
+                       }
+                       else
+                       {
+                               $result['message'] = 'Go away';
+                       }
+                       return $result;
+               }
+
                private function get_location_filter()
                {
                        $entity_group_id = phpgw::get_var('entity_group_id', 
'int');
@@ -155,9 +186,27 @@
                                (
                                        'id'            => $user['account_id'],
                                        'name'          => 
"{$user['account_lastname']}, {$user['account_firstname']}",
-                                       'selected'      => $this->account == 
$user['account_id'] ? 1 : 0
+                                       'selected'      => 0 //$this->account 
== $user['account_id'] ? 1 : 0
                                );
                        }
+
+                       $_my_negative_self = -1 * $this->account;
+
+                       $default_value = array
+                       (
+                               'id'            => $_my_negative_self,
+                               'name'          => lang('my assigned controls'),
+                               'selected'      => $_my_negative_self == 
($this->account * -1)
+                       );
+
+                       /*Unselect user if filter on component*/
+                       if(phpgw::get_var('component_id', 'int'))
+                       {
+                               $default_value['selected'] = 0;
+                       }
+
+                       unset($_my_negative_self);
+                       array_unshift ($user_list,$default_value);
                        array_unshift($user_list, array('id' => '', 'name' => 
lang('select')));
 
                        // Sigurd: Start categories
@@ -200,8 +249,6 @@
                                array('id' => 'not_performed', 'name' => 
lang('status not done')),
                                array('id' => 'done_with_open_deviation', 
'name' => lang('done with open deviation')),
                        );
-                       $location_filter = $this->get_location_filter();
-                       array_unshift($location_filter, array('id' => '', 
'name' => lang('select value')));
 
                        $filter_component = '';
                        if(phpgw::get_var('component_id', 'int'))
@@ -221,13 +268,24 @@
                                                                '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'     => 
'hidden',
+                                                               'name'   => 
'location_id',
+                                                               'value'  => 
phpgw::get_var('location_id', 'int')
+                                                       ),
                                                        array('type'     => 
'filter',
                                                                'name'   => 
'location_id',
                                                                'text'   => 
lang('component'),
-                                                               'list'   => 
$location_filter,
+                                                               'list'   => 
array(),
                                                                'onchange'      
=> 'update_table();'
-                                                       ),/*
+                                                       ),
                                                        array('type'     => 
'filter',
+                                                               'name'   => 
'org_unit_id',
+                                                               'text'   => 
lang('department'),
+                                                               'list'   => 
execMethod('property.bogeneric.get_list',array('type' => 'org_unit', 'selected' 
=> phpgw::get_var('org_unit_id'), 'add_empty' => true)),
+                                                               'onchange'      
=> 'update_table();'
+                                                       ),
+                                                       /*
+                                                       array('type'     => 
'filter',
                                                                'name'   => 
'control_area',
                                                                'text'   => 
lang('Control_area'),
                                                                'list'   => 
$control_areas_array,
@@ -277,7 +335,7 @@
                                        'field'  =>  
$this->get_fields($filter_component),
                                ),
                        );
-                       self::render_template_xsl(array('component'), $data);
+                       
self::render_template_xsl(array('component','calendar/icon_color_map'), $data);
                }
 
                private function get_fields($filter_component = '')
@@ -285,12 +343,12 @@
                        $fields = array
                        (
                                array(
-                                       'key'            => 'selected',
+                                       'key'            => 'choose',
                                        'label'          => '',
                                        'sortable'       => false,
                                ),
                                array(
-                                       'key'            => 'component_id',
+                                       'key'            => 'component_url',
                                        'label'          => lang('component'),
                                        'sortable'       => true,
                                ),
@@ -369,6 +427,21 @@
                        return $fields;
                }
 
+               /**
+               * Get the sublevels of the org tree into one arry
+               */
+               private function _get_children($data = array() )
+               {
+                       foreach ($data as $entry)
+                       {
+                               $this->org_units[]= $entry['id'];
+                               if(isset($entry['children']) && 
$entry['children'])
+                               {
+                                       
$this->_get_children($entry['children']);
+                               }
+                       }
+               }
+
                public function query()
                {
                        $entity_group_id = phpgw::get_var('entity_group_id', 
'int');
@@ -386,6 +459,21 @@
                                $location_id = $filter_component_arr[0];
                                $filter_component = $filter_component_arr[1];
                        }
+                       if($org_unit_id = phpgw::get_var('org_unit_id', 'int'))
+                       {
+                               $_subs = 
execMethod('property.sogeneric.read_tree',array('node_id' => $org_unit_id, 
'type' => 'org_unit'));
+                               $this->org_units[]= $org_unit_id;
+                               foreach($_subs as $entry)
+                               {
+                                       $this->org_units[]= $entry['id'];
+                                       if(isset($entry['children']) && 
$entry['children'])
+                                       {
+                                               
$this->_get_children($entry['children']);
+                                       }
+                               }
+                               unset($entry);
+                               unset($_subs);
+                       }
 
                        $so_control                      = 
CreateObject('controller.socontrol');
                        $this->so                       = 
CreateObject('controller.socheck_list');
@@ -407,10 +495,31 @@
                        }
 //                     _debug_array($location_type_name);
                        $components = array();
+                       $keep_only_assigned_to = 0;
 
                        $lookup_stray_items = false;
+                       if($user_id < 0)
+                       {
+                               $user_id = $user_id * -1;
+                               $all_items = false;
 
-                       if(!$location_id)
+                               $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)
+                               {
+                                       $_components = 
execMethod('property.soentity.read',array(
+                                               'filter_entity_group'           
=> $entity_group_id,
+                                               'location_id'                   
        => $_location_id,
+                                               'district_id'                   
        => $district_id,
+                                               'allrows'                       
                => true,
+                                               'filter_item'                   
        => $component_list
+                                               )
+                                       );
+                                       $components = array_merge($components, 
$_components);
+
+                               }
+                       }
+                       else if(!$location_id)
                        {
                                //nothing
                        }
@@ -440,10 +549,11 @@
                                                'filter_entity_group'           
=> $entity_group_id,
                                                'location_id'                   
        => $_location_id,
                                                'district_id'                   
        => $district_id,
+                                               'org_units'                     
                => $this->org_units,
                                                'allrows'                       
                => true,
                                                'control_registered'            
=> !$all_items,
                                                'check_for_control'             
        => true,
-                                               'filter_item'                   
        => $filter_component
+                                               'filter_item'                   
        => $filter_component ? array($filter_component) : array()
                                                )
                                        );
                                        $components = array_merge($components, 
$_components);
@@ -452,13 +562,14 @@
                                if($lookup_stray_items)
                                {
                                        $_components = 
execMethod('property.soentity.read_entity_group',array(
-                                               'entity_group_id' => 
$entity_group_id,
-                                               'exclude_locations'     => 
$exclude_locations,
-                                               'location_id' => $_location_id,
-                                               'district_id' => $district_id,
-                                               'allrows' => true,
-                                               'control_registered' => 
!$all_items,
-                                               'check_for_control' => true
+                                               'entity_group_id'               
        => $entity_group_id,
+                                               'exclude_locations'             
        => $exclude_locations,
+                                               'location_id'                   
        => $_location_id,
+                                               'district_id'                   
        => $district_id,
+                                               'org_units'                     
                => $this->org_units,
+                                               'allrows'                       
                => true,
+                                               'control_registered'            
=> !$all_items,
+                                               'check_for_control'             
        => true
                                                )
                                        );
                                        $components = array_merge($components, 
$_components);
@@ -482,7 +593,7 @@
                                {
                                        continue;
                                }
-                               $controls = 
execMethod('controller.socontrol.get_controls_at_component', 
array('location_id' => $location_id, 'component_id' => $component_id));
+                               $controls = 
$so_control->get_controls_at_component(array('location_id' => $location_id, 
'component_id' => $component_id));
 //_debug_array($controls);
                                foreach($controls as $_control)
                                {
@@ -606,8 +717,11 @@
                                        'active_tab'    => 'controller'
                                );
                        
-                               $data['component_id'] = '<a 
href="'.$GLOBALS['phpgw']->link('/index.php',$component_link_data)."\" 
target='_blank'>{$component_id}{$entry[0]['component']['xml_short_desc']}</a>";
+                               $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;
+                               $data['location_id'] = $location_id;
 
+
                                $max_repeat_type = 0;
                                $_data = array();
                                foreach($entry as $dataset)
@@ -655,8 +769,10 @@
                        unset($component_id);
                        unset($component);
 
+                       $choose_master = false;
                        if($all_components && count($all_components))
                        {
+                               $choose_master = true;
                                foreach($all_components as $component_id => 
$component)
                                {
                                        $data = array();
@@ -673,7 +789,9 @@
                                        $short_description = 
$component['short_description'];
                                        $short_description .= "[ 
{$component['location_name']} ]";
 
-                                       $data['component_id'] = '<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_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['location_id'] = $location_id;
                                        $data['missing_control'] = true;
                                        $values[] = $data;
 
@@ -686,7 +804,8 @@
                        {
                                $row            = array();
                                $row_sum        = array();
-                               $row['component_id'] = $entry['component_id'];
+                               $row_sum_actual = array();//billable_hours
+                               $row['component_url'] = $entry['component_url'];
                                $row['year'] = '';
                                $row['descr'] = '';
 
@@ -694,32 +813,39 @@
                                {
                                        if($filter_component_str)
                                        {
-                                               $row['selected'] = '<input 
id="selected_component" type="checkbox" name="selected_component" checked = 
"checked" onclick="deselect_component();">';
+                                               $row['choose'] = '<input 
id="selected_component" type="checkbox" name="selected_component" checked = 
"checked" onclick="deselect_component();">';
                                        }
-                                       else
+                                       else if ($choose_master)
                                        {
-                                               $row['selected'] = '';
+                                               $row['choose'] = "<input 
id=\"master_component\" type=\"radio\" name=\"master_component\" value = 
\"{$entry['location_id']}_{$entry['component_id']}\" >";
                                        }
                                        $row['year'] = $year;
                                        $row['descr'] = 
"Frekvens<br/>Status<br/>Utførende<br/>Tidsbruk";
                                }
+                               else if ($choose_master)
+                               {
+                                       $row['choose'] = "<input 
id=\"selected_components\" class=\"mychecks\" type=\"checkbox\" 
name=\"selected_components[]\" value = 
\"{$entry['location_id']}_{$entry['component_id']}\">";
+                               }
 
                                $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);
-                                       if( !$user_id || 
$entry[$_month]['info']['assigned_to'] == $user_id)
+                                       $row[$_month] = 
$this->translate_calendar_info($entry[$_month],$year, $_month, $filter_status, 
$found_at_least_one, $keep_only_assigned_to);
+                                       if($row[$_month] &&( !$user_id || 
$entry[$_month]['info']['assigned_to'] == $user_id))
                                        {
                                                $row_sum[$_month] = 
$entry[$_month]['info']['service_time'] + 
$entry[$_month]['info']['controle_time'];
+                                               $row_sum_actual[$_month] =  + 
$entry[$_month]['info']['billable_hours'];
                                        }
                                        else
                                        {
                                                $row_sum[$_month] = 0;
+                                               $row_sum_actual[$_month] = 0;
                                        }
                                }
                                if(!$filter_status || $found_at_least_one)
                                {
                                        $total_time[] = $row_sum;
+                                       $total_time_actual[] = $row_sum_actual;
                                        $data_set[] = $row;
                                }
                        }
@@ -748,6 +874,7 @@
                        unset($_month);
 
                        $sum_year = 0;
+                       $sum_year_actual = 0;
 
                        if(!$total_time)
                        {
@@ -766,22 +893,59 @@
                                                $sum_year += $_row[$_month];
                                        }
                                }
+                               unset($_row);
                        }
                        $result['time_sum'][0] = $sum_year;
+
+                       if(!$total_time_actual)
+                       {
+                               for ( $_month=1; $_month < 13; $_month++ )
+                               {
+                                       $result['time_sum_actual'][$_month] = 0;
+                               }
+                       }
+                       else
+                       {
+                               foreach ($total_time_actual as $_row)
+                               {
+                                       for ( $_month=1; $_month < 13; 
$_month++ )
+                                       {
+                                               
$result['time_sum_actual'][$_month] += $_row[$_month];
+                                               $sum_year_actual += 
$_row[$_month];
+                                       }
+                               }
+                       }
+                       $result['time_sum_actual'][0] = $sum_year_actual;
                        $result['total_records'] = $total_records;
-
                        $result['location_filter'] = $location_filter;
+                       if ($choose_master)
+                       {
+                               $lang_save = lang('add');
+                               $lang_select = lang('select');
+                               $result['checkall'] = "<input type=\"button\" 
value = '{$lang_save}' title = '{$lang_save}' 
onclick=\"add_from_master('mychecks');\">";
+                               $result['checkall'] .= '</br>';
+                               $result['checkall'] .= "<input 
type=\"checkbox\" title = '{$lang_select}' onclick=\"checkAll('mychecks');\">";
+                       }
+                       else
+                       {
+                               $result['checkall'] = '';
+                       }
 
                        return $result;
                }
 
-               private function translate_calendar_info($param = array(), 
$year, $month, $filter_status = '', &$found_at_least_one = false)
+               private function translate_calendar_info($param = array(), 
$year, $month, $filter_status = '', &$found_at_least_one = false, 
$keep_only_assigned_to)
                {
                        if(!isset($param['repeat_type']))
                        {
                                return '';
                        }
 
+                       if($keep_only_assigned_to && $keep_only_assigned_to != 
$param['info']['assigned_to'])
+                       {
+                               return '';
+                       }
+
                        if($filter_status)
                        {
                                if($filter_status == 'not_performed')
@@ -885,6 +1049,10 @@
                //      $controle_time = $param['info']['controle_time'] ? 
$param['info']['controle_time'] : '&nbsp;';
                        $time = $param['info']['service_time'] + 
$param['info']['controle_time'];
                        $time = $time ? $time : '&nbsp;';
+                       $billable_hours = 
(float)$param['info']['billable_hours'];
+                       {
+                               $time .= " / {$billable_hours}";
+                       }
 
                        return 
"{$repeat_type}<br/>{$link}<br/>{$assigned_to}<br/>{$time}";
                }

Modified: branches/dev-syncromind/controller/setup/phpgw_no.lang
===================================================================
--- branches/dev-syncromind/controller/setup/phpgw_no.lang      2015-06-23 
09:23:25 UTC (rev 13481)
+++ branches/dev-syncromind/controller/setup/phpgw_no.lang      2015-06-23 
09:26:51 UTC (rev 13482)
@@ -1,3 +1,6 @@
+my assigned controls   controller      no      Mine kontroller
+add case       controller      no      Registrer sak
+add ticket     controller      no      Registrer melding
 add_check_list_to_location     controller      no      Registrer kontroll for 
bygg
 added  controller      no      Lagt til
 deleted        controller      no      Slettet

Modified: 
branches/dev-syncromind/controller/templates/base/case/view_case_message.xsl
===================================================================
--- 
branches/dev-syncromind/controller/templates/base/case/view_case_message.xsl    
    2015-06-23 09:23:25 UTC (rev 13481)
+++ 
branches/dev-syncromind/controller/templates/base/case/view_case_message.xsl    
    2015-06-23 09:26:51 UTC (rev 13482)
@@ -1,130 +1,154 @@
 <!-- $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="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="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>
-               </div>
+                                                       </xsl:otherwise>
+                                               </xsl:choose>
+                                       </xsl:otherwise>
+                               </xsl:choose>
+                       </div>
                
-               <div class="box-2 select-box">
-                       <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>
-                                       Vis kontrollplan (år)
-                               </a>
+                       <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>
+                                                       Vis kontrollplan (å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>
-                                       Vis kontrollplan (måned)
-                               </a>
-                       </xsl:otherwise>
+                                               <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>
+                                                       Vis kontrollplan (måned)
+                                               </a>
+                                       </xsl:otherwise>
+                               </xsl:choose>
+                       </div>
+               
+                       <!-- ==================  CHECKLIST TAB MENU  
===================== -->
+                       <xsl:call-template name="check_list_menu" />
                </div>
-               
-               <!-- ==================  CHECKLIST TAB MENU  
===================== -->
-               <xsl:call-template name="check_list_menu" />
-       </div>
        
-       <!-- =======================  INFO ABOUT MESSAGE  
========================= -->
-       <h3 class="box_header ext">Registrert melding</h3>
-       <div id="caseMessage" class="box ext">
+               <!-- =======================  INFO ABOUT MESSAGE  
========================= -->
+               <h3 class="box_header ext">Registrert melding</h3>
+               <div id="caseMessage" class="box ext">
                
-                               <xsl:variable name="show_ticket_params">
-                                       
<xsl:text>menuaction:property.uitts.view, id:</xsl:text>
-                                       <xsl:value-of 
select="message_ticket_id" />
-                               </xsl:variable>
-                               <xsl:variable name="show_ticket_url">
-                                       <xsl:value-of 
select="php:function('get_phpgw_link', '/index.php', $show_ticket_params )" />
-                               </xsl:variable>
-                               <a id="showMessage" target="_blank" 
href="{$show_ticket_url}"><xsl:value-of select="php:function('lang', 'Show 
message')" /></a>
+                       <xsl:variable name="show_ticket_params">
+                               <xsl:text>menuaction:property.uitts.view, 
id:</xsl:text>
+                               <xsl:value-of select="message_ticket_id" />
+                       </xsl:variable>
+                       <xsl:variable name="show_ticket_url">
+                               <xsl:value-of 
select="php:function('get_phpgw_link', '/index.php', $show_ticket_params )" />
+                       </xsl:variable>
+                       <a id="showMessage" target="_blank" 
href="{$show_ticket_url}">
+                               <xsl:value-of select="php:function('lang', 
'Show message')" />
+                       </a>
                
-                   <!-- === TITLE === -->
-                   <div class="row">                           
-                               <label>Tittel på 
melding:</label><span><xsl:value-of select="message_ticket/subject"/></span>
+                       <!-- === TITLE === -->
+                       <div class="row">
+                               <label>Tittel på melding:</label>
+                               <span>
+                                       <xsl:value-of 
select="message_ticket/subject"/>
+                               </span>
                        </div>
                        <!-- === CATEGORY === -->
                        <div class="row">
-                               <label>Kategori</label><span><xsl:value-of 
select="category"/></span>
+                               <label>Kategori</label>
+                               <span>
+                                       <xsl:value-of select="category"/>
+                               </span>
                        </div>
                        <!-- === UPLOAD FILE === -->
                        <div class="row">
                                <label>Filvedlegg:</label>
-                                       <xsl:for-each 
select="message_ticket/files">
-                                               <li><xsl:value-of 
select="."/></li>
-                                       </xsl:for-each>
+                               <xsl:for-each select="message_ticket/files">
+                                       <li>
+                                               <xsl:value-of select="."/>
+                                       </li>
+                               </xsl:for-each>
                        </div>
                
-               <h3>Meldingen inneholder disse sakene</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/title"/></span></h4>
-                                                       <ul>            
-                                                               <xsl:for-each 
select="cases_array">
-                                                                       
<xsl:variable name="cases_id"><xsl:value-of select="id"/></xsl:variable>
-                                                                       
<li><xsl:value-of select="descr"/></li>
-                                                               </xsl:for-each>
-                                                       </ul>
-                                               </li>
-                                       </xsl:when>
-                               </xsl:choose>
-                       </xsl:for-each>
-               </ul>
+                       <h3>Meldingen inneholder disse sakene</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/title"/>
+                                                                       </span>
+                                                               </h4>
+                                                               <ul>
+                                                                       
<xsl:for-each select="cases_array">
+                                                                               
<xsl:variable name="cases_id">
+                                                                               
        <xsl:value-of select="id"/>
+                                                                               
</xsl:variable>
+                                                                               
<li>
+                                                                               
        <xsl:value-of select="descr"/>
+                                                                               
</li>
+                                                                       
</xsl:for-each>
+                                                               </ul>
+                                                       </li>
+                                               </xsl:when>
+                                       </xsl:choose>
+                               </xsl:for-each>
+                       </ul>
                
-               <xsl:variable name="new_ticket_params">
-                       
<xsl:text>menuaction:controller.uicase.create_case_message, 
check_list_id:</xsl:text>
-                       <xsl:value-of select="check_list/id" />
-               </xsl:variable>
-               <xsl:variable name="new_ticket_url">
-                       <xsl:value-of select="php:function('get_phpgw_link', 
'/index.php', $new_ticket_params)" />
-               </xsl:variable>
-               <a class="btn" href="{$new_ticket_url}"><xsl:value-of 
select="php:function('lang', 'Register new message')" /></a>
+                       <xsl:variable name="new_ticket_params">
+                               
<xsl:text>menuaction:controller.uicase.create_case_message, 
check_list_id:</xsl:text>
+                               <xsl:value-of select="check_list/id" />
+                       </xsl:variable>
+                       <xsl:variable name="new_ticket_url">
+                               <xsl:value-of 
select="php:function('get_phpgw_link', '/index.php', $new_ticket_params)" />
+                       </xsl:variable>
+                       <a class="btn" href="{$new_ticket_url}">
+                               <xsl:value-of select="php:function('lang', 
'Register new message')" />
+                       </a>
+               </div>
        </div>
-</div>
 </xsl:template>

Modified: 
branches/dev-syncromind/controller/templates/base/check_list/fragments/add_check_list_menu.xsl
===================================================================
--- 
branches/dev-syncromind/controller/templates/base/check_list/fragments/add_check_list_menu.xsl
      2015-06-23 09:23:25 UTC (rev 13481)
+++ 
branches/dev-syncromind/controller/templates/base/check_list/fragments/add_check_list_menu.xsl
      2015-06-23 09:26:51 UTC (rev 13482)
@@ -21,11 +21,11 @@
         <div class="right_btns">
             <!-- ==================  REGISTER NEW CASE  ===================== 
-->
             <span class="btn focus first">
-                Registrer sak
+                               <xsl:value-of select="php:function('lang', 'add 
case')"/>
             </span>
             <!-- ==================  REGISTER NEW MESSAGE  
===================== -->
             <span class="btn focus">
-                Registrer melding
+                               <xsl:value-of select="php:function('lang', 'add 
ticket')"/>
             </span>
         </div>
     </div>

Modified: 
branches/dev-syncromind/controller/templates/base/check_list/fragments/check_list_menu.xsl
===================================================================
--- 
branches/dev-syncromind/controller/templates/base/check_list/fragments/check_list_menu.xsl
  2015-06-23 09:23:25 UTC (rev 13481)
+++ 
branches/dev-syncromind/controller/templates/base/check_list/fragments/check_list_menu.xsl
  2015-06-23 09:26:51 UTC (rev 13482)
@@ -1,81 +1,83 @@
 <xsl:template name="check_list_menu" xmlns:php="http://php.net/xsl";>
-    <xsl:param name="active_tab" />
-    <xsl:variable name="session_url">&amp;<xsl:value-of 
select="php:function('get_phpgw_session_url')" /></xsl:variable>
+       <xsl:param name="active_tab" />
+       <xsl:variable name="session_url">&amp;
+               <xsl:value-of select="php:function('get_phpgw_session_url')" />
+       </xsl:variable>
 
-    <div id="check_list_menu">
-        <div class="left_btns">
-            <a class="first">
-                <xsl:choose>
-                    <xsl:when test="$active_tab = 'view_details'">
-                        <xsl:attribute name="class">first 
active</xsl:attribute>
-                    </xsl:when>
-                    <xsl:otherwise>
-                        <xsl:attribute name="class">first</xsl:attribute>
-                    </xsl:otherwise>
-                </xsl:choose>
+       <div id="check_list_menu">
+               <div class="left_btns">
+                       <a class="first">
+                               <xsl:choose>
+                                       <xsl:when test="$active_tab = 
'view_details'">
+                                               <xsl:attribute 
name="class">first active</xsl:attribute>
+                                       </xsl:when>
+                                       <xsl:otherwise>
+                                               <xsl:attribute 
name="class">first</xsl:attribute>
+                                       </xsl:otherwise>
+                               </xsl:choose>
                 
-                <xsl:attribute name="href">
-                    
<xsl:text>index.php?menuaction=controller.uicheck_list.edit_check_list</xsl:text>
-                    <xsl:text>&amp;check_list_id=</xsl:text>
-                    <xsl:value-of select="check_list/id"/>
-                    <xsl:value-of select="$session_url"/>
-                </xsl:attribute>
-                Vis detaljer for sjekkliste
-            </a>
-            <!-- ==================  LOADS CASES FOR CHECKLIST  
===================== -->
-            <a>
-                <xsl:if test="$active_tab = 'view_cases'">
-                    <xsl:attribute name="class">active</xsl:attribute>
-                </xsl:if>
-                <xsl:attribute name="href">
-                    
<xsl:text>index.php?menuaction=controller.uicase.view_open_cases</xsl:text>
-                    <xsl:text>&amp;check_list_id=</xsl:text>
-                    <xsl:value-of select="check_list/id"/>
-                    <xsl:value-of select="$session_url"/>
-                </xsl:attribute>
-                Vis saker
-            </a>
-            <!-- ==================  LOADS INFO ABOUT CONTROL  
===================== -->
-            <a>
-                <xsl:choose>
-                    <xsl:when test="$active_tab = 'view_control_info'">
-                        <xsl:attribute name="class">last active</xsl:attribute>
-                    </xsl:when>
-                    <xsl:otherwise>
-                        <xsl:attribute name="class">last</xsl:attribute>
-                    </xsl:otherwise>
-                </xsl:choose>
-                <xsl:attribute name="href">
-                    
<xsl:text>index.php?menuaction=controller.uicheck_list.view_control_info</xsl:text>
-                    <xsl:text>&amp;check_list_id=</xsl:text>
-                    <xsl:value-of select="check_list/id"/>
-                    <xsl:value-of select="$session_url"/>
-                </xsl:attribute>
-                Vis info om kontroll
-            </a>
-        </div>
+                               <xsl:attribute name="href">
+                                       
<xsl:text>index.php?menuaction=controller.uicheck_list.edit_check_list</xsl:text>
+                                       <xsl:text>&amp;check_list_id=</xsl:text>
+                                       <xsl:value-of select="check_list/id"/>
+                                       <xsl:value-of select="$session_url"/>
+                               </xsl:attribute>
+                               Vis detaljer for sjekkliste
+                       </a>
+                       <!-- ==================  LOADS CASES FOR CHECKLIST  
===================== -->
+                       <a>
+                               <xsl:if test="$active_tab = 'view_cases'">
+                                       <xsl:attribute 
name="class">active</xsl:attribute>
+                               </xsl:if>
+                               <xsl:attribute name="href">
+                                       
<xsl:text>index.php?menuaction=controller.uicase.view_open_cases</xsl:text>
+                                       <xsl:text>&amp;check_list_id=</xsl:text>
+                                       <xsl:value-of select="check_list/id"/>
+                                       <xsl:value-of select="$session_url"/>
+                               </xsl:attribute>
+                               Vis saker
+                       </a>
+                       <!-- ==================  LOADS INFO ABOUT CONTROL  
===================== -->
+                       <a>
+                               <xsl:choose>
+                                       <xsl:when test="$active_tab = 
'view_control_info'">
+                                               <xsl:attribute 
name="class">last active</xsl:attribute>
+                                       </xsl:when>
+                                       <xsl:otherwise>
+                                               <xsl:attribute 
name="class">last</xsl:attribute>
+                                       </xsl:otherwise>
+                               </xsl:choose>
+                               <xsl:attribute name="href">
+                                       
<xsl:text>index.php?menuaction=controller.uicheck_list.view_control_info</xsl:text>
+                                       <xsl:text>&amp;check_list_id=</xsl:text>
+                                       <xsl:value-of select="check_list/id"/>
+                                       <xsl:value-of select="$session_url"/>
+                               </xsl:attribute>
+                               Vis info om kontroll
+                       </a>
+               </div>
                
-        <div class="right_btns">
-            <!-- ==================  REGISTER NEW CASE  ===================== 
-->
-            <a class="btn focus first">
-                <xsl:attribute name="href">
-                    
<xsl:text>index.php?menuaction=controller.uicase.add_case</xsl:text>
-                    <xsl:text>&amp;check_list_id=</xsl:text>
-                    <xsl:value-of select="check_list/id"/>
-                    <xsl:value-of select="$session_url"/>
-                </xsl:attribute>
-                Registrer sak
-            </a>
-            <!-- ==================  REGISTER NEW MESSAGE  
===================== -->
-            <a class="btn focus">
-                <xsl:attribute name="href">
-                    
<xsl:text>index.php?menuaction=controller.uicase.create_case_message</xsl:text>
-                    <xsl:text>&amp;check_list_id=</xsl:text>
-                    <xsl:value-of select="check_list/id"/>
-                    <xsl:value-of select="$session_url"/>
-                </xsl:attribute>
-                Registrer melding
-            </a>
-        </div>
-    </div>
+               <div class="right_btns">
+                       <!-- ==================  REGISTER NEW CASE  
===================== -->
+                       <a class="btn focus first">
+                               <xsl:attribute name="href">
+                                       
<xsl:text>index.php?menuaction=controller.uicase.add_case</xsl:text>
+                                       <xsl:text>&amp;check_list_id=</xsl:text>
+                                       <xsl:value-of select="check_list/id"/>
+                                       <xsl:value-of select="$session_url"/>
+                               </xsl:attribute>
+                               <xsl:value-of select="php:function('lang', 'add 
case')"/>
+                       </a>
+                       <!-- ==================  REGISTER NEW MESSAGE  
===================== -->
+                       <a class="btn focus">
+                               <xsl:attribute name="href">
+                                       
<xsl:text>index.php?menuaction=controller.uicase.create_case_message</xsl:text>
+                                       <xsl:text>&amp;check_list_id=</xsl:text>
+                                       <xsl:value-of select="check_list/id"/>
+                                       <xsl:value-of select="$session_url"/>
+                               </xsl:attribute>
+                               <xsl:value-of select="php:function('lang', 'add 
ticket')"/>
+                       </a>
+               </div>
+       </div>
 </xsl:template>

Modified: branches/dev-syncromind/controller/templates/base/component.xsl
===================================================================
--- branches/dev-syncromind/controller/templates/base/component.xsl     
2015-06-23 09:23:25 UTC (rev 13481)
+++ branches/dev-syncromind/controller/templates/base/component.xsl     
2015-06-23 09:26:51 UTC (rev 13482)
@@ -20,6 +20,8 @@
        <h2>
                <xsl:value-of select="datatable_name"/>
        </h2>
+       <div id="receipt"></div>
+       <xsl:call-template name="icon_color_map" />
        <xsl:apply-templates select="form" />
        <xsl:apply-templates select="paging"/>
        <div id="list_flash">
@@ -180,6 +182,38 @@
 <xsl:template name="datasource-definition">
        <script type="text/javascript">
 <![CDATA[
+
+               /**
+               * Detect if browsertab is active - and update when revisit
+               */
+               var vis = (function(){
+                       var stateKey, eventKey, keys = {
+                               hidden: "visibilitychange",
+                               webkitHidden: "webkitvisibilitychange",
+                               mozHidden: "mozvisibilitychange",
+                               msHidden: "msvisibilitychange"
+                       };
+                       for (stateKey in keys) {
+                               if (stateKey in document) {
+                                       eventKey = keys[stateKey];
+                                       break;
+                               }
+                       }
+                       return function(c) {
+                               if (c) document.addEventListener(eventKey, c);
+                               return !document[stateKey];
+                       }
+               })();
+
+               vis(function(){
+                       if(vis())
+                       {
+                                       update_table();
+                       }
+               });
+
+
+
                $(document).ready(function(){
                        update_table();
                });
@@ -191,6 +225,32 @@
                };
                update_table = function()
                {
+                       $("#receipt").html('');
+
+                       var user_id = $("#user_id").val();
+                       if(user_id < 0)
+                       {
+                               $( "#entity_group_id" ).hide();
+                               $("[for='entity_group_id']").hide();
+                               $( "#location_id" ).hide();
+                               $("[for='location_id']").hide();
+                               $("[name='all_items']").hide();
+                               $("[for='all_items']").hide();
+                               $( "#org_unit_id" ).hide();
+                               $("[for='org_unit_id']").hide();
+                       }
+                       else
+                       {
+                               $( "#entity_group_id" ).show();
+                               $("[for='entity_group_id']").show();
+                               $( "#location_id" ).show();
+                               $("[for='location_id']").show();
+                               $("[name='all_items']").show();
+                               $("[for='all_items']").show();
+                               $( "#org_unit_id" ).show();
+                               $("[for='org_unit_id']").show();
+                       }
+
                        var requestUrl = $("#queryForm").attr("action");
                        requestUrl += '&phpgw_return_as=json' + "&" + 
$("#queryForm").serialize();
 
@@ -203,22 +263,24 @@
                                        {
                                                $("#tbody").html(data.tbody);
                                                var time_sum = data.time_sum;
+                                               var time_sum_actual = 
data.time_sum_actual;
 
+                                               
$("#checkall").html(data.checkall);
                                                
$("#total_records").html(data.total_records);
                                                $("#sum_text").html('Sum');
-                                               $("#month0").html(time_sum[0]);
-                                               $("#month1").html(time_sum[1]);
-                                               $("#month2").html(time_sum[2]);
-                                               $("#month3").html(time_sum[3]);
-                                               $("#month4").html(time_sum[4]);
-                                               $("#month5").html(time_sum[5]);
-                                               $("#month6").html(time_sum[6]);
-                                               $("#month7").html(time_sum[7]);
-                                               $("#month8").html(time_sum[8]);
-                                               $("#month9").html(time_sum[9]);
-                                               
$("#month10").html(time_sum[10]);
-                                               
$("#month11").html(time_sum[11]);
-                                               
$("#month12").html(time_sum[12]);
+                                               $("#month0").html(time_sum[0] + 
'/' + time_sum_actual[0]);
+                                               $("#month1").html(time_sum[1] + 
'/' + time_sum_actual[1]);
+                                               $("#month2").html(time_sum[2] + 
'/' + time_sum_actual[2]);
+                                               $("#month3").html(time_sum[3] + 
'/' + time_sum_actual[3]);
+                                               $("#month4").html(time_sum[4] + 
'/' + time_sum_actual[4]);
+                                               $("#month5").html(time_sum[5] + 
'/' + time_sum_actual[5]);
+                                               $("#month6").html(time_sum[6] + 
'/' + time_sum_actual[6]);
+                                               $("#month7").html(time_sum[7] + 
'/' + time_sum_actual[7]);
+                                               $("#month8").html(time_sum[8] + 
'/' + time_sum_actual[8]);
+                                               $("#month9").html(time_sum[9] + 
'/' + time_sum_actual[9]);
+                                               $("#month10").html(time_sum[10] 
+ '/' + time_sum_actual[10]);
+                                               $("#month11").html(time_sum[11] 
+ '/' + time_sum_actual[11]);
+                                               $("#month12").html(time_sum[12] 
+ '/' + time_sum_actual[12]);
                                                if(data.location_filter)
                                                {
                                                        var obj = 
data.location_filter;
@@ -257,12 +319,81 @@
                        });
 
                };
+
+               add_from_master = function(myclass)
+               {
+                       var myRadio = $('input[name=master_component]');
+                       var master_component = myRadio.filter(':checked').val();
+
+                       if(!master_component)
+                       {
+                               alert('velg master');
+                               return;
+                       }
+
+                       var selected  = new Array();
+
+                       $("." + myclass).each(function()
+                       {
+                               if($(this).prop("checked"))
+                               {
+                                       selected.push( $(this).val() );
+                               }
+                       });
+
+                       oArgs = {menuaction: 
'controller.uicomponent.add_controll_from_master'};
+                       var requestUrl = phpGWLink('index.php', oArgs, true);
+
+                       $.ajax({
+                               type: 'POST',
+                               data: {master_component:master_component, 
target:selected},
+                               dataType: 'json',
+                               url: requestUrl,
+                               success: function(data) {
+                                       if( data != null)
+                                       {
+console.log(data);
+                                               var message = data.message;
+
+                                               htmlString = "";
+                                               var msg_class = "msg_good";
+                                               if(data.status =='error')
+                                               {
+                                                       msg_class = "error";
+                                               }
+                                               htmlString += "<div class=\"" + 
msg_class + "\">";
+                                               htmlString += message;
+                                               htmlString += '</div>';
+                                               update_table();
+                                               $("#receipt").html(htmlString);
+
+                                       }
+                               }
+                       });
+
+               };
+
+               checkAll = function(myclass)
+               {
+                       $("." + myclass).each(function()
+                       {
+                               if($(this).prop("checked"))
+                               {
+                                       $(this).prop("checked", false);
+                               }
+                               else
+                               {
+                                       $(this).prop("checked", true);
+                               }
+                       });
+               };
+
 ]]>
        </script>
        <table id="components">
                <thead>
                        <tr>
-                               <td id='selected'>
+                               <td id='checkall'>
                                </td>
                                <td id='total_records'>
                                </td>

Modified: branches/dev-syncromind/property/inc/class.soentity.inc.php
===================================================================
--- branches/dev-syncromind/property/inc/class.soentity.inc.php 2015-06-23 
09:23:25 UTC (rev 13481)
+++ branches/dev-syncromind/property/inc/class.soentity.inc.php 2015-06-23 
09:26:51 UTC (rev 13482)
@@ -447,7 +447,7 @@
                        $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;
                        $filter_entity_group= 
isset($data['filter_entity_group']) && $data['filter_entity_group'] ? 
(int)$data['filter_entity_group'] : 0;
-                       $filter_item            = isset($data['filter_item']) 
&& $data['filter_item'] ? (int)$data['filter_item'] : 0;
+                       $filter_item            = isset($data['filter_item']) 
&& $data['filter_item'] ? $data['filter_item'] : array();
 
 
                        if($location_id)
@@ -509,11 +509,12 @@
                        $filtermethod = "WHERE fm_bim_type.location_id = 
{$location_id}";
                        $where= 'AND';
 
-                       if( $category['org_unit'])
+//                     if( $category['org_unit'])
                        {
                                if($org_units)
                                {
                                        $filtermethod .= " $where ( 
$entity_table.org_unit_id IN(" . implode(',',$org_units) . "))";
+                                       $where= 'AND';
                                }
                        }
 
@@ -615,9 +616,9 @@
                                $where= 'AND';
                        }
 
-                       if ($filter_item)
+                       if (is_array($filter_item) && count($filter_item))
                        {
-                               $filtermethod .= " {$where} {$entity_table}.id 
= {$filter_item}";
+                               $filtermethod .= " {$where} {$entity_table}.id 
IN (" . implode(',', $filter_item) . ')';
                                $where= 'AND';
                        }
 
@@ -1389,8 +1390,8 @@
                        $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;
                        $filter_entity_group= 
isset($data['filter_entity_group']) && $data['filter_entity_group'] ? 
(int)$data['filter_entity_group'] : 0;
+                       $filter_item            = isset($data['filter_item']) 
&& $data['filter_item'] ? $data['filter_item'] : array();
 
-
                        if($location_id)
                        {
                                $loc_arr = 
$GLOBALS['phpgw']->locations->get_name($location_id);
@@ -1498,7 +1499,7 @@
                        }
 
                        unset($_config);
-                       if( $category['org_unit'])
+//                     if( $category['org_unit'])
                        {
                                if($org_units)
                                {
@@ -1586,6 +1587,12 @@
                                $where= 'AND';
                        }
 
+                       if (is_array($filter_item) && count($filter_item))
+                       {
+                               $filtermethod .= " {$where} {$entity_table}.id 
IN (" . implode(',', $filter_item) . ')';
+                               $where= 'AND';
+                       }
+
                        $_querymethod = array();
                        $__querymethod = array();
                        $_joinmethod_datatype = array();

Modified: branches/dev-syncromind/property/setup/phpgw_no.lang
===================================================================
--- branches/dev-syncromind/property/setup/phpgw_no.lang        2015-06-23 
09:23:25 UTC (rev 13481)
+++ branches/dev-syncromind/property/setup/phpgw_no.lang        2015-06-23 
09:26:51 UTC (rev 13482)
@@ -539,7 +539,7 @@
 delete workorder       property        no      slett bestilling
 delivered      property        no      Levert
 delivery address       property        no      Leveringsadresse
-department     property        no      Avdeling
+department     common  no      Avdeling
 deposit claim  property        no      Krav mot depositum
 deposition     property        no      Avsetning
 description    property        no      Beskrivelse

Modified: branches/dev-syncromind/rental/inc/class.socomposite.inc.php
===================================================================
--- branches/dev-syncromind/rental/inc/class.socomposite.inc.php        
2015-06-23 09:23:25 UTC (rev 13481)
+++ branches/dev-syncromind/rental/inc/class.socomposite.inc.php        
2015-06-23 09:26:51 UTC (rev 13482)
@@ -24,7 +24,9 @@
        }
 
        protected function get_query(string $sort_field, boolean $ascending, 
string $search_for, string $search_type, array $filters, boolean $return_count)
-       {               
+       {
+               $location_id_into = $GLOBALS['phpgw']->locations->get_id( 
'rental', '.RESPONSIBILITY.INTO');
+
                $clauses = array('1=1');
                if($search_for)
                {
@@ -180,7 +182,8 @@
                        {
                                $cols = "rental_composite.id AS composite_id,";
                        }
-                       $cols .= "rental_unit.id AS unit_id, 
rental_unit.location_code, rental_composite.name, 
rental_composite.has_custom_address, rental_composite.address_1, 
rental_composite.house_number, 
+
+                       $cols .= "rental_unit.id AS unit_id, 
rental_unit.location_code, rental_composite.name, 
rental_composite.has_custom_address, rental_composite.address_1, 
rental_composite.house_number,
                                          rental_composite.address_2, 
rental_composite.postcode, rental_composite.place, rental_composite.is_active, 
rental_composite.area, rental_composite.description, 
rental_composite.furnish_type_id, rental_composite.standard_id, ";
                        $cols .= "rental_contract.id AS contract_id, 
rental_contract.date_start, rental_contract.date_end, 
rental_contract.old_contract_id, ";
                        $cols .= "
@@ -188,6 +191,7 @@
                        (
                                NOT rental_contract_composite.contract_id IS 
NULL AND
                                NOT rental_contract.date_start IS NULL AND
+                               NOT rental_contract.location_id = 
{$location_id_into} AND
                                ((NOT rental_contract.date_start > 
$availability_date_to AND rental_contract.date_end IS NULL)
                                OR
                                (NOT rental_contract.date_start > 
$availability_date_to AND NOT rental_contract.date_end IS NULL AND NOT 
rental_contract.date_end < $availability_date_from))

Modified: branches/dev-syncromind/rental/inc/class.soprice_item.inc.php
===================================================================
--- branches/dev-syncromind/rental/inc/class.soprice_item.inc.php       
2015-06-23 09:23:25 UTC (rev 13481)
+++ branches/dev-syncromind/rental/inc/class.soprice_item.inc.php       
2015-06-23 09:26:51 UTC (rev 13482)
@@ -45,6 +45,9 @@
                $price_item->set_price($this->unmarshal($this->db->f('price', 
true), 'float'));
                
$price_item->set_responsibility_id($this->unmarshal($this->db->f('responsibility_id',
 true), 'string'));
                
$price_item->set_responsibility_title($this->unmarshal($this->db->f('resp_title',
 true), 'string'));
+               $price_type_id  = (int)$this->db->f('type');
+               $price_item->set_price_type_id($price_type_id);
+               $price_item->set_price_type_title($price_type_id);
                
                return $price_item;
        }
@@ -73,7 +76,9 @@
                        
$price_item->set_price($this->unmarshal($this->db->f('price', true), 'float'));
                        
$price_item->set_responsibility_id($this->unmarshal($this->db->f('responsibility_id',
 true), 'string'));
                        
$price_item->set_responsibility_title($this->unmarshal($this->db->f('resp_title',
 true), 'string'));
-                       
+                       $price_type_id  = (int)$this->db->f('type');
+                       $price_item->set_price_type_id($price_type_id);
+                       $price_item->set_price_type_title($price_type_id);
                        return $price_item;
                }
                
@@ -102,6 +107,9 @@
                        
$price_item->set_price($this->unmarshal($this->db->f('price', true), 'float'));
                        
$price_item->set_responsibility_id($this->unmarshal($this->db->f('responsibility_id',
 true), 'string'));
                        
$price_item->set_responsibility_title($this->unmarshal($this->db->f('resp_title',
 true), 'string'));
+                       $price_type_id  = (int)$this->db->f('type');
+                       $price_item->set_price_type_id($price_type_id);
+                       $price_item->set_price_type_title($price_type_id);
                        
                        return $price_item;
                }
@@ -139,6 +147,9 @@
                        
$price_item->set_standard($this->unmarshal($this->db->f('standard', true), 
'bool'));
                        
$price_item->set_price($this->unmarshal($this->db->f('price', true), 'float'));
                        
$price_item->set_responsibility_id($this->unmarshal($this->db->f('responsibility_id',
 true), 'int'));
+                       $price_type_id  = (int)$this->db->f('type');
+                       $price_item->set_price_type_id($price_type_id);
+                       $price_item->set_price_type_title($price_type_id);
                        
                        $results[] = $price_item;
                }
@@ -190,6 +201,11 @@
                        case "both":
                                break;
                }
+
+               if(isset($filters['type']) && $filters['type'])
+               {
+                               $filter_clauses[] = 'rental_price_item.type = ' 
. (int)$filters['type'];
+               }
                        
                if(count($filter_clauses))
                        {
@@ -217,10 +233,11 @@
                        ($price_item->is_adjustable() ? "true" : "false"),
                        ($price_item->is_standard() ? "true" : "false"),
                        str_replace(',','.',$price),
-                       $price_item->get_responsibility_id()
+                       $price_item->get_responsibility_id(),
+                       $price_item->get_price_type_id()
                );
                
-               $cols = array('title', 'agresso_id', 'is_area', 'is_inactive', 
'is_adjustable', 'standard', 'price', 'responsibility_id');
+               $cols = array('title', 'agresso_id', 'is_area', 'is_inactive', 
'is_adjustable', 'standard', 'price', 'responsibility_id', 'type');
                
                $q ="INSERT INTO rental_price_item (" . join(',', $cols) . ") 
VALUES (" . join(',', $values) . ")";
                
@@ -250,7 +267,8 @@
                        'is_adjustable = ' . ($price_item->is_adjustable() ? 
"true" : "false"),
                        'standard = ' . ($price_item->is_standard() ? "true" : 
"false"),
                        'price = ' . 
str_replace(',','.',$price_item->get_price()),
-                       'responsibility_id = ' . 
$price_item->get_responsibility_id()
+                       'responsibility_id = ' . 
$price_item->get_responsibility_id(),
+                       'type = ' . $price_item->get_price_type_id()
                );
                                
                $this->db->query('UPDATE rental_price_item SET ' . join(',', 
$values) . " WHERE id=$id", __LINE__,__FILE__);
@@ -466,6 +484,10 @@
                        
$price_item->set_price($this->unmarshal($this->db->f('price'),'float'));
                        
$price_item->set_responsibility_id($this->unmarshal($this->db->f('responsibility_id',
 true), 'int'));
                        
$price_item->set_responsibility_title($this->unmarshal($this->db->f('resp_title',
 true), 'string'));
+                       $price_type_id  = (int)$this->db->f('type');
+                       $price_item->set_price_type_id($price_type_id);
+                       $price_item->set_price_type_title($price_type_id);
+
                }
                return $price_item;
        }

Modified: branches/dev-syncromind/rental/inc/class.uiprice_item.inc.php
===================================================================
--- branches/dev-syncromind/rental/inc/class.uiprice_item.inc.php       
2015-06-23 09:23:25 UTC (rev 13481)
+++ branches/dev-syncromind/rental/inc/class.uiprice_item.inc.php       
2015-06-23 09:26:51 UTC (rev 13482)
@@ -72,9 +72,21 @@
                        return;
                }
 
-               $id = (int)phpgw::get_var('id');
-               $price_item = rental_price_item::get($id);
+               if($id = phpgw::get_var('id', 'int'))
+               {
+                       $price_item = rental_price_item::get($id);
+               }
+               else
+               {
+                       $title = phpgw::get_var('price_item_title');
+                       $responsibility_id = 
phpgw::get_var('responsibility_id');
+                       $price_item = new rental_price_item();
+                       $price_item->set_title($title);
+                       $price_item->set_responsibility_id($responsibility_id);
+                       $price_item->set_price_type_id(1); // defaults to year
+               }
 
+
                // Save the price item if it was posted
                if(isset($_POST['save']))
                {
@@ -85,6 +97,7 @@
                        
$price_item->set_is_adjustable(phpgw::get_var('is_adjustable') == 'on' ? true : 
false);
                        $price_item->set_standard(phpgw::get_var('standard') == 
'on' ? true : false);
                        $price_item->set_price(phpgw::get_var('price'));
+                       
$price_item->set_price_type_id(phpgw::get_var('price_type_id', 'int'));
                        if($price_item->get_agresso_id() == null)
                        {
                                return $this->viewedit(true, $price_item, '', 
lang('missing_agresso_id'));
@@ -103,6 +116,7 @@
        }
 
        /*
+        * To be removed
         * Add a new price item to the database.  Requires only a title.
         */
        public function add()

Modified: branches/dev-syncromind/rental/inc/model/class.agresso_lg04.inc.php
===================================================================
--- branches/dev-syncromind/rental/inc/model/class.agresso_lg04.inc.php 
2015-06-23 09:23:25 UTC (rev 13481)
+++ branches/dev-syncromind/rental/inc/model/class.agresso_lg04.inc.php 
2015-06-23 09:26:51 UTC (rev 13482)
@@ -146,7 +146,7 @@
                                        $stop                    = 
$price_item->get_timestamp_end();
                                        if(isset($start) && isset($stop))
                                        {
-                                               $description .= ' ' . 
date('j/n', $start) . '-' . date('j/n', $stop);
+//                                             $description .= ' ' . 
date('j/n', $start) . '-' . date('j/n', $stop);
                                        }
                                        $data['article_description'] = 
$description;
                                        $data['article_code']            = 
$price_item->get_agresso_id();

Modified: branches/dev-syncromind/rental/inc/model/class.price_item.inc.php
===================================================================
--- branches/dev-syncromind/rental/inc/model/class.price_item.inc.php   
2015-06-23 09:23:25 UTC (rev 13481)
+++ branches/dev-syncromind/rental/inc/model/class.price_item.inc.php   
2015-06-23 09:26:51 UTC (rev 13482)
@@ -19,6 +19,15 @@
                protected $standard;
                protected $responsibility_id;
                protected $responsibility_title;
+               protected $price_type_id;
+               protected $price_type_title;
+               protected $price_types = array(
+                                       1 => 'year',
+                                       2 => 'month',
+                                       3 => 'day',
+                                       4 => 'hour',
+                               );
+
                //protected $is_one_time;
 
                /**
@@ -131,7 +140,8 @@
                                'standard' => $this->get_standard_text(),
                                'price' => $this->get_price(),
                                'responsibility_id' => 
$this->get_responsibility_id(),
-                               'responsibility_title' => 
lang($this->get_responsibility_title())
+                               'responsibility_title' => 
lang($this->get_responsibility_title()),
+                               'price_type_title' => 
lang($this->get_price_type_title()),
                                //'is_one_time' => $this->is_one_time()
                        );
                }
@@ -199,6 +209,30 @@
                        return $valid;
                }
 
+               public function get_price_types()
+               {
+                       return $this->price_types;
+               }
+               public function get_price_type_id()
+               {
+                       return $this->price_type_id;
+               }
+
+               public function set_price_type_id($price_type_id)
+               {
+                       $this->price_type_id = $price_type_id;
+               }
+
+               public function get_price_type_title()
+               {
+                       return $this->price_type_title;
+               }
+
+               public function set_price_type_title($price_type_id)
+               {
+                       $this->price_type_title = 
$this->price_types[$price_type_id];
+               }
+
                public function get_responsibility_id()
                {
                        return $this->responsibility_id;

Modified: branches/dev-syncromind/rental/setup/setup.inc.php
===================================================================
--- branches/dev-syncromind/rental/setup/setup.inc.php  2015-06-23 09:23:25 UTC 
(rev 13481)
+++ branches/dev-syncromind/rental/setup/setup.inc.php  2015-06-23 09:26:51 UTC 
(rev 13482)
@@ -1,6 +1,6 @@
 <?php
        $setup_info['rental']['name'] = 'rental';               // Module 
identifier
-       $setup_info['rental']['version'] = '0.1.0.21';  // Current module 
version
+       $setup_info['rental']['version'] = '0.1.0.22';  // Current module 
version
        $setup_info['rental']['app_order'] = 51;                // (?)
        $setup_info['rental']['tables'] = array(
                'rental_party',                                         // All 
contract participants, tenants etc.

Modified: branches/dev-syncromind/rental/setup/tables_current.inc.php
===================================================================
--- branches/dev-syncromind/rental/setup/tables_current.inc.php 2015-06-23 
09:23:25 UTC (rev 13481)
+++ branches/dev-syncromind/rental/setup/tables_current.inc.php 2015-06-23 
09:26:51 UTC (rev 13482)
@@ -238,7 +238,8 @@
                                        'is_adjustable' =>      array('type' => 
'bool','nullable' => true,'default' => 'true'),
                                        'standard' =>   array('type' => 
'bool','nullable' => true,'default' => 'false'),
                                        'price' =>      array('type' => 
'decimal', 'precision' => '20','scale' => '2', 'nullable' => true),
-                                       'responsibility_id' => array('type' => 
'int','precision' => '4', 'nullable' => false)
+                                       'responsibility_id' => array('type' => 
'int','precision' => '4', 'nullable' => false),
+                                       'type' =>       array('type' => 'int', 
'precision' => 2, 'nullable' => false,'default' => 1),
                                ),
                                'pk' => array('id'),
                                'fk' => array(),

Modified: branches/dev-syncromind/rental/setup/tables_update.inc.php
===================================================================
--- branches/dev-syncromind/rental/setup/tables_update.inc.php  2015-06-23 
09:23:25 UTC (rev 13481)
+++ branches/dev-syncromind/rental/setup/tables_update.inc.php  2015-06-23 
09:26:51 UTC (rev 13482)
@@ -376,3 +376,18 @@
                $GLOBALS['setup_info']['rental']['currentver'] = '0.1.0.21';
                return $GLOBALS['setup_info']['rental']['currentver'];
        }
+
+       $test[] = '0.1.0.21';
+       function rental_upgrade0_1_0_21()
+       {
+
+               $GLOBALS['phpgw_setup']->oProc->AddColumn('rental_price_item', 
'type', array(
+                       'type' => 'int',
+                       'precision' => 2,
+                       'nullable' => false,
+                       'default' => 1
+               ));
+
+               $GLOBALS['setup_info']['rental']['currentver'] = '0.1.0.22';
+               return $GLOBALS['setup_info']['rental']['currentver'];
+       }

Modified: branches/dev-syncromind/rental/templates/base/admin_price_item.php
===================================================================
--- branches/dev-syncromind/rental/templates/base/admin_price_item.php  
2015-06-23 09:23:25 UTC (rev 13481)
+++ branches/dev-syncromind/rental/templates/base/admin_price_item.php  
2015-06-23 09:26:51 UTC (rev 13482)
@@ -52,6 +52,33 @@
                        <input type="radio" name="is_area" value="false" 
id="is_area"<?php echo !$price_item->is_area() ? ' checked="checked"' : '' ?> 
<?php echo !$editable ? ' disabled="disabled"' : '' ?>/>
                        <label for="is_area"><?php echo 
lang('calculate_price_apiece') ?></label>
                </dd>
+               <dt>
+                       <label for="is_area"><?php echo lang('type') ?></label>
+               </dt>
+               <dd>
+                       <?php
+                       $current_price_type_id = 
$price_item->get_price_type_id();
+                       if ($editable)
+                       {
+                               ?>
+                               <select name="price_type_id">
+                                       <?php
+                                       foreach($price_item->get_price_types() 
as $price_type_id => $price_type_title)
+                                       {
+                                               echo "<option 
".($current_price_type_id == $price_type_id ? 'selected="selected"' : "")." 
value=\"{$price_type_id}\">".lang($price_type_title)."</option>";
+                                       }
+                                       ?>
+                               </select>
+                               <?php
+                       ?>
+                       <?php
+                       }
+                       else // Non-editable
+                       {
+                               echo 
lang($price_item->get_price_types($current_price_type_id));
+                       }
+                       ?>
+               </dd>
 
                <dt>
                        <label for="price"><?php echo lang('price') ?></label>

Modified: 
branches/dev-syncromind/rental/templates/base/admin_price_item_list.php
===================================================================
--- branches/dev-syncromind/rental/templates/base/admin_price_item_list.php     
2015-06-23 09:23:25 UTC (rev 13481)
+++ branches/dev-syncromind/rental/templates/base/admin_price_item_list.php     
2015-06-23 09:26:51 UTC (rev 13482)
@@ -51,7 +51,7 @@
                YAHOO.util.Event.stopEvent(e);
                newName = 
document.getElementById('ctrl_add_price_item_name').value;
                resp_id = document.getElementById('responsibility_id').value;
-                       window.location = 
'index.php?menuaction=rental.uiprice_item.add&amp;price_item_title=' + newName 
+ '&amp;responsibility_id=' + resp_id;
+                       window.location = 
'index.php?menuaction=rental.uiprice_item.edit&amp;price_item_title=' + newName 
+ '&amp;responsibility_id=' + resp_id;
                }
        );
 
@@ -110,6 +110,10 @@
                        label: "<?php echo lang('is_standard') ?>"
                },
                {
+                       key: "price_type_title",
+                       label: "<?php echo lang('type') ?>"
+               },
+               {
                        key: "actions",
                        hidden: true
                },




reply via email to

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