diff --git a/datamodels/2.x/itop-request-mgmt/datamodel.itop-request-mgmt.xml b/datamodels/2.x/itop-request-mgmt/datamodel.itop-request-mgmt.xml index 263fadfec1..8bda8690ef 100755 --- a/datamodels/2.x/itop-request-mgmt/datamodel.itop-request-mgmt.xml +++ b/datamodels/2.x/itop-request-mgmt/datamodel.itop-request-mgmt.xml @@ -306,10 +306,9 @@ true - service_id AND (ISNULL(:this->request_type) OR request_type = :this->request_type) AND status != 'obsolete']]> + service_id AND status != 'obsolete']]> - servicesubcategory_id ServiceSubcategory @@ -1334,19 +1333,21 @@ // Compute the priority of the ticket $this->Set('priority', $this->ComputePriority()); - // Compute the request_type if not already defined (by the user) - $sType = $this->Get('request_type'); - if (is_null($sType) || ($sType === '')) + return parent::ComputeValues(); + }]]> + + + false + public + EventListener + Get('servicesubcategory_id'); + if ($iSvcSubcat != 0) { - $iSvcSubcat = $this->Get('servicesubcategory_id'); - if ($iSvcSubcat != 0) - { - $oSvcSubcat = MetaModel::GetObject(ServiceSubcategory::class, $iSvcSubcat, true, true); - $this->Set('request_type', $oSvcSubcat->Get('request_type')); - } + $oSvcSubcat = MetaModel::GetObject(ServiceSubcategory::class, $iSvcSubcat, true, true); + $this->Set('request_type', $oSvcSubcat->Get('request_type')); } - - return parent::ComputeValues(); }]]> @@ -1528,6 +1529,13 @@ }]]> + + + EVENT_DB_BEFORE_WRITE + EvtComputeRequestType + 0 + +