Переглянути джерело

#1022 Do cascade the resolution of an incident to its child requests + rework of the lifecycle/actions to ease the extensibility (New handlers: Rest, Copy, SetCurrentDate, SetCurrentUser, SetElapsedTime)

git-svn-id: http://svn.code.sf.net/p/itop/code/trunk@3423 a333f486-631f-4898-b8df-5754b55c2be0
romainq 10 роки тому
батько
коміт
2566ec00cc

+ 1 - 1
application/user.preferences.class.inc.php

@@ -130,7 +130,7 @@ class appUserPreferences extends DBObject
 	/**
 	 * Call this function if the user has changed (like when doing a logoff...)
 	 */
-	static public function Reset()
+	static public function ResetPreferences()
 	{
 		self::$oUserPrefs = null;
 	}

+ 69 - 2
core/dbobject.class.php

@@ -338,7 +338,7 @@ abstract class DBObject implements iDisplay
 		if ($sAttCode == 'finalclass')
 		{
 			// Ignore it - this attribute is set upon object creation and that's it
-			return;
+			return false;
 		}
 		
 		$oAttDef = MetaModel::GetAttributeDef(get_class($this), $sAttCode);
@@ -416,6 +416,9 @@ abstract class DBObject implements iDisplay
 
 		// Make sure we do not reload it anymore... before saving it
 		$this->RegisterAsDirty();
+
+		// This function is eligible as a lifecycle action: returning true upon success is a must
+		return true;
 	}
 
 	public function GetLabel($sAttCode)
@@ -2075,7 +2078,7 @@ abstract class DBObject implements iDisplay
 		{
 			if (is_string($actionHandler))
 			{
-				// Old (pre-2.0.4) action definition without any parameter
+				// Old (pre-2.1.0) action definition without any parameter
 				$aActionCallSpec = array($this, $sActionHandler);
 	
 				if (!is_callable($aActionCallSpec))
@@ -2183,6 +2186,70 @@ abstract class DBObject implements iDisplay
 		$this->Set($sAttCode, $oSW);
 	}	 	
 
+	/**
+	 * Lifecycle action: Recover the default value (aka when an object is being created)
+	 */	 	
+	public function Reset($sAttCode)
+	{
+		$oAttDef = MetaModel::GetAttributeDef(get_class($this), $sAttCode);
+		$this->Set($sAttCode, $oAttDef->GetDefaultValue());
+		return true;
+	}
+
+	/**
+	 * Lifecycle action: Copy an attribute to another
+	 */	 	
+	public function Copy($sDestAttCode, $sSourceAttCode)
+	{
+		$this->Set($sDestAttCode, $this->Get($sSourceAttCode));
+		return true;
+	}
+
+	/**
+	 * Lifecycle action: Set the current date/time for the given attribute
+	 */	 	
+	public function SetCurrentDate($sAttCode)
+	{
+		$this->Set($sAttCode, time());
+		return true;
+	}
+
+	/**
+	 * Lifecycle action: Set the current logged in user for the given attribute
+	 */	 	
+	public function SetCurrentUser($sAttCode)
+	{
+		$this->Set($sAttCode, UserRights::GetUserId());
+		return true;
+	}
+
+	/**
+	 * Lifecycle action: Set the time elapsed since a reference point
+	 */	 	
+	public function SetElapsedTime($sAttCode, $sRefAttCode, $sWorkingTimeComputer = null)
+	{
+		if (is_null($sWorkingTimeComputer))
+		{
+			$sWorkingTimeComputer = class_exists('SLAComputation') ? 'SLAComputation' : 'DefaultWorkingTimeComputer';
+		}
+		$oComputer = new $sWorkingTimeComputer();
+		$aCallSpec = array($oComputer, 'GetOpenDuration');
+		if (!is_callable($aCallSpec))
+		{
+			throw new CoreException("Unknown class/verb '$sWorkingTimeComputer/GetOpenDuration'");
+		}
+
+		$iStartTime = AttributeDateTime::GetAsUnixSeconds($this->Get($sRefAttCode));
+		$oStartDate = new DateTime('@'.$iStartTime); // setTimestamp not available in PHP 5.2
+		$oEndDate = new DateTime(); // now
+		$iElapsed = call_user_func($aCallSpec, $this, $oStartDate, $oEndDate);
+
+		$this->Set($sAttCode, $iElapsed);
+		return true;
+	}
+
+
+
 	/*
 	* Create query parameters (SELECT ... WHERE service = :this->service_id)
 	* to be used with the APIs DBObjectSearch/DBObjectSet

+ 1 - 1
core/ormstopwatch.class.inc.php

@@ -478,7 +478,7 @@ class CheckStopWatchThresholds implements iBackgroundProcess
 								{
 									if (is_string($def))
 									{
-										// Old method (pre-2.0.4) non typed parameters
+										// Old method (pre-2.1.0) non typed parameters
 										$aValues[] = $def;
 									}
 									else // if(is_array($def))

+ 44 - 9
datamodels/2.x/itop-change-mgmt-itil/datamodel.itop-change-mgmt-itil.xml

@@ -902,6 +902,10 @@
       </lifecycle>
       <methods>
         <method id="SetClosureDate">
+          <comment><![CDATA[/**
+	 * To be deprecated: use SetCurrentDate() instead
+	 * @return void
+	 */]]></comment>
           <static>false</static>
           <access>public</access>
           <type>StimulusUserAction</type>
@@ -912,6 +916,10 @@
 	}]]></code>
         </method>
         <method id="ResetRejectReason">
+          <comment><![CDATA[/**
+	 * To be deprecated: use SetCurrentDate() instead
+	 * @return void
+	 */]]></comment>
           <static>false</static>
           <access>public</access>
           <type>LifecycleAction</type>
@@ -1679,7 +1687,10 @@
                 <target>closed</target>
                 <actions>
                   <action>
-                    <verb>SetClosureDate</verb>
+                    <verb>SetCurrentDate</verb>
+                    <params>
+                      <param xsi:type="string">close_date</param>
+                    </params>
                   </action>
                 </actions>
               </transition>
@@ -1713,7 +1724,10 @@
                 <target>closed</target>
                 <actions>
                   <action>
-                    <verb>SetClosureDate</verb>
+                    <verb>SetCurrentDate</verb>
+                    <params>
+                      <param xsi:type="string">close_date</param>
+                    </params>
                   </action>
                 </actions>
               </transition>
@@ -3099,7 +3113,10 @@
                 <target>validated</target>
                 <actions>
                   <action>
-                    <verb>ResetRejectReason</verb>
+                    <verb>Reset</verb>
+                    <params>
+                      <param xsi:type="string">reason</param>
+                    </params>
                   </action>
                 </actions>
               </transition>
@@ -3236,7 +3253,10 @@
                 <target>approved</target>
                 <actions>
                   <action>
