瀏覽代碼

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

git-svn-id: http://svn.code.sf.net/p/itop/code/trunk@2913 a333f486-631f-4898-b8df-5754b55c2be0
dflaven 11 年之前
父節點
當前提交
0428ec0f5d

+ 13 - 0
datamodels/2.x/itop-incident-mgmt-itil/datamodel.itop-incident-mgmt-itil.xml

@@ -1201,6 +1201,19 @@
 		return true;
 		return true;
 	}]]></code>
 	}]]></code>
         </method>
         </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">
         <method id="ComputePriority">
           <comment>/** Compute the priority of the ticket based on its impact and urgency&#13;
           <comment>/** Compute the priority of the ticket based on its impact and urgency&#13;
          * @return integer The priority of the ticket 1(high) .. 3(low)&#13;
          * @return integer The priority of the ticket 1(high) .. 3(low)&#13;

+ 1 - 0
datamodels/2.x/itop-incident-mgmt-itil/en.dict.itop-incident-mgmt-itil.php

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

+ 1 - 0
datamodels/2.x/itop-incident-mgmt-itil/fr.dict.itop-incident-mgmt-itil.php

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

+ 13 - 0
datamodels/2.x/itop-request-mgmt-itil/datamodel.itop-request-mgmt-itil.xml

@@ -1590,6 +1590,19 @@
 		return true;
 		return true;
 	}]]></code>
 	}]]></code>
         </method>
         </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">
         <method id="ComputePriority">
           <comment>/** Compute the priority of the ticket based on its impact and urgency&#13;
           <comment>/** Compute the priority of the ticket based on its impact and urgency&#13;
          * @return integer The priority of the ticket 1(high) .. 3(low)&#13;
          * @return integer The priority of the ticket 1(high) .. 3(low)&#13;

+ 1 - 0
datamodels/2.x/itop-request-mgmt-itil/en.dict.itop-request-mgmt-itil.php

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

+ 1 - 0
datamodels/2.x/itop-request-mgmt-itil/fr.dict.itop-request-mgmt-itil.php

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

+ 13 - 0
datamodels/2.x/itop-request-mgmt/datamodel.itop-request-mgmt.xml

@@ -1577,6 +1577,19 @@
 		return true;
 		return true;
 	}]]></code>
 	}]]></code>
         </method>
         </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">
         <method id="ComputePriority">
           <comment>/** Compute the priority of the ticket based on its impact and urgency&#13;
           <comment>/** Compute the priority of the ticket based on its impact and urgency&#13;
          * @return integer The priority of the ticket 1(high) .. 3(low)&#13;
          * @return integer The priority of the ticket 1(high) .. 3(low)&#13;

+ 1 - 0
datamodels/2.x/itop-request-mgmt/en.dict.itop-request-mgmt.php

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

+ 1 - 0
datamodels/2.x/itop-request-mgmt/fr.dict.itop-request-mgmt.php

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