datamodel.itop-problem-mgmt.xml 22 KB

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