From 3e879c64a717fa02ea0d3c1381b5569eead74580 Mon Sep 17 00:00:00 2001 From: Vincent Dumas <42336698+v-dumas@users.noreply.github.com> Date: Thu, 8 Jan 2026 10:08:52 +0100 Subject: [PATCH] =?UTF-8?q?N=C2=B04032=20-=20On=20UserRequest,=20change=20?= =?UTF-8?q?proposed=20service=20subcategories=20(#786)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * N°4032 - On UserRequest, service subcategory no more limited by request_type --- .../datamodel.itop-request-mgmt.xml | 40 +++++++++++-------- 1 file changed, 23 insertions(+), 17 deletions(-) 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 263fadfec..91d7ee388 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,21 +1331,23 @@ // 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 === '')) - { - $iSvcSubcat = $this->Get('servicesubcategory_id'); - if ($iSvcSubcat != 0) - { - $oSvcSubcat = MetaModel::GetObject(ServiceSubcategory::class, $iSvcSubcat, true, true); - $this->Set('request_type', $oSvcSubcat->Get('request_type')); - } - } - return parent::ComputeValues(); }]]> + + false + public + EventListener + Get('servicesubcategory_id'); + if ($iSvcSubcat != 0) + { + $oSvcSubcat = MetaModel::GetObject(ServiceSubcategory::class, $iSvcSubcat, true, true); + $this->Set('request_type', $oSvcSubcat->Get('request_type')); + } + }]]> + false public @@ -1528,6 +1527,13 @@ }]]> + + + EVENT_DB_BEFORE_WRITE + EvtComputeRequestType + 0 + +