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..91d7ee388a 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,11 +306,8 @@ 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 true @@ -1334,19 +1331,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 +1527,13 @@ }]]> + + + EVENT_DB_BEFORE_WRITE + EvtComputeRequestType + 0 + +