#754 Prevent UserRequests to have themselves set as Parent Request (and same for Incidents)

SVN:trunk[2913]
This commit is contained in:
Denis Flaven
2013-10-15 13:41:15 +00:00
parent fca3bb2a73
commit d5be250640
9 changed files with 45 additions and 0 deletions

View File

@@ -1200,6 +1200,19 @@
$this->Set('close_date', time());
return true;
}]]></code>
</method>
<method id="DoCheckToWrite">
<static>false</static>
<access>public</access>
<type>Overload-DBObject</type>
<code><![CDATA[public function DoCheckToWrite()
{
parent::DoCheckToWrite();
if (!$this->IsNew() && ($this->Get('parent_incident_id') == $this->GetKey()))
{
$this->m_aCheckIssues[] = Dict::Format('Class:Incident/Error:CannotAssignParentIncidentIdToSelf');
}
}]]></code>
</method>
<method id="ComputePriority">
<comment>/** Compute the priority of the ticket based on its impact and urgency&#13;

View File

@@ -234,6 +234,7 @@ Dict::Add('EN US', 'English', 'English', array(
'Class:Incident/Stimulus:ev_close+' => '',
'Class:Incident/Stimulus:ev_reopen' => 'Re-open',
'Class:Incident/Stimulus:ev_reopen+' => '',
'Class:Incident/Error:CannotAssignParentIncidentIdToSelf' => 'Cannot assign the Parent incident to the incident itself',
));

View File

@@ -192,6 +192,7 @@ Dict::Add('FR FR', 'French', 'Français', array(
'Class:Incident/Stimulus:ev_close+' => '',
'Class:Incident/Stimulus:ev_reopen' => 'Ré-ouvrir',
'Class:Incident/Stimulus:ev_reopen+' => '',
'Class:Incident/Error:CannotAssignParentIncidentIdToSelf' => 'L\'Incident parent ne peut pas être assigné à lui même',
));

View File

@@ -1589,6 +1589,19 @@
$this->Set('approver_id', UserRights::GetUserId());
return true;
}]]></code>
</method>
<method id="DoCheckToWrite">
<static>false</static>
<access>public</access>
<type>Overload-DBObject</type>
<code><![CDATA[public function DoCheckToWrite()
{
parent::DoCheckToWrite();
if (!$this->IsNew() && ($this->Get('parent_request_id') == $this->GetKey()))
{
$this->m_aCheckIssues[] = Dict::Format('Class:UserRequest/Error:CannotAssignParentRequestIdToSelf');
}
}]]></code>
</method>
<method id="ComputePriority">
<comment>/** Compute the priority of the ticket based on its impact and urgency&#13;

View File

@@ -260,6 +260,7 @@ Dict::Add('EN US', 'English', 'English', array(
'Class:UserRequest/Stimulus:ev_reopen+' => '',
'Class:UserRequest/Stimulus:ev_wait_for_approval' => 'Wait for approval',
'Class:UserRequest/Stimulus:ev_wait_for_approval+' => '',
'Class:UserRequest/Error:CannotAssignParentRequestIdToSelf' => 'Cannot assign the Parent request to the request itself',
));

View File

@@ -214,6 +214,7 @@ Dict::Add('FR FR', 'French', 'Français', array(
'Class:UserRequest/Stimulus:ev_reopen+' => '',
'Class:UserRequest/Stimulus:ev_wait_for_approval' => 'Attendre une approbation',
'Class:UserRequest/Stimulus:ev_wait_for_approval+' => '',
'Class:UserRequest/Error:CannotAssignParentRequestIdToSelf' => 'La Requête parente ne peut pas être assignée à elle même',
));

View File

@@ -1576,6 +1576,19 @@
$this->Set('approver_id', UserRights::GetUserId());
return true;
}]]></code>
</method>
<method id="DoCheckToWrite">
<static>false</static>
<access>public</access>
<type>Overload-DBObject</type>
<code><![CDATA[public function DoCheckToWrite()
{
parent::DoCheckToWrite();
if (!$this->IsNew() && ($this->Get('parent_request_id') == $this->GetKey()))
{
$this->m_aCheckIssues[] = Dict::Format('Class:UserRequest/Error:CannotAssignParentRequestIdToSelf');
}
}]]></code>
</method>
<method id="ComputePriority">
<comment>/** Compute the priority of the ticket based on its impact and urgency&#13;

View File

@@ -263,6 +263,7 @@ Dict::Add('EN US', 'English', 'English', array(
'Class:UserRequest/Stimulus:ev_reopen+' => '',
'Class:UserRequest/Stimulus:ev_wait_for_approval' => 'Wait for approval',
'Class:UserRequest/Stimulus:ev_wait_for_approval+' => '',
'Class:UserRequest/Error:CannotAssignParentRequestIdToSelf' => 'Cannot assign the Parent request to the request itself',
));

View File

@@ -214,6 +214,7 @@ Dict::Add('FR FR', 'French', 'Français', array(
'Class:UserRequest/Stimulus:ev_reopen+' => '',
'Class:UserRequest/Stimulus:ev_wait_for_approval' => 'Attendre une approbation',
'Class:UserRequest/Stimulus:ev_wait_for_approval+' => '',
'Class:UserRequest/Error:CannotAssignParentRequestIdToSelf' => 'La Requête parente ne peut pas être assignée à elle même',
));