-                    <verb>ResetRejectReason</verb>
+                    <verb>Reset</verb>
+                    <params>
+                      <param xsi:type="string">reason</param>
+                    </params>
                   </action>
                 </actions>
               </transition>
@@ -3336,7 +3356,10 @@
                 <target>closed</target>
                 <actions>
                   <action>
-                    <verb>SetClosureDate</verb>
+                    <verb>SetCurrentDate</verb>
+                    <params>
+                      <param xsi:type="string">close_date</param>
+                    </params>
                   </action>
                 </actions>
               </transition>
@@ -3369,7 +3392,10 @@
                 <target>closed</target>
                 <actions>
                   <action>
-                    <verb>SetClosureDate</verb>
+                    <verb>SetCurrentDate</verb>
+                    <params>
+                      <param xsi:type="string">close_date</param>
+                    </params>
                   </action>
                 </actions>
               </transition>
@@ -3985,7 +4011,10 @@
                 <target>approved</target>
                 <actions>
                   <action>
-                    <verb>ResetRejectReason</verb>
+                    <verb>Reset</verb>
+                    <params>
+                      <param xsi:type="string">reason</param>
+                    </params>
                   </action>
                 </actions>
               </transition>
@@ -4085,7 +4114,10 @@
                 <target>closed</target>
                 <actions>
                   <action>
-                    <verb>SetClosureDate</verb>
+                    <verb>SetCurrentDate</verb>
+                    <params>
+                      <param xsi:type="string">close_date</param>
+                    </params>
                   </action>
                 </actions>
               </transition>
@@ -4119,7 +4151,10 @@
                 <target>closed</target>
                 <actions>
                   <action>
-                    <verb>SetClosureDate</verb>
+                    <verb>SetCurrentDate</verb>
+                    <params>
+                      <param xsi:type="string">close_date</param>
+                    </params>
                   </action>
                 </actions>
               </transition>

+ 24 - 3
datamodels/2.x/itop-change-mgmt/datamodel.itop-change-mgmt.xml

@@ -280,10 +280,16 @@
                 <target>approved</target>
                 <actions>
                   <action>
-                    <verb>SetApprovalDate</verb>
+                    <verb>SetCurrentDate</verb>
+                    <params>
+                      <param xsi:type="string">approval_date</param>
+                    </params>
                   </action>
                   <action>
-                    <verb>ResetRejectReason</verb>
+                    <verb>Reset</verb>
+                    <params>
+                      <param xsi:type="string">reject_reason</param>
+                    </params>
                   </action>
                 </actions>
               </transition>
@@ -408,7 +414,10 @@
                 <target>closed</target>
                 <actions>
                   <action>
-                    <verb>SetClosureDate</verb>
+                    <verb>SetCurrentDate</verb>
+                    <params>
+                      <param xsi:type="string">close_date</param>
+                    </params>
                   </action>
                 </actions>
               </transition>
@@ -445,6 +454,10 @@
       </lifecycle>
       <methods>
         <method id="SetApprovalDate">
+          <comment><![CDATA[/**
+	 * To be deprecated: use SetCurrentDate() instead
+	 * @return void
+	 */]]></comment>
           <static>false</static>
           <access>public</access>
           <type>LifecycleAction</type>
@@ -455,6 +468,10 @@
 	}]]></code>
         </method>
         <method id="ResetRejectReason">
+          <comment><![CDATA[/**
+	 * To be deprecated: use SetCurrentDate() instead
+	 * @return void
+	 */]]></comment>
           <static>false</static>
           <access>public</access>
           <type>LifecycleAction</type>
@@ -465,6 +482,10 @@
 	}]]></code>
         </method>
         <method id="SetClosureDate">
+          <comment><![CDATA[/**
+	 * To be deprecated: use SetCurrentDate() instead
+	 * @return void
+	 */]]></comment>
           <static>false</static>
           <access>public</access>
           <type>LifecycleAction</type>

+ 193 - 27
datamodels/2.x/itop-incident-mgmt-itil/datamodel.itop-incident-mgmt-itil.xml

@@ -485,7 +485,10 @@
                 <target>assigned</target>
                 <actions>
                   <action>
-                    <verb>SetAssignedDate</verb>
+                    <verb>SetCurrentDate</verb>
+                    <params>
+                      <param xsi:type="string">assignment_date</param>
+                    </params>
                   </action>
                 </actions>
               </transition>
@@ -497,10 +500,22 @@
                 <target>resolved</target>
                 <actions>
                   <action>
-                    <verb>SetResolveDate</verb>
+                    <verb>SetCurrentDate</verb>
+                    <params>
+                      <param xsi:type="string">resolution_date</param>
+                    </params>
+                  </action>
+                  <action>
+                    <verb>SetElapsedTime</verb>
+                    <params>
+                      <param xsi:type="string">time_spent</param>
+                      <param xsi:type="string">start_date</param>
+                      <param xsi:type="string">DefaultWorkingTimeComputer</param>
+                    </params>
                   </action>
                   <action>
-                    <verb>resolveChilds</verb>
+                    <verb>ResolveChildTickets</verb>
+                    <params/>
                   </action>
                 </actions>
               </transition>
@@ -560,7 +575,10 @@
                 <target>pending</target>
                 <actions>
                   <action>
-                    <verb>SetLastPendingDate</verb>
+                    <verb>SetCurrentDate</verb>
+                    <params>
+                      <param xsi:type="string">last_pending_date</param>
+                    </params>
                   </action>
                 </actions>
               </transition>
@@ -568,10 +586,22 @@
                 <target>resolved</target>
                 <actions>
                   <action>
-                    <verb>SetResolveDate</verb>
+                    <verb>SetCurrentDate</verb>
+                    <params>
+                      <param xsi:type="string">resolution_date</param>
+                    </params>
+                  </action>
+                  <action>
+                    <verb>SetElapsedTime</verb>
+                    <params>
+                      <param xsi:type="string">time_spent</param>
+                      <param xsi:type="string">start_date</param>
+                      <param xsi:type="string">DefaultWorkingTimeComputer</param>
+                    </params>
                   </action>
                   <action>
-                    <verb>resolveChilds</verb>
+                    <verb>ResolveChildTickets</verb>
+                    <params/>
                   </action>
                 </actions>
               </transition>
@@ -587,10 +617,22 @@
                 <target>resolved</target>
                 <actions>
                   <action>
-                    <verb>SetResolveDate</verb>
+                    <verb>SetCurrentDate</verb>
+                    <params>
+                      <param xsi:type="string">resolution_date</param>
+                    </params>
                   </action>
                   <action>
-                    <verb>resolveChilds</verb>
+                    <verb>SetElapsedTime</verb>
+                    <params>
+                      <param xsi:type="string">time_spent</param>
+                      <param xsi:type="string">start_date</param>
+                      <param xsi:type="string">DefaultWorkingTimeComputer</param>
+                    </params>
+                  </action>
+                  <action>
+                    <verb>ResolveChildTickets</verb>
+                    <params/>
                   </action>
                 </actions>
               </transition>
