fmsystem-commits
[Top][All Lists]
Advanced

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

[Fmsystem-commits] [17441] controller: more on controller


From: sigurdne
Subject: [Fmsystem-commits] [17441] controller: more on controller
Date: Thu, 14 Dec 2017 10:01:33 -0500 (EST)

Revision: 17441
          http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=17441
Author:   sigurdne
Date:     2017-12-14 10:01:33 -0500 (Thu, 14 Dec 2017)
Log Message:
-----------
controller: more on controller

Modified Paths:
--------------
    trunk/controller/inc/class.uicheck_list.inc.php
    trunk/controller/inc/class.uicomponent.inc.php
    trunk/controller/js/controller/component.index.js
    trunk/controller/setup/phpgw_no.lang
    trunk/controller/templates/base/component.xsl

Modified: trunk/controller/inc/class.uicheck_list.inc.php
===================================================================
--- trunk/controller/inc/class.uicheck_list.inc.php     2017-12-13 15:50:13 UTC 
(rev 17440)
+++ trunk/controller/inc/class.uicheck_list.inc.php     2017-12-14 15:01:33 UTC 
(rev 17441)
@@ -1095,7 +1095,11 @@
 
                        if ($status == controller_check_list::STATUS_DONE && 
$required_actual_hours && $check_list->get_billable_hours() == 0 && 
!$billable_hours)
                        {
-                               phpgwapi_cache::message_set(lang("Please enter 
billable hours"), 'error');
+                               $error_message = lang("Please enter billable 
hours");
+                               if (phpgw::get_var('phpgw_return_as') != 'json')
+                               {
+                                       
phpgwapi_cache::message_set($error_message, 'error');
+                               }
                                $error = true;
                        }
                        else
@@ -1232,7 +1236,7 @@
 
                                        if (phpgw::get_var('phpgw_return_as') 
== 'json')
                                        {
-                                               return 
json_encode(array("status" => 'ok', 'message' => lang('Ok')));
+                                               return array("status" => 'ok', 
'message' => lang('Ok'));
                                        }
                                        else if($submit_deviation)
                                        {
@@ -1249,7 +1253,7 @@
                                {
                                        if (phpgw::get_var('phpgw_return_as') 
== 'json')
                                        {
-                                               return 
json_encode(array("status" => 'error', 'message' => lang('Error')));
+                                               return array('status' => 
'error', 'message' => $error_message ? $error_message : lang('Error'));
                                        }
                                        $this->edit_check_list($check_list);
                                }
@@ -1258,7 +1262,7 @@
                        {
                                if (phpgw::get_var('phpgw_return_as') == 'json')
                                {
-                                       return json_encode(array("status" => 
'error', 'message' => lang('Error')));
+                                       return array('status' => 'error', 
'message' => $error_message ? $error_message : lang('Error'));
                                }
                                else if ($check_list->get_id() > 0)
                                {

Modified: trunk/controller/inc/class.uicomponent.inc.php
===================================================================
--- trunk/controller/inc/class.uicomponent.inc.php      2017-12-13 15:50:13 UTC 
(rev 17440)
+++ trunk/controller/inc/class.uicomponent.inc.php      2017-12-14 15:01:33 UTC 
(rev 17441)
@@ -61,7 +61,8 @@
                        $custom,
                        $get_locations,
                        $user_id,
-                       $currentapp;
+                       $currentapp,
+                       $config;
                public $public_functions = array
                        (
                        'index' => true,
@@ -79,9 +80,8 @@
                        $this->manage = 
$GLOBALS['phpgw']->acl->check('.control', 16, 'controller');//16
 //                     $this->so                                        = 
CreateObject('controller.socontrol');
 
-                       $config = CreateObject('phpgwapi.config', 'controller');
-                       $config->read();
-                       $this->_category_acl = 
isset($config->config_data['acl_at_control_area']) && 
$config->config_data['acl_at_control_area'] == 1 ? true : false;
+                       $this->config = CreateObject('phpgwapi.config', 
'controller')->read();
+                       $this->_category_acl = 
isset($this->config['acl_at_control_area']) && 
$this->config['acl_at_control_area'] == 1 ? true : false;
 
                        $location_id = phpgw::get_var('location_id', 'int');
                        $this->get_locations = phpgw::get_var('get_locations', 
'bool');
@@ -335,6 +335,7 @@
                        $status_list = array(
                                array('id' => 'in_queue', 'name' => lang('in 
queue')),
                                array('id' => 'all', 'name' => lang('All')),
+                               array('id' => 'performed', 'name' => 
lang('status done')),
                                array('id' => 'not_performed', 'name' => 
lang('status not done')),
                                array('id' => 'done_with_open_deviation', 
'name' => lang('done with open deviation')),
                        );
@@ -352,8 +353,10 @@
                                        'name'  => $control_type->get_title()
                                );
                        }
+
        //              _debug_array($control_types_arr);
                        $data = array(
+                               'required_actual_hours' => 
!empty($this->config['required_actual_hours']) ? true : false,
                                'datatable_name' =>  
phpgw::get_var('get_locations', 'bool') ? lang('status locations') : 
lang('status components'),
                                'form' => array(
                                        'action' => 
self::link(array('menuaction' => 'controller.uicomponent.index',
@@ -1571,10 +1574,23 @@
                                                        return;
                                        }
                                }
-                               if ($filter_status == 'not_performed')
+                               else if ($filter_status == 'performed')
                                {
                                        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;
+                                       }
+                               }
+                               else if ($filter_status == 'not_performed')
+                               {
+                                       switch ($param['status'])
+                                       {
                                                case "CONTROL_NOT_DONE":
                        //                      case "CONTROL_REGISTERED":
                        //                      case "CONTROL_PLANNED":

Modified: trunk/controller/js/controller/component.index.js
===================================================================
--- trunk/controller/js/controller/component.index.js   2017-12-13 15:50:13 UTC 
(rev 17440)
+++ trunk/controller/js/controller/component.index.js   2017-12-14 15:01:33 UTC 
(rev 17441)
@@ -404,7 +404,7 @@
 
        dialog = $("#dialog-form").dialog({
                autoOpen: false,
-               height: 300,
+               height: 250,
                width: 350,
                modal: true,
                buttons: {
@@ -442,16 +442,8 @@
                                if (data !== null)
                                {
                                        var message = data.message;
-
-                                       if (data.status === 'error')
-                                       {
-                                               alert(message);
-                                       }
-                                       else
-                                       {
-                                               alert('Ok');
-                                               update_table();
-                                       }
+                                       alert(message);
+                                       update_table();
                                }
                        }
                });

Modified: trunk/controller/setup/phpgw_no.lang
===================================================================
--- trunk/controller/setup/phpgw_no.lang        2017-12-13 15:50:13 UTC (rev 
17440)
+++ trunk/controller/setup/phpgw_no.lang        2017-12-14 15:01:33 UTC (rev 
17441)
@@ -251,6 +251,7 @@
 status_date    controller      no      den
 status_unknown controller      no      Ukjent status
 status controller      no      Status
+status done    controller      no      Utført
 status not done        controller      no      Ikke utført
 done with open deviation       controller      no      Utført med åpne avvik
 Success        controller      no      Suksess

Modified: trunk/controller/templates/base/component.xsl
===================================================================
--- trunk/controller/templates/base/component.xsl       2017-12-13 15:50:13 UTC 
(rev 17440)
+++ trunk/controller/templates/base/component.xsl       2017-12-14 15:01:33 UTC 
(rev 17441)
@@ -352,17 +352,19 @@
        <div id="dialog-form" title="Egne timer">
                <p>Godkjenner du denne uten avvik?</p>
                <form>
-                       <fieldset>
-                               <div class="pure-control-group">
-                                       <label>Egne Timer</label>
-                                       <input class="pure-input-1" 
type="number" step="0.01" required="required">
-                                               <xsl:attribute 
name="id">billable_hours</xsl:attribute>
-                                               <xsl:attribute 
name="name">billable_hours</xsl:attribute>
-                                       </input>
-                               </div>
+                       <!--<fieldset>-->
+                               <xsl:if test="//required_actual_hours = '1'">
+                                       <div class="pure-control-group">
+                                               <label>Egne Timer</label>
+                                               <input class="pure-input-1" 
type="number" step="0.01" min="1" required='required'>
+                                                       <xsl:attribute 
name="id">billable_hours</xsl:attribute>
+                                                       <xsl:attribute 
name="name">billable_hours</xsl:attribute>
+                                               </input>
+                                       </div>
+                               </xsl:if>
                                <input type="submit" tabindex="-1" 
style="position:absolute; top:-1000px">
                                </input>
-                       </fieldset>
+                       <!--</fieldset>-->
                </form>
        </div>
         




reply via email to

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