mirror of
https://github.com/Combodo/iTop.git
synced 2026-05-19 07:12:26 +02:00
Prevent infinite cross-ticket recursion when propagating parent->child resolution in tickets.
SVN:trunk[4045]
This commit is contained in:
@@ -1164,15 +1164,22 @@
|
|||||||
</arguments>
|
</arguments>
|
||||||
<code><![CDATA[ public function ResolveChildTickets()
|
<code><![CDATA[ public function ResolveChildTickets()
|
||||||
{
|
{
|
||||||
|
static $aRequests = array(); // prevent infinite recursion
|
||||||
|
static $Incidents = array(); // prevent infinite recursion
|
||||||
|
|
||||||
if (MetaModel::IsValidClass('UserRequest'))
|
if (MetaModel::IsValidClass('UserRequest'))
|
||||||
{
|
{
|
||||||
// Automatically resolve child requests
|
// Automatically resolve child requests
|
||||||
$sOQL = "SELECT UserRequest WHERE parent_incident_id = :ticket AND status != 'resolved'";
|
$sOQL = "SELECT UserRequest WHERE parent_incident_id = :ticket AND status != 'resolved'";
|
||||||
$oChildRequestSet = new DBObjectSet(DBObjectSearch::FromOQL($sOQL), array(), array('ticket' => $this->GetKey()));
|
$oChildRequestSet = new DBObjectSet(DBObjectSearch::FromOQL($sOQL), array(), array('ticket' => $this->GetKey()));
|
||||||
while($oRequest = $oChildRequestSet->Fetch())
|
while($oRequest = $oChildRequestSet->Fetch())
|
||||||
{
|
{
|
||||||
$oRequest->ResolveFrom($this);
|
if (!array_key_exists($oRequest->GetKey(), $aRequests))
|
||||||
}
|
{
|
||||||
|
$aRequests[$oRequest->GetKey()] = true;
|
||||||
|
$oRequest->ResolveFrom($this);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Automatically resolve child incidents
|
// Automatically resolve child incidents
|
||||||
@@ -1180,7 +1187,11 @@
|
|||||||
$oChildIncidentSet = new DBObjectSet(DBObjectSearch::FromOQL($sOQL), array(), array('ticket' => $this->GetKey()));
|
$oChildIncidentSet = new DBObjectSet(DBObjectSearch::FromOQL($sOQL), array(), array('ticket' => $this->GetKey()));
|
||||||
while($oIncident = $oChildIncidentSet->Fetch())
|
while($oIncident = $oChildIncidentSet->Fetch())
|
||||||
{
|
{
|
||||||
$oIncident->ResolveFrom($this);
|
if (!array_key_exists($oIncident->GetKey(), $Incidents))
|
||||||
|
{
|
||||||
|
$Incidents[$oIncident->GetKey()] = true;
|
||||||
|
$oIncident->ResolveFrom($this);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}]]></code>
|
}]]></code>
|
||||||
|
|||||||
@@ -1278,12 +1278,18 @@
|
|||||||
</arguments>
|
</arguments>
|
||||||
<code><![CDATA[ public function ResolveChildTickets()
|
<code><![CDATA[ public function ResolveChildTickets()
|
||||||
{
|
{
|
||||||
|
static $aTickets = array(); // prevent infinite recursion
|
||||||
|
|
||||||
// Automatically resolve child requests
|
// Automatically resolve child requests
|
||||||
$sOQL = "SELECT UserRequest WHERE parent_request_id = :ticket AND status != 'resolved'";
|
$sOQL = "SELECT UserRequest WHERE parent_request_id = :ticket AND status != 'resolved'";
|
||||||
$oChildRequestSet = new DBObjectSet(DBObjectSearch::FromOQL($sOQL), array(), array('ticket' => $this->GetKey()));
|
$oChildRequestSet = new DBObjectSet(DBObjectSearch::FromOQL($sOQL), array(), array('ticket' => $this->GetKey()));
|
||||||
while($oRequest = $oChildRequestSet->Fetch())
|
while($oRequest = $oChildRequestSet->Fetch())
|
||||||
{
|
{
|
||||||
$oRequest->ResolveFrom($this);
|
if (!array_key_exists($oRequest->GetKey(), $aTickets))
|
||||||
|
{
|
||||||
|
$aTickets[$oRequest->GetKey()] = true;
|
||||||
|
$oRequest->ResolveFrom($this);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}]]></code>
|
}]]></code>
|
||||||
|
|||||||
@@ -1280,12 +1280,18 @@
|
|||||||
</arguments>
|
</arguments>
|
||||||
<code><![CDATA[ public function ResolveChildTickets()
|
<code><![CDATA[ public function ResolveChildTickets()
|
||||||
{
|
{
|
||||||
|
static $aTickets = array(); // prevent infinite recursion
|
||||||
|
|
||||||
// Automatically resolve child requests
|
// Automatically resolve child requests
|
||||||
$sOQL = "SELECT UserRequest WHERE parent_request_id = :ticket AND status != 'resolved'";
|
$sOQL = "SELECT UserRequest WHERE parent_request_id = :ticket AND status != 'resolved'";
|
||||||
$oChildRequestSet = new DBObjectSet(DBObjectSearch::FromOQL($sOQL), array(), array('ticket' => $this->GetKey()));
|
$oChildRequestSet = new DBObjectSet(DBObjectSearch::FromOQL($sOQL), array(), array('ticket' => $this->GetKey()));
|
||||||
while($oRequest = $oChildRequestSet->Fetch())
|
while($oRequest = $oChildRequestSet->Fetch())
|
||||||
{
|
{
|
||||||
$oRequest->ResolveFrom($this);
|
if (!array_key_exists($oRequest->GetKey(), $aTickets))
|
||||||
|
{
|
||||||
|
$aTickets[$oRequest->GetKey()] = true;
|
||||||
|
$oRequest->ResolveFrom($this);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}]]></code>
|
}]]></code>
|
||||||
|
|||||||
Reference in New Issue
Block a user