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]
This commit is contained in:
Romain Quetiez
2016-05-10 15:38:10 +00:00
parent 89328e1662
commit c911ce38a6

View File

@@ -70,7 +70,7 @@
<value id="service_request">service_request</value>
</values>
<sql>request_type</sql>
<default_value>incident</default_value>
<default_value></default_value>
<is_null_allowed>true</is_null_allowed>
<display_style>list</display_style>
</field>
@@ -157,7 +157,7 @@
<is_null_allowed>true</is_null_allowed>
</field>
<field id="servicesubcategory_id" xsi:type="AttributeExternalKey">
<filter><![CDATA[SELECT ServiceSubcategory WHERE service_id = :this->service_id AND request_type = :this->request_type AND status != 'obsolete']]></filter>
<filter><![CDATA[SELECT ServiceSubcategory WHERE service_id = :this->service_id AND (ISNULL(:this->request_type) OR request_type = :this->request_type) AND status != 'obsolete']]></filter>
<dependencies>
<attribute id="service_id"/>
<attribute id="request_type"/>
@@ -1196,10 +1196,21 @@
<type>Overload-DBObject</type>
<code><![CDATA[ public function ComputeValues()
{
// 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)
{
$sType = $this->Get('servicesubcategory_id->request_type');
$this->Set('request_type', $sType);
}
}
return parent::ComputeValues();
}]]></code>
</method>