[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Fmsystem-commits] [13619] controller: status and configurable required
From: |
Sigurd Nes |
Subject: |
[Fmsystem-commits] [13619] controller: status and configurable required billing hours |
Date: |
Fri, 10 Jul 2015 07:47:49 +0000 |
Revision: 13619
http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=13619
Author: sigurdne
Date: 2015-07-10 07:47:43 +0000 (Fri, 10 Jul 2015)
Log Message:
-----------
controller: status and configurable required billing hours
Modified Paths:
--------------
trunk/controller/inc/class.socheck_list.inc.php
trunk/controller/inc/class.uicheck_list.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
trunk/controller/templates/base/config.tpl
Modified: trunk/controller/inc/class.socheck_list.inc.php
===================================================================
--- trunk/controller/inc/class.socheck_list.inc.php 2015-07-09 23:35:09 UTC
(rev 13618)
+++ trunk/controller/inc/class.socheck_list.inc.php 2015-07-10 07:47:43 UTC
(rev 13619)
@@ -820,15 +820,17 @@
function update($check_list)
{
$id = (int)$check_list->get_id();
-
+/*
$sql = "SELECT billable_hours FROM controller_check_list WHERE
controller_check_list.id = {$id}";
$this->db->query($sql);
$this->db->next_record();
$old_billable_hours = (float) $this->db->f('billable_hours');
+*/
+ $old_billable_hours = (float) $check_list->get_billable_hours();
- $billable_hours = $old_billable_hours +
$check_list->get_billable_hours();
+ $billable_hours = $old_billable_hours +
$check_list->get_delta_billable_hours();
//--------
$so_check_item = CreateObject('controller.socheck_item');
Modified: trunk/controller/inc/class.uicheck_list.inc.php
===================================================================
--- trunk/controller/inc/class.uicheck_list.inc.php 2015-07-09 23:35:09 UTC
(rev 13618)
+++ trunk/controller/inc/class.uicheck_list.inc.php 2015-07-10 07:47:43 UTC
(rev 13619)
@@ -326,6 +326,11 @@
);
}
+ $config = CreateObject('phpgwapi.config','controller');
+ $config->read();
+
+ $required_actual_hours =
isset($config->config_data['required_actual_hours']) &&
$config->config_data['required_actual_hours'] ?
$config->config_data['required_actual_hours'] : false;
+
$data = array
(
'user_list' => array('options' =>
$user_list_options),
@@ -340,7 +345,8 @@
'building_location_code' =>
$building_location_code,
'location_level' => $level,
'check_list_type' => 'add_check_list',
- 'serie_id' => $serie_id
+ 'serie_id' => $serie_id,
+ 'required_actual_hours' =>
$required_actual_hours
);
$GLOBALS['phpgw']->jqcal->add_listener('planned_date');
@@ -425,6 +431,11 @@
);
}
+ $config = CreateObject('phpgwapi.config','controller');
+ $config->read();
+
+ $required_actual_hours =
isset($config->config_data['required_actual_hours']) &&
$config->config_data['required_actual_hours'] ?
$config->config_data['required_actual_hours'] : false;
+
$data = array
(
'user_list' => array('options' =>
$user_list_options),
@@ -437,7 +448,8 @@
'current_year' => $year,
'current_month_nr' => $month,
'building_location_code' =>
$building_location_code,
- 'location_level' => $level
+ 'location_level' => $level,
+ 'required_actual_hours' =>
$required_actual_hours
);
$GLOBALS['phpgw']->jqcal->add_listener('planned_date');
@@ -482,6 +494,8 @@
$deadline_date_ts =
date_converter::date_to_timestamp($deadline_date);
+ $error = false;
+
if($planned_date != '')
{
$planned_date_ts =
date_converter::date_to_timestamp($planned_date);
@@ -520,6 +534,7 @@
$status =
controller_check_list::STATUS_NOT_DONE;
$completed_date_ts = 0;
$error_message = "Status kunne ikke
settes til utført - prøv igjen";
+ $error = true;
phpgwapi_cache::message_set($error_message, 'error');
}
@@ -539,17 +554,33 @@
}
}
- $check_list->set_status($status);
$check_list->set_comment($comment);
$check_list->set_deadline($deadline_date_ts);
$check_list->set_planned_date($planned_date_ts);
$check_list->set_completed_date($completed_date_ts);
$check_list->set_assigned_to($assigned_to);
- $check_list->set_billable_hours($billable_hours);
+ $config = CreateObject('phpgwapi.config','controller');
+ $config->read();
- if($check_list->validate())
+ $required_actual_hours =
isset($config->config_data['required_actual_hours']) &&
$config->config_data['required_actual_hours'] ?
$config->config_data['required_actual_hours'] : false;
+
+ 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 = true;
+ }
+ else
+ {
+
$check_list->set_delta_billable_hours($billable_hours);
+ }
+ if ( $this->_check_for_required($check_list) && !$error)
+ {
+ $check_list->set_status($status);
+ }
+
+ if(!$error && $check_list->validate())
+ {
$check_list_id = $this->so->store($check_list);
if($check_list_id > 0)
@@ -569,7 +600,17 @@
}
else
{
- $this->add_check_list($check_list);
+ $this->redirect(array('menuaction' =>
'controller.uicheck_list.add_check_list',
+ 'control_id' =>
$control_id,
+ 'location_id' =>
$location_id,
+ 'component_id' =>
$component_id,
+ 'serie_id'
=> $serie_id,
+ 'deadline_ts' =>
$deadline_date_ts,
+ 'type'
=> $type,
+ 'assigned_to' =>
$assigned_to,
+ 'status'
=> $status,
+ // 'billable_hours' =>
$billable_hours
+ ));
}
}
}
@@ -893,10 +934,22 @@
$check_list_id = phpgw::get_var('check_list_id');
$check_list_status = phpgw::get_var('status');
+ $check_list = $this->so->get_single($check_list_id);
- $check_list = $this->so->get_single($check_list_id);
- if ( !$this->_check_for_required($check_list) )
+//
+ $config = CreateObject('phpgwapi.config','controller');
+ $config->read();
+ $ok = true;
+
+ $required_actual_hours =
isset($config->config_data['required_actual_hours']) &&
$config->config_data['required_actual_hours'] ?
$config->config_data['required_actual_hours'] : false;
+ if($check_list_status ==
controller_check_list::STATUS_DONE && $required_actual_hours &&
$check_list->get_billable_hours() == 0)
{
+ phpgwapi_cache::message_set(lang("Please enter
billable hours"), 'error');
+ $ok = false;
+ }
+//
+ if ( !$this->_check_for_required($check_list) || !$ok)
+ {
$messages = phpgwapi_cache::message_get(true);
$message = '';
foreach($messages as $_type => $_message)
@@ -1058,6 +1111,17 @@
}
}
}
+ $config = CreateObject('phpgwapi.config','controller');
+ $config->read();
+
+ $required_actual_hours =
isset($config->config_data['required_actual_hours']) &&
$config->config_data['required_actual_hours'] ?
$config->config_data['required_actual_hours'] : false;
+
+ if($check_list->get_status ==
controller_check_list::STATUS_DONE && $required_actual_hours &&
$check_list->get_billable_hours() == 0)
+ {
+ phpgwapi_cache::message_set(lang("Please enter
billable hours"), 'error');
+ $ok = false;
+ }
+
return $ok;
}
}
Modified: trunk/controller/inc/model/class.check_list.inc.php
===================================================================
--- trunk/controller/inc/model/class.check_list.inc.php 2015-07-09 23:35:09 UTC
(rev 13618)
+++ trunk/controller/inc/model/class.check_list.inc.php 2015-07-10 07:47:43 UTC
(rev 13619)
@@ -56,6 +56,7 @@
protected $location_id;
protected $assigned_to;
protected $billable_hours;
+ protected $delta_billable_hours;
protected $control_area_id;
// Aggregate fields. Fields not in a table
@@ -268,11 +269,20 @@
{
$this->billable_hours = $billable_hours;
}
-
+
public function get_billable_hours()
{
return $this->billable_hours;
}
+ public function set_delta_billable_hours($delta_billable_hours)
+ {
+ $this->delta_billable_hours = $delta_billable_hours;
+ }
+
+ public function get_delta_billable_hours()
+ {
+ return (float)$this->delta_billable_hours;
+ }
public function serialize()
{
Modified: trunk/controller/setup/phpgw_no.lang
===================================================================
--- trunk/controller/setup/phpgw_no.lang 2015-07-09 23:35:09 UTC (rev
13618)
+++ trunk/controller/setup/phpgw_no.lang 2015-07-10 07:47:43 UTC (rev
13619)
@@ -1,3 +1,4 @@
+Please enter billable hours controller no Angi egne timer
my assigned controls controller no Mine kontroller
add case controller no Registrer sak
add ticket controller no Registrer melding
Modified: trunk/controller/templates/base/check_list/add_check_list.xsl
===================================================================
--- trunk/controller/templates/base/check_list/add_check_list.xsl
2015-07-09 23:35:09 UTC (rev 13618)
+++ trunk/controller/templates/base/check_list/add_check_list.xsl
2015-07-10 07:47:43 UTC (rev 13619)
@@ -153,6 +153,19 @@
<xsl:apply-templates
select="user_list/options"/>
</select>
</div>
+ <xsl:if test="required_actual_hours = 1">
+ <div class="row">
+ <label>Egne Timer</label>
+ <input class="date">
+ <xsl:attribute
name="id">billable_hours</xsl:attribute>
+ <xsl:attribute
name="name">billable_hours</xsl:attribute>
+ <xsl:attribute
name="type">text</xsl:attribute>
+ </input>
+ <xsl:text> </xsl:text>
+ <xsl:value-of
select="check_list/billable_hours"/>
+ </div>
+ </xsl:if>
+
<!-- COMMENT -->
<div class="comment">
<label>Kommentar</label>
Modified: trunk/controller/templates/base/check_list/edit_check_list.xsl
===================================================================
--- trunk/controller/templates/base/check_list/edit_check_list.xsl
2015-07-09 23:35:09 UTC (rev 13618)
+++ trunk/controller/templates/base/check_list/edit_check_list.xsl
2015-07-10 07:47:43 UTC (rev 13619)
@@ -93,17 +93,18 @@
<xsl:apply-templates
select="user_list/options"/>
</select>
</div>
- <div class="row">
- <label>Egne Timer</label>
- <input class="date">
- <xsl:attribute
name="id">billable_hours</xsl:attribute>
- <xsl:attribute
name="name">billable_hours</xsl:attribute>
- <xsl:attribute name="type">text</xsl:attribute>
- </input>
- <xsl:text> </xsl:text>
- <xsl:value-of
select="check_list/billable_hours"/>
- </div>
-
+ <xsl:if test="required_actual_hours = 1">
+ <div class="row">
+ <label>Egne Timer</label>
+ <input class="date">
+ <xsl:attribute
name="id">billable_hours</xsl:attribute>
+ <xsl:attribute
name="name">billable_hours</xsl:attribute>
+ <xsl:attribute
name="type">text</xsl:attribute>
+ </input>
+ <xsl:text> </xsl:text>
+ <xsl:value-of
select="check_list/billable_hours"/>
+ </div>
+ </xsl:if>
</fieldset>
<fieldset class="col_2">
<div class="row">
Modified: trunk/controller/templates/base/config.tpl
===================================================================
--- trunk/controller/templates/base/config.tpl 2015-07-09 23:35:09 UTC (rev
13618)
+++ trunk/controller/templates/base/config.tpl 2015-07-10 07:47:43 UTC (rev
13619)
@@ -23,18 +23,27 @@
</td>
</tr>
<tr class="row_off">
+ <td>{lang_required_actual_hours}.</td>
+ <td>
+ <select
name="newsettings[required_actual_hours]">
+ <option value=""
{selected_required_actual_hours_}>NO</option>
+ <option value="1"
{selected_required_actual_hours_1}>YES</option>
+ </select>
+ </td>
+ </tr>
+ <tr class="row_on">
<td>Antall planlagte kontroller som skal vises.</td>
<td>
<input type="text"
name="newsettings[no_of_planned_controls]"
value="{value_no_of_planned_controls}"/>
</td>
</tr>
- <tr class="row_on">
+ <tr class="row_off">
<td>Antall tildelte kontroller som skal vises</td>
<td>
<input type="text"
name="newsettings[no_of_assigned_controls]"
value="{value_no_of_assigned_controls}"/>
</td>
</tr>
- <tr class="row_off">
+ <tr class="row_on">
<td>{lang_document_category}:</td>
<td>
<!--to be able to blank the setting - need an empty value-->
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Fmsystem-commits] [13619] controller: status and configurable required billing hours,
Sigurd Nes <=