@@ -607,7 +649,10 @@
                 <target>pending</target>
                 <actions>
                   <action>
-                    <verb>SetLastPendingDate</verb>
+                    <verb>SetCurrentDate</verb>
+                    <params>
+                      <param xsi:type="string">last_pending_date</param>
+                    </params>
                   </action>
                 </actions>
               </transition>
@@ -615,10 +660,22 @@
                 <target>resolved</target>
                 <actions>
                   <action>
-                    <verb>SetResolveDate</verb>
+                    <verb>SetCurrentDate</verb>
+                    <params>
+                      <param xsi:type="string">resolution_date</param>
+                    </params>
                   </action>
                   <action>
-                    <verb>resolveChilds</verb>
+                    <verb>SetElapsedTime</verb>
+                    <params>
+                      <param xsi:type="string">time_spent</param>
+                      <param xsi:type="string">start_date</param>
+                      <param xsi:type="string">DefaultWorkingTimeComputer</param>
+                    </params>
+                  </action>
+                  <action>
+                    <verb>ResolveChildTickets</verb>
+                    <params/>
                   </action>
                 </actions>
               </transition>
@@ -630,10 +687,22 @@
                 <target>resolved</target>
                 <actions>
                   <action>
-                    <verb>SetResolveDate</verb>
+                    <verb>SetCurrentDate</verb>
+                    <params>
+                      <param xsi:type="string">resolution_date</param>
+                    </params>
+                  </action>
+                  <action>
+                    <verb>SetElapsedTime</verb>
+                    <params>
+                      <param xsi:type="string">time_spent</param>
+                      <param xsi:type="string">start_date</param>
+                      <param xsi:type="string">DefaultWorkingTimeComputer</param>
+                    </params>
                   </action>
                   <action>
-                    <verb>resolveChilds</verb>
+                    <verb>ResolveChildTickets</verb>
+                    <params/>
                   </action>
                 </actions>
               </transition>
@@ -669,10 +738,22 @@
                 <target>resolved</target>
                 <actions>
                   <action>
-                    <verb>SetResolveDate</verb>
+                    <verb>SetCurrentDate</verb>
+                    <params>
+                      <param xsi:type="string">resolution_date</param>
+                    </params>
+                  </action>
+                  <action>
+                    <verb>SetElapsedTime</verb>
+                    <params>
+                      <param xsi:type="string">time_spent</param>
+                      <param xsi:type="string">start_date</param>
+                      <param xsi:type="string">DefaultWorkingTimeComputer</param>
+                    </params>
                   </action>
                   <action>
-                    <verb>resolveChilds</verb>
+                    <verb>ResolveChildTickets</verb>
+                    <params/>
                   </action>
                 </actions>
               </transition>
@@ -766,7 +847,10 @@
                 <target>closed</target>
                 <actions>
                   <action>
-                    <verb>SetClosureDate</verb>
+                    <verb>SetCurrentDate</verb>
+                    <params>
+                      <param xsi:type="string">close_date</param>
+                    </params>
                   </action>
                 </actions>
               </transition>
@@ -779,10 +863,22 @@
                 <target>resolved</target>
                 <actions>
                   <action>
-                    <verb>SetResolveDate</verb>
+                    <verb>SetCurrentDate</verb>
+                    <params>
+                      <param xsi:type="string">resolution_date</param>
+                    </params>
+                  </action>
+                  <action>
+                    <verb>SetElapsedTime</verb>
+                    <params>
+                      <param xsi:type="string">time_spent</param>
+                      <param xsi:type="string">start_date</param>
+                      <param xsi:type="string">DefaultWorkingTimeComputer</param>
+                    </params>
                   </action>
                   <action>
-                    <verb>resolveChilds</verb>
+                    <verb>ResolveChildTickets</verb>
+                    <params/>
                   </action>
                 </actions>
               </transition>
@@ -838,6 +934,10 @@
       </lifecycle>
       <methods>
         <method id="SetAssignedDate">
+          <comment><![CDATA[/**
+	 * To be deprecated: use SetCurrentDate() instead
+	 * @return void
+	 */]]></comment>
           <static>false</static>
           <access>public</access>
           <type>LifecycleAction</type>
@@ -848,6 +948,10 @@
 	}]]></code>
         </method>
         <method id="SetLastPendingDate">
+          <comment><![CDATA[/**
+	 * To be deprecated: use SetCurrentDate() instead
+	 * @return void
+	 */]]></comment>
           <static>false</static>
           <access>public</access>
           <type>LifecycleAction</type>
@@ -858,6 +962,10 @@
 	}]]></code>
         </method>
         <method id="SetResolveDate">
+          <comment><![CDATA[/**
+	 * To be deprecated: use SetCurrentDate() and SetElapsedTime() instead
+	 * @return void
+	 */]]></comment>
           <static>false</static>
           <access>public</access>
           <type>LifecycleAction</type>
@@ -870,6 +978,10 @@
 	}]]></code>
         </method>
         <method id="SetClosureDate">
+          <comment><![CDATA[/**
+	 * To be deprecated: use SetCurrentDate() instead
+	 * @return void
+	 */]]></comment>
           <static>false</static>
           <access>public</access>
           <type>LifecycleAction</type>
@@ -973,20 +1085,17 @@
 	}]]></code>
         </method>
         <method id="resolveChilds">
+          <comment><![CDATA[/**
+	 * To be deprecated: use ResolveChildTickets() instead
+	 */]]></comment>
           <static>false</static>
           <access>public</access>
           <type>LifecycleAction</type>
           <code><![CDATA[	public function resolveChilds($sStimulusCode)
 	{
-				
-		$oMyChange = MetaModel::NewObject("CMDBChange");
-		$oMyChange->Set("date", time());
-		$sUserString = CMDBChange::GetCurrentUserName();
-		$oMyChange->Set("userinfo", $sUserString."(automatic resolution)");
-		$iChangeId = $oMyChange->DBInsert();
         if (MetaModel::IsValidClass('UserRequest'))
         {
-    		$sOQL = "SELECT UserRequest WHERE parent_request_id=:ticket";
+    		$sOQL = "SELECT UserRequest WHERE parent_incident_id=:ticket";
     		$oChildRequestSet = new DBObjectSet(DBObjectSearch::FromOQL($sOQL),
     						array(),
     						array(
@@ -1005,7 +1114,7 @@
     				$oRequest->set('resolution_code',$this->Get('resolution_code'));
     				$oRequest->set('solution','Automatically resolved by incident:[[Incident:'.$this->Get('ref').']]');
     				$oRequest->ApplyStimulus('ev_autoresolve');
-    				$oRequest->DBUpdateTracked($oMyChange);
+    				$oRequest->DBUpdate();
     			}
     		}
         }
@@ -1029,13 +1138,70 @@
 				$oIncident->set('resolution_code',$this->Get('resolution_code'));
 				$oIncident->set('solution','Automatically resolved by incident:[[Incident:'.$this->Get('ref').']]');
 				$oIncident->ApplyStimulus('ev_autoresolve');
-				$oIncident->DBUpdateTracked($oMyChange);
+				$oIncident->DBUpdate();
 			}
 		}
 		return true;
 
 	}]]></code>
         </method>
