From c911ce38a6bc793e83c365a0ab0a1ba854af6e10 Mon Sep 17 00:00:00 2001 From: Romain Quetiez Date: Tue, 10 May 2016 15:38:10 +0000 Subject: [PATCH] User request (all-in-one): the end-user can leave the request type undefined, in such a case, she can select any type of services and the request type gets computed when the requests is written to the DB. Still, this is possible to select a request type and the list of services is filled with the corresponding services. This behavior was necessary for the new user portal to work fine. SVN:trunk[4046] --- .../datamodel.itop-request-mgmt.xml | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 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 a8ac8438f1..f72200b244 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 @@ -70,7 +70,7 @@ service_request request_type - incident + true list @@ -157,7 +157,7 @@ true - service_id AND request_type = :this->request_type AND status != 'obsolete']]> + service_id AND (ISNULL(:this->request_type) OR request_type = :this->request_type) AND status != 'obsolete']]> @@ -1196,10 +1196,21 @@ Overload-DBObject 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) + { + $sType = $this->Get('servicesubcategory_id->request_type'); + $this->Set('request_type', $sType); + } + } + return parent::ComputeValues(); }]]>