fmsystem-commits
[Top][All Lists]
Advanced

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

[Fmsystem-commits] [13426] more on controller


From: Sigurd Nes
Subject: [Fmsystem-commits] [13426] more on controller
Date: Fri, 12 Jun 2015 13:03:21 +0000

Revision: 13426
          http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=13426
Author:   sigurdne
Date:     2015-06-12 13:03:20 +0000 (Fri, 12 Jun 2015)
Log Message:
-----------
more on controller

Modified Paths:
--------------
    trunk/controller/inc/class.uicomponent.inc.php
    trunk/controller/inc/component/class.check_list_status_manager.inc.php
    trunk/controller/inc/component/class.year_calendar.inc.php
    trunk/controller/setup/phpgw_no.lang

Modified: trunk/controller/inc/class.uicomponent.inc.php
===================================================================
--- trunk/controller/inc/class.uicomponent.inc.php      2015-06-12 09:09:39 UTC 
(rev 13425)
+++ trunk/controller/inc/class.uicomponent.inc.php      2015-06-12 13:03:20 UTC 
(rev 13426)
@@ -195,7 +195,11 @@
                                        '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')));
 
@@ -243,6 +247,12 @@
                                                                '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',
@@ -354,6 +364,7 @@
                        $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');
 
                        $so_control                      = 
CreateObject('controller.socontrol');
                        $this->so                       = 
CreateObject('controller.socheck_list');
@@ -436,6 +447,7 @@
                        $all_components = array();
                        $components_with_calendar_array = array();
 //                     _debug_array($components);
+                       $have_been_here_before = array();
                        foreach($components as $_component)
                        {
                                $location_id = $_component['location_id'];
@@ -461,9 +473,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 +484,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 +504,18 @@
                                                }
                                        }
                                        // 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)
                                                {
+                                                       
if($have_been_here_before[$component->get_id()])
+                                                       {
+                                                               continue;
+                                                       }
+                                                       
$have_been_here_before[$component->get_id()] = true;
+
                                                        
$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 +608,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;
@@ -662,9 +680,10 @@
                                        $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,8 +693,11 @@
                                                $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();
                        $class = '';
@@ -729,12 +751,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":

Modified: trunk/controller/inc/component/class.check_list_status_manager.inc.php
===================================================================
--- trunk/controller/inc/component/class.check_list_status_manager.inc.php      
2015-06-12 09:09:39 UTC (rev 13425)
+++ trunk/controller/inc/component/class.check_list_status_manager.inc.php      
2015-06-12 13:03:20 UTC (rev 13426)
@@ -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: trunk/controller/inc/component/class.year_calendar.inc.php
===================================================================
--- trunk/controller/inc/component/class.year_calendar.inc.php  2015-06-12 
09:09:39 UTC (rev 13425)
+++ trunk/controller/inc/component/class.year_calendar.inc.php  2015-06-12 
13:03:20 UTC (rev 13426)
@@ -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: trunk/controller/setup/phpgw_no.lang
===================================================================
--- trunk/controller/setup/phpgw_no.lang        2015-06-12 09:09:39 UTC (rev 
13425)
+++ trunk/controller/setup/phpgw_no.lang        2015-06-12 13:03:20 UTC (rev 
13426)
@@ -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.




reply via email to

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