+        <method id="ResolveChildTickets">
+          <comment><![CDATA[/**
+	 * Cascade the resolution to child User Request and Incidents
+	 * @return true (returning false would stop the ongoing transition)
+	 */]]></comment>
+          <static>false</static>
+          <access>public</access>
+          <type>LifecycleAction</type>
+          <arguments>
+          </arguments>
+          <code><![CDATA[	public function ResolveChildTickets()
+	{
+		if (MetaModel::IsValidClass('UserRequest'))
+		{
+			// Automatically resolve child requests
+			$sOQL = "SELECT UserRequest WHERE parent_incident_id = :ticket AND status != 'resolved'";
+			$oChildRequestSet = new DBObjectSet(DBObjectSearch::FromOQL($sOQL), array(), array('ticket' => $this->GetKey()));
+			while($oRequest = $oChildRequestSet->Fetch())
+			{
+				$oRequest->ResolveFrom($this);
+			}
+		}
+
+		// Automatically resolve child incidents
+		$sOQL = "SELECT Incident WHERE parent_incident_id = :ticket AND status != 'resolved'";
+		$oChildIncidentSet = new DBObjectSet(DBObjectSearch::FromOQL($sOQL), array(), array('ticket' => $this->GetKey()));
+		while($oIncident = $oChildIncidentSet->Fetch())
+		{
+			$oIncident->ResolveFrom($this);
+		}
+		return true;
+	}]]></code>
+        </method>
+         <method id="ResolveFrom">
+          <comment><![CDATA[/**
+	 * Resolve the ticket from another resolved ticket
+	 * @return void
+	 */]]></comment>
+          <static>false</static>
+          <access>public</access>
+          <type>Internal</type>
+          <code><![CDATA[	public function ResolveFrom($oParentTicket)
+	{
+		if ($this->Get('status') != 'resolved')
+		{
+			$this->Set('servicesubcategory_id', $oParentTicket->Get('servicesubcategory_id'));
+			$this->Set('service_id', $oParentTicket->Get('service_id'));		
+			$this->Set('team_id', $oParentTicket->Get('team_id'));
+			$this->Set('agent_id', $oParentTicket->Get('agent_id'));	
+			$this->Set('resolution_code', $oParentTicket->Get('resolution_code'));
+			$sParent = '[['.get_class($oParentTicket).':'.$oParentTicket->Get('ref').']]';
+			$this->Set('solution', Dict::Format('Tickets:ResolvedFrom', $sParent, MetaModel::GetName(get_class($oParentTicket))));
+			$this->ApplyStimulus('ev_autoresolve');
+			$this->DBUpdate();
+		}
+	}]]></code>
+        </method>
         <method id="UpdateChildRequestLog">
           <static>false</static>
           <access>public</access>

+ 20 - 2
datamodels/2.x/itop-problem-mgmt/datamodel.itop-problem-mgmt.xml

@@ -259,7 +259,10 @@
                 <target>resolved</target>
                 <actions>
                   <action>
-                    <verb>SetResolveDate</verb>
+                    <verb>SetCurrentDate</verb>
+                    <params>
+                      <param xsi:type="string">resolution_date</param>
+                    </params>
                   </action>
                 </actions>
               </transition>
@@ -311,7 +314,10 @@
                 <target>closed</target>
                 <actions>
                   <action>
-                    <verb>SetClosureDate</verb>
+                    <verb>SetCurrentDate</verb>
+                    <params>
+                      <param xsi:type="string">close_date</param>
+                    </params>
                   </action>
                 </actions>
               </transition>
@@ -345,6 +351,10 @@
       </lifecycle>
       <methods>
         <method id="SetAssignedDate">
+          <comment><![CDATA[/**
+	 * To be deprecated: use SetCurrentDate() instead
+	 * @return void
+	 */]]></comment>
           <static>false</static>
           <access>public</access>
           <type>LifecycleAction</type>
@@ -355,6 +365,10 @@
         }]]></code>
         </method>
         <method id="SetResolveDate">
+          <comment><![CDATA[/**
+	 * To be deprecated: use SetCurrentDate() instead
+	 * @return void
+	 */]]></comment>
           <static>false</static>
           <access>public</access>
           <type>LifecycleAction</type>
@@ -365,6 +379,10 @@
         }]]></code>
         </method>
         <method id="SetClosureDate">
+          <comment><![CDATA[/**
+	 * To be deprecated: use SetCurrentDate() instead
+	 * @return void
+	 */]]></comment>
           <static>false</static>
           <access>public</access>
           <type>LifecycleAction</type>

+ 205 - 22
datamodels/2.x/itop-request-mgmt-itil/datamodel.itop-request-mgmt-itil.xml

@@ -509,7 +509,10 @@
                 <target>assigned</target>
                 <actions>
                   <action>
-                    <verb>SetAssignedDate</verb>
+                    <verb>SetCurrentDate</verb>
+                    <params>
+                      <param xsi:type="string">assignment_date</param>
+                    </params>
                   </action>
                 </actions>
               </transition>
@@ -525,10 +528,22 @@
                 <target>resolved</target>
                 <actions>
                   <action>
-                    <verb>SetResolveDate</verb>
+                    <verb>SetCurrentDate</verb>
+                    <params>
+                      <param xsi:type="string">resolution_date</param>
+                    </params>
                   </action>
                   <action>
-                    <verb>resolveChilds</verb>
+                    <verb>SetElapsedTime</verb>
+                    <params>
+                      <param xsi:type="string">time_spent</param>
+                      <param xsi:type="string">start_date</param>
+                      <param xsi:type="string">DefaultWorkingTimeComputer</param>
+                    </params>
+                  </action>
+                  <action>
+                    <verb>ResolveChildTickets</verb>
+                    <params/>
                   </action>
                 </actions>
               </transition>
@@ -547,7 +562,10 @@
                 <target>assigned</target>
                 <actions>
                   <action>
-                    <verb>SetAssignedDate</verb>
+                    <verb>SetCurrentDate</verb>
+                    <params>
+                      <param xsi:type="string">assignment_date</param>
+                    </params>
                   </action>
                 </actions>
               </transition>
@@ -591,7 +609,10 @@
                 <target>pending</target>
                 <actions>
                   <action>
