fmsystem-commits
[Top][All Lists]
Advanced

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

[Fmsystem-commits] [13433] Syncromind: Merge 13400:13432 from trunk


From: Sigurd Nes
Subject: [Fmsystem-commits] [13433] Syncromind: Merge 13400:13432 from trunk
Date: Mon, 15 Jun 2015 11:30:35 +0000

Revision: 13433
          http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=13433
Author:   sigurdne
Date:     2015-06-15 11:30:34 +0000 (Mon, 15 Jun 2015)
Log Message:
-----------
Syncromind: Merge 13400:13432 from trunk

Modified Paths:
--------------
    branches/dev-syncromind/admin/templates/base/custom.xsl
    branches/dev-syncromind/controller/inc/class.uicase.inc.php
    branches/dev-syncromind/controller/inc/class.uicheck_list.inc.php
    branches/dev-syncromind/controller/inc/class.uicomponent.inc.php
    
branches/dev-syncromind/controller/inc/component/class.check_list_status_manager.inc.php
    branches/dev-syncromind/controller/inc/component/class.year_calendar.inc.php
    branches/dev-syncromind/controller/js/controller/check_list_update_status.js
    branches/dev-syncromind/controller/setup/phpgw_no.lang
    
branches/dev-syncromind/controller/templates/base/case/create_case_message.xsl
    branches/dev-syncromind/controller/templates/base/case/view_case_message.xsl
    
branches/dev-syncromind/controller/templates/base/check_list/fragments/check_list_top_section.xsl
    
branches/dev-syncromind/controller/templates/base/check_list/fragments/nav_control_plan.xsl
    branches/dev-syncromind/controller/templates/base/component.xsl
    branches/dev-syncromind/phpgwapi/inc/class.cache.inc.php
    branches/dev-syncromind/property/inc/class.boproject.inc.php
    branches/dev-syncromind/property/inc/class.botts.inc.php
    branches/dev-syncromind/property/inc/class.hook_helper.inc.php
    branches/dev-syncromind/property/inc/class.menu.inc.php
    branches/dev-syncromind/property/inc/class.soentity.inc.php
    branches/dev-syncromind/property/inc/class.soinvoice.inc.php
    branches/dev-syncromind/property/inc/class.sotts.inc.php
    branches/dev-syncromind/property/inc/class.soworkorder.inc.php
    branches/dev-syncromind/property/inc/class.uientity.inc.php
    branches/dev-syncromind/property/inc/hook_settings.inc.php

Added Paths:
-----------
    
branches/dev-syncromind/property/inc/custom/default/EBF_update_ticket_on_project_change.php

Removed Paths:
-------------
    branches/dev-syncromind/property/inc/hook_home.inc.php

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


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
   + /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

Modified: branches/dev-syncromind/admin/templates/base/custom.xsl
===================================================================
--- branches/dev-syncromind/admin/templates/base/custom.xsl     2015-06-15 
07:09:00 UTC (rev 13432)
+++ branches/dev-syncromind/admin/templates/base/custom.xsl     2015-06-15 
11:30:34 UTC (rev 13433)
@@ -636,7 +636,8 @@
 
        <xsl:template match="edit_custom_function" 
xmlns:php="http://php.net/xsl";>
                <div align="left">
-               
+
+               <form method="post" action="{form_action}">
                <table cellpadding="2" cellspacing="2" width="80%" 
align="center">
                        <xsl:choose>
                                <xsl:when test="msgbox_data != ''">
@@ -647,8 +648,6 @@
                                        </tr>
                                </xsl:when>
                        </xsl:choose>
-                       
-                       <form method="post" action="{form_action}">
 
                        <tr>
                                <td class="th_text" align="left">
@@ -778,8 +777,9 @@
                                        </input>
                                </td>
                        </tr>
-
-                       </form>
+               </table>
+       </form>
+               <table cellpadding="2" cellspacing="2" width="80%" 
align="center">
                        <tr>
                                <td>
                                        <xsl:variable 
name="done_action"><xsl:value-of select="done_action"/></xsl:variable>

Modified: branches/dev-syncromind/controller/inc/class.uicase.inc.php
===================================================================
--- branches/dev-syncromind/controller/inc/class.uicase.inc.php 2015-06-15 
07:09:00 UTC (rev 13432)
+++ branches/dev-syncromind/controller/inc/class.uicase.inc.php 2015-06-15 
11:30:34 UTC (rev 13433)
@@ -525,6 +525,8 @@
                //              $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_array = $component->toArray();
@@ -728,6 +730,8 @@
 //                             $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_array = $component->toArray();
@@ -901,6 +905,8 @@
 //                             $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_array = $component->toArray();
@@ -1006,6 +1012,8 @@
 //                             $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_array = $component->toArray();

Modified: branches/dev-syncromind/controller/inc/class.uicheck_list.inc.php
===================================================================
--- branches/dev-syncromind/controller/inc/class.uicheck_list.inc.php   
2015-06-15 07:09:00 UTC (rev 13432)
+++ branches/dev-syncromind/controller/inc/class.uicheck_list.inc.php   
2015-06-15 11:30:34 UTC (rev 13433)
@@ -270,6 +270,8 @@
                                $short_desc = $location_name . '::' . 
execMethod('property.soentity.get_short_description', array('location_id' => 
$location_id, 'id' => $component_id));
 
                                $component = new controller_component();
+                               $component->set_id($component_id);
+                               $component->set_location_id($location_id);
                                
$component->set_location_code($component_arr['location_code']);
                                $component->set_xml_short_desc($short_desc);
 
@@ -285,13 +287,16 @@
 
                        $control = 
$this->so_control->get_single($check_list->get_control_id());
 
-                       $responsible_user_id = 
execMethod('property.soresponsible.get_responsible_user_id',
+                       if(!$responsible_user_id = 
phpgw::get_var('assigned_to', 'int'))
+                       {
+                               $responsible_user_id = 
execMethod('property.soresponsible.get_responsible_user_id',
                                        array
                                        (
                                                'responsibility_id' => 
$control->get_responsibility_id(),
                                                'location_code' => 
$location_code
                                        )
                                );
+                       }
 
                        $year = date("Y", $deadline_ts);
                        $month_nr = date("n", $deadline_ts);
@@ -373,6 +378,8 @@
                                $short_desc = $location_name . '::' . 
execMethod('property.soentity.get_short_description', array('location_id' => 
$location_id, 'id' => $component_id));
 
                                $component = new controller_component();
+                               $component->set_id($component_id);
+                               $component->set_location_id($location_id);
                                
$component->set_location_code($component_arr['location_code']);
                                $component->set_xml_short_desc($short_desc);
                                $component_array = $component->toArray();
@@ -703,6 +710,8 @@
                                $short_desc = $location_name . '::' . 
execMethod('property.soentity.get_short_description', array('location_id' => 
$location_id, 'id' => $component_id));
 
                                $component = new controller_component();
+                               $component->set_id($component_id);
+                               $component->set_location_id($location_id);
                                
$component->set_location_code($component_arr['location_code']);
                                $component->set_xml_short_desc($short_desc);
                                $component_array = $component->toArray();
@@ -873,7 +882,7 @@
                {
                        if(!$this->add && !$this->edit)
                        {
-                               return json_encode( array( "status" => 
'not_saved') );
+                               return json_encode( array( "status" => 
'not_saved', 'message' => '') );
                        }
 
                        $check_list_id = phpgw::get_var('check_list_id');
@@ -882,7 +891,23 @@
                        $check_list = $this->so->get_single($check_list_id);
                        if ( !$this->_check_for_required($check_list) )
                        {
-                               return json_encode( array( "status" => 
'not_saved') );                  
+                               $messages = phpgwapi_cache::message_get(true);
+                               $message = '';
+                               foreach($messages as $_type => $_message)
+                               {
+                                       if($_type == 'error')
+                                       {
+                                               foreach($_message as $__message)
+                                               {
+                                       //              $message.= 
strip_tags($__message['msg']);
+                                                       $message.= 
preg_replace("/<\/br[^>]*>\s*\r*\n*/is", "\n", $__message['msg']);
+
+                                               }
+                                       }
+
+                               }
+                               return json_encode( array( "status" => 
'not_saved', 'message' => $message) );
+
                        }
 
                        if($check_list_status == 
controller_check_list::STATUS_DONE)
@@ -903,7 +928,7 @@
                        }
                        else
                        {
-                               return json_encode( array( "status" => 
'not_saved') );
+                               return json_encode( array( "status" => 
'not_saved', 'message' => '') );
                        }
                }
 

Modified: branches/dev-syncromind/controller/inc/class.uicomponent.inc.php
===================================================================
--- branches/dev-syncromind/controller/inc/class.uicomponent.inc.php    
2015-06-15 07:09:00 UTC (rev 13432)
+++ branches/dev-syncromind/controller/inc/class.uicomponent.inc.php    
2015-06-15 11:30:34 UTC (rev 13433)
@@ -195,11 +195,19 @@
                                        'selected'      => $_year == $year ? 1 
: 0
                                );
                        }
-
+                       $status_list = array(
+                               array('id' => '', 'name' => lang('select 
value')),
+                               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'))
+                       {
+                               $filter_component = 
phpgw::get_var('location_id', 'int') . '_' . phpgw::get_var('component_id', 
'int');
+                       }
                        $data = array(
                                'datatable_name' => lang('status components'),
                                'form'                   => array(
@@ -243,29 +251,45 @@
                                                                'list'   => 
$year_list,
                                                                'onchange'      
=> 'update_table();'
                                                        ),
+                                                       array('type'     => 
'filter',
+                                                               'name'   => 
'status',
+                                                               'text'   => 
lang('status'),
+                                                               'list'   => 
$status_list,
+                                                               'onchange'      
=> 'update_table();'
+                                                       ),
                                                        array('type'     => 
'checkbox',
                                                                'name'   => 
'all_items',
                                                                'text'   => 
'List uten kontroller',
                                                                'value'  => 1,
                                                                'onclick'       
=> 'update_table();'
                                                        ),
+                                                       array('type'     => 
'hidden',
+                                                               'name'   => 
'filter_component',
+                                                               'text'   => '',
+                                                               'value'  => 
$filter_component
+                                                       ),
                                                ),
                                        ),
                                ),
                                'datatable'              => array(
                                        'source' => 
self::link(array('menuaction' => 'controller.uicomponent.index',
                                                'phpgw_return_as' => 'json')),
-                                       'field'  =>  $this->get_fields(),
+                                       'field'  =>  
$this->get_fields($filter_component),
                                ),
                        );
                        self::render_template_xsl(array('component'), $data);
                }
 
