mirror of
https://github.com/Combodo/iTop.git
synced 2026-04-27 04:28:44 +02:00
# Conflicts: # application/applicationextension.inc.php # core/attributedef.class.inc.php # core/cmdbchangeop.class.inc.php # core/cmdbobject.class.inc.php # core/dbobjectsearch.class.php # core/oql/expression.class.inc.php # core/oql/oql-lexer.plex # core/oql/oql-parser.y # core/oql/oqlquery.class.inc.php # css/light-grey.scss # datamodels/2.x/itop-full-itil/datamodel.itop-full-itil.xml # datamodels/2.x/itop-portal/datamodel.itop-portal.xml # datamodels/2.x/itop-tickets/en.dict.itop-tickets.php # dictionaries/en.dictionary.itop.core.php # dictionaries/fr.dictionary.itop.core.php # setup/xmldataloader.class.inc.php # test/ItopDataTestCase.php
75 lines
2.2 KiB
XML
75 lines
2.2 KiB
XML
<?xml version="1.0" encoding="UTF-8"?>
|
|
<itop_design version="1.6">
|
|
<classes>
|
|
<class id="Ticket">
|
|
<methods>
|
|
<method id="CreateFromServiceSubcategory" _delta="define">
|
|
<comment>/**
|
|
* Instanciate an object of the relevant class, depending on the request type
|
|
* @return DBObject
|
|
*/</comment>
|
|
<static>true</static>
|
|
<access>public</access>
|
|
<type>Factory</type>
|
|
<code><![CDATA[ static public function CreateFromServiceSubcategory($oServiceSubcategory)
|
|
{
|
|
$sType = $oServiceSubcategory->Get('request_type');
|
|
if ($sType == 'incident')
|
|
{
|
|
if (!class_exists('Incident'))
|
|
{
|
|
throw new Exception('Could not create a ticket after the service '.$oServiceSubcategory->Get('friendlyname').' of type '.$sType.': unknown class "Incident"');
|
|
}
|
|
$oRet = new Incident();
|
|
}
|
|
else
|
|
{
|
|
if (!class_exists('UserRequest'))
|
|
{
|
|
throw new Exception('Could not create a ticket after the service '.$oServiceSubcategory->Get('friendlyname').' of type '.$sType.': unknown class "UserRequest"');
|
|
}
|
|
$oRet = new UserRequest();
|
|
}
|
|
return $oRet;
|
|
}]]></code>
|
|
</method>
|
|
</methods>
|
|
</class>
|
|
</classes>
|
|
<module_designs>
|
|
<module_design id="itop-portal">
|
|
<bricks>
|
|
<brick id="services">
|
|
<levels>
|
|
<level id="1">
|
|
<levels>
|
|
<level id="1">
|
|
<levels>
|
|
<level id="1">
|
|
<actions>
|
|
<action id="create_from_this">
|
|
<class _delta="delete" />
|
|
<factory_method _delta="define"><![CDATA[\Ticket::CreateFromServiceSubcategory]]></factory_method>
|
|
</action>
|
|
</actions>
|
|
</level>
|
|
</levels>
|
|
</level>
|
|
</levels>
|
|
</level>
|
|
</levels>
|
|
</brick>
|
|
</bricks>
|
|
<classes>
|
|
<class id="ServiceSubcategory">
|
|
<scopes>
|
|
<scope id="all">
|
|
<oql_view _delta="redefine"><![CDATA[SELECT ServiceSubcategory WHERE status != 'obsolete']]></oql_view>
|
|
</scope>
|
|
</scopes>
|
|
</class>
|
|
</classes>
|
|
</module_design>
|
|
</module_designs>
|
|
</itop_design>
|