-                    <verb>SetLastPendingDate</verb>
+                    <verb>SetCurrentDate</verb>
+                    <params>
+                      <param xsi:type="string">last_pending_date</param>
+                    </params>
                   </action>
                 </actions>
               </transition>
@@ -599,10 +620,22 @@
                 <target>resolved</target>
                 <actions>
                   <action>
-                    <verb>SetResolveDate</verb>
+                    <verb>SetCurrentDate</verb>
+                    <params>
+                      <param xsi:type="string">resolution_date</param>
+                    </params>
                   </action>
                   <action>
-                    <verb>resolveChilds</verb>
+                    <verb>SetElapsedTime</verb>
+                    <params>
+                      <param xsi:type="string">time_spent</param>
+                      <param xsi:type="string">start_date</param>
+                      <param xsi:type="string">DefaultWorkingTimeComputer</param>
+                    </params>
+                  </action>
+                  <action>
+                    <verb>ResolveChildTickets</verb>
+                    <params/>
                   </action>
                 </actions>
               </transition>
@@ -618,10 +651,22 @@
                 <target>resolved</target>
                 <actions>
                   <action>
-                    <verb>SetResolveDate</verb>
+                    <verb>SetCurrentDate</verb>
+                    <params>
+                      <param xsi:type="string">resolution_date</param>
+                    </params>
                   </action>
                   <action>
-                    <verb>resolveChilds</verb>
+                    <verb>SetElapsedTime</verb>
+                    <params>
+                      <param xsi:type="string">time_spent</param>
+                      <param xsi:type="string">start_date</param>
+                      <param xsi:type="string">DefaultWorkingTimeComputer</param>
+                    </params>
+                  </action>
+                  <action>
+                    <verb>ResolveChildTickets</verb>
+                    <params/>
                   </action>
                 </actions>
               </transition>
@@ -638,7 +683,10 @@
                 <target>pending</target>
                 <actions>
                   <action>
-                    <verb>SetLastPendingDate</verb>
+                    <verb>SetCurrentDate</verb>
+                    <params>
+                      <param xsi:type="string">last_pending_date</param>
+                    </params>
                   </action>
                 </actions>
               </transition>
@@ -646,10 +694,22 @@
                 <target>resolved</target>
                 <actions>
                   <action>
-                    <verb>SetResolveDate</verb>
+                    <verb>SetCurrentDate</verb>
+                    <params>
+                      <param xsi:type="string">resolution_date</param>
+                    </params>
+                  </action>
+                  <action>
+                    <verb>SetElapsedTime</verb>
+                    <params>
+                      <param xsi:type="string">time_spent</param>
+                      <param xsi:type="string">start_date</param>
+                      <param xsi:type="string">DefaultWorkingTimeComputer</param>
+                    </params>
                   </action>
                   <action>
-                    <verb>resolveChilds</verb>
+                    <verb>ResolveChildTickets</verb>
+                    <params/>
                   </action>
                 </actions>
               </transition>
@@ -661,10 +721,22 @@
                 <target>resolved</target>
                 <actions>
                   <action>
-                    <verb>SetResolveDate</verb>
+                    <verb>SetCurrentDate</verb>
+                    <params>
+                      <param xsi:type="string">resolution_date</param>
+                    </params>
                   </action>
                   <action>
-                    <verb>resolveChilds</verb>
+                    <verb>SetElapsedTime</verb>
+                    <params>
+                      <param xsi:type="string">time_spent</param>
+                      <param xsi:type="string">start_date</param>
+                      <param xsi:type="string">DefaultWorkingTimeComputer</param>
+                    </params>
+                  </action>
+                  <action>
+                    <verb>ResolveChildTickets</verb>
+                    <params/>
                   </action>
                 </actions>
               </transition>
@@ -705,7 +777,10 @@
                 <target>assigned</target>
                 <actions>
                   <action>
-                    <verb>SetAssignedDate</verb>
+                    <verb>SetCurrentDate</verb>
+                    <params>
+                      <param xsi:type="string">assignment_date</param>
+                    </params>
                   </action>
                 </actions>
               </transition>
@@ -713,10 +788,22 @@
                 <target>resolved</target>
                 <actions>
                   <action>
-                    <verb>SetResolveDate</verb>
+                    <verb>SetCurrentDate</verb>
+                    <params>
+                      <param xsi:type="string">resolution_date</param>
+                    </params>
+                  </action>
+                  <action>
+                    <verb>SetElapsedTime</verb>
+                    <params>
+                      <param xsi:type="string">time_spent</param>
+                      <param xsi:type="string">start_date</param>
+                      <param xsi:type="string">DefaultWorkingTimeComputer</param>
+                    </params>
                   </action>
                   <action>
-                    <verb>resolveChilds</verb>
+                    <verb>ResolveChildTickets</verb>
+                    <params/>
                   </action>
                 </actions>
               </transition>
@@ -761,10 +848,22 @@
                 <target>resolved</target>
                 <actions>
                   <action>
-                    <verb>SetResolveDate</verb>
+                    <verb>SetCurrentDate</verb>
+                    <params>
+                      <param xsi:type="string">resolution_date</param>
+                    </params>
+                  </action>
+                  <action>
+                    <verb>SetElapsedTime</verb>
+                    <params>
+                      <param xsi:type="string">time_spent</param>
+                      <param xsi:type="string">start_date</param>
+                      <param xsi:type="string">DefaultWorkingTimeComputer</param>
+                    </params>
                   </action>
                   <action>
-                    <verb>resolveChilds</verb>
+                    <verb>ResolveChildTickets</verb>
+                    <params/>
                   </action>
                 </actions>
               </transition>
@@ -857,7 +956,10 @@
                 <target>closed</target>
                 <actions>
                   <action>
-                    <verb>SetClosureDate</verb>
+                    <verb>SetCurrentDate</verb>
+                    <params>
+                      <param xsi:type="string">close_date</param>
+                    </params>
                   </action>
                 </actions>
               </transition>
@@ -870,10 +972,22 @@
                 <target>resolved</target>
                 <actions>
                   <action>
-                    <verb>SetResolveDate</verb>
+                    <verb>SetCurrentDate</verb>
+                    <params>
+                      <param xsi:type="string">resolution_date</param>
+                    </params>
+                  </action>
+                  <action>
+                    <verb>SetElapsedTime</verb>
+                    <params>
+                      <param xsi:type="string">time_spent</param>
+                      <param xsi:type="string">start_date</param>
+                      <param xsi:type="string">DefaultWorkingTimeComputer</param>
+                    </params>
                   </action>
                   <action>
-                    <verb>resolveChilds</verb>
+                    <verb>ResolveChildTickets</verb>
+                    <params/>
                   </action>
                 </actions>
               </transition>
@@ -929,6 +1043,10 @@
       </lifecycle>
       <methods>
         <method id="SetAssignedDate">
