datamodel.itop-problem-mgmt.xml 24 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <itop_design xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  3. <classes>
  4. <class id="Problem">
  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. <category>bizmodel,searchable,problemmgmt</category>
  15. <parent>Ticket</parent>
  16. <abstract>false</abstract>
  17. <key_type>autoincrement</key_type>
  18. <db_table>ticket_problem</db_table>
  19. <db_key_field>id</db_key_field>
  20. <db_final_class_field></db_final_class_field>
  21. <naming>
  22. <format>%1$s</format>
  23. <attributes>
  24. <attribute id="ref"/>
  25. </attributes>
  26. </naming>
  27. <display_template></display_template>
  28. <icon>images/problem.png</icon>
  29. <reconciliation>
  30. <attributes>
  31. <attribute id="ref"/>
  32. </attributes>
  33. </reconciliation>
  34. <order>
  35. <columns>
  36. <column id="ref" order="0">
  37. <ascending>false</ascending>
  38. </column>
  39. </columns>
  40. </order>
  41. </properties>
  42. <fields>
  43. <field id="status" xsi:type="AttributeEnum">
  44. <values>
  45. <value>new</value>
  46. <value>assigned</value>
  47. <value>resolved</value>
  48. <value>closed</value>
  49. </values>
  50. <sql>status</sql>
  51. <default_value>new</default_value>
  52. <is_null_allowed>false</is_null_allowed>
  53. </field>
  54. <field id="org_id" xsi:type="AttributeExternalKey">
  55. <sql>org_id</sql>
  56. <target_class>Organization</target_class>
  57. <is_null_allowed>false</is_null_allowed>
  58. <on_target_delete>DEL_AUTO</on_target_delete>
  59. <jointype></jointype>
  60. </field>
  61. <field id="org_name" xsi:type="AttributeExternalField">
  62. <extkey_attcode>org_id</extkey_attcode>
  63. <target_attcode>name</target_attcode>
  64. </field>
  65. <field id="service_id" xsi:type="AttributeExternalKey">
  66. <filter><![CDATA[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->org_id]]></filter>
  67. <dependencies>
  68. <attribute id="org_id"/>
  69. </dependencies>
  70. <sql>service_id</sql>
  71. <target_class>Service</target_class>
  72. <is_null_allowed>false</is_null_allowed>
  73. <on_target_delete>DEL_MANUAL</on_target_delete>
  74. <jointype></jointype>
  75. </field>
  76. <field id="service_name" xsi:type="AttributeExternalField">
  77. <extkey_attcode>service_id</extkey_attcode>
  78. <target_attcode>name</target_attcode>
  79. </field>
  80. <field id="servicesubcategory_id" xsi:type="AttributeExternalKey">
  81. <filter><![CDATA[SELECT ServiceSubcategory WHERE service_id = :this->service_id]]></filter>
  82. <dependencies>
  83. <attribute id="service_id"/>
  84. </dependencies>
  85. <sql>servicesubcategory_id</sql>
  86. <target_class>ServiceSubcategory</target_class>
  87. <is_null_allowed>false</is_null_allowed>
  88. <on_target_delete>DEL_MANUAL</on_target_delete>
  89. <jointype></jointype>
  90. </field>
  91. <field id="servicesubcategory_name" xsi:type="AttributeExternalField">
  92. <extkey_attcode>servicesubcategory_id</extkey_attcode>
  93. <target_attcode>name</target_attcode>
  94. </field>
  95. <field id="product" xsi:type="AttributeString">
  96. <sql>product</sql>
  97. <default_value></default_value>
  98. <is_null_allowed>true</is_null_allowed>
  99. </field>
  100. <field id="impact" xsi:type="AttributeEnum">
  101. <values>
  102. <value>1</value>
  103. <value>2</value>
  104. <value>3</value>
  105. </values>
  106. <sql>impact</sql>
  107. <default_value>1</default_value>
  108. <is_null_allowed>false</is_null_allowed>
  109. </field>
  110. <field id="urgency" xsi:type="AttributeEnum">
  111. <values>
  112. <value>1</value>
  113. <value>2</value>
  114. <value>3</value>
  115. </values>
  116. <sql>urgency</sql>
  117. <default_value>1</default_value>
  118. <is_null_allowed>false</is_null_allowed>
  119. </field>
  120. <field id="priority" xsi:type="AttributeEnum">
  121. <values>
  122. <value>1</value>
  123. <value>2</value>
  124. <value>3</value>
  125. </values>
  126. <sql>priority</sql>
  127. <default_value>1</default_value>
  128. <is_null_allowed>false</is_null_allowed>
  129. </field>
  130. <field id="workgroup_id" xsi:type="AttributeExternalKey">
  131. <filter><![CDATA[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->service_id AND cc.org_id = :this->org_id]]></filter>
  132. <dependencies>
  133. <attribute id="org_id"/>
  134. <attribute id="service_id"/>
  135. </dependencies>
  136. <sql>workgroup_id</sql>
  137. <target_class>Team</target_class>
  138. <is_null_allowed>false</is_null_allowed>
  139. <on_target_delete>DEL_MANUAL</on_target_delete>
  140. <jointype></jointype>
  141. </field>
  142. <field id="workgroup_name" xsi:type="AttributeExternalField">
  143. <extkey_attcode>workgroup_id</extkey_attcode>
  144. <target_attcode>name</target_attcode>
  145. </field>
  146. <field id="agent_id" xsi:type="AttributeExternalKey">
  147. <filter><![CDATA[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->workgroup_id]]></filter>
  148. <dependencies>
  149. <attribute id="workgroup_id"/>
  150. </dependencies>
  151. <sql>agent_id</sql>
  152. <target_class>Person</target_class>
  153. <is_null_allowed>true</is_null_allowed>
  154. <on_target_delete>DEL_MANUAL</on_target_delete>
  155. <jointype></jointype>
  156. </field>
  157. <field id="agent_name" xsi:type="AttributeExternalField">
  158. <extkey_attcode>agent_id</extkey_attcode>
  159. <target_attcode>name</target_attcode>
  160. </field>
  161. <field id="agent_email" xsi:type="AttributeExternalField">
  162. <extkey_attcode>agent_id</extkey_attcode>
  163. <target_attcode>email</target_attcode>
  164. </field>
  165. <field id="related_change_id" xsi:type="AttributeExternalKey">
  166. <sql>related_change_id</sql>
  167. <target_class>Change</target_class>
  168. <is_null_allowed>true</is_null_allowed>
  169. <on_target_delete>DEL_MANUAL</on_target_delete>
  170. <jointype></jointype>
  171. </field>
  172. <field id="related_change_ref" xsi:type="AttributeExternalField">
  173. <extkey_attcode>related_change_id</extkey_attcode>
  174. <target_attcode>ref</target_attcode>
  175. </field>
  176. <field id="close_date" xsi:type="AttributeDateTime">
  177. <sql>close_date</sql>
  178. <default_value></default_value>
  179. <is_null_allowed>true</is_null_allowed>
  180. </field>
  181. <field id="last_update" xsi:type="AttributeDateTime">
  182. <sql>last_update</sql>
  183. <default_value></default_value>
  184. <is_null_allowed>true</is_null_allowed>
  185. </field>
  186. <field id="assignment_date" xsi:type="AttributeDateTime">
  187. <sql>assignment_date</sql>
  188. <default_value></default_value>
  189. <is_null_allowed>true</is_null_allowed>
  190. </field>
  191. <field id="resolution_date" xsi:type="AttributeDateTime">
  192. <sql>resolution_date</sql>
  193. <default_value></default_value>
  194. <is_null_allowed>true</is_null_allowed>
  195. </field>
  196. <field id="knownerrors_list" xsi:type="AttributeLinkedSet">
  197. <linked_class>KnownError</linked_class>
  198. <ext_key_to_me>problem_id</ext_key_to_me>
  199. <count_min>0</count_min>
  200. <count_max>0</count_max>
  201. </field>
  202. </fields>
  203. <lifecycle>
  204. <attribute>status</attribute>
  205. <stimuli>
  206. <stimulus id="ev_assign" xsi:type="StimulusUserAction"/>
  207. <stimulus id="ev_reassign" xsi:type="StimulusUserAction"/>
  208. <stimulus id="ev_resolve" xsi:type="StimulusUserAction"/>
  209. <stimulus id="ev_close" xsi:type="StimulusUserAction"/>
  210. </stimuli>
  211. <states>
  212. <state id="new">
  213. <flags>
  214. <attribute id="ref">
  215. <read_only/>
  216. </attribute>
  217. <attribute id="description">
  218. <must_change/>
  219. </attribute>
  220. <attribute id="ticket_log">
  221. <hidden/>
  222. </attribute>
  223. <attribute id="start_date">
  224. <read_only/>
  225. </attribute>
  226. <attribute id="org_id">
  227. <must_change/>
  228. </attribute>
  229. <attribute id="service_id">
  230. <must_change/>
  231. </attribute>
  232. <attribute id="servicesubcategory_id">
  233. <must_change/>
  234. </attribute>
  235. <attribute id="product">
  236. <must_prompt/>
  237. </attribute>
  238. <attribute id="impact">
  239. <must_change/>
  240. </attribute>
  241. <attribute id="urgency">
  242. <must_change/>
  243. </attribute>
  244. <attribute id="priority">
  245. <read_only/>
  246. </attribute>
  247. <attribute id="workgroup_id">
  248. <must_change/>
  249. </attribute>
  250. <attribute id="agent_id">
  251. <hidden/>
  252. </attribute>
  253. <attribute id="agent_email">
  254. <hidden/>
  255. </attribute>
  256. <attribute id="related_change_id">
  257. <hidden/>
  258. </attribute>
  259. <attribute id="close_date">
  260. <hidden/>
  261. </attribute>
  262. <attribute id="last_update">
  263. <read_only/>
  264. </attribute>
  265. <attribute id="assignment_date">
  266. <hidden/>
  267. </attribute>
  268. <attribute id="resolution_date">
  269. <hidden/>
  270. </attribute>
  271. </flags>
  272. <transitions>
  273. <transition>
  274. <stimulus>ev_assign</stimulus>
  275. <target>assigned</target>
  276. <actions>
  277. <action>
  278. <verb>SetAssignedDate</verb>
  279. </action>
  280. </actions>
  281. </transition>
  282. </transitions>
  283. </state>
  284. <state id="assigned">
  285. <flags>
  286. <attribute id="ref">
  287. <read_only/>
  288. </attribute>
  289. <attribute id="title">
  290. <read_only/>
  291. </attribute>
  292. <attribute id="description">
  293. <read_only/>
  294. </attribute>
  295. <attribute id="start_date">
  296. <read_only/>
  297. </attribute>
  298. <attribute id="org_id">
  299. <read_only/>
  300. </attribute>
  301. <attribute id="priority">
  302. <read_only/>
  303. </attribute>
  304. <attribute id="workgroup_id">
  305. <mandatory/>
  306. <must_prompt/>
  307. </attribute>
  308. <attribute id="agent_id">
  309. <mandatory/>
  310. <must_prompt/>
  311. </attribute>
  312. <attribute id="agent_email">
  313. <read_only/>
  314. </attribute>
  315. <attribute id="close_date">
  316. <hidden/>
  317. </attribute>
  318. <attribute id="last_update">
  319. <read_only/>
  320. </attribute>
  321. <attribute id="assignment_date">
  322. <read_only/>
  323. </attribute>
  324. <attribute id="resolution_date">
  325. <hidden/>
  326. </attribute>
  327. </flags>
  328. <transitions>
  329. <transition>
  330. <stimulus>ev_reassign</stimulus>
  331. <target>assigned</target>
  332. <actions/>
  333. </transition>
  334. <transition>
  335. <stimulus>ev_resolve</stimulus>
  336. <target>resolved</target>
  337. <actions>
  338. <action>
  339. <verb>SetResolveDate</verb>
  340. </action>
  341. </actions>
  342. </transition>
  343. </transitions>
  344. </state>
  345. <state id="resolved">
  346. <flags>
  347. <attribute id="ref">
  348. <read_only/>
  349. </attribute>
  350. <attribute id="title">
  351. <read_only/>
  352. </attribute>
  353. <attribute id="description">
  354. <read_only/>
  355. </attribute>
  356. <attribute id="start_date">
  357. <read_only/>
  358. </attribute>
  359. <attribute id="org_id">
  360. <read_only/>
  361. </attribute>
  362. <attribute id="service_id">
  363. <read_only/>
  364. </attribute>
  365. <attribute id="servicesubcategory_id">
  366. <read_only/>
  367. </attribute>
  368. <attribute id="product">
  369. <read_only/>
  370. </attribute>
  371. <attribute id="impact">
  372. <read_only/>
  373. </attribute>
  374. <attribute id="urgency">
  375. <read_only/>
  376. </attribute>
  377. <attribute id="priority">
  378. <read_only/>
  379. </attribute>
  380. <attribute id="workgroup_id">
  381. <read_only/>
  382. </attribute>
  383. <attribute id="agent_id">
  384. <read_only/>
  385. </attribute>
  386. <attribute id="agent_email">
  387. <read_only/>
  388. </attribute>
  389. <attribute id="close_date">
  390. <hidden/>
  391. </attribute>
  392. <attribute id="last_update">
  393. <read_only/>
  394. </attribute>
  395. <attribute id="assignment_date">
  396. <read_only/>
  397. </attribute>
  398. <attribute id="resolution_date">
  399. <hidden/>
  400. </attribute>
  401. </flags>
  402. <transitions>
  403. <transition>
  404. <stimulus>ev_reassign</stimulus>
  405. <target>assigned</target>
  406. <actions/>
  407. </transition>
  408. <transition>
  409. <stimulus>ev_close</stimulus>
  410. <target>closed</target>
  411. <actions>
  412. <action>
  413. <verb>SetClosureDate</verb>
  414. </action>
  415. </actions>
  416. </transition>
  417. </transitions>
  418. </state>
  419. <state id="closed">
  420. <flags>
  421. <attribute id="ref">
  422. <read_only/>
  423. </attribute>
  424. <attribute id="title">
  425. <read_only/>
  426. </attribute>
  427. <attribute id="description">
  428. <read_only/>
  429. </attribute>
  430. <attribute id="ticket_log">
  431. <read_only/>
  432. </attribute>
  433. <attribute id="start_date">
  434. <read_only/>
  435. </attribute>
  436. <attribute id="org_id">
  437. <read_only/>
  438. </attribute>
  439. <attribute id="service_id">
  440. <read_only/>
  441. </attribute>
  442. <attribute id="servicesubcategory_id">
  443. <read_only/>
  444. </attribute>
  445. <attribute id="product">
  446. <read_only/>
  447. </attribute>
  448. <attribute id="impact">
  449. <read_only/>
  450. </attribute>
  451. <attribute id="urgency">
  452. <read_only/>
  453. </attribute>
  454. <attribute id="priority">
  455. <read_only/>
  456. </attribute>
  457. <attribute id="workgroup_id">
  458. <read_only/>
  459. </attribute>
  460. <attribute id="agent_id">
  461. <read_only/>
  462. </attribute>
  463. <attribute id="agent_email">
  464. <read_only/>
  465. </attribute>
  466. <attribute id="close_date">
  467. <read_only/>
  468. </attribute>
  469. <attribute id="last_update">
  470. <read_only/>
  471. </attribute>
  472. <attribute id="assignment_date">
  473. <read_only/>
  474. </attribute>
  475. <attribute id="resolution_date">
  476. <hidden/>
  477. </attribute>
  478. </flags>
  479. <transitions/>
  480. </state>
  481. </states>
  482. </lifecycle>
  483. <methods>
  484. <method id="SetAssignedDate">
  485. <static>false</static>
  486. <access>public</access>
  487. <type>LifecycleAction</type>
  488. <code><![CDATA[ public function SetAssignedDate($sStimulusCode)
  489. {
  490. $this->Set('assignment_date', time());
  491. return true;
  492. }]]></code>
  493. </method>
  494. <method id="SetResolveDate">
  495. <static>false</static>
  496. <access>public</access>
  497. <type>LifecycleAction</type>
  498. <code><![CDATA[ public function SetResolveDate($sStimulusCode)
  499. {
  500. $this->Set('resolution_date', time());
  501. return true;
  502. }]]></code>
  503. </method>
  504. <method id="SetClosureDate">
  505. <static>false</static>
  506. <access>public</access>
  507. <type>LifecycleAction</type>
  508. <code><![CDATA[ public function SetClosureDate($sStimulusCode)
  509. {
  510. $this->Set('close_date', time());
  511. return true;
  512. }]]></code>
  513. </method>
  514. <method id="ComputePriority">
  515. <comment>/** Compute the priority of the ticket based on its impact and urgency
  516. * @return integer The priority of the ticket 1(high) .. 3(low)
  517. */</comment>
  518. <static>false</static>
  519. <access>public</access>
  520. <type>LifecycleAction</type>
  521. <code><![CDATA[ public function ComputePriority()
  522. {
  523. // priority[impact][urgency]
  524. $aPriorities = array(
  525. // single person
  526. 1 => array(
  527. 1 => 1,
  528. 2 => 1,
  529. 3 => 2,
  530. ),
  531. // a group
  532. 2 => array(
  533. 1 => 1,
  534. 2 => 2,
  535. 3 => 3,
  536. ),
  537. // a departement!
  538. 3 => array(
  539. 1 => 2,
  540. 2 => 3,
  541. 3 => 3,
  542. ),
  543. );
  544. $iPriority = $aPriorities[(int)$this->Get('impact')][(int)$this->Get('urgency')];
  545. return $iPriority;
  546. }]]></code>
  547. </method>
  548. <method id="ComputeValues">
  549. <static>false</static>
  550. <access>public</access>
  551. <type>Overload-DBObject</type>
  552. <code><![CDATA[ public function ComputeValues()
  553. {
  554. // Compute the priority of the ticket
  555. $this->Set('priority', $this->ComputePriority());
  556. $sCurrRef = $this->Get('ref');
  557. if (strlen($sCurrRef) == 0)
  558. {
  559. $iKey = $this->GetKey();
  560. if ($iKey < 0)
  561. {
  562. // Object not yet in the Database
  563. $iKey = MetaModel::GetNextKey(get_class($this));
  564. }
  565. $sName = sprintf('P-%06d', $iKey);
  566. $this->Set('ref', $sName);
  567. }
  568. }]]></code>
  569. </method>
  570. </methods>
  571. <presentation>
  572. <details>
  573. <items>
  574. <item>document_list</item>
  575. <item>ci_list</item>
  576. <item>contact_list</item>
  577. <item>incident_list</item>
  578. <item id="col:col1">
  579. <items>
  580. <item id="fieldset:Ticket:baseinfo">
  581. <items>
  582. <item>ref</item>
  583. <item>title</item>
  584. <item>org_id</item>
  585. <item>status</item>
  586. <item>priority</item>
  587. <item>service_id</item>
  588. <item>servicesubcategory_id</item>
  589. <item>product</item>
  590. </items>
  591. </item>
  592. <item id="fieldset:Ticket:moreinfo">
  593. <items>
  594. <item>impact</item>
  595. <item>urgency</item>
  596. <item>description</item>
  597. </items>
  598. </item>
  599. </items>
  600. </item>
  601. <item id="col:col2">
  602. <items>
  603. <item id="fieldset:Ticket:date">
  604. <items>
  605. <item>start_date</item>
  606. <item>last_update</item>
  607. <item>assignment_date</item>
  608. <item>close_date</item>
  609. </items>
  610. </item>
  611. <item id="fieldset:Ticket:contact">
  612. <items>
  613. <item>workgroup_id</item>
  614. <item>agent_id</item>
  615. </items>
  616. </item>
  617. <item id="fieldset:Ticket:relation">
  618. <items>
  619. <item>related_change_id</item>
  620. </items>
  621. </item>
  622. </items>
  623. </item>
  624. </items>
  625. </details>
  626. <search>
  627. <items>
  628. <item>ref</item>
  629. <item>title</item>
  630. <item>org_id</item>
  631. <item>start_date</item>
  632. <item>status</item>
  633. <item>service_id</item>
  634. <item>servicesubcategory_id</item>
  635. <item>product</item>
  636. <item>impact</item>
  637. <item>urgency</item>
  638. <item>priority</item>
  639. <item>workgroup_id</item>
  640. <item>agent_id</item>
  641. <item>agent_email</item>
  642. <item>close_date</item>
  643. </items>
  644. </search>
  645. <list>
  646. <items>
  647. <item>title</item>
  648. <item>org_id</item>
  649. <item>start_date</item>
  650. <item>status</item>
  651. <item>service_id</item>
  652. <item>priority</item>
  653. </items>
  654. </list>
  655. </presentation>
  656. </class>
  657. </classes>
  658. <menus>
  659. <menu id="Problem:Overview" xsi:type="TemplateMenuNode">
  660. <rank>0</rank>
  661. <parent>ProblemManagement</parent>
  662. <template_file>overview.html</template_file>
  663. </menu>
  664. <menu id="NewProblem" xsi:type="NewObjectMenuNode">
  665. <rank>1</rank>
  666. <parent>ProblemManagement</parent>
  667. <class>Problem</class>
  668. </menu>
  669. <menu id="SearchProblems" xsi:type="SearchMenuNode">
  670. <rank>2</rank>
  671. <parent>ProblemManagement</parent>
  672. <class>Problem</class>
  673. </menu>
  674. <menu id="Problem:MyProblems" xsi:type="OQLMenuNode">
  675. <rank>1</rank>
  676. <parent>Problem:Shortcuts</parent>
  677. <oql><![CDATA[SELECT Problem WHERE agent_id = :current_contact_id AND status NOT IN ("closed", "resolved")]]></oql>
  678. <do_search></do_search>
  679. </menu>
  680. <menu id="Problem:OpenProblems" xsi:type="OQLMenuNode">
  681. <rank>2</rank>
  682. <parent>Problem:Shortcuts</parent>
  683. <oql><![CDATA[SELECT Problem WHERE status IN ("new", "assigned", "resolved")]]></oql>
  684. <do_search></do_search>
  685. </menu>
  686. </menus>
  687. </itop_design>