datamodel.itop-problem-mgmt.xml 19 KB

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