+          <comment><![CDATA[/**
+	 * To be deprecated: use SetCurrentDate() instead
+	 * @return void
+	 */]]></comment>
           <static>false</static>
           <access>public</access>
           <type>LifecycleAction</type>
@@ -939,6 +1057,10 @@
 	}]]></code>
         </method>
         <method id="SetLastPendingDate">
+          <comment><![CDATA[/**
+	 * To be deprecated: use SetCurrentDate() instead
+	 * @return void
+	 */]]></comment>
           <static>false</static>
           <access>public</access>
           <type>LifecycleAction</type>
@@ -949,6 +1071,10 @@
 	}]]></code>
         </method>
         <method id="SetResolveDate">
+          <comment><![CDATA[/**
+	 * To be deprecated: use SetCurrentDate() and SetElapsedTime() instead
+	 * @return void
+	 */]]></comment>
           <static>false</static>
           <access>public</access>
           <type>LifecycleAction</type>
@@ -961,6 +1087,10 @@
 	}]]></code>
         </method>
         <method id="SetClosureDate">
+          <comment><![CDATA[/**
+	 * To be deprecated: use SetCurrentDate() instead
+	 * @return void
+	 */]]></comment>
           <static>false</static>
           <access>public</access>
           <type>LifecycleAction</type>
@@ -971,6 +1101,10 @@
 	}]]></code>
         </method>
         <method id="SetApprover">
+          <comment><![CDATA[/**
+	 * To be deprecated: use SetCurrentUser() instead
+	 * @return void
+	 */]]></comment>
           <static>false</static>
           <access>public</access>
           <type>LifecycleAction</type>
@@ -1075,6 +1209,9 @@
 	}]]></code>
         </method>
         <method id="resolveChilds">
+          <comment><![CDATA[/**
+	 * To be deprecated: use ResolveChildTickets() instead
+	 */]]></comment>
           <static>false</static>
           <access>public</access>
           <type>LifecycleAction</type>
@@ -1106,6 +1243,52 @@
 
 	}]]></code>
         </method>
+        <method id="ResolveChildTickets">
+          <comment><![CDATA[/**
+	 * Cascade the resolution to child User Request
+	 * @return true (returning false would stop the ongoing transition)
+	 */]]></comment>
+          <static>false</static>
+          <access>public</access>
+          <type>LifecycleAction</type>
+          <arguments>
+          </arguments>
+          <code><![CDATA[	public function ResolveChildTickets()
+	{
+		// Automatically resolve child requests
+		$sOQL = "SELECT UserRequest WHERE parent_request_id = :ticket AND status != 'resolved'";
+		$oChildRequestSet = new DBObjectSet(DBObjectSearch::FromOQL($sOQL), array(), array('ticket' => $this->GetKey()));
+		while($oRequest = $oChildRequestSet->Fetch())
+		{
+			$oRequest->ResolveFrom($this);
+		}
+		return true;
+	}]]></code>
+        </method>
+         <method id="ResolveFrom">
+          <comment><![CDATA[/**
+	 * Resolve the ticket from another resolved ticket
+	 * @return void
+	 */]]></comment>
+          <static>false</static>
+          <access>public</access>
+          <type>Internal</type>
+          <code><![CDATA[	public function ResolveFrom($oParentTicket)
+	{
+		if ($this->Get('status') != 'resolved')
+		{
+			$this->Set('servicesubcategory_id', $oParentTicket->Get('servicesubcategory_id'));
+			$this->Set('service_id', $oParentTicket->Get('service_id'));		
+			$this->Set('team_id', $oParentTicket->Get('team_id'));
+			$this->Set('agent_id', $oParentTicket->Get('agent_id'));	
+			$this->Set('resolution_code', $oParentTicket->Get('resolution_code'));
+			$sParent = '[['.get_class($oParentTicket).':'.$oParentTicket->Get('ref').']]';
+			$this->Set('solution', Dict::Format('Tickets:ResolvedFrom', $sParent, MetaModel::GetName(get_class($oParentTicket))));
+			$this->ApplyStimulus('ev_autoresolve');
+			$this->DBUpdate();
+		}
+	}]]></code>
+        </method>
         <method id="UpdateChildRequestLog">
           <static>false</static>
           <access>public</access>

+ 205 - 22
datamodels/2.x/itop-request-mgmt/datamodel.itop-request-mgmt.xml

@@ -522,7 +522,10 @@
                 <target>assigned</target>
                 <actions>
                   <action>
-                    <verb>SetAssignedDate</verb>
+                    <verb>SetCurrentDate</verb>
+                    <params>
+                      <param xsi:type="string">assignment_date</param>
+                    </params>
                   </action>
                 </actions>
               </transition>
@@ -538,10 +541,22 @@
                 <target>resolved</target>
                 <actions>
                   <action>
-                    <verb>SetResolveDate</verb>
+                    <verb>SetCurrentDate</verb>
+                    <params>
+                      <param xsi:type="string">resolution_date</param>
+                    </params>
                   </action>
                   <action>
-                    <verb>resolveChilds</verb>
+                    <verb>SetElapsedTime</verb>
+                    <params>
+                      <param xsi:type="string">time_spent</param>
+                      <param xsi:type="string">start_date</param>
+                      <param xsi:type="string">DefaultWorkingTimeComputer</param>
+                    </params>
+                  </action>
+                  <action>
+                    <verb>ResolveChildTickets</verb>
+                    <params/>
                   </action>
                 </actions>
               </transition>
@@ -560,7 +575,10 @@
                 <target>assigned</target>
                 <actions>
                   <action>
-                    <verb>SetAssignedDate</verb>
+                    <verb>SetCurrentDate</verb>
+                    <params>
+                      <param xsi:type="string">assignment_date</param>
+                    </params>
                   </action>
                 </actions>
               </transition>
@@ -607,7 +625,10 @@
                 <target>pending</target>
                 <actions>
                   <action>
-                    <verb>SetLastPendingDate</verb>
+                    <verb>SetCurrentDate</verb>
+                    <params>
+                      <param xsi:type="string">last_pending_date</param>
+                    </params>
                   </action>
                 </actions>
               </transition>
@@ -615,10 +636,22 @@
                 <target>resolved</target>
                 <actions>
                   <action>
-                    <verb>SetResolveDate</verb>
+                    <verb>SetCurrentDate</verb>
+                    <params>
+                      <param xsi:type="string">resolution_date</param>
+                    </params>
                   </action>
                   <action>
-                    <verb>resolveChilds</verb>
+                    <verb>SetElapsedTime</verb>
+                    <params>
+                      <param xsi:type="string">time_spent</param>
+                      <param xsi:type="string">start_date</param>
+                      <param xsi:type="string">DefaultWorkingTimeComputer</param>
+                    </params>
+                  </action>
+                  <action>
+                    <verb>ResolveChildTickets</verb>
+                    <params/>
                   </action>
                 </actions>
               </transition>
