fmsystem-commits
[Top][All Lists]
Advanced

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

[Fmsystem-commits] [17290] FDV-247: Placement in calendar is controlled


From: erikhl
Subject: [Fmsystem-commits] [17290] FDV-247: Placement in calendar is controlled by planned date or completed date when displaying control calendar.
Date: Fri, 10 Nov 2017 01:00:44 -0500 (EST)

Revision: 17290
          http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=17290
Author:   erikhl
Date:     2017-11-10 01:00:43 -0500 (Fri, 10 Nov 2017)
Log Message:
-----------
FDV-247: Placement in calendar is controlled by planned date or completed date 
when displaying control calendar.
Remaining: change due_date on auto-placed yearly controls from january to 
december

Modified Paths:
--------------
    trunk/controller/inc/class.uicheck_list.inc.php
    trunk/controller/inc/component/class.check_list_status_info.inc.php
    trunk/controller/inc/component/class.check_list_status_manager.inc.php
    trunk/controller/inc/component/class.year_calendar.inc.php
    trunk/controller/inc/model/class.check_list.inc.php
    trunk/controller/setup/phpgw_no.lang
    trunk/controller/templates/base/check_list/add_check_list.xsl
    trunk/controller/templates/base/check_list/edit_check_list.xsl

Modified: trunk/controller/inc/class.uicheck_list.inc.php
===================================================================
--- trunk/controller/inc/class.uicheck_list.inc.php     2017-11-09 14:34:37 UTC 
(rev 17289)
+++ trunk/controller/inc/class.uicheck_list.inc.php     2017-11-10 06:00:43 UTC 
(rev 17290)
@@ -558,7 +558,6 @@
 
                        $GLOBALS['phpgw']->jqcal->add_listener('planned_date');
                        
$GLOBALS['phpgw']->jqcal->add_listener('completed_date');
-                       $GLOBALS['phpgw']->jqcal->add_listener('deadline_date');
 
                        self::add_javascript('controller', 'controller', 
'custom_ui.js');
                        self::add_javascript('controller', 'controller', 
'ajax.js');

Modified: trunk/controller/inc/component/class.check_list_status_info.inc.php
===================================================================
--- trunk/controller/inc/component/class.check_list_status_info.inc.php 
2017-11-09 14:34:37 UTC (rev 17289)
+++ trunk/controller/inc/component/class.check_list_status_info.inc.php 
2017-11-10 06:00:43 UTC (rev 17290)
@@ -37,6 +37,8 @@
                private $status_text;
                private $deadline_date_ts;
                private $deadline_date_txt;
+               private $planned_date_ts;
+               private $completed_date_ts;
                private $original_deadline_date_ts;
                private $info_text;
                private $location_code;
@@ -122,7 +124,27 @@
                {
                        return $this->deadline_date_txt;
                }
+               
+               public function set_planned_date_ts( $planned_date_ts )
+               {
+                       $this->planned_date_ts = $planned_date_ts;
+               }
 
