Advanced customization: a stop watch can be started in the past (incident ticket created from an alarm)

SVN:trunk[3478]
This commit is contained in:
Romain Quetiez
2014-12-18 08:37:00 +00:00
parent b08de31b3c
commit ece152173f
2 changed files with 11 additions and 5 deletions

View File

@@ -330,7 +330,7 @@ class ormStopWatch
* It is the responsibility of the caller to compute the deadlines * It is the responsibility of the caller to compute the deadlines
* (to avoid computing twice for the same result) * (to avoid computing twice for the same result)
*/ */
public function Start($oObject, $oAttDef) public function Start($oObject, $oAttDef, $iNow = null)
{ {
if (!is_null($this->iLastStart)) if (!is_null($this->iLastStart))
{ {
@@ -338,11 +338,16 @@ class ormStopWatch
return false; return false;
} }
if (is_null($iNow))
{
$iNow = time();
}
if (is_null($this->iStarted)) if (is_null($this->iStarted))
{ {
$this->iStarted = time(); $this->iStarted = $iNow;
} }
$this->iLastStart = time(); $this->iLastStart = $iNow;
$this->iStopped = null; $this->iStopped = null;
return true; return true;

View File

@@ -1,4 +1,4 @@
iTop - version 2.1.0 - 16-Dec-2014 iTop - version 2.1.0 - 16-Dec-2014
Readme file Readme file
1. ABOUT THIS RELEASE 1. ABOUT THIS RELEASE
@@ -293,6 +293,8 @@ Extending the data model
User rights: deny on a parent class must give DENY even if the class is explicitely ALLOW on the same profile (that was already working if the rules are given on several profiles). Added a config flag to force the legacy algorithm (user_rights_legacy, defaulting to false) User rights: deny on a parent class must give DENY even if the class is explicitely ALLOW on the same profile (that was already working if the rules are given on several profiles). Added a config flag to force the legacy algorithm (user_rights_legacy, defaulting to false)
#1029 Got rid of tags <format> that were not used at all and that were really misleading extension developers #1029 Got rid of tags <format> that were not used at all and that were really misleading extension developers
#1032 When adding a case log, existing objects could not be displayed anymore! #1032 When adding a case log, existing objects could not be displayed anymore!
Advanced customization: a stop watch can be started in the past (incident ticket created from an alarm)
Improved the XML format, changing from 1.0 to 1.1 Improved the XML format, changing from 1.0 to 1.1
- The change is ascendant compatible (automatically converted into 1.1 by ModelFactory) and thus sould be transparent: could may leave your extensions unchanged if you do not need to benefit from the new format - The change is ascendant compatible (automatically converted into 1.1 by ModelFactory) and thus sould be transparent: could may leave your extensions unchanged if you do not need to benefit from the new format
@@ -302,7 +304,6 @@ Improved the XML format, changing from 1.0 to 1.1
- Added an id on the transitions to allow a finer granularity for the deltas. - Added an id on the transitions to allow a finer granularity for the deltas.
- Rework of the lifecycle/actions to ease the extensibility (Generic handlers replacing the specific ones: Rest, Copy, SetCurrentDate, SetCurrentUser, SetElapsedTime) - Rework of the lifecycle/actions to ease the extensibility (Generic handlers replacing the specific ones: Rest, Copy, SetCurrentDate, SetCurrentUser, SetElapsedTime)
Internals Internals
---------------------- ----------------------
Protected the property fields against the collision of ids within the same page (even if that is a bug, make it work not too bad!) Protected the property fields against the collision of ids within the same page (even if that is a bug, make it work not too bad!)