@@ -634,10 +667,22 @@
                 <target>resolved</target>
                 <actions>
                   <action>
-                    <verb>SetResolveDate</verb>
+                    <verb>SetCurrentDate</verb>
+                    <params>
+                      <param xsi:type="string">resolution_date</param>
+                    </params>
                   </action>
                   <action>
-                    <verb>resolveChilds</verb>
+                    <verb>SetElapsedTime</verb>
+                    <params>
+                      <param xsi:type="string">time_spent</param>
+                      <param xsi:type="string">start_date</param>
+                      <param xsi:type="string">DefaultWorkingTimeComputer</param>
+                    </params>
+                  </action>
+                  <action>
+                    <verb>ResolveChildTickets</verb>
+                    <params/>
                   </action>
                 </actions>
               </transition>
@@ -654,7 +699,10 @@
                 <target>pending</target>
                 <actions>
                   <action>
-                    <verb>SetLastPendingDate</verb>
+                    <verb>SetCurrentDate</verb>
+                    <params>
+                      <param xsi:type="string">last_pending_date</param>
+                    </params>
                   </action>
                 </actions>
               </transition>
@@ -662,10 +710,22 @@
                 <target>resolved</target>
                 <actions>
                   <action>
-                    <verb>SetResolveDate</verb>
+                    <verb>SetCurrentDate</verb>
+                    <params>
+                      <param xsi:type="string">resolution_date</param>
+                    </params>
+                  </action>
+                  <action>
+                    <verb>SetElapsedTime</verb>
+                    <params>
+                      <param xsi:type="string">time_spent</param>
+                      <param xsi:type="string">start_date</param>
+                      <param xsi:type="string">DefaultWorkingTimeComputer</param>
+                    </params>
                   </action>
                   <action>
-                    <verb>resolveChilds</verb>
+                    <verb>ResolveChildTickets</verb>
+                    <params/>
                   </action>
                 </actions>
               </transition>
@@ -677,10 +737,22 @@
                 <target>resolved</target>
                 <actions>
                   <action>
-                    <verb>SetResolveDate</verb>
+                    <verb>SetCurrentDate</verb>
+                    <params>
+                      <param xsi:type="string">resolution_date</param>
+                    </params>
                   </action>
                   <action>
-                    <verb>resolveChilds</verb>
+                    <verb>SetElapsedTime</verb>
+                    <params>
+                      <param xsi:type="string">time_spent</param>
+                      <param xsi:type="string">start_date</param>
+                      <param xsi:type="string">DefaultWorkingTimeComputer</param>
+                    </params>
+                  </action>
+                  <action>
+                    <verb>ResolveChildTickets</verb>
+                    <params/>
                   </action>
                 </actions>
               </transition>
@@ -721,7 +793,10 @@
                 <target>assigned</target>
                 <actions>
                   <action>
-                    <verb>SetAssignedDate</verb>
+                    <verb>SetCurrentDate</verb>
+                    <params>
+                      <param xsi:type="string">assignment_date</param>
+                    </params>
                   </action>
                 </actions>
               </transition>
@@ -729,10 +804,22 @@
                 <target>resolved</target>
                 <actions>
                   <action>
-                    <verb>SetResolveDate</verb>
+                    <verb>SetCurrentDate</verb>
+                    <params>
+                      <param xsi:type="string">resolution_date</param>
+                    </params>
+                  </action>
+                  <action>
+                    <verb>SetElapsedTime</verb>
+                    <params>
+                      <param xsi:type="string">time_spent</param>
+                      <param xsi:type="string">start_date</param>
+                      <param xsi:type="string">DefaultWorkingTimeComputer</param>
+                    </params>
                   </action>
                   <action>
-                    <verb>resolveChilds</verb>
+                    <verb>ResolveChildTickets</verb>
+                    <params/>
                   </action>
                 </actions>
               </transition>
@@ -777,10 +864,22 @@
                 <target>resolved</target>
                 <actions>
                   <action>
-                    <verb>SetResolveDate</verb>
+                    <verb>SetCurrentDate</verb>
+                    <params>
+                      <param xsi:type="string">resolution_date</param>
+                    </params>
+                  </action>
+                  <action>
+                    <verb>SetElapsedTime</verb>
+                    <params>
+                      <param xsi:type="string">time_spent</param>
+                      <param xsi:type="string">start_date</param>
+                      <param xsi:type="string">DefaultWorkingTimeComputer</param>
+                    </params>
                   </action>
                   <action>
-                    <verb>resolveChilds</verb>
+                    <verb>ResolveChildTickets</verb>
+                    <params/>
                   </action>
                 </actions>
               </transition>
@@ -876,7 +975,10 @@
                 <target>closed</target>
                 <actions>
                   <action>
-                    <verb>SetClosureDate</verb>
+                    <verb>SetCurrentDate</verb>
+                    <params>
+                      <param xsi:type="string">close_date</param>
+                    </params>
                   </action>
                 </actions>
               </transition>
@@ -889,10 +991,22 @@
                 <target>resolved</target>
                 <actions>
                   <action>
-                    <verb>SetResolveDate</verb>
+                    <verb>SetCurrentDate</verb>
+                    <params>
+                      <param xsi:type="string">resolution_date</param>
+                    </params>
+                  </action>
+                  <action>
+                    <verb>SetElapsedTime</verb>
+                    <params>
+                      <param xsi:type="string">time_spent</param>
+                      <param xsi:type="string">start_date</param>
+                      <param xsi:type="string">DefaultWorkingTimeComputer</param>
+                    </params>
                   </action>
                   <action>
-                    <verb>resolveChilds</verb>
+                    <verb>ResolveChildTickets</verb>
+                    <params/>
                   </action>
                 </actions>
               </transition>
@@ -948,6 +1062,10 @@
       </lifecycle>
       <methods>
         <method id="SetAssignedDate">
+          <comment><![CDATA[/**
+	 * To be deprecated: use SetCurrentDate() instead
+	 * @return void
+	 */]]></comment>
           <static>false</static>
           <access>public</access>
           <type>LifecycleAction</type>
@@ -958,6 +1076,10 @@
 	}]]></code>
         </method>
         <method id="SetLastPendingDate">
+          <comment><![CDATA[/**
+	 * To be deprecated: use SetCurrentDate() instead
+	 * @return void
+	 */]]></comment>
           <static>false</static>
           <access>public</access>
           <type>LifecycleAction</type>
@@ -968,6 +1090,10 @@
 	}]]></code>
         </method>
         <method id="SetResolveDate">
+          <comment><![CDATA[/**
+	 * To be deprecated: use SetCurrentDate() and SetElapsedTime() instead
+	 * @return void
+	 */]]></comment>
           <static>false</static>
           <access>public</access>
           <type>LifecycleAction</type>