-               private function get_fields()
+               private function get_fields($filter_component = '')
                {
                        $fields = array
                        (
                                array(
+                                       'key'            => 'selected',
+                                       'label'          => '',
+                                       'sortable'       => false,
+                               ),
+                               array(
                                        'key'            => 'component_id',
                                        'label'          => lang('component'),
                                        'sortable'       => true,
@@ -282,65 +306,66 @@
                                ),
                                array(
                                        'key'            => '1',
-                                       'label'          => lang('month 1'),
+                                       'label'          => lang('short_month 1 
capitalized'),
                                        'sortable'       => true,
                                ),
                                array(
                                        'key'            => '2',
-                                       'label'          => lang('month 2'),
+                                       'label'          => lang('short_month 2 
capitalized'),
                                        'sortable'       => true,
                                ),
                                array(
                                        'key'            => '3',
-                                       'label'          => lang('month 3'),
+                                       'label'          => lang('short_month 3 
capitalized'),
                                        'sortable'       => true,
                                ),
                                array(
                                        'key'            => '4',
-                                       'label'          => lang('month 4'),
+                                       'label'          => lang('short_month 4 
capitalized'),
                                        'sortable'       => true,
                                ),
                                array(
                                        'key'            => '5',
-                                       'label'          => lang('month 5'),
+                                       'label'          => lang('short_month 5 
capitalized'),
                                        'sortable'       => true,
                                ),
                                array(
                                        'key'            => '6',
-                                       'label'          => lang('month 6'),
+                                       'label'          => lang('short_month 6 
capitalized'),
                                        'sortable'       => true,
                                ),
                                array(
                                        'key'            => '7',
-                                       'label'          => lang('month 7'),
+                                       'label'          => lang('short_month 7 
capitalized'),
                                        'sortable'       => true,
                                ),
                                array(
                                        'key'            => '8',
-                                       'label'          => lang('month 8'),
+                                       'label'          => lang('short_month 8 
capitalized'),
                                        'sortable'       => true,
                                ),
                                array(
                                        'key'            => '9',
-                                       'label'          => lang('month 9'),
+                                       'label'          => lang('short_month 9 
capitalized'),
                                        'sortable'       => true,
                                ),
                                array(
                                        'key'            => '10',
-                                       'label'          => lang('month 10'),
+                                       'label'          => lang('short_month 
10 capitalized'),
                                        'sortable'       => true,
                                ),
                                array(
                                        'key'            => '11',
-                                       'label'          => lang('month 11'),
+                                       'label'          => lang('short_month 
11 capitalized'),
                                        'sortable'       => true,
                                ),
                                array(
                                        'key'            => '12',
-                                       'label'          => lang('month 12'),
+                                       'label'          => lang('short_month 
12 capitalized'),
                                        'sortable'       => true,
                                ),
                        );
+
                        return $fields;
                }
 
@@ -354,6 +379,13 @@
                        $query = phpgw::get_var('query', 'string');
                        $year = phpgw::get_var('year', 'int');
                        $all_items = phpgw::get_var('all_items', 'bool');
+                       $filter_status = phpgw::get_var('status', 'string');
+                       if($filter_component_str = 
phpgw::get_var('filter_component', 'string'))
+                       {
+                               $filter_component_arr = explode('_', 
$filter_component_str);
+                               $location_id = $filter_component_arr[0];
+                               $filter_component = $filter_component_arr[1];
+                       }
 
                        $so_control                      = 
CreateObject('controller.socontrol');
                        $this->so                       = 
CreateObject('controller.socheck_list');
@@ -405,12 +437,13 @@
                                        $exclude_locations[] = $_location_id;
 
                                        $_components = 
execMethod('property.soentity.read',array(
-                                               'filter_entity_group' => 
$entity_group_id,
-                                               'location_id' => $_location_id,
-                                               'district_id' => $district_id,
-                                               'allrows' => true,
-                                               'control_registered' => 
!$all_items,
-                                               'check_for_control' => true
+                                               'filter_entity_group'           
=> $entity_group_id,
+                                               'location_id'                   
        => $_location_id,
+                                               'district_id'                   
        => $district_id,
+                                               'allrows'                       
                => true,
+                                               'control_registered'            
=> !$all_items,
+                                               'check_for_control'             
        => true,
+                                               'filter_item'                   
        => $filter_component
                                                )
                                        );
                                        $components = array_merge($components, 
$_components);
@@ -461,9 +494,10 @@
                                        $control                                
                = $so_control->get_single($_control['control_id']);
                                        // one for each serie
                                        $components_for_control_array   = 
$so_control->get_components_for_control($control_id, $location_id, 
$component_id,0);//,$user_id);
+                                       $repeat_type                            
 = $control->get_repeat_type();
 
                                        // LOCATIONS: Process aggregated values 
for controls with repeat type day or week
-                                       if($control->get_repeat_type() <= 
controller_control::REPEAT_TYPE_WEEK)
+                                       if($repeat_type <= 
controller_control::REPEAT_TYPE_WEEK)
                                        {
 
                                                // COMPONENTS: Process 
aggregated values for controls with repeat type day or week
@@ -471,7 +505,6 @@
                                                {
                                                        
$component->set_xml_short_desc(" 
{$location_type_name[$location_id]}</br>{$short_description}");
 
-                                                       $repeat_type            
                 = $control->get_repeat_type();
                                                        
$component_with_check_lists      = 
$this->so->get_check_lists_for_control_and_component($control_id, 
$component->get_location_id(), $component->get_id(), $from_date_ts, 
$to_date_ts, $repeat_type);
 
                                                        $cl_criteria = new 
controller_check_list();
@@ -492,13 +525,13 @@
                                                }
                                        }
                                        // Process values for controls with 
repeat type month or year
-                                       else if($control->get_repeat_type() > 
controller_control::REPEAT_TYPE_WEEK)
+                                       else if($repeat_type > 
controller_control::REPEAT_TYPE_WEEK)
                                        {
                                                
foreach($components_for_control_array as $component)
                                                {
+
                                                        
$component->set_xml_short_desc(" 
{$location_type_name[$location_id]}</br>{$short_description}");
 
-                                                       $repeat_type            
                 = $control->get_repeat_type();
                                                        
$component_with_check_lists      = 
$this->so->get_check_lists_for_control_and_component($control_id, 
$component->get_location_id(), $component->get_id(), $from_date_ts, 
$to_date_ts, $repeat_type);// ,$user_id);
 
                                                        $check_lists_array = 
$component_with_check_lists["check_lists_array"];
@@ -591,6 +624,7 @@
                                        {
                                                if($calendar)
                                                {
+                                                       $repeat_type = 
$calendar['info']['repeat_type'] ? (int)$calendar['info']['repeat_type'] : 
$repeat_type;
                                                        
$calendar['info']['service_time'] = $calendar['info']['service_time'] ? 
$calendar['info']['service_time'] : $service_time;
                                                        
$calendar['info']['controle_time'] = $calendar['info']['controle_time'] ? 
$calendar['info']['controle_time'] : $controle_time;
                                                        
$_data[$month][$repeat_type] = $calendar;
@@ -658,13 +692,22 @@
 
                                if(!isset($entry['missing_control']))
                                {
+                                       if($filter_component_str)
+                                       {
+                                               $row['selected'] = '<input 
id="selected_component" type="checkbox" name="selected_component" checked = 
"checked" onclick="deselect_component();">';
+                                       }
+                                       else
+                                       {
+                                               $row['selected'] = '';
+                                       }
                                        $row['year'] = $year;
                                        $row['descr'] = 
"Frekvens<br/>Status<br/>Utførende<br/>Tidsbruk";
                                }
 
+                               $found_at_least_one = false;
                                for ( $_month=1; $_month < 13; $_month++ )
                                {
-                                       $row[$_month] = 
$this->translate_calendar_info($entry[$_month],$year, $_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_sum[$_month] = 
$entry[$_month]['info']['service_time'] + 
$entry[$_month]['info']['controle_time'];
@@ -674,10 +717,13 @@
                                                $row_sum[$_month] = 0;
                                        }
                                }
-                               $total_time[] = $row_sum;
-                               $data_set[] = $row;
+                               if(!$filter_status || $found_at_least_one)
+                               {
+                                       $total_time[] = $row_sum;
+                                       $data_set[] = $row;
+                               }
                        }
-                       $fields = $this->get_fields();
+                       $fields = $this->get_fields($filter_component_str);
                        $class = '';
                        $tbody = '';
                        foreach($data_set as $row_data )
@@ -729,12 +775,45 @@
                        return $result;
                }
 
-               private function translate_calendar_info($param = array(), 
$year, $month)
+               private function translate_calendar_info($param = array(), 
$year, $month, $filter_status = '', &$found_at_least_one = false)
                {
                        if(!isset($param['repeat_type']))
                        {
                                return '';
                        }
+
+                       if($filter_status)
+                       {
+                               if($filter_status == 'not_performed')
+                               {
+                                       switch($param['status'])
+                                       {
+                                               case "CONTROL_NOT_DONE":
+                                               case "CONTROL_REGISTERED":
+                                               case "CONTROL_PLANNED":
+                                               case 
"CONTROL_NOT_DONE_WITH_PLANNED_DATE":
+                                                       break;//continues
+                                               default:
+                                                       return;
+                                       }
+                               }
+                               else if($filter_status == 
'done_with_open_deviation')
+                               {
+                                       switch($param['status'])
+                                       {
+                                       //      case 
"CONTROL_DONE_OVER_TIME_WITHOUT_ERRORS":
+                                       //      case 
"CONTROL_DONE_IN_TIME_WITHOUT_ERRORS":
+                                               case "CONTROL_DONE_WITH_ERRORS":
+                                       //      case "CONTROL_CANCELED":
+                                                       break;//continues
+                                               default:
+                                                       return;
+                                       }
+                               }
+                       }
+
+                       $found_at_least_one = true;
+
                        switch($param['status'])
                        {
                                case "CONTROL_NOT_DONE":
@@ -763,7 +842,7 @@
                                        break;
                                case "CONTROL_DONE_WITH_ERRORS":
                                        $status = "Utført med 
{$param['info']['num_open_cases']} åpne avvik";
-                                       $img = "<img height=\"15\" 
src=\"controller/images/status_icon_yellow_ring.png\" title=\"{$status}\"/> 
({$param['info']['num_open_cases']})";
+                                       $img = "<img height=\"15\" 
src=\"controller/images/status_icon_red_empty.png\" title=\"{$status}\"/> 
({$param['info']['num_open_cases']})";
                                        break;
                                case "CONTROL_CANCELED":
                                        $status = 'Kansellert';
@@ -784,6 +863,7 @@
                        else
                        {
                                $menuaction     = 
'controller.uicheck_list.add_check_list';
+                               $a_date = "{$year}-{$month}-23";
                                $control_link_data = array
                                (
                                        'menuaction'    => $menuaction,
@@ -791,8 +871,9 @@
                                        'location_id'   => 
$param['info']['location_id'],
                                        'component_id'  => 
$param['info']['component_id'],
                                        'serie_id'              => 
$param['info']['serie_id'],
-                                       'deadline_ts'   => mktime(23, 59, 00, 
$month, date('t', $month), $year),
-                                       'type'                  => 
$param['info']['component_id'] ? 'component' : ''
+                                       'deadline_ts'   => mktime(23, 59, 00, 
$month, date('t', strtotime($a_date)), $year),
+                                       'type'                  => 
$param['info']['component_id'] ? 'component' : '',
+                                       'assigned_to'   => 
$param['info']['assigned_to']
                                );
                        }
                        $link = "<a 
href=\"".$GLOBALS['phpgw']->link('/index.php',$control_link_data)."\" 
target=\"_blank\">{$img}</a>";

Modified: 
branches/dev-syncromind/controller/inc/component/class.check_list_status_manager.inc.php
===================================================================
--- 
branches/dev-syncromind/controller/inc/component/class.check_list_status_manager.inc.php
    2015-06-15 07:09:00 UTC (rev 13432)
+++ 
branches/dev-syncromind/controller/inc/component/class.check_list_status_manager.inc.php
    2015-06-15 11:30:34 UTC (rev 13433)
@@ -40,7 +40,7 @@
                        $this->check_list        = $check_list;
                        if(!$type)
                        {
-                               $check_list->get_component_id() ? 'component' : 
'';
+                               $type = $check_list->get_component_id() ? 
'component' : '';
                        }
                        $this->type                      = $type;
                }

Modified: 
branches/dev-syncromind/controller/inc/component/class.year_calendar.inc.php
===================================================================
--- 
branches/dev-syncromind/controller/inc/component/class.year_calendar.inc.php    
    2015-06-15 07:09:00 UTC (rev 13432)
+++ 
branches/dev-syncromind/controller/inc/component/class.year_calendar.inc.php    
    2015-06-15 11:30:34 UTC (rev 13433)
@@ -94,6 +94,11 @@
        {
                foreach($check_lists_array as $check_list)
                {
+                       if(isset($this->control_relation['serie_id']) && 
$check_list->get_serie_id() != $this->control_relation['serie_id'])
+                       {
+                               continue;
+                       }
+
                        $check_list_status_manager = new 
check_list_status_manager( $check_list );
                        $check_list_status_info = 
$check_list_status_manager->get_status_for_check_list(); 
 

Modified: 
branches/dev-syncromind/controller/js/controller/check_list_update_status.js
===================================================================
--- 
branches/dev-syncromind/controller/js/controller/check_list_update_status.js    
    2015-06-15 07:09:00 UTC (rev 13432)
+++ 
branches/dev-syncromind/controller/js/controller/check_list_update_status.js    
    2015-06-15 11:30:34 UTC (rev 13433)
@@ -22,6 +22,11 @@
                                        if (jsonObj.status == 'not_saved')
                                        {
                                                $(submitBnt).val("feil ved 
lagring");
+                                               if (jsonObj.message)
+                                               {
+                                                       alert(jsonObj.message);
+                                               }
+
                                        }
                                        else if (jsonObj.status == '1')
                                        {

Modified: branches/dev-syncromind/controller/setup/phpgw_no.lang
===================================================================
--- branches/dev-syncromind/controller/setup/phpgw_no.lang      2015-06-15 
07:09:00 UTC (rev 13432)
+++ branches/dev-syncromind/controller/setup/phpgw_no.lang      2015-06-15 
11:30:34 UTC (rev 13433)
@@ -245,6 +245,7 @@
 status_unknown controller      no      Ukjent status
 status controller      no      Status
 status not done        controller      no      Ikke utført
+done with open deviation       controller      no      Utført med åpne avvik
 Success        controller      no      Suksess
 sum    controller      no      Sum
 System setting for responsibility id for the current user must be 6 
characters.        controller      no      Systeminnstilling for ansvar må være 
seks tegn.

Modified: 
branches/dev-syncromind/controller/templates/base/case/create_case_message.xsl
===================================================================
--- 
branches/dev-syncromind/controller/templates/base/case/create_case_message.xsl  
    2015-06-15 07:09:00 UTC (rev 13432)
+++ 
branches/dev-syncromind/controller/templates/base/case/create_case_message.xsl  
    2015-06-15 11:30:34 UTC (rev 13433)
@@ -23,43 +23,47 @@
                        </xsl:choose>
                </div>
                <div class="box-2 select-box">
-                       <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:choose>
-                                         <xsl:when test="type = 'component'">
-                                                 <xsl:value-of 
select="building_location_code"/>
-                                               </xsl:when>
-                                               <xsl:otherwise>
-                                                 <xsl:value-of 
select="location_array/location_code"/>
-                                               </xsl:otherwise>
-                                       </xsl:choose>
-                               </xsl:attribute>
-                               Kontrollplan for bygg/eiendom (år)
-                       </a>
-                               
-                       <a class="last">
-                               <xsl:attribute name="href">
-                                       <xsl:value-of 
select="php:function('get_phpgw_link', '/index.php', 
'menuaction:controller.uicalendar.view_calendar_for_month' )" />
-                                       <xsl:text>&amp;year=</xsl:text>
-                                       <xsl:value-of select="current_year"/>
-                                       <xsl:text>&amp;month=</xsl:text>
-                                       <xsl:value-of 
select="current_month_nr"/>
-                                       <xsl:text>&amp;location_code=</xsl:text>
-                                       <xsl:choose>
-                                         <xsl:when test="type = 'component'">
-                                                 <xsl:value-of 
select="building_location_code"/>
-                                               </xsl:when>
-                                               <xsl:otherwise>
-                                                 <xsl:value-of 
select="location_array/location_code"/>
-                                               </xsl:otherwise>
-                                       </xsl:choose>
-                               </xsl:attribute>
-                               Kontrolplan for bygg/eiendom (måned)
-                       </a>
+                       <xsl:choose>
+                         <xsl:when test="type = 'component'">
+                               <a>
+                                       <xsl:attribute name="href">
+                                               <xsl:value-of 
select="php:function('get_phpgw_link', '/index.php', 
'menuaction:controller.uicomponent.index' )" />
+                                               <xsl:text>&amp;year=</xsl:text>
+                                               <xsl:value-of 
select="current_year"/>
+                                               
<xsl:text>&amp;location_id=</xsl:text>
+                                               <xsl:value-of 
select="component_array/location_id"/>
+                                               
<xsl:text>&amp;component_id=</xsl:text>
+                                               <xsl:value-of 
select="component_array/id"/>
+                                       </xsl:attribute>
+                                       Kontrollplan for komponent (år)
+                               </a>
+                       </xsl:when>
+                       <xsl:otherwise>
+                               <a>
+                                       <xsl:attribute name="href">
+                                               <xsl:value-of 
select="php:function('get_phpgw_link', '/index.php', 
'menuaction:controller.uicalendar.view_calendar_for_year' )" />
+                                               <xsl:text>&amp;year=</xsl:text>
+                                               <xsl:value-of 
select="current_year"/>
+                                               
<xsl:text>&amp;location_code=</xsl:text>
+                                               <xsl:value-of 
select="location_array/location_code"/>
+                                       </xsl:attribute>
+                                       Kontrollplan for bygg/eiendom (år)
+                               </a>
+
+                               <a class="last">
+                                       <xsl:attribute name="href">
+                                               <xsl:value-of 
select="php:function('get_phpgw_link', '/index.php', 
'menuaction:controller.uicalendar.view_calendar_for_month' )" />
+                                               <xsl:text>&amp;year=</xsl:text>
+                                               <xsl:value-of 
select="current_year"/>
+                                               <xsl:text>&amp;month=</xsl:text>
+                                               <xsl:value-of 
select="current_month_nr"/>
+                                               
<xsl:text>&amp;location_code=</xsl:text>
+                                               <xsl:value-of 
select="location_array/location_code"/>
+                                       </xsl:attribute>
+                                       Kontrolplan for bygg/eiendom (måned)
+                               </a>
+                               </xsl:otherwise>
+                       </xsl:choose>
                </div>
                
                <!-- ==================  CHECKLIST TAB MENU  
===================== -->

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-15 07:09:00 UTC (rev 13432)
+++ 
branches/dev-syncromind/controller/templates/base/case/view_case_message.xsl    
    2015-06-15 11:30:34 UTC (rev 13433)
@@ -24,43 +24,45 @@
                </div>
                
                <div class="box-2 select-box">
-                       <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:choose>
-                                         <xsl:when test="type = 'component'">
-                                                 <xsl:value-of 
select="building_location_code"/>
-                                               </xsl:when>
-                                               <xsl:otherwise>
-                                                 <xsl:value-of 
select="location_array/location_code"/>
-                                               </xsl:otherwise>
-                                       </xsl:choose>
-                               </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:choose>
-                                         <xsl:when test="type = 'component'">
-                                                 <xsl:value-of 
select="building_location_code"/>
-                                               </xsl:when>
-                                               <xsl:otherwise>
-                                                 <xsl:value-of 
select="location_array/location_code"/>
-                                               </xsl:otherwise>
-                                       </xsl:choose>
-                               </xsl:attribute>
-                               Vis kontrollplan (måned)
-                       </a>
+                       <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>
                </div>
                
                <!-- ==================  CHECKLIST TAB MENU  
===================== -->

Modified: 
branches/dev-syncromind/controller/templates/base/check_list/fragments/check_list_top_section.xsl
===================================================================
--- 
branches/dev-syncromind/controller/templates/base/check_list/fragments/check_list_top_section.xsl
   2015-06-15 07:09:00 UTC (rev 13432)
+++ 
branches/dev-syncromind/controller/templates/base/check_list/fragments/check_list_top_section.xsl
   2015-06-15 11:30:34 UTC (rev 13433)
@@ -23,13 +23,13 @@
                        </xsl:choose>
                </div>
                
-               <div class="box-2 select-box">
-            <xsl:call-template name="nav_control_plan" />
-               </div>
                
+               
     <!-- ==================  CHANGE STATUS FOR CHECKLIST  
===================== -->
                <xsl:choose>
                        <xsl:when test="check_list/id != 0">
+               <div class="box-2 select-box">
+            <xsl:call-template name="nav_control_plan" />
                      <xsl:variable name="action_url"><xsl:value-of 
select="php:function('get_phpgw_link', '/index.php', 
'menuaction:controller.uicheck_list.update_status,phpgw_return_as:json')" 
/></xsl:variable>
                              <form id="update-check-list-status" class="done" 
action="{$action_url}" method="post">
                                        <input type="hidden" 
name="check_list_id" value="{check_list/id}" /> 
@@ -64,9 +64,9 @@
                                                </div>
 -->
                              </form>
+                     </div>
                                </xsl:when>
                        </xsl:choose>
-      
                <!-- ==================  CHECKLIST TAB MENU  
===================== -->
         <xsl:choose>
         <xsl:when test="count(check_list_type) = 0 or check_list_type != 
'add_check_list'">

Modified: 
branches/dev-syncromind/controller/templates/base/check_list/fragments/nav_control_plan.xsl
===================================================================
--- 
branches/dev-syncromind/controller/templates/base/check_list/fragments/nav_control_plan.xsl
 2015-06-15 07:09:00 UTC (rev 13432)
+++ 
branches/dev-syncromind/controller/templates/base/check_list/fragments/nav_control_plan.xsl
 2015-06-15 11:30:34 UTC (rev 13433)
@@ -1,42 +1,49 @@
   <xsl:template name="nav_control_plan" xmlns:php="http://php.net/xsl";>
-  <xsl:variable name="session_url">&amp;<xsl:value-of 
select="php:function('get_phpgw_session_url')" /></xsl:variable>
+       <xsl:variable name="session_url">&amp;
+               <xsl:value-of select="php:function('get_phpgw_session_url')" />
+       </xsl:variable>
 
-  <a>
-    <xsl:attribute name="href">
-      
<xsl:text>index.php?menuaction=controller.uicalendar.view_calendar_for_year</xsl:text>
-      <xsl:text>&amp;year=</xsl:text>
-      <xsl:value-of select="current_year"/>
-      <xsl:text>&amp;location_code=</xsl:text>
-      <xsl:choose>
-        <xsl:when test="type = 'component'">
-          <xsl:value-of select="building_location_code"/>
-        </xsl:when>
-        <xsl:otherwise>
-          <xsl:value-of select="location_array/location_code"/>
-        </xsl:otherwise>
-      </xsl:choose>
-      <xsl:value-of select="$session_url"/>
-    </xsl:attribute>
-    Vis kontrolplan for år
-  </a>
-  <a class="last">
-    <xsl:attribute name="href">
-      
<xsl:text>index.php?menuaction=controller.uicalendar.view_calendar_for_month</xsl:text>
-      <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:choose>
-        <xsl:when test="type = 'component'">
-          <xsl:value-of select="building_location_code"/>
-        </xsl:when>
-        <xsl:otherwise>
-          <xsl:value-of select="location_array/location_code"/>
-        </xsl:otherwise>
-      </xsl:choose>
-      <xsl:value-of select="$session_url"/>
-    </xsl:attribute>
-    Vis kontrolplan for måned
-  </a>         
-  </xsl:template>
\ No newline at end of file
+       <xsl:choose>
+               <xsl:when test="type = 'component'">
+                       <a>
+                               <xsl:attribute name="href">
+                                       <xsl:value-of 
select="php:function('get_phpgw_link', '/index.php', 
'menuaction:controller.uicomponent.index' )" />
+                                       <xsl:text>&amp;year=</xsl:text>
+                                       <xsl:value-of select="current_year"/>
+                                       <xsl:text>&amp;location_id=</xsl:text>
+                                       <xsl:value-of 
select="component_array/location_id"/>
+                                       <xsl:text>&amp;component_id=</xsl:text>
+                                       <xsl:value-of 
select="component_array/id"/>
+                               </xsl:attribute>
+                               Kontrollplan for komponent (år)
+                       </a>
+               </xsl:when>
+               <xsl:otherwise>
+                       <a>
+                               <xsl:attribute name="href">
+                                       <xsl:value-of 
select="php:function('get_phpgw_link', '/index.php', 
'menuaction:controller.uicalendar.view_calendar_for_year' )" />
+                                       <xsl:text>&amp;year=</xsl:text>
+                                       <xsl:value-of select="current_year"/>
+                                       <xsl:text>&amp;location_code=</xsl:text>
+                                       <xsl:value-of 
select="location_array/location_code"/>
+                               </xsl:attribute>
+                               Kontrollplan for bygg/eiendom (år)
+                       </a>
+
+                       <a class="last">
+                               <xsl:attribute name="href">
+                                       <xsl:value-of 
select="php:function('get_phpgw_link', '/index.php', 
'menuaction:controller.uicalendar.view_calendar_for_month' )" />
+                                       <xsl:text>&amp;year=</xsl:text>
+                                       <xsl:value-of select="current_year"/>
+                                       <xsl:text>&amp;month=</xsl:text>
+                                       <xsl:value-of 
select="current_month_nr"/>
+                                       <xsl:text>&amp;location_code=</xsl:text>
+                                       <xsl:value-of 
select="location_array/location_code"/>
+                               </xsl:attribute>
+                               Kontrolplan for bygg/eiendom (måned)
+                       </a>
+
+               </xsl:otherwise>
+       </xsl:choose>
+
+</xsl:template>
\ No newline at end of file

Modified: branches/dev-syncromind/controller/templates/base/component.xsl
===================================================================
--- branches/dev-syncromind/controller/templates/base/component.xsl     
2015-06-15 07:09:00 UTC (rev 13432)
+++ branches/dev-syncromind/controller/templates/base/component.xsl     
2015-06-15 11:30:34 UTC (rev 13433)
@@ -180,6 +180,15 @@
 <xsl:template name="datasource-definition">
        <script type="text/javascript">
 <![CDATA[
+               $(document).ready(function(){
+                       update_table();
+               });
+
+               deselect_component = function()
+               {
+                       $("[name='filter_component']").val('');
+                       update_table();
+               };
                update_table = function()
                {
                        var requestUrl = $("#queryForm").attr("action");
@@ -253,6 +262,8 @@
        <table id="components">
                <thead>
                        <tr>
+                               <td id='selected'>
+                               </td>
                                <td id='total_records'>
                                </td>
                                <td id='sum_text'>

Modified: branches/dev-syncromind/phpgwapi/inc/class.cache.inc.php
===================================================================
--- branches/dev-syncromind/phpgwapi/inc/class.cache.inc.php    2015-06-15 
07:09:00 UTC (rev 13432)
+++ branches/dev-syncromind/phpgwapi/inc/class.cache.inc.php    2015-06-15 
11:30:34 UTC (rev 13433)
@@ -596,4 +596,20 @@
 
                        return !!self::session_set('phpgwapi', 
'phpgw_messages', $receipt);
                }
+
+               /**
+                * GET system message from the session cache
+                *
+                * @param bool clear flag
+                * @return array containing messages
+                */
+               public static function message_get($clear = false)
+               {
+                       $messages =  self::session_get('phpgwapi', 
'phpgw_messages');
+                       if($clear)
+                       {
+                               self::session_clear('phpgwapi', 
'phpgw_messages');
+                       }
+                       return $messages;
+               }
        }

Modified: branches/dev-syncromind/property/inc/class.boproject.inc.php
===================================================================
--- branches/dev-syncromind/property/inc/class.boproject.inc.php        
2015-06-15 07:09:00 UTC (rev 13432)
+++ branches/dev-syncromind/property/inc/class.boproject.inc.php        
2015-06-15 11:30:34 UTC (rev 13433)
@@ -44,6 +44,7 @@
                var $cat_id;
                var $allrows;
                var $project_type_id;
+               var $acl_location = '.project';
 
                var $public_functions = array
                        (
@@ -54,11 +55,11 @@
                                'check_perms'           => true
                        );
 
-               function property_boproject($session=false)
+               function __construct($session=false)
                {
                        $this->so                                       = 
CreateObject('property.soproject');
                        $this->bocommon                         = & 
$this->so->bocommon;
-                       $this->cats                                     = 
CreateObject('phpgwapi.categories', -1,  'property', '.project');
+                       $this->cats                                     = 
CreateObject('phpgwapi.categories', -1,  'property', $this->acl_location);
                        $this->cats->supress_info       = true;
                        $this->interlink                        = & 
$this->so->interlink;
                        $this->custom                           = & 
$this->so->custom;
@@ -923,6 +924,34 @@
                                $values_attribute = 
$this->custom->convert_attribute_save($values_attribute);
                        }
 
+                       // Custom rules - pre commit
+                       $criteria = array
+                               (
+                                       'appname'       => 'property',
+                                       'location'      => '.project',
+                                       'allrows'       => true
+                               );
+
+                       $custom_functions = 
$GLOBALS['phpgw']->custom_functions->find($criteria);
+
+                       foreach ( $custom_functions as $entry )
+                       {
+                               // prevent path traversal
+                               if ( preg_match('/\.\./', $entry['file_name']) )
+                               {
+                                       continue;
+                               }
+
+                               $file = PHPGW_SERVER_ROOT . 
"/property/inc/custom/{$GLOBALS['phpgw_info']['user']['domain']}/{$entry['file_name']}";
+
+                               if ( $entry['active'] && is_file($file)  && 
!$entry['client_side'] && $entry['pre_commit'])
+                               {
+                                       require_once $file;
+                               }
+                       }
+                       unset($entry);
+                       reset($custom_functions);
+
                        if ($action=='edit')
                        {
                                try
@@ -961,6 +990,22 @@
                        {
                                $receipt = $this->so->add($project, 
$values_attribute);
                        }
+
+                       foreach ( $custom_functions as $entry )
+                       {
+                               // prevent path traversal
+                               if ( preg_match('/\.\./', $entry['file_name']) )
+                               {
+                                       continue;
+                               }
+
+                               $file = PHPGW_SERVER_ROOT . 
"/property/inc/custom/{$GLOBALS['phpgw_info']['user']['domain']}/{$entry['file_name']}";
+
+                               if ( $entry['active'] && is_file($file)  && 
!$entry['client_side'] && !$entry['pre_commit'])
+                               {
+                                       require_once $file;
+                               }
+                       }
                        return $receipt;
                }
 

Modified: branches/dev-syncromind/property/inc/class.botts.inc.php
===================================================================
--- branches/dev-syncromind/property/inc/class.botts.inc.php    2015-06-15 
07:09:00 UTC (rev 13432)
+++ branches/dev-syncromind/property/inc/class.botts.inc.php    2015-06-15 
11:30:34 UTC (rev 13433)
@@ -1156,10 +1156,6 @@
                        // build subject
                        $subject = '['.lang('Ticket').' #'.$id.'] : ' . 
$location_code .' ' .$this->get_category_name($ticket['cat_id']) . '; ' 
.$ticket['subject'];
 
-                       $prefs_user = 
$this->bocommon->create_preferences('property',$ticket['user_id']);
-
-                       $from_address=$prefs_user['email'];
-
                        //-----------from--------
 
                        $current_prefs_user = 
$this->bocommon->create_preferences('property',$GLOBALS['phpgw_info']['user']['account_id']);

Modified: branches/dev-syncromind/property/inc/class.hook_helper.inc.php
===================================================================
--- branches/dev-syncromind/property/inc/class.hook_helper.inc.php      
2015-06-15 07:09:00 UTC (rev 13432)
+++ branches/dev-syncromind/property/inc/class.hook_helper.inc.php      
2015-06-15 11:30:34 UTC (rev 13433)
@@ -25,6 +25,7 @@
           along with this program.  If not, see <http://www.gnu.org/licenses/>.
         */
 
+       phpgw::import_class('phpgwapi.datetime');
 
        /**
         * Hook helper
@@ -89,6 +90,8 @@
                 */
                public function home_backend()
                {
+                       $this->home_workorder_overdue_tender();
+                       $this->home_workorder_overdue_end_date();
                        $this->home_tenant_claims();
                        $this->home_ticket();
                        $this->home_project();
@@ -118,6 +121,148 @@
                }
 
                /**
+                * Show project that is overdue
+                *
+                * @return void
+                */
+               public function home_workorder_overdue_tender()
+               {
+                       $accound_id = 
$GLOBALS['phpgw_info']['user']['account_id'];
+                       $save_app = 
$GLOBALS['phpgw_info']['flags']['currentapp'];
+                       $GLOBALS['phpgw_info']['flags']['currentapp'] = 
'property';
+                       $maxmatches = 
$GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs'];
+                       
$GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs'] = 5;
+
+                       $prefs = $GLOBALS['phpgw_info']['user']['preferences'];
+
+                       if ( 
isset($prefs['property']['mainscreen_show_project_overdue'])
+                       && 
$prefs['property']['mainscreen_show_project_overdue'] == 'yes')
+                       {
+                               $soworkorder = 
CreateObject('property.soworkorder');
+
+                               $values = $soworkorder->read(array(
+                                       'filter'                        => 
$accound_id,
+                                       'tender_deadline'       => time()
+                               ));
+
+                               $total_records = $soworkorder->total_records;
+                               $portalbox = CreateObject('phpgwapi.listbox', 
array
+                               (
+                                       'title'         => lang('tender delay') 
. " ({$total_records})",
+                                       'primary'       => 
$GLOBALS['phpgw_info']['theme']['navbar_bg'],
+                                       'secondary'     => 
$GLOBALS['phpgw_info']['theme']['navbar_bg'],
+                                       'tertiary'      => 
$GLOBALS['phpgw_info']['theme']['navbar_bg'],
+                                       'width' => '100%',
+                                       'outerborderwidth'      => '0',
+                                       'header_background_image'       => 
$GLOBALS['phpgw']->common->image('phpgwapi','bg_filler', '.png', False)
+                               ));
+
+                               $app_id = 
$GLOBALS['phpgw']->applications->name2id('property');
+                               if( !isset($GLOBALS['portal_order']) 
||!in_array($app_id, $GLOBALS['portal_order']) )
+                               {
+                                       $GLOBALS['portal_order'][] = $app_id;
+                               }
+
+                               $var = $this->get_controls($app_id);
+
+                               foreach ( $var as $key => $value )
+                               {
+       //                              $portalbox->set_controls($key,$value);
+                               }
+                               foreach ($values as $entry)
+                               {
+                                       $entry['tender_delay']  = 
ceil(phpgwapi_datetime::get_working_days($entry['tender_deadline'], time()));
+                                       $portalbox->data[] = array
+                                       (
+                                               'text' => "Forsinkelse: 
{$entry['tender_delay']} dager :: bestilling nr:{$entry['workorder_id']} :: 
{$entry['location_code']} :: {$entry['address']}",
+                                               'link' => 
$GLOBALS['phpgw']->link('/index.php', array('menuaction' => 
'property.uiworkorder.edit', 'id' => $entry['workorder_id'], 'tab' => 'budget'))
+                                       );
+                               }
+                               echo "\n".'<!-- BEGIN ticket info -->'."\n<div 
class='property_tickets' style='padding-left: 
10px;'>".$portalbox->draw()."</div>\n".'<!-- END ticket info -->'."\n";
+
+                               unset($tts);
+                               unset($portalbox);
+                               unset($category_name);
+                               unset($default_status);
+                       }
+
+                       $GLOBALS['phpgw_info']['flags']['currentapp'] = 
$save_app;
+                       
$GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs'] = 
$maxmatches;
+
+               }
+
+               /**
+                * Show project that is overdue
+                *
+                * @return void
+                */
+               public function home_workorder_overdue_end_date()
+               {
+                       $accound_id = 
$GLOBALS['phpgw_info']['user']['account_id'];
+                       $save_app = 
$GLOBALS['phpgw_info']['flags']['currentapp'];
+                       $GLOBALS['phpgw_info']['flags']['currentapp'] = 
'property';
+                       $maxmatches = 
$GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs'];
+                       
$GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs'] = 5;
+
+                       $prefs = $GLOBALS['phpgw_info']['user']['preferences'];
+
+                       if ( 
isset($prefs['property']['mainscreen_show_project_overdue'])
+                       && 
$prefs['property']['mainscreen_show_project_overdue'] == 'yes')
+                       {
+                               $soworkorder = 
CreateObject('property.soworkorder');
+
+                               $values = $soworkorder->read(array(
+                                       'filter'                        => 
$accound_id,
+                                       'inspection_on_completion'      => 
time(),
+                               ));
+
+                               $total_records = $soworkorder->total_records;
+                               $portalbox = CreateObject('phpgwapi.listbox', 
array
+                               (
+                                       'title'         => lang('end date 
delay') . " ({$total_records})",
+                                       'primary'       => 
$GLOBALS['phpgw_info']['theme']['navbar_bg'],
+                                       'secondary'     => 
$GLOBALS['phpgw_info']['theme']['navbar_bg'],
+                                       'tertiary'      => 
$GLOBALS['phpgw_info']['theme']['navbar_bg'],
+                                       'width' => '100%',
+                                       'outerborderwidth'      => '0',
+                                       'header_background_image'       => 
$GLOBALS['phpgw']->common->image('phpgwapi','bg_filler', '.png', False)
+                               ));
+
+                               $app_id = 
$GLOBALS['phpgw']->applications->name2id('property');
+                               if( !isset($GLOBALS['portal_order']) 
||!in_array($app_id, $GLOBALS['portal_order']) )
+                               {
+                                       $GLOBALS['portal_order'][] = $app_id;
+                               }
+
+                               $var = $this->get_controls($app_id);
+
+                               foreach ( $var as $key => $value )
+                               {
+       //                              $portalbox->set_controls($key,$value);
+                               }
+                               foreach ($values as $entry)
+                               {
+                                       $entry['tender_delay']  = 
ceil(phpgwapi_datetime::get_working_days($entry['tender_deadline'], time()));
+                                       $portalbox->data[] = array
+                                       (
+                                               'text' => "Forsinkelse: 
{$entry['tender_delay']} dager :: bestilling nr:{$entry['workorder_id']} :: 
{$entry['location_code']} :: {$entry['address']}",
+                                               'link' => 
$GLOBALS['phpgw']->link('/index.php', array('menuaction' => 
'property.uiworkorder.edit', 'id' => $entry['workorder_id'], 'tab' => 'budget'))
+                                       );
+                               }
+                               echo "\n".'<!-- BEGIN ticket info -->'."\n<div 
class='property_tickets' style='padding-left: 
10px;'>".$portalbox->draw()."</div>\n".'<!-- END ticket info -->'."\n";
+
+                               unset($tts);
+                               unset($portalbox);
+                               unset($category_name);
+                               unset($default_status);
+                       }
+
+                       $GLOBALS['phpgw_info']['flags']['currentapp'] = 
$save_app;
+                       
$GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs'] = 
$maxmatches;
+
+               }
+
+               /**
                 * Show tenant claims on homepage
                 *
                 * @return void
@@ -188,7 +333,8 @@
                                unset($default_status);
 
                        }
-
+                       $GLOBALS['phpgw_info']['flags']['currentapp'] = 
$save_app;
+                       
$GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs'] = 
$maxmatches;
                }
                /**
                 * Show ticket info for homepage

Modified: branches/dev-syncromind/property/inc/class.menu.inc.php
===================================================================
--- branches/dev-syncromind/property/inc/class.menu.inc.php     2015-06-15 
07:09:00 UTC (rev 13432)
+++ branches/dev-syncromind/property/inc/class.menu.inc.php     2015-06-15 
11:30:34 UTC (rev 13433)
@@ -156,6 +156,55 @@
                                                )
                                        );
 
+                               $admin_children_project = array
+                                       (
+                                               'project_cats'  => array
+                                               (
+                                                       'text'  => 
lang('project categories'),
+                                                       'url'   => 
$GLOBALS['phpgw']->link('/index.php', array('menuaction' => 
'admin.uicategories.index', 'appname' => 'property', 'location' => '.project', 
'global_cats' => 'true', 'menu_selection' => 
'admin::property::project::project_cats') )
+                                               ),
+                                               'project_attribs'       => array
+                                               (
+                                                       'text'  => 
lang('project attributes'),
+                                                       'url'   => 
$GLOBALS['phpgw']->link('/index.php', array('menuaction' => 
'admin.ui_custom.list_attribute', 'appname' => 'property', 'location' 
=>'.project', 'menu_selection' => 'admin::property::project::project_attribs') )
+                                               ),
+                                               'workorder_status'      => array
+                                               (
+                                                       'text'  => 
lang('Workorders status'),
+                                                       'url'   => 
$GLOBALS['phpgw']->link('/index.php', array('menuaction' => 
'property.uigeneric.index', 'type' => 'workorder_status') )
+                                               ),
+                                               'project_status'        => array
+                                               (
+                                                       'text'  => 
lang('project status'),
+                                                       'url'   => 
$GLOBALS['phpgw']->link('/index.php', array('menuaction' => 
'property.uigeneric.index', 'type' => 'project_status') )
+                                               ),
+                                               'project_group' => array
+                                               (
+                                                       'text'  => 
lang('project group'),
+                                                       'url'   => 
$GLOBALS['phpgw']->link('/index.php', array('menuaction' => 
'property.uigeneric.index', 'type' => 'project_group') )
+                                               ),
+                                               'workorder_detail'      => array
+                                               (
+                                                       'text'  => 
lang('Workorder Detail Categories'),
+                                                       'url'   => 
$GLOBALS['phpgw']->link('/index.php', array('menuaction' => 
'property.uigeneric.index', 'type' => 'wo_hours') )
+                                               ),
+                                               'workorder_recalculate' => array
+                                               (
+                                                       'text'  => 
lang('Workorder recalculate actual cost'),
+                                                       'url'   => 
$GLOBALS['phpgw']->link('/index.php', array('menuaction' => 
'property.uiworkorder.recalculate') )
+                                               ),
+                                               'project_functions'     => array
+                                               (
+                                                       'text'  => lang('custom 
functions'),
+                                                       'url'   => 
$GLOBALS['phpgw']->link('/index.php', array('menuaction' => 
'admin.ui_custom.list_custom_function','appname' => 'property', 'location' => 
'.project', 'menu_selection' => 'admin::property::project::project_functions') )
+                                               ),
+                                               'check_missing_project_budget'  
=> array
+                                               (
+                                                       'text'  => lang('check 
missing project budget'),
+                                                       'url'   => 
$GLOBALS['phpgw']->link('/index.php', array('menuaction' => 
'property.uiproject.check_missing_project_budget') )
+                                               )
+                               );
+
                                $admin_children_ticket = array
                                        (
                                                'ticket_cats'   => array
@@ -296,16 +345,7 @@
                                                (
                                                        'text'  => 
lang('Accounting voucher type'),
                                                        'url'   => 
$GLOBALS['phpgw']->link('/index.php', array('menuaction' => 
'property.uigeneric.index', 'type' => 'voucher_type') )
-                                               ),
-                                               'check_missing_project_budget'  
=> array
-                                               (
-                                                       'text'  => lang('check 
missing project budget'),
-                                                       'url'   => 
$GLOBALS['phpgw']->link('/index.php', array('menuaction' => 
'property.uiproject.check_missing_project_budget') )
                                                )
-
-
-
-
                                        );
 
                                $admin_children_agreement = array
@@ -435,26 +475,12 @@
                                                        'text'  => lang('Update 
the not active category for locations'),
                                                        'url'   => 
$GLOBALS['phpgw']->link('/index.php', array('menuaction' => 
'property.uilocation.update_cat') )
                                                ),
-                                               'project_cats'  => array
+                                               'project'       => array
                                                (
-                                                       'text'  => 
lang('project categories'),
-                                                       'url'   => 
$GLOBALS['phpgw']->link('/index.php', array('menuaction' => 
'admin.uicategories.index', 'appname' => 'property', 'location' => '.project', 
'global_cats' => 'true', 'menu_selection' => 'admin::property::project_cats') )
+                                                       'text'  => 
lang('project'),
+                                                       'url'   => 
$GLOBALS['phpgw']->link('/index.php', array('menuaction' => 
'admin.uicategories.index', 'appname' => 'property', 'location' => '.project', 
'global_cats' => 'true', 'menu_selection' => 
'admin::property::project::project_cats') ),
+                                                       'children' => 
$admin_children_project
                                                ),
-                                               'project_attribs'       => array
-                                               (
-                                                       'text'  => 
lang('project attributes'),
-                                                       'url'   => 
$GLOBALS['phpgw']->link('/index.php', array('menuaction' => 
'admin.ui_custom.list_attribute', 'appname' => 'property', 'location' 
=>'.project', 'menu_selection' => 'admin::property::project_attribs') )
-                                               ),
-                                               'workorder_detail'      => array
-                                               (
-                                                       'text'  => 
lang('Workorder Detail Categories'),
-                                                       'url'   => 
$GLOBALS['phpgw']->link('/index.php', array('menuaction' => 
'property.uigeneric.index', 'type' => 'wo_hours') )
-                                               ),
-                                               'workorder_recalculate' => array
-                                               (
-                                                       'text'  => 
lang('Workorder recalculate actual cost'),
-                                                       'url'   => 
$GLOBALS['phpgw']->link('/index.php', array('menuaction' => 
'property.uiworkorder.recalculate') )
-                                               ),
                                                'ticket'        => array
                                                (
                                                        'text'  => 
lang('helpdesk'),
@@ -560,21 +586,6 @@
                                                        'text'  => 
lang('order_dim1'),//translation have to refeflect the (local) meaning
                                                        'url'   => 
$GLOBALS['phpgw']->link('/index.php', array('menuaction' => 
'property.uigeneric.index', 'type' => 'order_dim1') )
                                                ),
-                                               'workorder_status'      => array
-                                               (
-                                                       'text'  => 
lang('Workorders status'),
-                                                       'url'   => 
$GLOBALS['phpgw']->link('/index.php', array('menuaction' => 
'property.uigeneric.index', 'type' => 'workorder_status') )
-                                               ),
-                                               'project_status'        => array
-                                               (
-                                                       'text'  => 
lang('project status'),
-                                                       'url'   => 
$GLOBALS['phpgw']->link('/index.php', array('menuaction' => 
'property.uigeneric.index', 'type' => 'project_status') )
-                                               ),
-                                               'project_group' => array
-                                               (
-                                                       'text'  => 
lang('project group'),
-                                                       'url'   => 
$GLOBALS['phpgw']->link('/index.php', array('menuaction' => 
'property.uigeneric.index', 'type' => 'project_group') )
-                                               ),
                                                'agreement'     => array
                                                (
                                                        'text'  => 
lang('Agreement'),

Modified: branches/dev-syncromind/property/inc/class.soentity.inc.php
===================================================================
--- branches/dev-syncromind/property/inc/class.soentity.inc.php 2015-06-15 
07:09:00 UTC (rev 13432)
+++ branches/dev-syncromind/property/inc/class.soentity.inc.php 2015-06-15 
11:30:34 UTC (rev 13433)
@@ -447,6 +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;
 
 
                        if($location_id)
@@ -614,6 +615,12 @@
                                $where= 'AND';
                        }
 
+                       if ($filter_item)
+                       {
+                               $filtermethod .= " {$where} {$entity_table}.id 
= {$filter_item}";
+                               $where= 'AND';
+                       }
+
                        $_querymethod = array();
                        $__querymethod = array();
                        $_joinmethod_datatype = array();
@@ -1381,6 +1388,7 @@
                        $org_units              = isset($data['org_units']) && 
is_array($data['org_units']) ? $data['org_units'] : array();
                        $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;
 
 
                        if($location_id)
@@ -1567,6 +1575,17 @@
                                $where= 'AND';
                        }
 
+                       if ($entity_group_id)
+                       {
+                               $filtermethod .= " {$where} 
{$entity_table}.entity_group_id = {$entity_group_id}";
+                               $where= 'AND';
+                       }
+                       if ($filter_entity_group)
+                       {
+                               $filtermethod .= " {$where} 
{$entity_table}.entity_group_id IS NULL";
+                               $where= 'AND';
+                       }
+
                        $_querymethod = array();
                        $__querymethod = array();
                        $_joinmethod_datatype = array();

Modified: branches/dev-syncromind/property/inc/class.soinvoice.inc.php
===================================================================
--- branches/dev-syncromind/property/inc/class.soinvoice.inc.php        
2015-06-15 07:09:00 UTC (rev 13432)
+++ branches/dev-syncromind/property/inc/class.soinvoice.inc.php        
2015-06-15 11:30:34 UTC (rev 13433)
@@ -2316,7 +2316,18 @@
                        unset($value_set);
 
                        $value_set_line = array();
-
+                       $process_log = '';
+                       if(isset($data['process_log']) && $data['process_log'])
+                       {
+                               if(stripos($data['process_log'], '::'))
+                               {
+                                       $process_log = 
$this->db->db_addslashes($data['process_log']);
+                               }
+                               else
+                               {
+                                       $process_log = 
$this->db->db_addslashes("{$GLOBALS['phpgw_info']['user']['account_lid']}::{$data['process_log']}");
+                               }
+                       }
                        $value_set_line['pmwrkord_code'] = $data['order_id'];
                        $value_set_line['dimb']                  = 
$data['dim_b'];
                        $value_set_line['dima']                  = 
$data['dim_a'];
@@ -2325,7 +2336,7 @@
                        $value_set_line['project_id']    = 
$data['project_group'];
                        $value_set_line['spbudact_code'] = 
$data['b_account_id'];
                        $value_set_line['line_text']     = 
$this->db->db_addslashes($data['line_text']);
-                       $value_set_line['process_log']   = 
$this->db->db_addslashes($data['process_log']);
+                       $value_set_line['process_log']   = $process_log;
                        $value_set_line['process_code']  = 
$data['process_code'];
 
                        $value_set_line = 
$this->db->validate_update($value_set_line);

Modified: branches/dev-syncromind/property/inc/class.sotts.inc.php
===================================================================
--- branches/dev-syncromind/property/inc/class.sotts.inc.php    2015-06-15 
07:09:00 UTC (rev 13432)
+++ branches/dev-syncromind/property/inc/class.sotts.inc.php    2015-06-15 
11:30:34 UTC (rev 13433)
@@ -400,7 +400,7 @@
                                $order_edit = 
$GLOBALS['phpgw']->acl->check('.ticket.order', PHPGW_ACL_EDIT, 'property');
                                $_end_date      = $end_date + 3600 * 16 + 
phpgwapi_datetime::user_timezone();
                                $_start_date    = $start_date - 3600 * 8 + 
phpgwapi_datetime::user_timezone();
-                               $filtermethod .= " $where 
(fm_tts_tickets.entry_date >= $_start_date AND fm_tts_tickets.entry_date <= 
$_end_date ";
+                               $filtermethod .= " $where 
(fm_tts_tickets.modified_date >= $_start_date AND fm_tts_tickets.modified_date 
<= $_end_date ";
 
                                if($order_add || $order_edit)
                                {

Modified: branches/dev-syncromind/property/inc/class.soworkorder.inc.php
===================================================================
--- branches/dev-syncromind/property/inc/class.soworkorder.inc.php      
2015-06-15 07:09:00 UTC (rev 13432)
+++ branches/dev-syncromind/property/inc/class.soworkorder.inc.php      
2015-06-15 11:30:34 UTC (rev 13433)
@@ -167,6 +167,8 @@
                        $dry_run                 = isset($data['dry_run']) ? 
$data['dry_run'] : '';
                        $criteria                = isset($data['criteria']) && 
$data['criteria'] ? $data['criteria'] : array();
                        $filter_year     = isset($data['filter_year']) ? 
$data['filter_year'] : '';
+                       $tender_deadline = isset($data['tender_deadline']) && 
$data['tender_deadline'] ? (int) $data['tender_deadline'] : 0;
+                       $inspection_on_completion                = 
isset($data['inspection_on_completion']) && $data['inspection_on_completion'] ? 
(int) $data['inspection_on_completion'] : 0;
 
                        $GLOBALS['phpgw']->config->read();
                        $sql = $this->bocommon->fm_cache('sql_workorder' . 
!!$search_vendor . '_' . !!$wo_hour_cat_id . '_' . !!$b_group);
@@ -664,6 +666,24 @@
                                $where = 'AND';
                        }
 
+                       if($tender_deadline)
+                       {
+                               $tender_deadline = $tender_deadline - 3600 * 8 
+ phpgwapi_datetime::user_timezone();
+                               $filtermethod .= " $where 
(fm_workorder.tender_deadline IS NOT NULL AND fm_workorder.tender_deadline > 0"
+                               . " AND fm_workorder.tender_deadline <= 
{$tender_deadline} AND"
+                               . " (fm_workorder.tender_received  = 0 OR 
fm_workorder.tender_received  IS NULL))";
+                               $where = 'AND';
+                       }
+                       if($inspection_on_completion)
+                       {
+                               $inspection_on_completion = 
$inspection_on_completion - 3600 * 8 + phpgwapi_datetime::user_timezone();
+                               $filtermethod .= " $where 
(fm_workorder.tender_deadline IS NOT NULL  AND fm_workorder.tender_deadline > 0"
+                               . " AND fm_workorder.end_date IS NOT NULL AND 
fm_workorder.end_date > 0"
+                               . " AND fm_workorder.end_date <= 
{$inspection_on_completion} AND"
+                               . " (fm_workorder.inspection_on_completion  = 0 
OR fm_workorder.inspection_on_completion  IS NULL))";
+                               $where = 'AND';
+                       }
+
                        if($filter_year && $filter_year != 'all')
                        {
                                $filter_year = (int) $filter_year;

Modified: branches/dev-syncromind/property/inc/class.uientity.inc.php
===================================================================
--- branches/dev-syncromind/property/inc/class.uientity.inc.php 2015-06-15 
07:09:00 UTC (rev 13432)
+++ branches/dev-syncromind/property/inc/class.uientity.inc.php 2015-06-15 
11:30:34 UTC (rev 13433)
@@ -3163,6 +3163,7 @@
                        $controls = 
execMethod('controller.socontrol.get_controls_at_component', 
array('location_id' => $location_id, 'component_id' => $id));
                        foreach($controls as &$entry)
                        {
+/*
                                $menuaction     = 
'controller.uicalendar.view_calendar_year_for_locations';
                                if($entry['repeat_type'] < 2)
                                {
@@ -3177,6 +3178,17 @@
                                        'component_id'  => $id,
                                        'serie_id'              => 
$entry['serie_id']
                                );
+*/
+
+                               $menuaction     = 
'controller.uicomponent.index';
+
+                               $control_link_data = array
+                               (
+                                       'menuaction'    => $menuaction,
+                                       'location_id'   => $location_id,
+                                       'component_id'  => $id,
+                               );
+
                                $entry['title'] = '<a 
href="'.$GLOBALS['phpgw']->link('/index.php',$control_link_data).'" 
target="_blank">'.$entry['title'].'</a>';
 
                                $entry['start_date'] =  
$GLOBALS['phpgw']->common->show_date($entry['start_date'],$GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat']);

Copied: 
branches/dev-syncromind/property/inc/custom/default/EBF_update_ticket_on_project_change.php
 (from rev 13432, 
trunk/property/inc/custom/default/EBF_update_ticket_on_project_change.php)
===================================================================
--- 
branches/dev-syncromind/property/inc/custom/default/EBF_update_ticket_on_project_change.php
                         (rev 0)
+++ 
branches/dev-syncromind/property/inc/custom/default/EBF_update_ticket_on_project_change.php
 2015-06-15 11:30:34 UTC (rev 13433)
@@ -0,0 +1,88 @@
+<?php
+
+       /*
+       * This class will update finnish date in ticket where tickets are 
linked to project.
+       */
+
+       class update_ticket_on_project_change extends property_boproject
+       {
+
+               function __construct()
+               {
+                       parent::__construct();
+                       if($this->acl_location != '.project')
+                       {
+                               throw new 
Exception("'update_ticket_on_project_change' is intended for location = 
'.project'");
+                       }
+                       $this->historylog       = 
CreateObject('property.historylog','tts');
+                       $this->botts            = 
CreateObject('property.botts');
+                       $this->db                       = & 
$GLOBALS['phpgw']->db;
+                       $this->like             = & $this->db->like;
+                       $this->join             = & $this->db->join;
+                       $this->left_join        = & $this->db->left_join;
+
+               }
+
+               public function check_values($project, $values_attribute)
+               {
+                       $origin = $this->interlink->get_relation('property', 
'.project', $project['id'], 'origin');
+                       $ids = array();
+                       foreach($origin as $_origin)
+                       {
+                               if($_origin['location'] == '.ticket')
+                               {
+                                       foreach($_origin['data'] as $data)
+                                       {
+                                               $ids[]=$data['id'];
+                                       }
+                               }
+                       }
+
+                       foreach($ids as $id)
+                       {
+                               $this->update_ticket($id, $project, 
$values_attribute);
+                       }
+               }
+
+               private function update_ticket($id, $project, $values_attribute)
+               {
+                       $finnish_date   = (int)$project['end_date'];
+                       if(!$finnish_date)
+                       {
+                               return;
+                       }
+
+                       $this->db->query("SELECT finnish_date, finnish_date2 
FROM fm_tts_tickets WHERE id='$id'",__LINE__,__FILE__);
+                       $this->db->next_record();
+
+                       $oldfinnish_date = (int)$this->db->f('finnish_date');
+                       $oldfinnish_date2 = (int)$this->db->f('finnish_date2');
+
+                       $update = false;
+
+                       if ($oldfinnish_date && $finnish_date && 
$oldfinnish_date2 != $finnish_date)
+                       {
+                               $this->db->query("UPDATE fm_tts_tickets SET 
finnish_date2='{$finnish_date}' WHERE id='{$id}'",__LINE__,__FILE__);
+                               $old_value = $oldfinnish_date2;
+                               $update = true;
+                       }
+                       else if(!$oldfinnish_date && $finnish_date && 
$oldfinnish_date != $finnish_date)
+                       {
+                               $this->db->query("UPDATE fm_tts_tickets SET 
finnish_date='{$finnish_date}' , finnish_date2='{$finnish_date}' WHERE 
id='{$id}'",__LINE__,__FILE__);
+                               $old_value = $oldfinnish_date;
+                               $update = true;
+                       }
+
+                       if($update)
+                       {
+                               $fields_updated = array('finnish_date');
+                               
$this->historylog->add('F',$id,$finnish_date,$old_value);
+                               $this->botts->mail_ticket($id, $fields_updated, 
$receipt=array(),$project['location_code'], false, true);
+                               phpgwapi_cache::message_set(lang('finnish date 
changed'), 'message');
+                       }
+               }
+       }
+
+       $trigger = new update_ticket_on_project_change();
+       $trigger->check_values($project, $values_attribute);
+

Deleted: branches/dev-syncromind/property/inc/hook_home.inc.php
===================================================================
--- branches/dev-syncromind/property/inc/hook_home.inc.php      2015-06-15 
07:09:00 UTC (rev 13432)
+++ branches/dev-syncromind/property/inc/hook_home.inc.php      2015-06-15 
11:30:34 UTC (rev 13433)
@@ -1,872 +0,0 @@
-<?php
-       /**
-       * phpGroupWare - property: a Facilities Management System.
-       *
-       * @author Sigurd Nes <address@hidden>
-       * @copyright Copyright (C) 2003-2009 Free Software Foundation, Inc. 
http://www.fsf.org/
-       * This file is part of phpGroupWare.
-       *
-       * phpGroupWare is free software; you can redistribute it and/or modify
-       * it under the terms of the GNU General Public License as published by
-       * the Free Software Foundation; either version 2 of the License, or
-       * (at your option) any later version.
-       *
-       * phpGroupWare is distributed in the hope that it will be useful,
-       * but WITHOUT ANY WARRANTY; without even the implied warranty of
-       * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-       * GNU General Public License for more details.
-       *
-       * You should have received a copy of the GNU General Public License
-       * along with phpGroupWare; if not, write to the Free Software
-       * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301 
 USA
-       *
-       * @license http://www.gnu.org/licenses/gpl.html GNU General Public 
License
-       * @internal Development of this application was funded by 
http://www.bergen.kommune.no/bbb_/ekstern/
-       * @package property
-       * @subpackage core
-       * @version $Id$
-       */
-
-
-       $accound_id = $GLOBALS['phpgw_info']['user']['account_id'];
-       $save_app = $GLOBALS['phpgw_info']['flags']['currentapp'];
-       $GLOBALS['phpgw_info']['flags']['currentapp'] = 'property';
-       $maxmatches = 
$GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs'];
-       $GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs'] = 
5;
-
-       $prefs = $GLOBALS['phpgw_info']['user']['preferences'];
-
-
-       if ( isset($prefs['property']['mainscreen_show_new_updated_tts'])
-       && $prefs['property']['mainscreen_show_new_updated_tts'] == 'yes')
-       {
-
-               $default_status         = 
isset($prefs['property']['tts_status']) ? $prefs['property']['tts_status'] : '';
-               $tts = CreateObject('property.sotts');
-               $tickets = $tts->read(array('user_id' => $accound_id, 
'status_id' => array($default_status, 'O'), 'new' => true));
-               $total_records = $tts->total_records;
-
-               $portalbox = CreateObject('phpgwapi.listbox', array
-               (
-                       'title'         => 
isset($prefs['property']['mainscreen_tts_title']) && 
$prefs['property']['mainscreen_tts_title']? 
"{$prefs['property']['mainscreen_tts_title']} ({$total_records})" : 
lang('Helpdesk') . " ({$total_records})",
-                       'primary'       => 
$GLOBALS['phpgw_info']['theme']['navbar_bg'],
-                       'secondary'     => 
$GLOBALS['phpgw_info']['theme']['navbar_bg'],
-                       'tertiary'      => 
$GLOBALS['phpgw_info']['theme']['navbar_bg'],
-                       'width' => '100%',
-                       'outerborderwidth'      => '0',
-                       'header_background_image'       => 
$GLOBALS['phpgw']->common->image('phpgwapi','bg_filler', '.png', False)
-               ));
-
-               $app_id = $GLOBALS['phpgw']->applications->name2id('property');
-               if( !isset($GLOBALS['portal_order']) ||!in_array($app_id, 
$GLOBALS['portal_order']) )
-               {
-                       $GLOBALS['portal_order'][] = $app_id;
-               }
-               $var = array
-               (
-                       'up'    => array('url'  => '/set_box.php', 'app'        
=> $app_id),
-                       'down'  => array('url'  => '/set_box.php', 'app'        
=> $app_id),
-                       'close' => array('url'  => '/set_box.php', 'app'        
=> $app_id),
-                       'question'      => array('url'  => '/set_box.php', 
'app'        => $app_id),
-                       'edit'  => array('url'  => '/set_box.php', 'app'        
=> $app_id)
-               );
-
-               foreach ( $var as $key => $value )
-               {
-                       //                      
$portalbox->set_controls($key,$value);
-               }
-
-               $category_name = array(); // caching
-
-               $portalbox->data = array();
-               foreach ($tickets as $ticket)
-               {
-                       if(!$ticket['subject'])
-                       {
-                               if(!isset($category_name[$ticket['cat_id']]))
-                               {
-                                       $ticket['subject']= 
execMethod('property.botts.get_category_name', $ticket['cat_id']);
-                                       $category_name[$ticket['cat_id']] = 
$ticket['subject'];
-                               }
-                               else
-                               {
-                                       $ticket['subject'] = 
$category_name[$ticket['cat_id']];
-                               }
-                       }
-
-                       $location = 
execMethod('property.bolocation.read_single', array('location_code' => 
$ticket['location_code'], 'extra' => array('view' => true))); 
-
-                       $group = '';
-                       if($ticket['group_id'])
-                       {
-                               $group = '[' . 
$GLOBALS['phpgw']->accounts->get($ticket['group_id'])->__toString() . ']';
-                       }
-                       $portalbox->data[] = array
-                       (
-                               'text' => "{$location['loc1_name']} :: 
{$ticket['subject']}{$group}",
-                               'link' => $GLOBALS['phpgw']->link('/index.php', 
array('menuaction' => 'property.uitts.view', 'id' => $ticket['id']))
-                       );
-               }
-
-               echo "\n".'<!-- BEGIN ticket info -->'."\n<div 
class='property_tickets' style='padding-left: 
10px;'>".$portalbox->draw()."</div>\n".'<!-- END ticket info -->'."\n";
-
-               unset($tts);
-               unset($portalbox);
-               unset($category_name);
-               unset($default_status);
-       }
-
-
-       if ( isset($prefs['property']['mainscreen_show_new_updated_tts_2'])
-       && $prefs['property']['mainscreen_show_new_updated_tts_2'] == 'yes')
-       {
-
-               $default_status         = 
isset($prefs['property']['tts_status_2']) ? $prefs['property']['tts_status_2'] 
: '';
-               $tts = CreateObject('property.sotts');
-               $tickets = $tts->read(array('user_id' => $accound_id, 
'status_id' => $default_status));
-               $total_records = $tts->total_records;
-
-               $portalbox = CreateObject('phpgwapi.listbox', array
-               (
-                       'title'         => 
isset($prefs['property']['mainscreen_tts_title_2']) && 
$prefs['property']['mainscreen_tts_title_2']? 
"{$prefs['property']['mainscreen_tts_title_2']} ({$total_records})" : 
lang('Helpdesk') . " ({$total_records})",
-                       'primary'       => 
$GLOBALS['phpgw_info']['theme']['navbar_bg'],
-                       'secondary'     => 
$GLOBALS['phpgw_info']['theme']['navbar_bg'],
-                       'tertiary'      => 
$GLOBALS['phpgw_info']['theme']['navbar_bg'],
-                       'width' => '100%',
-                       'outerborderwidth'      => '0',
-                       'header_background_image'       => 
$GLOBALS['phpgw']->common->image('phpgwapi','bg_filler', '.png', False)
-               ));
-
-               $app_id = $GLOBALS['phpgw']->applications->name2id('property');
-               if( !isset($GLOBALS['portal_order']) ||!in_array($app_id, 
$GLOBALS['portal_order']) )
-               {
-                       $GLOBALS['portal_order'][] = $app_id;
-               }
-               $var = array
-               (
-                       'up'    => array('url'  => '/set_box.php', 'app'        
=> $app_id),
-                       'down'  => array('url'  => '/set_box.php', 'app'        
=> $app_id),
-                       'close' => array('url'  => '/set_box.php', 'app'        
=> $app_id),
-                       'question'      => array('url'  => '/set_box.php', 
'app'        => $app_id),
-                       'edit'  => array('url'  => '/set_box.php', 'app'        
=> $app_id)
-               );
-
-               foreach ( $var as $key => $value )
-               {
-                       //                      
$portalbox->set_controls($key,$value);
-               }
-
-               $category_name = array(); // caching
-
-               $portalbox->data = array();
-               foreach ($tickets as $ticket)
-               {
-                       if(!$ticket['subject'])
-                       {
-                               if(!isset($category_name[$ticket['cat_id']]))
-                               {
-                                       $ticket['subject']= 
execMethod('property.botts.get_category_name', $ticket['cat_id']);
-                                       $category_name[$ticket['cat_id']] = 
$ticket['subject'];
-                               }
-                               else
-                               {
-                                       $ticket['subject'] = 
$category_name[$ticket['cat_id']];
-                               }
-                       }
-
-                       $location = 
execMethod('property.bolocation.read_single', array('location_code' => 
$ticket['location_code'], 'extra' => array('view' => true))); 
-
-                       $group = '';
-                       if($ticket['group_id'])
-                       {
-                               $group = '[' . 
$GLOBALS['phpgw']->accounts->get($ticket['group_id'])->__toString() . ']';
-                       }
-
-                       $portalbox->data[] = array
-                       (
-                               'text' => "{$location['loc1_name']} :: 
{$ticket['subject']}{$group}",
-                               'link' => $GLOBALS['phpgw']->link('/index.php', 
array('menuaction' => 'property.uitts.view', 'id' => $ticket['id']))
-                       );
-               }
-
-               echo "\n".'<!-- BEGIN ticket info -->'."\n<div 
class='property_tickets' style='padding-left: 
10px;'>".$portalbox->draw()."</div>\n".'<!-- END ticket info -->'."\n";
-
-               unset($tts);
-               unset($portalbox);
-               unset($category_name);
-               unset($default_status);
-       }
-
-
-       if ( isset($prefs['property']['mainscreen_show_new_updated_tts_3'])
-       && $prefs['property']['mainscreen_show_new_updated_tts_3'] == 'yes')
-       {
-
-               $default_status         = 
isset($prefs['property']['tts_status_3']) ? $prefs['property']['tts_status_3'] 
: '';
-               $tts = CreateObject('property.sotts');
-               $tickets = $tts->read(array('user_id' => $accound_id, 
'status_id' => $default_status));
-               $total_records = $tts->total_records;
-
-               $portalbox = CreateObject('phpgwapi.listbox', array
-               (
-                       'title'         => 
isset($prefs['property']['mainscreen_tts_title_3']) && 
$prefs['property']['mainscreen_tts_title_3']? 
"{$prefs['property']['mainscreen_tts_title_3']} ({$total_records})" : 
lang('Helpdesk') . " ({$total_records})",
-                       'primary'       => 
$GLOBALS['phpgw_info']['theme']['navbar_bg'],
-                       'secondary'     => 
$GLOBALS['phpgw_info']['theme']['navbar_bg'],
-                       'tertiary'      => 
$GLOBALS['phpgw_info']['theme']['navbar_bg'],
-                       'width' => '100%',
-                       'outerborderwidth'      => '0',
-                       'header_background_image'       => 
$GLOBALS['phpgw']->common->image('phpgwapi','bg_filler', '.png', False)
-               ));
-
-               $app_id = $GLOBALS['phpgw']->applications->name2id('property');
-               if( !isset($GLOBALS['portal_order']) ||!in_array($app_id, 
$GLOBALS['portal_order']) )
-               {
-                       $GLOBALS['portal_order'][] = $app_id;
-               }
-               $var = array
-               (
-                       'up'    => array('url'  => '/set_box.php', 'app'        
=> $app_id),
-                       'down'  => array('url'  => '/set_box.php', 'app'        
=> $app_id),
-                       'close' => array('url'  => '/set_box.php', 'app'        
=> $app_id),
-                       'question'      => array('url'  => '/set_box.php', 
'app'        => $app_id),
-                       'edit'  => array('url'  => '/set_box.php', 'app'        
=> $app_id)
-               );
-
-               foreach ( $var as $key => $value )
-               {
-                       //                      
$portalbox->set_controls($key,$value);
-               }
-
-               $category_name = array(); // caching
-
-               $portalbox->data = array();
-               foreach ($tickets as $ticket)
-               {
-                       if(!$ticket['subject'])
-                       {
-                               if(!isset($category_name[$ticket['cat_id']]))
-                               {
-                                       $ticket['subject']= 
execMethod('property.botts.get_category_name', $ticket['cat_id']);
-                                       $category_name[$ticket['cat_id']] = 
$ticket['subject'];
-                               }
-                               else
-                               {
-                                       $ticket['subject'] = 
$category_name[$ticket['cat_id']];
-                               }
-                       }
-                       $location = 
execMethod('property.bolocation.read_single', array('location_code' => 
$ticket['location_code'], 'extra' => array('view' => true))); 
-
-                       $group = '';
-                       if($ticket['group_id'])
-                       {
-                               $group = '[' . 
$GLOBALS['phpgw']->accounts->get($ticket['group_id'])->__toString() . ']';
-                       }
-
-                       $portalbox->data[] = array
-                       (
-                               'text' => "{$location['loc1_name']} :: 
{$ticket['subject']}{$group}",
-                               'link' => $GLOBALS['phpgw']->link('/index.php', 
array('menuaction' => 'property.uitts.view', 'id' => $ticket['id']))
-                       );
-               }
-
-               echo "\n".'<!-- BEGIN ticket info -->'."\n<div 
class='property_tickets' style='padding-left: 
10px;'>".$portalbox->draw()."</div>\n".'<!-- END ticket info -->'."\n";
-
-               unset($tts);
-               unset($portalbox);
-               unset($category_name);
-               unset($default_status);
-       }
-
-       if ( isset($prefs['property']['mainscreen_show_new_updated_tts_4'])
-       && $prefs['property']['mainscreen_show_new_updated_tts_4'] == 'yes')
-       {
-
-               $default_status         = 
isset($prefs['property']['tts_status_4']) ? $prefs['property']['tts_status_4'] 
: '';
-               $tts = CreateObject('property.sotts');
-               $tickets = $tts->read(array('user_id' => $accound_id, 
'status_id' => $default_status));
-               $total_records = $tts->total_records;
-
-               $portalbox = CreateObject('phpgwapi.listbox', array
-               (
-                       'title'         => 
isset($prefs['property']['mainscreen_tts_title_4']) && 
$prefs['property']['mainscreen_tts_title_4']? 
"{$prefs['property']['mainscreen_tts_title_4']} ({$total_records})" : 
lang('Helpdesk') . " ({$total_records})",
-                       'primary'       => 
$GLOBALS['phpgw_info']['theme']['navbar_bg'],
-                       'secondary'     => 
$GLOBALS['phpgw_info']['theme']['navbar_bg'],
-                       'tertiary'      => 
$GLOBALS['phpgw_info']['theme']['navbar_bg'],
-                       'width' => '100%',
-                       'outerborderwidth'      => '0',
-                       'header_background_image'       => 
$GLOBALS['phpgw']->common->image('phpgwapi','bg_filler', '.png', False)
-               ));
-
-               $app_id = $GLOBALS['phpgw']->applications->name2id('property');
-               if( !isset($GLOBALS['portal_order']) ||!in_array($app_id, 
$GLOBALS['portal_order']) )
-               {
-                       $GLOBALS['portal_order'][] = $app_id;
-               }
-               $var = array
-               (
-                       'up'    => array('url'  => '/set_box.php', 'app'        
=> $app_id),
-                       'down'  => array('url'  => '/set_box.php', 'app'        
=> $app_id),
-                       'close' => array('url'  => '/set_box.php', 'app'        
=> $app_id),
-                       'question'      => array('url'  => '/set_box.php', 
'app'        => $app_id),
-                       'edit'  => array('url'  => '/set_box.php', 'app'        
=> $app_id)
-               );
-
-               foreach ( $var as $key => $value )
-               {
-                       //                      
$portalbox->set_controls($key,$value);
-               }
-
-               $status = array();
-               $status['X'] = array
-               (
-                       'name'                  => lang('closed'),
-               );
-               $status['O'] = array
-               (
-                       'name'                  => lang('open'),
-               );
-
-               $custom_status  = 
execMethod('property.botts.get_custom_status');
-
-               foreach($custom_status as $custom)
-               {
-                       $status["C{$custom['id']}"] = array
-                       (
-                               'status'                        => 
$custom['name'],
-                       );
-               }
-
-               $category_name = array(); // caching
-
-               $portalbox->data = array();
-               foreach ($tickets as $ticket)
-               {
-                       if(!$ticket['subject'])
-                       {
-                               if(!isset($category_name[$ticket['cat_id']]))
-                               {
-                                       $ticket['subject']= 
execMethod('property.botts.get_category_name', $ticket['cat_id']);
-                                       $category_name[$ticket['cat_id']] = 
$ticket['subject'];
-                               }
-                               else
-                               {
-                                       $ticket['subject'] = 
$category_name[$ticket['cat_id']];
-                               }
-                       }
-                       $location = 
execMethod('property.bolocation.read_single', array('location_code' => 
$ticket['location_code'], 'extra' => array('view' => true))); 
-                       $portalbox->data[] = array
-                       (
-                               'text' => "{$location['loc1_name']} :: 
{$ticket['subject']} :: {$status[$ticket['status']]['name']}",
-                               'link' => $GLOBALS['phpgw']->link('/index.php', 
array('menuaction' => 'property.uitts.view', 'id' => $ticket['id']))
-                       );
-               }
-
-               echo "\n".'<!-- BEGIN ticket info -->'."\n<div 
class='property_tickets' style='padding-left: 
10px;'>".$portalbox->draw()."</div>\n".'<!-- END ticket info -->'."\n";
-
-               unset($tts);
-               unset($portalbox);
-               unset($category_name);
-               unset($default_status);
-       }
-
-       if ( isset($prefs['property']['mainscreen_project_1'])
-       && $prefs['property']['mainscreen_project_1'] == 'yes')
-       {
-
-               $default_status         = 
isset($prefs['property']['project_status_mainscreen_1']) ? 
$prefs['property']['project_status_mainscreen_1'] : '';
-               $obj = CreateObject('property.soproject');
-               $projects = $obj->read(array('filter' => $accound_id, 
'status_id' => $default_status));
-               $total_records = $obj->total_records;
-
-               $portalbox = CreateObject('phpgwapi.listbox', array
-               (
-                       'title' => 
isset($prefs['property']['mainscreen_projects_1_title']) && 
$prefs['property']['mainscreen_projects_1_title']? 
"{$prefs['property']['mainscreen_projects_1_title']} ({$total_records})" : 
lang('project') . '::' . lang('list') . ' ' . 1 . "::Status: {$default_status} 
({$total_records})",
-                       'primary'       => 
$GLOBALS['phpgw_info']['theme']['navbar_bg'],
-                       'secondary'     => 
$GLOBALS['phpgw_info']['theme']['navbar_bg'],
-                       'tertiary'      => 
$GLOBALS['phpgw_info']['theme']['navbar_bg'],
-                       'width' => '100%',
-                       'outerborderwidth'      => '0',
-                       'header_background_image'       => 
$GLOBALS['phpgw']->common->image('phpgwapi','bg_filler', '.png', False)
-               ));
-
-               $app_id = $GLOBALS['phpgw']->applications->name2id('property');
-               if( !isset($GLOBALS['portal_order']) ||!in_array($app_id, 
$GLOBALS['portal_order']) )
-               {
-                       $GLOBALS['portal_order'][] = $app_id;
-               }
-               $var = array
-               (
-                       'up'    => array('url'  => '/set_box.php', 'app'        
=> $app_id),
-                       'down'  => array('url'  => '/set_box.php', 'app'        
=> $app_id),
-                       'close' => array('url'  => '/set_box.php', 'app'        
=> $app_id),
-                       'question'      => array('url'  => '/set_box.php', 
'app'        => $app_id),
-                       'edit'  => array('url'  => '/set_box.php', 'app'        
=> $app_id)
-               );
-
-               foreach ( $var as $key => $value )
-               {
-                       //                      
$portalbox->set_controls($key,$value);
-               }
-
-               $portalbox->data = array();
-               foreach ($projects as $project)
-               {
-                       $portalbox->data[] = array
-                       (
-                               'text' => "{$project['address']} :: 
{$project['name']}",
-                               'link' => $GLOBALS['phpgw']->link('/index.php', 
array('menuaction' => 'property.uiproject.edit', 'id' => 
$project['project_id']))
-                       );
-               }
-
-               echo "\n".'<!-- BEGIN project 1 info -->'."\n<div 
class='property_project' style='padding-left: 
10px;'>".$portalbox->draw()."</div>\n".'<!-- END project 1 info -->'."\n";
-
-               unset($obj);
-               unset($portalbox);
-               unset($default_status);
-       }
-
-       if ( isset($prefs['property']['mainscreen_workorder_1'])
-       && $prefs['property']['mainscreen_workorder_1'] == 'yes')
-       {
-
-               $default_status         = 
isset($prefs['property']['workorder_status_mainscreen_1']) ? 
$prefs['property']['workorder_status_mainscreen_1'] : '';
-               $obj = CreateObject('property.soworkorder');
-               $workorders = $obj->read(array('filter' => $accound_id, 
'status_id' => $default_status));
-               $total_records = $obj->total_records;
-
-               $portalbox = CreateObject('phpgwapi.listbox', array
-               (
-                       'title' => 
isset($prefs['property']['mainscreen_workorders_1_title']) && 
$prefs['property']['mainscreen_workorders_1_title']? 
"{$prefs['property']['mainscreen_workorders_1_title']} ({$total_records})" : 
lang('workorder') . '::' . lang('list') . ' ' . 1 . "::Status: 
{$default_status} ({$total_records})",
-                       'primary'       => 
$GLOBALS['phpgw_info']['theme']['navbar_bg'],
-                       'secondary'     => 
$GLOBALS['phpgw_info']['theme']['navbar_bg'],
-                       'tertiary'      => 
$GLOBALS['phpgw_info']['theme']['navbar_bg'],
-                       'width' => '100%',
-                       'outerborderwidth'      => '0',
-                       'header_background_image'       => 
$GLOBALS['phpgw']->common->image('phpgwapi','bg_filler', '.png', False)
-               ));
-
-               $app_id = $GLOBALS['phpgw']->applications->name2id('property');
-               if( !isset($GLOBALS['portal_order']) ||!in_array($app_id, 
$GLOBALS['portal_order']) )
-               {
-                       $GLOBALS['portal_order'][] = $app_id;
-               }
-               $var = array
-               (
-                       'up'    => array('url'  => '/set_box.php', 'app'        
=> $app_id),
-                       'down'  => array('url'  => '/set_box.php', 'app'        
=> $app_id),
-                       'close' => array('url'  => '/set_box.php', 'app'        
=> $app_id),
-                       'question'      => array('url'  => '/set_box.php', 
'app'        => $app_id),
-                       'edit'  => array('url'  => '/set_box.php', 'app'        
=> $app_id)
-               );
-
-               foreach ( $var as $key => $value )
-               {
-                       //                      
$portalbox->set_controls($key,$value);
-               }
-
-               $portalbox->data = array();
-               foreach ($workorders as $workorder)
-               {
-                       $portalbox->data[] = array
-                       (
-                               'text' => "{$workorder['address']} :: 
{$workorder['title']}",
-                               'link' => $GLOBALS['phpgw']->link('/index.php', 
array('menuaction' => 'property.uiworkorder.edit', 'id' => 
$workorder['workorder_id']))
-                       );
-               }
-
-               echo "\n".'<!-- BEGIN workorder 1 info -->'."\n<div 
class='property_workorder' style='padding-left: 
10px;'>".$portalbox->draw()."</div>\n".'<!-- END workorder 1 info -->'."\n";
-
-               unset($obj);
-               unset($portalbox);
-               unset($default_status);
-       }
-       if ( isset($prefs['property']['mainscreen_workorder_2'])
-       && $prefs['property']['mainscreen_workorder_2'] == 'yes')
-       {
-
-               $default_status         = 
isset($prefs['property']['workorder_status_mainscreen_2']) ? 
$prefs['property']['workorder_status_mainscreen_2'] : '';
-               $obj = CreateObject('property.soworkorder');
-               $workorders = $obj->read(array('filter' => $accound_id, 
'status_id' => $default_status));
-               $total_records = $obj->total_records;
-
-               $portalbox = CreateObject('phpgwapi.listbox', array
-               (
-                       'title' => 
isset($prefs['property']['mainscreen_workorders_2_title']) && 
$prefs['property']['mainscreen_workorders_2_title']? 
"{$prefs['property']['mainscreen_workorders_2_title']} ({$total_records})" : 
lang('workorder') . '::' . lang('list') . ' ' . 2 . "::Status: 
{$default_status} ({$total_records})",
-                       'primary'       => 
$GLOBALS['phpgw_info']['theme']['navbar_bg'],
-                       'secondary'     => 
$GLOBALS['phpgw_info']['theme']['navbar_bg'],
-                       'tertiary'      => 
$GLOBALS['phpgw_info']['theme']['navbar_bg'],
-                       'width' => '100%',
-                       'outerborderwidth'      => '0',
-                       'header_background_image'       => 
$GLOBALS['phpgw']->common->image('phpgwapi','bg_filler', '.png', False)
-               ));
-
-               $app_id = $GLOBALS['phpgw']->applications->name2id('property');
-               if( !isset($GLOBALS['portal_order']) ||!in_array($app_id, 
$GLOBALS['portal_order']) )
-               {
-                       $GLOBALS['portal_order'][] = $app_id;
-               }
-               $var = array
-               (
-                       'up'    => array('url'  => '/set_box.php', 'app'        
=> $app_id),
-                       'down'  => array('url'  => '/set_box.php', 'app'        
=> $app_id),
-                       'close' => array('url'  => '/set_box.php', 'app'        
=> $app_id),
-                       'question'      => array('url'  => '/set_box.php', 
'app'        => $app_id),
-                       'edit'  => array('url'  => '/set_box.php', 'app'        
=> $app_id)
-               );
-
-               foreach ( $var as $key => $value )
-               {
-                       //                      
$portalbox->set_controls($key,$value);
-               }
-
-               $portalbox->data = array();
-               foreach ($workorders as $workorder)
-               {
-                       $portalbox->data[] = array
-                       (
-                               'text' => "{$workorder['address']} :: 
{$workorder['title']}",
-                               'link' => $GLOBALS['phpgw']->link('/index.php', 
array('menuaction' => 'property.uiworkorder.edit', 'id' => 
$workorder['workorder_id']))
-                       );
-               }
-
-               echo "\n".'<!-- BEGIN workorder 2 info -->'."\n<div 
class='property_workorder' style='padding-left: 
10px;'>".$portalbox->draw()."</div>\n".'<!-- END workorder 2 info -->'."\n";
-
-               unset($obj);
-               unset($portalbox);
-               unset($default_status);
-       }
-
-       if ( isset($prefs['property']['mainscreen_showapprovals_request'])
-       && $prefs['property']['mainscreen_showapprovals_request'] == 'yes' )
-       {
-               $total_records = 0;
-               $title = 
isset($prefs['property']['mainscreen_showapprovals_request_title']) && 
$prefs['property']['mainscreen_showapprovals_request_title']? 
"{$prefs['property']['mainscreen_showapprovals_request_title']} 
({$total_records})" : lang('approvals request') . " ({$total_records})";
-
-               //TODO Make listbox css compliant
-               $portalbox = CreateObject('phpgwapi.listbox', array
-               (
-                       'title' => $title,
-                       'primary'       => 
$GLOBALS['phpgw_info']['theme']['navbar_bg'],
-                       'secondary'     => 
$GLOBALS['phpgw_info']['theme']['navbar_bg'],
-                       'tertiary'      => 
$GLOBALS['phpgw_info']['theme']['navbar_bg'],
-                       'width' => '100%',
-                       'outerborderwidth'      => '0',
-                       'header_background_image'       => 
$GLOBALS['phpgw']->common->image('phpgwapi','bg_filler', '.png', False)
-               ));
-
-               $app_id = $GLOBALS['phpgw']->applications->name2id('property');
-
-               if( !isset($GLOBALS['portal_order']) ||!in_array($app_id, 
$GLOBALS['portal_order']) )
-               {
-                       $GLOBALS['portal_order'][] = $app_id;
-               }
-
-               $var = array
-               (
-                       'up'    => array('url'  => '/set_box.php', 'app'        
=> $app_id),
-                       'down'  => array('url'  => '/set_box.php', 'app'        
=> $app_id),
-                       'close' => array('url'  => '/set_box.php', 'app'        
=> $app_id),
-                       'question'      => array('url'  => '/set_box.php', 
'app'        => $app_id),
-                       'edit'  => array('url'  => '/set_box.php', 'app'        
=> $app_id)
-               );
-
-               foreach ( $var as $key => $value )
-               {
-                       //                      
$portalbox->set_controls($key,$value);
-               }
-
-               $action_params = array
-               (
-                       'appname'                       => 'property',
-                       'location'                      => '.project',
-                       //      'id'                            => $id,
-                       'responsible'           => '',
-                       'responsible_type'  => 'user',
-                       'action'                        => 'approval',
-                       'deadline'                      => '',
-                       'created_by'            => $accound_id,
-                       'allrows'                       => true
-               );
-
-               $obj = CreateObject('property.sopending_action');
-               $pending_approvals = $obj->get_pending_action($action_params);
-               $total_records = $obj->total_records;
-
-               $portalbox->data = array();
-               foreach ($pending_approvals as $entry)
-               {
-                       $responsible = $entry['responsible'] ? 
$GLOBALS['phpgw']->accounts->get($entry['responsible'])->__toString() : '';
-                       $portalbox->data[] = array
-                       (
-                               'text' => "{$responsible}: Prosjekt venter på 
godkjenning: {$entry['item_id']}",
-                               'link' => $entry['url']
-                       );
-               }
-               $action_params = array
-               (
-                       'appname'                       => 'property',
-                       'location'                      => '.project.workorder',
-                       //      'id'                            => $id,
-                       'responsible'           => '',
-                       'responsible_type'  => 'user',
-                       'action'                        => 'approval',
-                       'deadline'                      => '',
-                       'created_by'            => $accound_id,
-                       'allrows'                       => true
-               );
-
-               $pending_approvals = $obj->get_pending_action($action_params);
-               $total_records = $total_records + $obj->total_records;
-
-               foreach ($pending_approvals as $entry)
-               {
-                       $responsible = $entry['responsible'] ? 
$GLOBALS['phpgw']->accounts->get($entry['responsible'])->__toString() : '';
-                       $portalbox->data[] = array
-                       (
-                               'text' => "{$responsible}: Ordre venter på 
godkjenning: {$entry['item_id']}",
-                               'link' => $entry['url']
-                       );
-               }
-               $action_params = array
-               (
-                       'appname'                       => 'property',
-                       'location'                      => '.ticket',
-                       //      'id'                            => $id,
-                       'responsible'           => '',
-                       'responsible_type'  => 'user',
-                       'action'                        => 'approval',
-                       'deadline'                      => '',
-                       'created_by'            => $accound_id,
-                       'allrows'                       => true
-               );
-
-               $pending_approvals = $obj->get_pending_action($action_params);
-               $total_records = $total_records + $obj->total_records;
-
-               foreach ($pending_approvals as $entry)
-               {
-                       $responsible = $entry['responsible'] ? 
$GLOBALS['phpgw']->accounts->get($entry['responsible'])->__toString() : '';
-                       $portalbox->data[] = array
-                       (
-                               'text' => "{$responsible}: Melding venter på 
godkjenning: {$entry['item_id']}",
-                               'link' => $entry['url']
-                       );
-               }
-
-               echo "\n".'<!-- BEGIN approval info -->'."\n<div 
class='property_approval' style='padding-left: 
10px;'>".$portalbox->draw()."</div>\n".'<!-- END approval info -->'."\n";
-
-               unset($portalbox);
-               unset($obj);
-               unset($pending_approvals);
-       }
-
-       if ( isset($prefs['property']['mainscreen_showapprovals'])
-       && $prefs['property']['mainscreen_showapprovals'] == 'yes' )
-       {
-               $total_records = 0;
-               $title = 'dummy';       
-               //TODO Make listbox css compliant
-               $portalbox = CreateObject('phpgwapi.listbox', array
-               (
-                       'title' => $title,
-                       'primary'       => 
$GLOBALS['phpgw_info']['theme']['navbar_bg'],
-                       'secondary'     => 
$GLOBALS['phpgw_info']['theme']['navbar_bg'],
-                       'tertiary'      => 
$GLOBALS['phpgw_info']['theme']['navbar_bg'],
-                       'width' => '100%',
-                       'outerborderwidth'      => '0',
-                       'header_background_image'       => 
$GLOBALS['phpgw']->common->image('phpgwapi','bg_filler', '.png', False)
-               ));
-
-               $app_id = $GLOBALS['phpgw']->applications->name2id('property');
-
-               if( !isset($GLOBALS['portal_order']) ||!in_array($app_id, 
$GLOBALS['portal_order']) )
-               {
-                       $GLOBALS['portal_order'][] = $app_id;
-               }
-
-               $var = array
-               (
-                       'up'    => array('url'  => '/set_box.php', 'app'        
=> $app_id),
-                       'down'  => array('url'  => '/set_box.php', 'app'        
=> $app_id),
-                       'close' => array('url'  => '/set_box.php', 'app'        
=> $app_id),
-                       'question'      => array('url'  => '/set_box.php', 
'app'        => $app_id),
-                       'edit'  => array('url'  => '/set_box.php', 'app'        
=> $app_id)
-               );
-
-               foreach ( $var as $key => $value )
-               {
-                       //                      
$portalbox->set_controls($key,$value);
-               }
-
-               $action_params = array
-               (
-                       'appname'                       => 'property',
-                       'location'                      => '.project',
-                       //      'id'                            => $id,
-                       'responsible'           => $accound_id,
-                       'responsible_type'  => 'user',
-                       'action'                        => 'approval',
-                       'deadline'                      => '',
-                       'created_by'            => '',
-                       'allrows'                       => true
-               );
-
-               $pending_approvals = 
execMethod('property.sopending_action.get_pending_action', $action_params);
-
-               $portalbox->data = array();
-               foreach ($pending_approvals as $entry)
-               {
-                       $portalbox->data[] = array
-                       (
-                               'text' => 'Prosjekt venter på godkjenning: ' . 
$entry['item_id'],
-                               'link' => $entry['url']
-                       );
-                       $total_records++;
-               }
-
-               //              echo "\n".'<!-- BEGIN approval info 
-->'."\n".$portalbox->draw()."\n".'<!-- END approval info -->'."\n";
-
-               $action_params = array
-               (
-                       'appname'                       => 'property',
-                       'location'                      => '.project.workorder',
-                       //      'id'                            => $id,
-                       'responsible'           => $accound_id,
-                       'responsible_type'  => 'user',
-                       'action'                        => 'approval',
-                       'deadline'                      => '',
-                       'created_by'            => '',
-                       'allrows'                       => true
-               );
-
-               $pending_approvals = 
execMethod('property.sopending_action.get_pending_action', $action_params);
-
-               //              $portalbox->data = array();
-               foreach ($pending_approvals as $entry)
-               {
-                       $portalbox->data[] = array
-                       (
-                               'text' => 'Ordre venter på godkjenning: ' . 
$entry['item_id'],
-                               'link' => $entry['url']
-                       );
-                       $total_records++;
-               }
-
-               $action_params = array
-               (
-                       'appname'                       => 'property',
-                       'location'                      => '.ticket',
-                       //      'id'                            => $id,
-                       'responsible'           => $accound_id,
-                       'responsible_type'  => 'user',
-                       'action'                        => 'approval',
-                       'deadline'                      => '',
-                       'created_by'            => '',
-                       'allrows'                       => true
-               );
-
-               $pending_approvals = 
execMethod('property.sopending_action.get_pending_action', $action_params);
-
-               //              $portalbox->data = array();
-               foreach ($pending_approvals as $entry)
-               {
-                       $portalbox->data[] = array
-                       (
-                               'text' => 'Melding venter på godkjenning: ' . 
$entry['item_id'],
-                               'link' => $entry['url']
-                       );
-                       $total_records++;
-               }
-               //Hack
-               $title = 
isset($prefs['property']['mainscreen_showapprovals_title']) && 
$prefs['property']['mainscreen_showapprovals_title']? 
"{$prefs['property']['mainscreen_showapprovals_title']} ({$total_records})" : 
lang('approvals') . " ({$total_records})";  
-               $portalbox->setvar('title', $title);
-               $portalbox->start_template();
-
-               echo "\n".'<!-- BEGIN approval info -->'."\n<div 
class='property_approval' style='padding-left: 
10px;'>".$portalbox->draw()."</div>\n".'<!-- END approval info -->'."\n";
-
-               unset($portalbox);
-               unset($pending_approvals);
-       }
-
-       if ( isset($prefs['property']['mainscreen_showvendor_reminder'])
-       && $prefs['property']['mainscreen_showvendor_reminder']  == 'yes' )
-       {
-               $total_records = 0;
-               $title = 'dummy';
-               //TODO Make listbox css compliant
-               $portalbox = CreateObject('phpgwapi.listbox', array
-               (
-                       'title' => $title,
-                       'primary'       => 
$GLOBALS['phpgw_info']['theme']['navbar_bg'],
-                       'secondary'     => 
$GLOBALS['phpgw_info']['theme']['navbar_bg'],
-                       'tertiary'      => 
$GLOBALS['phpgw_info']['theme']['navbar_bg'],
-                       'width' => '100%',
-                       'outerborderwidth'      => '0',
-                       'header_background_image'       => 
$GLOBALS['phpgw']->common->image('phpgwapi','bg_filler', '.png', False)
-               ));
-
-               $app_id = $GLOBALS['phpgw']->applications->name2id('property');
-               if( !isset($GLOBALS['portal_order']) ||!in_array($app_id, 
$GLOBALS['portal_order']) )
-               {
-                       $GLOBALS['portal_order'][] = $app_id;
-               }
-
-               $var = array
-               (
-                       'up'    => array('url'  => '/set_box.php', 'app'        
=> $app_id),
-                       'down'  => array('url'  => '/set_box.php', 'app'        
=> $app_id),
-                       'close' => array('url'  => '/set_box.php', 'app'        
=> $app_id),
-                       'question'      => array('url'  => '/set_box.php', 
'app'        => $app_id),
-                       'edit'  => array('url'  => '/set_box.php', 'app'        
=> $app_id)
-               );
-
-               foreach ( $var as $key => $value )
-               {
-                       //                      
$portalbox->set_controls($key,$value);
-               }
-
-               $action_params = array
-               (
-                       'appname'                       => 'property',
-                       'location'                      => '.project.workorder',
-                       //      'id'                            => $id,
-                       'responsible'           => '',
-                       'responsible_type'  => 'vendor',
-                       'action'                        => 'remind',
-                       'deadline'                      => '',
-                       'created_by'            => $accound_id,
-                       'allrows'                       => true
-               );
-
-               $pending_reminder = 
execMethod('property.sopending_action.get_pending_action', $action_params);
-
-               $portalbox->data = array();
-               foreach ($pending_reminder as $entry)
-               {
-                       $sql='SELECT org_name FROM fm_vendor where id=' . 
(int)$entry['responsible'];
-                       $GLOBALS['phpgw']->db;
-                       $GLOBALS['phpgw']->db->query($sql);
-                       $GLOBALS['phpgw']->db->next_record();
-                       $vendor_name =  
$GLOBALS['phpgw']->db->f('org_name',true);
-
-                       $portalbox->data[] = array
-                       (
-                               'text' => "påminning nr {$entry['reminder']} 
til leverandør {$vendor_name}- ordre nr: {$entry['item_id']}",
-                               'link' => $entry['url']
-                       );
-                       $total_records++;
-               }
-
-               $title = 
isset($prefs['property']['mainscreen_showvendor_reminder_title']) && 
$prefs['property']['mainscreen_showvendor_reminder_title']? 
"{$prefs['property']['mainscreen_showvendor_reminder_title']} 
({$total_records})" : lang('vendor reminder') . " ({$total_records})";  
-               $portalbox->setvar('title', $title);
-               $portalbox->start_template();
-
-               echo "\n".'<!-- BEGIN reminder info -->'."\n<div 
class='property_reminder' style='padding-left: 
10px;'>".$portalbox->draw()."</div>\n".'<!-- END reminder info -->'."\n";
-
-               unset($pending_reminder);
-               unset($portalbox);
-       }
-
-       $GLOBALS['phpgw_info']['flags']['currentapp'] = $save_app;
-       $GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs'] = 
$maxmatches;
-

Modified: branches/dev-syncromind/property/inc/hook_settings.inc.php
===================================================================
--- branches/dev-syncromind/property/inc/hook_settings.inc.php  2015-06-15 
07:09:00 UTC (rev 13432)
+++ branches/dev-syncromind/property/inc/hook_settings.inc.php  2015-06-15 
11:30:34 UTC (rev 13433)
@@ -73,7 +73,8 @@
        }
 
 
-       create_select_box('show oen tenant claims on main 
screen','mainscreen_show_open_tenant_claim',$yes_and_no,'Link to claims you are 
assigned to');
+       create_select_box('Show overdue projects on main 
screen','mainscreen_show_project_overdue',$yes_and_no,'Link to projects you are 
assigned to');
+       create_select_box('show open tenant claims on main 
screen','mainscreen_show_open_tenant_claim',$yes_and_no,'Link to claims you are 
assigned to');
 
        create_select_box('show new/updated tickets on main 
screen','mainscreen_show_new_updated_tts',$yes_and_no,'Link to tickets you are 
assigned to');
        create_select_box('Default ticket 
status','tts_status',$_status_tts,'The default status when entering the 
helpdesk and mainscreen');




reply via email to

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