+               public function get_planned_date_ts()
+               {
+                       return $this->planned_date_ts;
+               }
+               
+               public function set_completed_date_ts( $completed_date_ts )
+               {
+                       $this->completed_date_ts = $completed_date_ts;
+               }
+
+               public function get_completed_date_ts()
+               {
+                       return $this->completed_date_ts;
+               }
+
                public function set_info_text( $info_text )
                {
                        $this->info_text = $info_text;
@@ -223,6 +245,8 @@
                                'deadline_date_ts' => 
$this->get_deadline_date_ts(),
                                'deadline_date_txt' => 
$this->get_deadline_date_txt(),
                                'original_deadline_date_ts' => 
$this->get_original_deadline_date_ts(),
+                               'planned_date_ts' => 
$this->get_planned_date_ts(),
+                               'completed_date_ts' => 
$this->get_completed_date_ts(),
                                'info_text' => $this->get_info_text(),
                                'location_code' => $this->get_location_code(),
                                'location_id' => $this->get_location_id(),

Modified: trunk/controller/inc/component/class.check_list_status_manager.inc.php
===================================================================
--- trunk/controller/inc/component/class.check_list_status_manager.inc.php      
2017-11-09 14:34:37 UTC (rev 17289)
+++ trunk/controller/inc/component/class.check_list_status_manager.inc.php      
2017-11-10 06:00:43 UTC (rev 17290)
@@ -103,6 +103,8 @@
                        
$check_list_status_info->set_control_id($this->check_list->get_control_id());
                        
$check_list_status_info->set_deadline_date_txt(date($dateformat, 
$this->check_list->get_deadline()));
                        
$check_list_status_info->set_deadline_date_ts($this->check_list->get_deadline());
+                       
$check_list_status_info->set_planned_date_ts($this->check_list->get_planned_date());
+                       
$check_list_status_info->set_completed_date_ts($this->check_list->get_completed_date());
                        
$check_list_status_info->set_original_deadline_date_ts($this->check_list->get_original_deadline());
                        $check_list_status_info->set_type($this->type);
 

Modified: trunk/controller/inc/component/class.year_calendar.inc.php
===================================================================
--- trunk/controller/inc/component/class.year_calendar.inc.php  2017-11-09 
14:34:37 UTC (rev 17289)
+++ trunk/controller/inc/component/class.year_calendar.inc.php  2017-11-10 
06:00:43 UTC (rev 17290)
@@ -97,6 +97,8 @@
                {
                        foreach ($check_lists_array as $check_list)
                        {
+                               $has_planned_date = FALSE;
+                               $has_completed_date = FALSE;
                                if (isset($this->control_relation['serie_id']) 
&& $check_list->get_serie_id() != $this->control_relation['serie_id'])
                                {
                                        continue;
@@ -106,16 +108,41 @@
                                $check_list_status_info = 
$check_list_status_manager->get_status_for_check_list();
 
                                $month_nr = date("n", 
$check_list_status_info->get_deadline_date_ts());
+                               
if($check_list_status_info->get_planned_date_ts() && 
$check_list_status_info->get_planned_date_ts() > 0)
+                               {
+                                       $month_nr_planned = date("n", 
$check_list_status_info->get_planned_date_ts());
+                                       $has_planned_date = TRUE;
+                               }
+                               
+                               
if($check_list_status_info->get_completed_date_ts() && 
$check_list_status_info->get_completed_date_ts() > 0)
+                               {
+                                       $has_completed_date = TRUE;
+                                       $month_nr_completed = date("n", 
$check_list_status_info->get_completed_date_ts());
+                               }
+                               var_dump('planned: ' . $month_nr_planned . 
'-completed: ' . $month_nr_completed . '->' . 
$check_list_status_info->get_completed_date_ts());
 
                                $repeat_type = $check_list->get_repeat_type();
                                //              if( 
!isset($this->calendar_array[ $month_nr ]) || $repeat_type > 
$this->calendar_array[ $month_nr ]['repeat_type'])
+                               if($has_completed_date)
                                {
+                                       
$this->calendar_array[$month_nr_completed]['repeat_type'] = $repeat_type;
+                                       
$this->calendar_array[$month_nr_completed]["status"] = 
$check_list_status_info->get_status();
+                                       
$this->calendar_array[$month_nr_completed]["info"] = 
$check_list_status_info->serialize();
+                               }
+                               else if($has_planned_date)
+                               {
+                                       
$this->calendar_array[$month_nr_planned]['repeat_type'] = $repeat_type;
+                                       
$this->calendar_array[$month_nr_planned]["status"] = 
$check_list_status_info->get_status();
+                                       
$this->calendar_array[$month_nr_planned]["info"] = 
$check_list_status_info->serialize();
+                               }
+                               else
+                               {
                                        
$this->calendar_array[$month_nr]['repeat_type'] = $repeat_type;
                                        
$this->calendar_array[$month_nr]["status"] = 
$check_list_status_info->get_status();
                                        
$this->calendar_array[$month_nr]["info"] = $check_list_status_info->serialize();
                                }
                        }
-                       //_debug_array($this->calendar_array);
+//                     _debug_array($this->calendar_array);
                        /*Insert code to remove controls with changed due-date 
from array*/
                        $m_cnt = 0;
                        $not_done_due_date;

Modified: trunk/controller/inc/model/class.check_list.inc.php
===================================================================
--- trunk/controller/inc/model/class.check_list.inc.php 2017-11-09 14:34:37 UTC 
(rev 17289)
+++ trunk/controller/inc/model/class.check_list.inc.php 2017-11-10 06:00:43 UTC 
(rev 17290)
@@ -398,7 +398,21 @@
                                $status = false;
                                $this->error_msg_array['deadline'] = 
"error_msg_1";
                        }
+                       
+                       //Validate PLANNED DATE against DEADLINE
+                       if ($this->planned_date > $this->deadline)
+                       {
+                               $status = false;
+                               $this->error_msg_array['planned_date'] = 
"error_msg_8";
+                       }
 
+                       //Validate COMPLETED DATE against DEADLINE
+                       if ($this->completed_date > $this->deadline)
+                       {
+                               $status = false;
+                               $this->error_msg_array['completed_date'] = 
"error_msg_9";
+                       }
+
                        // Validate connection to COMPONENT/LOCATION
                        if (empty($this->location_code) && 
empty($this->component_id))
                        {

Modified: trunk/controller/setup/phpgw_no.lang
===================================================================
--- trunk/controller/setup/phpgw_no.lang        2017-11-09 14:34:37 UTC (rev 
17289)
+++ trunk/controller/setup/phpgw_no.lang        2017-11-10 06:00:43 UTC (rev 
17290)
@@ -374,6 +374,8 @@
 error_msg_5    controller      no      Vennligst angi når kontrollen ble utført
 error_msg_6    controller      no      Kontrollen må være knyttet mot en 
komponent/lokasjon
 error_msg_7    controller      no      Vennligst endre status for kontroll 
eller angi planlagtdato
+error_msg_8    controller      no      Planlagtdato kan ikke være etter 
fristdato
+error_msg_9    controller      no      Utførtdato kan ikke være etter fristdato
 error_msg_no_controls_in_period        controller      no      Ingen 
kontroller for bygg i denne perioden
 error_msg_no_controls_for_component    controller      no      Ingen 
kontroller for komponent i denne perioden
 role at location       controller      no      Tildeling av rolle

Modified: trunk/controller/templates/base/check_list/add_check_list.xsl
===================================================================
--- trunk/controller/templates/base/check_list/add_check_list.xsl       
2017-11-09 14:34:37 UTC (rev 17289)
+++ trunk/controller/templates/base/check_list/add_check_list.xsl       
2017-11-10 06:00:43 UTC (rev 17290)
@@ -103,7 +103,8 @@
                                                        </div>
                                                </xsl:if>
                                                <label>Fristdato</label>
-                                               <input type="text" 
id="deadline_date" name="deadline_date" class="date" >
+                                               <xsl:value-of 
select="php:function('date', $date_format, number(check_list/deadline))"/>
+                                               <input type="hidden" 
id="deadline_date" name="deadline_date" >
                                                        <xsl:attribute 
name="value">
                                                                <xsl:value-of 
select="php:function('date', $date_format, number(check_list/deadline))"/>
                                                        </xsl:attribute>
@@ -116,6 +117,14 @@
                                        </div>
                                        <!-- PLANNED DATE -->
                                        <div class="row">
+                                               <xsl:if 
test="check_list/error_msg_array/planned_date != ''">
+                                                       <xsl:variable 
name="error_msg">
+                                                               <xsl:value-of 
select="check_list/error_msg_array/planned_date" />
+                                                       </xsl:variable>
+                                                       <div 
class='input_error_msg'>
+                                                               <xsl:value-of 
select="php:function('lang', $error_msg)" />
+                                                       </div>
+                                               </xsl:if>
                                                <label>Planlagt dato</label>
                                                <input type="text" 
id="planned_date" name="planned_date" class="date" readonly="readonly">
                                                        <xsl:if 
test="check_list/planned_date != 0 and check_list/planned_date != ''">

Modified: trunk/controller/templates/base/check_list/edit_check_list.xsl
===================================================================
--- trunk/controller/templates/base/check_list/edit_check_list.xsl      
2017-11-09 14:34:37 UTC (rev 17289)
+++ trunk/controller/templates/base/check_list/edit_check_list.xsl      
2017-11-10 06:00:43 UTC (rev 17290)
@@ -49,10 +49,8 @@
                        </div>
                        <div class="row">
                                <label>Skal utføres innen</label>
-                               <input class="date" readonly="readonly">
-                             <xsl:attribute 
name="id">deadline_date</xsl:attribute>
-                             <xsl:attribute 
name="name">deadline_date</xsl:attribute>
-                             <xsl:attribute name="type">text</xsl:attribute>
+                               <xsl:value-of select="php:function('date', 
$date_format, number(check_list/deadline))"/>
+                               <input id="deadline_date" name="deadline_date" 
type="hidden">
                              <xsl:if test="check_list/deadline != 0 or 
check_list/deadline != ''">
                                <xsl:attribute name="value"><xsl:value-of 
select="php:function('date', $date_format, 
number(check_list/deadline))"/></xsl:attribute>
                                  </xsl:if>