@@ -980,6 +1106,10 @@
 	}]]></code>
         </method>
         <method id="SetClosureDate">
+          <comment><![CDATA[/**
+	 * To be deprecated: use SetCurrentDate() instead
+	 * @return void
+	 */]]></comment>
           <static>false</static>
           <access>public</access>
           <type>LifecycleAction</type>
@@ -990,6 +1120,10 @@
 	}]]></code>
         </method>
         <method id="SetApprover">
+          <comment><![CDATA[/**
+	 * To be deprecated: use SetCurrentUser() instead
+	 * @return void
+	 */]]></comment>
           <static>false</static>
           <access>public</access>
           <type>LifecycleAction</type>
@@ -1093,6 +1227,9 @@
 	}]]></code>
         </method>
         <method id="resolveChilds">
+          <comment><![CDATA[/**
+	 * To be deprecated: use ResolveChildTickets() instead
+	 */]]></comment>
           <static>false</static>
           <access>public</access>
           <type>LifecycleAction</type>
@@ -1124,6 +1261,52 @@
 
 	}]]></code>
         </method>
+        <method id="ResolveChildTickets">
+          <comment><![CDATA[/**
+	 * Cascade the resolution to child User Request
+	 * @return true (returning false would stop the ongoing transition)
+	 */]]></comment>
+          <static>false</static>
+          <access>public</access>
+          <type>LifecycleAction</type>
+          <arguments>
+          </arguments>
+          <code><![CDATA[	public function ResolveChildTickets()
+	{
+		// Automatically resolve child requests
+		$sOQL = "SELECT UserRequest WHERE parent_request_id = :ticket AND status != 'resolved'";
+		$oChildRequestSet = new DBObjectSet(DBObjectSearch::FromOQL($sOQL), array(), array('ticket' => $this->GetKey()));
+		while($oRequest = $oChildRequestSet->Fetch())
+		{
+			$oRequest->ResolveFrom($this);
+		}
+		return true;
+	}]]></code>
+        </method>
+         <method id="ResolveFrom">
+          <comment><![CDATA[/**
+	 * Resolve the ticket from another resolved ticket
+	 * @return void
+	 */]]></comment>
+          <static>false</static>
+          <access>public</access>
+          <type>Internal</type>
+          <code><![CDATA[	public function ResolveFrom($oParentTicket)
+	{
+		if ($this->Get('status') != 'resolved')
+		{
+			$this->Set('servicesubcategory_id', $oParentTicket->Get('servicesubcategory_id'));
+			$this->Set('service_id', $oParentTicket->Get('service_id'));		
+			$this->Set('team_id', $oParentTicket->Get('team_id'));
+			$this->Set('agent_id', $oParentTicket->Get('agent_id'));	
+			$this->Set('resolution_code', $oParentTicket->Get('resolution_code'));
+			$sParent = '[['.get_class($oParentTicket).':'.$oParentTicket->Get('ref').']]';
+			$this->Set('solution', Dict::Format('Tickets:ResolvedFrom', $sParent, MetaModel::GetName(get_class($oParentTicket))));
+			$this->ApplyStimulus('ev_autoresolve');
+			$this->DBUpdate();
+		}
+	}]]></code>
+        </method>
         <method id="UpdateChildRequestLog">
           <static>false</static>
           <access>public</access>

+ 35 - 1
datamodels/2.x/itop-tickets/datamodel.itop-tickets.xml

@@ -213,7 +213,7 @@
         }
         ]]></code>
         </method>
-      </methods>
+     </methods>
       <presentation>
         <details>
           <items>
@@ -772,6 +772,40 @@
               </argument>
             </arguments>
           </method>
+          <method id="SetCurrentUser">
+            <arguments>
+              <argument>
+                <label>Field Code</label>
+                <type>attcode</type>
+                <mandatory>true</mandatory>
+                <description>The field, in the current object, to set to
+                  the current logged in user</description>
+              </argument>
+            </arguments>
+          </method>
+          <method id="SetElapsedTime">
+            <arguments>
+              <argument>
+                <label>Field Code</label>
+                <type>attcode</type>
+                <mandatory>true</mandatory>
+                <description>The field, in the current object, to set to
+                  the time elapsed since the date given by the reference field</description>
+              </argument>
+              <argument>
+                <label>Reference Field Code</label>
+                <type>attcode</type>
+                <mandatory>true</mandatory>
+                <description>The reference date or date/time</description>
+              </argument>
+              <argument>
+                <label>Working hours</label>
+                <type>attcode</type>
+                <mandatory>false</mandatory>
+                <description>Leave empty to rely on the standard working hours scheme, or set to "DefaultWorkingTimeComputer" to force a 24x7 scheme</description>
+              </argument>
+            </arguments>
+          </method>
           <method id="Reset">
             <arguments>
               <argument>

+ 2 - 10
datamodels/2.x/itop-tickets/en.dict.itop-tickets.php

@@ -1,5 +1,5 @@
 <?php
-// Copyright (C) 2010-2012 Combodo SARL
+// Copyright (C) 2010-2014 Combodo SARL
 //
 //   This file is part of iTop.
 //
@@ -179,13 +179,5 @@ Dict::Add('EN US', 'English', 'English', array(
 	'Ticket:SLA' => 'SLA report',
 	'WorkOrder:Details' => 'Details',
 	'WorkOrder:Moreinfo' => 'More information',
-
+	'Tickets:ResolvedFrom' => 'Automatically resolved from %1$s'
 ));
-
-
-
-
-
-
-
-?>

+ 1 - 2
datamodels/2.x/itop-tickets/fr.dict.itop-tickets.php

@@ -164,6 +164,5 @@ Dict::Add('FR FR', 'French', 'Français', array(
 	'Ticket:SLA' => 'Rapport SLA',
 	'WorkOrder:Details' => 'Détails',
 	'WorkOrder:Moreinfo' => 'Informations complémentaires',
-
+	'Tickets:ResolvedFrom' => 'Résolu via %1$s'
 ));
-?>

+ 2 - 2
setup/compiler.class.inc.php

@@ -1247,12 +1247,12 @@ EOF;
 								{
 									$sParamType = 'string';
 								}
-								$aActionParams[] = "array('type' => '$sType', 'value' => ".self::QuoteForPHP($oParam->textContent).")";
+								$aActionParams[] = "array('type' => '$sParamType', 'value' => ".self::QuoteForPHP($oParam->textContent).")";
 							}
 						}
 						else
 						{
-							// Old (pre 2.0.4) format, when no parameter is specified, assume 1 parameter: reference sStimulusCode
+							// Old (pre 2.1.0) format, when no parameter is specified, assume 1 parameter: reference sStimulusCode
 							$aActionParams[] = "array('type' => 'reference', 'value' => 'sStimulusCode')";
 						}
 						$sActionParams = 'array('.implode(', ', $aActionParams).')';