datamodel.itop-problem-mgmt.xml 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <itop_design xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  3. <classes>
  4. <class name="Problem" category="bizmodel,searchable,problemmgmt" parent="Ticket" abstract="false" key_type="autoincrement" db_table="ticket_problem" db_key_field="id" db_final_class_field="">
  5. <properties>
  6. <comment><![CDATA[/**
  7. * Persistent classes for a CMDB
  8. *
  9. * @author Erwan Taloc <erwan.taloc@combodo.com>
  10. * @author Romain Quetiez <romain.quetiez@combodo.com>
  11. * @author Denis Flaven <denis.flaven@combodo.com>
  12. * @license http://www.opensource.org/licenses/gpl-3.0.html LGPL
  13. */]]></comment>
  14. <naming format="%1$s">
  15. <attributes>
  16. <attribute name="ref"/>
  17. </attributes>
  18. </naming>
  19. <display_template></display_template>
  20. <icon>images/problem.png</icon>
  21. <reconciliation>
  22. <attributes>
  23. <attribute name="ref"/>
  24. </attributes>
  25. </reconciliation>
  26. <order>
  27. <columns>
  28. <column name="ref" ascending="false"/>
  29. </columns>
  30. </order>
  31. </properties>
  32. <fields>
  33. <field name="status" xsi:type="AttributeEnum" sql="status" default_value="new" is_null_allowed="false">
  34. <values>
  35. <value>new</value>
  36. <value>assigned</value>
  37. <value>resolved</value>
  38. <value>closed</value>
  39. </values>
  40. </field>
  41. <field name="org_id" xsi:type="AttributeExternalKey" target_class="Organization" jointype="" sql="org_id" is_null_allowed="false" on_target_delete="DEL_AUTO"/>
  42. <field name="org_name" xsi:type="AttributeExternalField" extkey_attcode="org_id" target_attcode="name"/>
  43. <field name="service_id" xsi:type="AttributeExternalKey" target_class="Service" jointype="" filter="SELECT Service AS s JOIN SLA AS sla ON sla.service_id=s.id JOIN lnkContractToSLA AS ln ON ln.sla_id=sla.id JOIN CustomerContract AS cc ON ln.contract_id=cc.id WHERE cc.org_id =:this-&gt;org_id" sql="service_id" is_null_allowed="false" on_target_delete="DEL_MANUAL">
  44. <dependencies>
  45. <attribute name="org_id"/>
  46. </dependencies>
  47. </field>
  48. <field name="service_name" xsi:type="AttributeExternalField" extkey_attcode="service_id" target_attcode="name"/>
  49. <field name="servicesubcategory_id" xsi:type="AttributeExternalKey" target_class="ServiceSubcategory" jointype="" filter="SELECT ServiceSubcategory WHERE service_id = :this-&gt;service_id" sql="servicesubcategory_id" is_null_allowed="false" on_target_delete="DEL_MANUAL">
  50. <dependencies>
  51. <attribute name="service_id"/>
  52. </dependencies>
  53. </field>
  54. <field name="servicesubcategory_name" xsi:type="AttributeExternalField" extkey_attcode="servicesubcategory_id" target_attcode="name"/>
  55. <field name="product" xsi:type="AttributeString" sql="product" default_value="" is_null_allowed="true"/>
  56. <field name="impact" xsi:type="AttributeEnum" sql="impact" default_value="1" is_null_allowed="false">
  57. <values>
  58. <value>1</value>
  59. <value>2</value>
  60. <value>3</value>
  61. </values>
  62. </field>
  63. <field name="urgency" xsi:type="AttributeEnum" sql="urgency" default_value="1" is_null_allowed="false">
  64. <values>
  65. <value>1</value>
  66. <value>2</value>
  67. <value>3</value>
  68. </values>
  69. </field>
  70. <field name="priority" xsi:type="AttributeEnum" sql="priority" default_value="1" is_null_allowed="false">
  71. <values>
  72. <value>1</value>
  73. <value>2</value>
  74. <value>3</value>
  75. </values>
  76. </field>
  77. <field name="workgroup_id" xsi:type="AttributeExternalKey" target_class="Team" jointype="" filter="SELECT Team AS t JOIN CustomerContract AS cc ON cc.support_team_id=t.id JOIN lnkContractToSLA AS ln ON ln.contract_id=cc.id JOIN SLA AS sla ON ln.sla_id=sla.id WHERE sla.service_id = :this-&gt;service_id AND cc.org_id = :this-&gt;org_id" sql="workgroup_id" is_null_allowed="false" on_target_delete="DEL_MANUAL">
  78. <dependencies>
  79. <attribute name="org_id"/>
  80. <attribute name="service_id"/>
  81. </dependencies>
  82. </field>
  83. <field name="workgroup_name" xsi:type="AttributeExternalField" extkey_attcode="workgroup_id" target_attcode="name"/>
  84. <field name="agent_id" xsi:type="AttributeExternalKey" target_class="Person" jointype="" filter="SELECT Person AS p JOIN lnkTeamToContact AS l ON l.contact_id=p.id JOIN Team AS t ON l.team_id=t.id WHERE t.id = :this-&gt;workgroup_id" sql="agent_id" is_null_allowed="true" on_target_delete="DEL_MANUAL">
  85. <dependencies>
  86. <attribute name="workgroup_id"/>
  87. </dependencies>
  88. </field>
  89. <field name="agent_name" xsi:type="AttributeExternalField" extkey_attcode="agent_id" target_attcode="name"/>
  90. <field name="agent_email" xsi:type="AttributeExternalField" extkey_attcode="agent_id" target_attcode="email"/>
  91. <field name="related_change_id" xsi:type="AttributeExternalKey" target_class="Change" jointype="" sql="related_change_id" is_null_allowed="true" on_target_delete="DEL_MANUAL"/>
  92. <field name="related_change_ref" xsi:type="AttributeExternalField" extkey_attcode="related_change_id" target_attcode="ref"/>
  93. <field name="close_date" xsi:type="AttributeDateTime" sql="close_date" default_value="" is_null_allowed="true"/>
  94. <field name="last_update" xsi:type="AttributeDateTime" sql="last_update" default_value="" is_null_allowed="true"/>
  95. <field name="assignment_date" xsi:type="AttributeDateTime" sql="assignment_date" default_value="" is_null_allowed="true"/>
  96. <field name="resolution_date" xsi:type="AttributeDateTime" sql="resolution_date" default_value="" is_null_allowed="true"/>
  97. <field name="knownerrors_list" xsi:type="AttributeLinkedSet" linked_class="KnownError" ext_key_to_me="problem_id" count_min="0" count_max="0"/>
  98. </fields>
  99. <lifecycle attribute="status">
  100. <stimuli>
  101. <stimulus name="ev_assign" type="StimulusUserAction"/>
  102. <stimulus name="ev_reassign" type="StimulusUserAction"/>
  103. <stimulus name="ev_resolve" type="StimulusUserAction"/>
  104. <stimulus name="ev_close" type="StimulusUserAction"/>
  105. </stimuli>
  106. <states>
  107. <state name="new">
  108. <flags>
  109. <attribute name="ref" read_only="1"/>
  110. <attribute name="title"/>
  111. <attribute name="description" must_change="1"/>
  112. <attribute name="ticket_log" hidden="1"/>
  113. <attribute name="start_date" read_only="1"/>
  114. <attribute name="document_list"/>
  115. <attribute name="ci_list"/>
  116. <attribute name="contact_list"/>
  117. <attribute name="incident_list"/>
  118. <attribute name="status"/>
  119. <attribute name="org_id" must_change="1"/>
  120. <attribute name="org_name"/>
  121. <attribute name="service_id" must_change="1"/>
  122. <attribute name="service_name"/>
  123. <attribute name="servicesubcategory_id" must_change="1"/>
  124. <attribute name="servicesubcategory_name"/>
  125. <attribute name="product" must_prompt="1"/>
  126. <attribute name="impact" must_change="1"/>
  127. <attribute name="urgency" must_change="1"/>
  128. <attribute name="priority" read_only="1"/>
  129. <attribute name="workgroup_id" must_change="1"/>
  130. <attribute name="workgroup_name"/>
  131. <attribute name="agent_id" hidden="1"/>
  132. <attribute name="agent_name"/>
  133. <attribute name="agent_email" hidden="1"/>
  134. <attribute name="related_change_id" hidden="1"/>
  135. <attribute name="related_change_ref"/>
  136. <attribute name="close_date" hidden="1"/>
  137. <attribute name="last_update" read_only="1"/>
  138. <attribute name="assignment_date" hidden="1"/>
  139. <attribute name="resolution_date" hidden="1"/>
  140. <attribute name="knownerrors_list"/>
  141. <attribute name="related_change_id_finalclass_recall"/>
  142. </flags>
  143. <transitions>
  144. <transition stimulus="ev_assign" target="assigned">
  145. <actions>
  146. <action verb="SetAssignedDate"/>
  147. </actions>
  148. </transition>
  149. </transitions>
  150. </state>
  151. <state name="assigned">
  152. <flags>
  153. <attribute name="ref" read_only="1"/>
  154. <attribute name="title" read_only="1"/>
  155. <attribute name="description" read_only="1"/>
  156. <attribute name="ticket_log"/>
  157. <attribute name="start_date" read_only="1"/>
  158. <attribute name="document_list"/>
  159. <attribute name="ci_list"/>
  160. <attribute name="contact_list"/>
  161. <attribute name="incident_list"/>
  162. <attribute name="status"/>
  163. <attribute name="org_id" read_only="1"/>
  164. <attribute name="org_name"/>
  165. <attribute name="service_id"/>
  166. <attribute name="service_name"/>
  167. <attribute name="servicesubcategory_id"/>
  168. <attribute name="servicesubcategory_name"/>
  169. <attribute name="product"/>
  170. <attribute name="impact"/>
  171. <attribute name="urgency"/>
  172. <attribute name="priority" read_only="1"/>
  173. <attribute name="workgroup_id" mandatory="1" must_prompt="1"/>
  174. <attribute name="workgroup_name"/>
  175. <attribute name="agent_id" mandatory="1" must_prompt="1"/>
  176. <attribute name="agent_name"/>
  177. <attribute name="agent_email" read_only="1"/>
  178. <attribute name="related_change_id"/>
  179. <attribute name="related_change_ref"/>
  180. <attribute name="close_date" hidden="1"/>
  181. <attribute name="last_update" read_only="1"/>
  182. <attribute name="assignment_date" read_only="1"/>
  183. <attribute name="resolution_date" hidden="1"/>
  184. <attribute name="knownerrors_list"/>
  185. <attribute name="related_change_id_finalclass_recall"/>
  186. </flags>
  187. <transitions>
  188. <transition stimulus="ev_reassign" target="assigned">
  189. <actions/>
  190. </transition>
  191. <transition stimulus="ev_resolve" target="resolved">
  192. <actions>
  193. <action verb="SetResolveDate"/>
  194. </actions>
  195. </transition>
  196. </transitions>
  197. </state>
  198. <state name="resolved">
  199. <flags>
  200. <attribute name="ref" read_only="1"/>
  201. <attribute name="title" read_only="1"/>
  202. <attribute name="description" read_only="1"/>
  203. <attribute name="ticket_log"/>
  204. <attribute name="start_date" read_only="1"/>
  205. <attribute name="document_list"/>
  206. <attribute name="ci_list"/>
  207. <attribute name="contact_list"/>
  208. <attribute name="incident_list"/>
  209. <attribute name="status"/>
  210. <attribute name="org_id" read_only="1"/>
  211. <attribute name="org_name"/>
  212. <attribute name="service_id" read_only="1"/>
  213. <attribute name="service_name"/>
  214. <attribute name="servicesubcategory_id" read_only="1"/>
  215. <attribute name="servicesubcategory_name"/>
  216. <attribute name="product" read_only="1"/>
  217. <attribute name="impact" read_only="1"/>
  218. <attribute name="urgency" read_only="1"/>
  219. <attribute name="priority" read_only="1"/>
  220. <attribute name="workgroup_id" read_only="1"/>
  221. <attribute name="workgroup_name"/>
  222. <attribute name="agent_id" read_only="1"/>
  223. <attribute name="agent_name"/>
  224. <attribute name="agent_email" read_only="1"/>
  225. <attribute name="related_change_id"/>
  226. <attribute name="related_change_ref"/>
  227. <attribute name="close_date" hidden="1"/>
  228. <attribute name="last_update" read_only="1"/>
  229. <attribute name="assignment_date" read_only="1"/>
  230. <attribute name="resolution_date" hidden="1"/>
  231. <attribute name="knownerrors_list"/>
  232. <attribute name="related_change_id_finalclass_recall"/>
  233. </flags>
  234. <transitions>
  235. <transition stimulus="ev_reassign" target="assigned">
  236. <actions/>
  237. </transition>
  238. <transition stimulus="ev_close" target="closed">
  239. <actions>
  240. <action verb="SetClosureDate"/>
  241. </actions>
  242. </transition>
  243. </transitions>
  244. </state>
  245. <state name="closed">
  246. <flags>
  247. <attribute name="ref" read_only="1"/>
  248. <attribute name="title" read_only="1"/>
  249. <attribute name="description" read_only="1"/>
  250. <attribute name="ticket_log" read_only="1"/>
  251. <attribute name="start_date" read_only="1"/>
  252. <attribute name="document_list"/>
  253. <attribute name="ci_list"/>
  254. <attribute name="contact_list"/>
  255. <attribute name="incident_list"/>
  256. <attribute name="status"/>
  257. <attribute name="org_id" read_only="1"/>
  258. <attribute name="org_name"/>
  259. <attribute name="service_id" read_only="1"/>
  260. <attribute name="service_name"/>
  261. <attribute name="servicesubcategory_id" read_only="1"/>
  262. <attribute name="servicesubcategory_name"/>
  263. <attribute name="product" read_only="1"/>
  264. <attribute name="impact" read_only="1"/>
  265. <attribute name="urgency" read_only="1"/>
  266. <attribute name="priority" read_only="1"/>
  267. <attribute name="workgroup_id" read_only="1"/>
  268. <attribute name="workgroup_name"/>
  269. <attribute name="agent_id" read_only="1"/>
  270. <attribute name="agent_name"/>
  271. <attribute name="agent_email" read_only="1"/>
  272. <attribute name="related_change_id"/>
  273. <attribute name="related_change_ref"/>
  274. <attribute name="close_date" read_only="1"/>
  275. <attribute name="last_update" read_only="1"/>
  276. <attribute name="assignment_date" read_only="1"/>
  277. <attribute name="resolution_date" hidden="1"/>
  278. <attribute name="knownerrors_list"/>
  279. <attribute name="related_change_id_finalclass_recall"/>
  280. </flags>
  281. <transitions/>
  282. </state>
  283. </states>
  284. </lifecycle>
  285. <methods>
  286. <method name="SetAssignedDate" static="false" access="public" type="LifecycleAction"><![CDATA[ public function SetAssignedDate($sStimulusCode)
  287. {
  288. $this->Set('assignment_date', time());
  289. return true;
  290. }]]></method>
  291. <method name="SetResolveDate" static="false" access="public" type="LifecycleAction"><![CDATA[ public function SetResolveDate($sStimulusCode)
  292. {
  293. $this->Set('resolution_date', time());
  294. return true;
  295. }]]></method>
  296. <method name="SetClosureDate" static="false" access="public" type="LifecycleAction"><![CDATA[ public function SetClosureDate($sStimulusCode)
  297. {
  298. $this->Set('close_date', time());
  299. return true;
  300. }]]></method>
  301. <method name="ComputePriority" static="false" access="public" type="LifecycleAction"><comment><![CDATA[/** Compute the priority of the ticket based on its impact and urgency
  302. * @return integer The priority of the ticket 1(high) .. 3(low)
  303. */]]></comment><![CDATA[ public function ComputePriority()
  304. {
  305. // priority[impact][urgency]
  306. $aPriorities = array(
  307. // single person
  308. 1 => array(
  309. 1 => 1,
  310. 2 => 1,
  311. 3 => 2,
  312. ),
  313. // a group
  314. 2 => array(
  315. 1 => 1,
  316. 2 => 2,
  317. 3 => 3,
  318. ),
  319. // a departement!
  320. 3 => array(
  321. 1 => 2,
  322. 2 => 3,
  323. 3 => 3,
  324. ),
  325. );
  326. $iPriority = $aPriorities[(int)$this->Get('impact')][(int)$this->Get('urgency')];
  327. return $iPriority;
  328. }]]></method>
  329. <method name="ComputeValues" static="false" access="public" type="Overload-DBObject"><![CDATA[ public function ComputeValues()
  330. {
  331. // Compute the priority of the ticket
  332. $this->Set('priority', $this->ComputePriority());
  333. $sCurrRef = $this->Get('ref');
  334. if (strlen($sCurrRef) == 0)
  335. {
  336. $iKey = $this->GetKey();
  337. if ($iKey < 0)
  338. {
  339. // Object not yet in the Database
  340. $iKey = MetaModel::GetNextKey(get_class($this));
  341. }
  342. $sName = sprintf('P-%06d', $iKey);
  343. $this->Set('ref', $sName);
  344. }
  345. }]]></method>
  346. </methods>
  347. <presentation>
  348. <details>
  349. <items>
  350. <item>document_list</item>
  351. <item>ci_list</item>
  352. <item>contact_list</item>
  353. <item>incident_list</item>
  354. <item key="col:col1">
  355. <items>
  356. <item key="fieldset:Ticket:baseinfo">
  357. <items>
  358. <item>ref</item>
  359. <item>title</item>
  360. <item>org_id</item>
  361. <item>status</item>
  362. <item>priority</item>
  363. <item>service_id</item>
  364. <item>servicesubcategory_id</item>
  365. <item>product</item>
  366. </items>
  367. </item>
  368. <item key="fieldset:Ticket:moreinfo">
  369. <items>
  370. <item>impact</item>
  371. <item>urgency</item>
  372. <item>description</item>
  373. </items>
  374. </item>
  375. </items>
  376. </item>
  377. <item key="col:col2">
  378. <items>
  379. <item key="fieldset:Ticket:date">
  380. <items>
  381. <item>start_date</item>
  382. <item>last_update</item>
  383. <item>assignment_date</item>
  384. <item>close_date</item>
  385. </items>
  386. </item>
  387. <item key="fieldset:Ticket:contact">
  388. <items>
  389. <item>workgroup_id</item>
  390. <item>agent_id</item>
  391. </items>
  392. </item>
  393. <item key="fieldset:Ticket:relation">
  394. <items>
  395. <item>related_change_id</item>
  396. </items>
  397. </item>
  398. </items>
  399. </item>
  400. </items>
  401. </details>
  402. <search>
  403. <items>
  404. <item>ref</item>
  405. <item>title</item>
  406. <item>org_id</item>
  407. <item>start_date</item>
  408. <item>status</item>
  409. <item>service_id</item>
  410. <item>servicesubcategory_id</item>
  411. <item>product</item>
  412. <item>impact</item>
  413. <item>urgency</item>
  414. <item>priority</item>
  415. <item>workgroup_id</item>
  416. <item>agent_id</item>
  417. <item>agent_email</item>
  418. <item>close_date</item>
  419. </items>
  420. </search>
  421. <list>
  422. <items>
  423. <item>title</item>
  424. <item>org_id</item>
  425. <item>start_date</item>
  426. <item>status</item>
  427. <item>service_id</item>
  428. <item>priority</item>
  429. </items>
  430. </list>
  431. </presentation>
  432. </class>
  433. </classes>
  434. <menus>
  435. <menu id="Problem:Overview" xsi:type="TemplateMenuNode">
  436. <rank value="0"/>
  437. <parent value="ProblemManagement"/>
  438. <template_file value="overview.html"/>
  439. </menu>
  440. <menu id="NewProblem" xsi:type="NewObjectMenuNode">
  441. <rank value="1"/>
  442. <parent value="ProblemManagement"/>
  443. <class value="Problem"/>
  444. </menu>
  445. <menu id="SearchProblems" xsi:type="SearchMenuNode">
  446. <rank value="2"/>
  447. <parent value="ProblemManagement"/>
  448. <class value="Problem"/>
  449. </menu>
  450. <menu id="Problem:MyProblems" xsi:type="OQLMenuNode">
  451. <rank value="1"/>
  452. <parent value="Problem:Shortcuts"/>
  453. <oql value="SELECT Problem WHERE agent_id = :current_contact_id AND status NOT IN (&quot;closed&quot;, &quot;resolved&quot;)"/>
  454. <do_search value=""/>
  455. </menu>
  456. <menu id="Problem:OpenProblems" xsi:type="OQLMenuNode">
  457. <rank value="2"/>
  458. <parent value="Problem:Shortcuts"/>
  459. <oql value="SELECT Problem WHERE status IN (&quot;new&quot;, &quot;assigned&quot;, &quot;resolved&quot;)"/>
  460. <do_search value=""/>
  461. </menu>
  462. </menus>
  463. </itop_design>