@@ -64,6 +62,14 @@
                                </input>
                        </div>
                        <div class="row">
+                               <xsl:if 
test="check_list/error_msg_array/planned_date != ''">
+                                       <xsl:variable name="error_msg">
+                                               <xsl:value-of 
select="check_list/error_msg_array/planned_date" />
+                                       </xsl:variable>
+                                       <div class='input_error_msg'>
+                                               <xsl:value-of 
select="php:function('lang', $error_msg)" />
+                                       </div>
+                               </xsl:if>
                                <label>Planlagt dato</label>
                                <input class="date" readonly="readonly">
                              <xsl:attribute 
name="id">planned_date</xsl:attribute>
@@ -75,6 +81,14 @@
                            </input>
                    </div>
                    <div class="row">
+                               <xsl:if 
test="check_list/error_msg_array/completed_date != ''">
+                                       <xsl:variable name="error_msg">
+                                               <xsl:value-of 
select="check_list/error_msg_array/completed_date" />
+                                       </xsl:variable>
+                                       <div class='input_error_msg'>
+                                               <xsl:value-of 
select="php:function('lang', $error_msg)" />
+                                       </div>
+                               </xsl:if>
                                <label>Utført dato</label>
                                <input class="date" >
                              <xsl:attribute 
name="id">completed_date</xsl:attribute>




reply via email to

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