N°4756 - revert events for datamodel/2.x objects for backward compatibility

This commit is contained in:
Eric Espie
2022-09-20 15:35:59 +02:00
parent 6386a302b2
commit d1414a3f34
8 changed files with 97 additions and 195 deletions

View File

@@ -975,18 +975,6 @@
</state>
</states>
</lifecycle>
<event_listeners>
<listener id="OnChangeInsertRequested">
<event>EVENT_SERVICE_DB_INSERT_REQUESTED</event>
<callback>OnChangeInsertRequested</callback>
<priority>0</priority>
</listener>
<listener id="OnChangeUpdateRequested">
<event>EVENT_SERVICE_DB_UPDATE_REQUESTED</event>
<callback>OnChangeUpdateRequested</callback>
<priority>0</priority>
</listener>
</event_listeners>
<methods>
<method id="GetTicketRefFormat">
<static>true</static>
@@ -1027,26 +1015,28 @@
return true;
}]]></code>
</method>
<method id="OnChangeInsertRequested">
<method id="OnInsert">
<static>false</static>
<access>public</access>
<type>Overload-ExNihilo</type>
<access>protected</access>
<type>Overload-DBObject</type>
<code><![CDATA[
public function OnChangeInsertRequested(Combodo\iTop\Service\EventData $oEventData)
protected function OnInsert()
{
parent::OnInsert();
$this->UpdateImpactedItems();
$this->SetIfNull('creation_date', time());
$this->SetIfNull('last_update', time());
}]]>
</code>
</method>
<method id="OnChangeUpdateRequested">
<method id="OnUpdate">
<static>false</static>
<access>public</access>
<type>Overload-ExNihilo</type>
<access>protected</access>
<type>Overload-DBObject</type>
<code><![CDATA[
public function OnChangeUpdateRequested(Combodo\iTop\Service\EventData $oEventData)
protected function OnUpdate()
{
parent::OnUpdate();
$aChanges = $this->ListChanges();
if (array_key_exists('functionalcis_list', $aChanges))
{

View File

@@ -512,18 +512,6 @@
</state>
</states>
</lifecycle>
<event_listeners>
<listener id="OnChangeInsertRequested">
<event>EVENT_SERVICE_DB_INSERT_REQUESTED</event>
<callback>OnChangeInsertRequested</callback>
<priority>0</priority>
</listener>
<listener id="OnChangeUpdateRequested">
<event>EVENT_SERVICE_DB_UPDATE_REQUESTED</event>
<callback>OnChangeUpdateRequested</callback>
<priority>0</priority>
</listener>
</event_listeners>
<methods>
<method id="GetTicketRefFormat">
<static>true</static>
@@ -578,25 +566,27 @@
return true;
}]]></code>
</method>
<method id="OnChangeInsertRequested">
<method id="OnInsert">
<static>false</static>
<access>public</access>
<type>Overload-ExNihilo</type>
<access>protected</access>
<type>Overload-DBObject</type>
<code><![CDATA[
public function OnChangeInsertRequested(Combodo\iTop\Service\EventData $oEventData)
protected function OnInsert()
{
parent::OnInsert();
$this->UpdateImpactedItems();
$this->SetIfNull('creation_date', time());
$this->SetIfNull('last_update', time());
}]]></code>
</method>
<method id="OnChangeUpdateRequested">
<method id="OnUpdate">
<static>false</static>
<access>public</access>
<type>Overload-ExNihilo</type>
<access>protected</access>
<type>Overload-DBObject</type>
<code><![CDATA[
public function OnChangeUpdateRequested(Combodo\iTop\Service\EventData $oEventData)
protected function OnUpdate()
{
parent::OnUpdate();
$aChanges = $this->ListChanges();
if (array_key_exists('functionalcis_list', $aChanges))
{

View File

@@ -1052,28 +1052,6 @@
</state>
</states>
</lifecycle>
<event_listeners>
<listener id="OnIncidentInsertRequested">
<event>EVENT_SERVICE_DB_INSERT_REQUESTED</event>
<callback>OnIncidentInsertRequested</callback>
<priority>0</priority>
</listener>
<listener id="OnIncidentUpdateRequested">
<event>EVENT_SERVICE_DB_UPDATE_REQUESTED</event>
<callback>OnIncidentUpdateRequested</callback>
<priority>0</priority>
</listener>
<listener id="OnIncidentComputeValues">
<event>EVENT_SERVICE_DB_COMPUTE_VALUES</event>
<callback>OnIncidentComputeValues</callback>
<priority>0</priority>
</listener>
<listener id="OnIncidentCheckToWrite">
<event>EVENT_SERVICE_DB_CHECK_TO_WRITE</event>
<callback>OnIncidentCheckToWrite</callback>
<priority>0</priority>
</listener>
</event_listeners>
<methods>
<method id="GetTicketRefFormat">
<static>true</static>
@@ -1144,12 +1122,13 @@
return true;
}]]></code>
</method>
<method id="OnIncidentCheckToWrite">
<method id="DoCheckToWrite">
<static>false</static>
<access>public</access>
<type>Overload-ExNihilo</type>
<code><![CDATA[public function OnIncidentCheckToWrite(Combodo\iTop\Service\EventData $oEventData)
<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');
@@ -1198,15 +1177,17 @@
return $iPriority;
}]]></code>
</method>
<method id="OnIncidentComputeValues">
<method id="ComputeValues">
<static>false</static>
<access>public</access>
<type>Overload-ExNihilo</type>
<code><![CDATA[ public function OnIncidentComputeValues(Combodo\iTop\Service\EventData $oEventData)
<type>Overload-DBObject</type>
<code><![CDATA[ public function ComputeValues()
{
// Compute the priority of the ticket
$this->Set('priority', $this->ComputePriority());
return parent::ComputeValues();
}]]></code>
</method>
<method id="DisplayBareRelations">
@@ -1484,24 +1465,26 @@
$this->UpdateImpactedItems();
}]]></code>
</method>
<method id="OnIncidentInsertRequested">
<method id="OnInsert">
<static>false</static>
<access>public</access>
<type>Overload-ExNihilo</type>
<code><![CDATA[ public function OnIncidentInsertRequested(Combodo\iTop\Service\EventData $oEventData)
<access>protected</access>
<type>Overload-DBObject</type>
<code><![CDATA[ protected function OnInsert()
{
parent::OnInsert();
$this->ComputeImpactedItems();
$this->SetIfNull('last_update', time());
$this->SetIfNull('start_date', time());
}]]></code>
</method>
<method id="OnIncidentUpdateRequested">
<method id="OnUpdate">
<static>false</static>
<access>public</access>
<type>Overload-ExNihilo</type>
<code><![CDATA[ public function OnIncidentUpdateRequested(Combodo\iTop\Service\EventData $oEventData)
<access>protected</access>
<type>Overload-DBObject</type>
<code><![CDATA[ protected function OnUpdate()
{
parent::OnUpdate();
$aChanges = $this->ListChanges();
if (array_key_exists('functionalcis_list', $aChanges))
{

View File

@@ -423,23 +423,6 @@
</state>
</states>
</lifecycle>
<event_listeners>
<listener id="OnProblemInsertRequested">
<event>EVENT_SERVICE_DB_INSERT_REQUESTED</event>
<callback>OnProblemInsertRequested</callback>
<priority>0</priority>
</listener>
<listener id="OnProblemUpdateRequested">
<event>EVENT_SERVICE_DB_UPDATE_REQUESTED</event>
<callback>OnProblemUpdateRequested</callback>
<priority>0</priority>
</listener>
<listener id="OnProblemComputeValues">
<event>EVENT_SERVICE_DB_COMPUTE_VALUES</event>
<callback>OnProblemComputeValues</callback>
<priority>0</priority>
</listener>
</event_listeners>
<methods>
<method id="GetTicketRefFormat">
<static>true</static>
@@ -537,31 +520,31 @@
return $iPriority;
}]]></code>
</method>
<method id="OnProblemComputeValues">
<method id="ComputeValues">
<static>false</static>
<access>public</access>
<type>Overload-ExNihilo</type>
<code><![CDATA[ public function OnProblemComputeValues(Combodo\iTop\Service\EventData $oEventData)
<type>Overload-DBObject</type>
<code><![CDATA[ public function ComputeValues()
{
// Compute the priority of the ticket
$this->Set('priority', $this->ComputePriority());
}]]></code>
</method>
<method id="OnProblemInsertRequested">
<method id="OnInsert">
<static>false</static>
<access>public</access>
<type>Overload-ExNihilo</type>
<code><![CDATA[ public function OnProblemInsertRequested(Combodo\iTop\Service\EventData $oEventData)
<access>protected</access>
<type>Overload-DBObject</type>
<code><![CDATA[ protected function OnInsert()
{
$this->SetIfNull('start_date', time());
$this->SetIfNull('last_update', time());
}]]></code>
</method>
<method id="OnProblemUpdateRequested">
<method id="OnUpdate">
<static>false</static>
<access>public</access>
<type>Overload-ExNihilo</type>
<code><![CDATA[ public function OnProblemUpdateRequested(Combodo\iTop\Service\EventData $oEventData)
<access>protected</access>
<type>Overload-DBObject</type>
<code><![CDATA[ protected function OnUpdate()
{
$this->Set('last_update', time());
}]]></code>

View File

@@ -1198,28 +1198,6 @@
</state>
</states>
</lifecycle>
<event_listeners>
<listener id="OnUserRequestInsertRequested">
<event>EVENT_SERVICE_DB_INSERT_REQUESTED</event>
<callback>OnUserRequestInsertRequested</callback>
<priority>0</priority>
</listener>
<listener id="OnUserRequestUpdateRequested">
<event>EVENT_SERVICE_DB_UPDATE_REQUESTED</event>
<callback>OnUserRequestUpdateRequested</callback>
<priority>0</priority>
</listener>
<listener id="OnUserRequestComputeValues">
<event>EVENT_SERVICE_DB_COMPUTE_VALUES</event>
<callback>OnUserRequestComputeValues</callback>
<priority>0</priority>
</listener>
<listener id="OnUserRequestCheckToWrite">
<event>EVENT_SERVICE_DB_CHECK_TO_WRITE</event>
<callback>OnUserRequestCheckToWrite</callback>
<priority>0</priority>
</listener>
</event_listeners>
<methods>
<method id="GetTicketRefFormat">
<static>true</static>
@@ -1304,12 +1282,13 @@
return true;
}]]></code>
</method>
<method id="OnUserRequestCheckToWrite">
<method id="DoCheckToWrite">
<static>false</static>
<access>public</access>
<type>Overload-ExNihilo</type>
<code><![CDATA[public function OnUserRequestCheckToWrite(Combodo\iTop\Service\EventData $oEventData)
<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');
@@ -1358,14 +1337,16 @@
return $iPriority;
}]]></code>
</method>
<method id="OnUserRequestComputeValues">
<method id="ComputeValues">
<static>false</static>
<access>public</access>
<type>Overload-ExNihilo</type>
<code><![CDATA[ public function OnUserRequestComputeValues(Combodo\iTop\Service\EventData $oEventData)
<type>Overload-DBObject</type>
<code><![CDATA[ public function ComputeValues()
{
// Compute the priority of the ticket
$this->Set('priority', $this->ComputePriority());
return parent::ComputeValues();
}]]></code>
</method>
<method id="DisplayBareRelations">
@@ -1555,25 +1536,27 @@
$this->UpdateImpactedItems();
}]]></code>
</method>
<method id="OnUserRequestInsertRequested">
<method id="OnInsert">
<static>false</static>
<access>public</access>
<type>Overload-ExNihilo</type>
<access>protected</access>
<type>Overload-DBObject</type>
<code><![CDATA[
public function OnUserRequestInsertRequested(Combodo\iTop\Service\EventData $oEventData)
protected function OnInsert()
{
parent::OnInsert();
$this->ComputeImpactedItems();
$this->SetIfNull('last_update', time());
$this->SetIfNull('start_date', time());
}]]></code>
</method>
<method id="OnUserRequestUpdateRequested">
<method id="OnUpdate">
<static>false</static>
<access>public</access>
<type>Overload-ExNihilo</type>
<access>protected</access>
<type>Overload-DBObject</type>
<code><![CDATA[
public function OnUserRequestUpdateRequested(Combodo\iTop\Service\EventData $oEventData)
protected function OnUpdate()
{
parent::OnUpdate();
$aChanges = $this->ListChanges();
if (array_key_exists('functionalcis_list', $aChanges))
{

View File

@@ -1231,28 +1231,6 @@
</state>
</states>
</lifecycle>
<event_listeners>
<listener id="OnUserRequestInsertRequested">
<event>EVENT_SERVICE_DB_INSERT_REQUESTED</event>
<callback>OnUserRequestInsertRequested</callback>
<priority>0</priority>
</listener>
<listener id="OnUserRequestUpdateRequested">
<event>EVENT_SERVICE_DB_UPDATE_REQUESTED</event>
<callback>OnUserRequestUpdateRequested</callback>
<priority>0</priority>
</listener>
<listener id="OnUserRequestComputeValues">
<event>EVENT_SERVICE_DB_COMPUTE_VALUES</event>
<callback>OnUserRequestComputeValues</callback>
<priority>0</priority>
</listener>
<listener id="OnUserRequestCheckToWrite">
<event>EVENT_SERVICE_DB_CHECK_TO_WRITE</event>
<callback>OnUserRequestCheckToWrite</callback>
<priority>0</priority>
</listener>
</event_listeners>
<methods>
<method id="GetTicketRefFormat">
<static>true</static>
@@ -1337,12 +1315,13 @@
return true;
}]]></code>
</method>
<method id="OnUserRequestCheckToWrite">
<method id="DoCheckToWrite">
<static>false</static>
<access>public</access>
<type>Overload-ExNihilo</type>
<code><![CDATA[public function OnUserRequestCheckToWrite(Combodo\iTop\Service\EventData $oEventData)
<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');
@@ -1392,11 +1371,11 @@
return $iPriority;
}]]></code>
</method>
<method id="OnUserRequestComputeValues">
<method id="ComputeValues">
<static>false</static>
<access>public</access>
<type>Overload-ExNihilo</type>
<code><![CDATA[ public function OnUserRequestComputeValues(Combodo\iTop\Service\EventData $oEventData)
<type>Overload-DBObject</type>
<code><![CDATA[ public function ComputeValues()
{
// Compute the priority of the ticket
$this->Set('priority', $this->ComputePriority());
@@ -1412,6 +1391,8 @@
$this->Set('request_type', $sType);
}
}
return parent::ComputeValues();
}]]></code>
</method>
<method id="DisplayBareRelations">
@@ -1601,26 +1582,28 @@
$this->UpdateImpactedItems();
}]]></code>
</method>
<method id="OnUserRequestInsertRequested">
<method id="OnInsert">
<static>false</static>
<access>public</access>
<type>Overload-ExNihilo</type>
<access>protected</access>
<type>Overload-DBObject</type>
<code><![CDATA[
public function OnUserRequestInsertRequested(Combodo\iTop\Service\EventData $oEventData)
protected function OnInsert()
{
parent::OnInsert();
$this->ComputeImpactedItems();
$this->SetIfNull('last_update', time());
$this->SetIfNull('start_date', time());
}]]></code>
</method>
<method id="OnUserRequestUpdateRequested">
<method id="OnUpdate">
<static>false</static>
<access>public</access>
<type>Overload-ExNihilo</type>
<access>protected</access>
<type>Overload-DBObject</type>
<code><![CDATA[
public function OnUserRequestUpdateRequested(Combodo\iTop\Service\EventData $oEventData)
protected function OnUpdate()
{
parent::OnUpdate();
$aChanges = $this->ListChanges();
if (array_key_exists('functionalcis_list', $aChanges))
{

View File

@@ -1597,20 +1597,15 @@ public function PrefillSearchForm(&$aContextParam)
<duplicates>true</duplicates>
</field>
</fields>
<event_listeners>
<listener id="OnSLACheckToWrite">
<event>EVENT_SERVICE_DB_CHECK_TO_WRITE</event>
<callback>OnSLACheckToWrite</callback>
<priority>0</priority>
</listener>
</event_listeners>
<methods>
<method id="OnSLACheckToWrite">
<method id="DoCheckToWrite">
<static>false</static>
<access>public</access>
<code><![CDATA[
public function OnSLACheckToWrite(Combodo\iTop\Service\EventData $oEventData)
public function DoCheckToWrite()
{
parent::DoCheckToWrite();
$aCustomerContracts = $this->Get("customercontracts_list");
foreach ($aCustomerContracts as $sAttCode => $oCustomerContracts)
{

View File

@@ -216,24 +216,19 @@
<count_max>0</count_max>
</field>
</fields>
<event_listeners>
<listener id="OnTicketInsertRequested">
<event>EVENT_SERVICE_DB_INSERT_REQUESTED</event>
<callback>OnTicketInsertRequested</callback>
<priority>-10</priority>
</listener>
</event_listeners>
<methods>
<method id="OnTicketInsertRequested">
<method id="DBInsertNoReload">
<static>false</static>
<access>public</access>
<type>Overload-ExNihilo</type>
<type>Overload-DBObject</type>
<code><![CDATA[
public function OnTicketInsertRequested(Combodo\iTop\Service\EventData $oEventData)
public function DBInsertNoReload()
{
$iNextId = ItopCounter::IncClass(get_class($this));
$sRef = $this->MakeTicketRef($iNextId);
$this->SetIfNull('ref', $sRef);
$iKey = parent::DBInsertNoReload();
return $iKey;
}
]]></code>
</method>