<?xml version="1.0" encoding="UTF-8"?>
<itop_design xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="1.6">
	<constants>
		<constant id="PORTAL_TYPE_TO_CLASS" xsi:type="string" _delta="redefine"><![CDATA[{"service_request":"UserRequest","incident":"Incident"}]]></constant>
		<constant id="PORTAL_INCIDENT_PUBLIC_LOG" xsi:type="string" _delta="define"><![CDATA[public_log]]></constant>
		<constant id="PORTAL_INCIDENT_USER_COMMENT" xsi:type="string" _delta="define"><![CDATA[user_comment]]></constant>
		<constant id="PORTAL_INCIDENT_FORM_ATTRIBUTES" xsi:type="string" _delta="define"><![CDATA[title,description,impact,urgency]]></constant>
		<constant id="PORTAL_INCIDENT_TYPE" xsi:type="string" _delta="define"><![CDATA[]]></constant>
		<constant id="PORTAL_INCIDENT_LIST_ZLIST" xsi:type="string" _delta="define"><![CDATA[finalclass,title,start_date,status,servicesubcategory_id,priority,caller_id]]></constant>
		<constant id="PORTAL_INCIDENT_CLOSED_ZLIST" xsi:type="string" _delta="define"><![CDATA[title,start_date,close_date,servicesubcategory_id]]></constant>
		<constant id="PORTAL_INCIDENT_DETAILS_ZLIST" xsi:type="string" _delta="define"><![CDATA[{"col:left":["ref","caller_id","servicesubcategory_id","title","description","solution"],"col:right":["status","priority","start_date","resolution_date","last_update","agent_id"]}]]></constant>
		<constant id="PORTAL_INCIDENT_DISPLAY_QUERY" xsi:type="string" _delta="define"><![CDATA[SELECT Incident WHERE org_id = :contact->org_id AND caller_id = :contact->id]]></constant>
		<constant id="PORTAL_INCIDENT_DISPLAY_POWERUSER_QUERY" xsi:type="string" _delta="define"><![CDATA[SELECT Incident WHERE org_id = :contact->org_id]]></constant>
	</constants>
	<classes>
		<class id="Incident" _delta="define">
			<parent>Ticket</parent>
			<properties>
				<comment><![CDATA[/**
 * Persistent classes for a CMDB
 *
 * @copyright   Copyright (C) 2010-2012 Combodo SARL
 * @license     http://opensource.org/licenses/AGPL-3.0
 */]]></comment>
				<category>bizmodel,searchable,requestmgmt</category>
				<abstract>false</abstract>
				<key_type>autoincrement</key_type>
				<db_table>ticket_incident</db_table>
				<db_key_field>id</db_key_field>
				<db_final_class_field/>
				<naming>
					<attributes>
						<attribute id="ref"/>
					</attributes>
				</naming>
				<display_template/>
				<icon>images/incident.png</icon>
				<reconciliation>
					<attributes>
						<attribute id="ref"/>
					</attributes>
				</reconciliation>
				<order>
					<columns>
						<column id="ref" ascending="false"/>
					</columns>
				</order>
			</properties>
			<fields>
				<field id="status" xsi:type="AttributeEnum">
					<always_load_in_tables>true</always_load_in_tables>
					<values>
						<value id="new">new</value>
						<value id="assigned">assigned</value>
						<value id="pending">pending</value>
						<value id="escalated_tto">escalated_tto</value>
						<value id="escalated_ttr">escalated_ttr</value>
						<value id="resolved">resolved</value>
						<value id="closed">closed</value>
					</values>
					<sql>status</sql>
					<default_value>new</default_value>
					<is_null_allowed>false</is_null_allowed>
					<display_style>list</display_style>
				</field>
				<field id="impact" xsi:type="AttributeEnum">
					<values>
						<value id="1">1</value>
						<value id="2">2</value>
						<value id="3">3</value>
					</values>
					<sql>impact</sql>
					<default_value>1</default_value>
					<is_null_allowed>false</is_null_allowed>
					<display_style>list</display_style>
				</field>
				<field id="priority" xsi:type="AttributeEnum">
					<values>
						<value id="1">1</value>
						<value id="2">2</value>
						<value id="3">3</value>
						<value id="4">4</value>
					</values>
					<dependencies>
						<attribute id="impact"/>
						<attribute id="urgency"/>
					</dependencies>
					<sql>priority</sql>
					<default_value>4</default_value>
					<is_null_allowed>false</is_null_allowed>
				</field>
				<field id="urgency" xsi:type="AttributeEnum">
					<values>
						<value id="1">1</value>
						<value id="2">2</value>
						<value id="3">3</value>
						<value id="4">4</value>
					</values>
					<sql>urgency</sql>
					<default_value>4</default_value>
					<is_null_allowed>false</is_null_allowed>
				</field>
				<field id="origin" xsi:type="AttributeEnum">
					<values>
						<value id="mail">mail</value>
						<value id="phone">phone</value>
						<value id="portal">portal</value>
						<value id="monitoring">monitoring</value>
					</values>
					<sql>origin</sql>
					<default_value>phone</default_value>
					<is_null_allowed>true</is_null_allowed>
					<display_style>list</display_style>
				</field>
				<field id="service_id" xsi:type="AttributeExternalKey">
					<filter><![CDATA[SELECT Service AS s JOIN lnkCustomerContractToService AS l1 ON l1.service_id=s.id JOIN CustomerContract AS cc ON l1.customercontract_id=cc.id WHERE cc.org_id = :this->org_id AND s.status != 'obsolete']]></filter>
					<dependencies>
						<attribute id="org_id"/>
					</dependencies>
					<sql>service_id</sql>
					<target_class>Service</target_class>
					<is_null_allowed>true</is_null_allowed>
					<on_target_delete>DEL_MANUAL</on_target_delete>
					<allow_target_creation>false</allow_target_creation>
				</field>
				<field id="service_name" xsi:type="AttributeExternalField">
					<extkey_attcode>service_id</extkey_attcode>
					<target_attcode>name</target_attcode>
				</field>
				<field id="servicesubcategory_id" xsi:type="AttributeExternalKey">
					<filter><![CDATA[SELECT ServiceSubcategory WHERE service_id = :this->service_id AND request_type = 'incident' AND status != 'obsolete']]></filter>
					<dependencies>
						<attribute id="service_id"/>
					</dependencies>
					<sql>servicesubcategory_id</sql>
					<target_class>ServiceSubcategory</target_class>
					<is_null_allowed>true</is_null_allowed>
					<on_target_delete>DEL_MANUAL</on_target_delete>
					<allow_target_creation>false</allow_target_creation>
				</field>
				<field id="servicesubcategory_name" xsi:type="AttributeExternalField">
					<extkey_attcode>servicesubcategory_id</extkey_attcode>
					<target_attcode>name</target_attcode>
				</field>
				<field id="escalation_flag" xsi:type="AttributeEnum">
					<values>
						<value id="yes">yes</value>
						<value id="no">no</value>
					</values>
					<sql>escalation_flag</sql>
					<default_value>no</default_value>
					<is_null_allowed>true</is_null_allowed>
					<display_style>list</display_style>
				</field>
				<field id="escalation_reason" xsi:type="AttributeString">
					<sql>escalation_reason</sql>
					<default_value/>
					<is_null_allowed>true</is_null_allowed>
				</field>
				<field id="assignment_date" xsi:type="AttributeDateTime">
					<sql>assignment_date</sql>
					<default_value/>
					<is_null_allowed>true</is_null_allowed>
				</field>
				<field id="resolution_date" xsi:type="AttributeDateTime">
					<sql>resolution_date</sql>
					<default_value/>
					<is_null_allowed>true</is_null_allowed>
				</field>
				<field id="last_pending_date" xsi:type="AttributeDateTime">
					<sql>last_pending_date</sql>
					<default_value/>
					<is_null_allowed>true</is_null_allowed>
				</field>
				<field id="cumulatedpending" xsi:type="AttributeStopWatch">
					<states>
						<state id="pending"/>
					</states>
					<working_time/>
					<thresholds/>
					<goal/>
				</field>
				<field id="tto" xsi:type="AttributeStopWatch">
					<always_load_in_tables>true</always_load_in_tables>
					<states>
						<state id="new"/>
						<state id="escalated_tto"/>
					</states>
					<working_time/>
					<goal>ResponseTicketTTO</goal>
					<thresholds>
						<threshold id="75">
							<highlight>
								<code>warning</code>
								<persistent>false</persistent>
							</highlight>
							<actions>
							</actions>
						</threshold>
						<threshold id="100">
							<highlight>
								<code>critical</code>
								<persistent>false</persistent>
							</highlight>
							<actions>
								<action>
									<verb>ApplyStimulus</verb>
									<params>
										<param>ev_timeout</param>
									</params>
								</action>
							</actions>
						</threshold>
					</thresholds>
				</field>
				<field id="ttr" xsi:type="AttributeStopWatch">
					<always_load_in_tables>true</always_load_in_tables>
					<states>
						<state id="new"/>
						<state id="escalated_tto"/>
						<state id="assigned"/>
						<state id="escalated_ttr"/>
					</states>
					<working_time/>
					<goal>ResponseTicketTTR</goal>
					<thresholds>
						<threshold id="75">
							<highlight>
								<code>warning</code>
								<persistent>false</persistent>
							</highlight>
							<actions>
							</actions>
						</threshold>
						<threshold id="100">
							<highlight>
								<code>critical</code>
								<persistent>false</persistent>
							</highlight>
							<actions>
								<action>
									<verb>ApplyStimulus</verb>
									<params>
										<param>ev_timeout</param>
									</params>
								</action>
							</actions>
						</threshold>
					</thresholds>
				</field>
				<field id="tto_escalation_deadline" xsi:type="AttributeSubItem">
					<target_attcode>tto</target_attcode>
					<item_code>100_deadline</item_code>
				</field>
				<field id="sla_tto_passed" xsi:type="AttributeSubItem">
					<target_attcode>tto</target_attcode>
					<item_code>100_passed</item_code>
				</field>
				<field id="sla_tto_over" xsi:type="AttributeSubItem">
					<target_attcode>tto</target_attcode>
					<item_code>100_overrun</item_code>
				</field>
				<field id="ttr_escalation_deadline" xsi:type="AttributeSubItem">
					<target_attcode>ttr</target_attcode>
					<item_code>100_deadline</item_code>
				</field>
				<field id="sla_ttr_passed" xsi:type="AttributeSubItem">
					<target_attcode>ttr</target_attcode>
					<item_code>100_passed</item_code>
				</field>
				<field id="sla_ttr_over" xsi:type="AttributeSubItem">
					<target_attcode>ttr</target_attcode>
					<item_code>100_overrun</item_code>
				</field>
				<field id="time_spent" xsi:type="AttributeDuration">
					<sql>time_spent</sql>
					<default_value/>
					<is_null_allowed>true</is_null_allowed>
				</field>
				<field id="resolution_code" xsi:type="AttributeEnum">
					<values>
						<value id="assistance">assistance</value>
						<value id="other">other</value>
						<value id="software patch">software patch</value>
						<value id="training">training</value>
						<value id="hardware repair">hardware repair</value>
						<value id="system update">system update</value>
						<value id="bug fixed">bug fixed</value>
					</values>
					<sql>resolution_code</sql>
					<default_value>assistance</default_value>
					<is_null_allowed>true</is_null_allowed>
					<display_style>list</display_style>
				</field>
				<field id="solution" xsi:type="AttributeText">
					<sql>solution</sql>
					<default_value/>
					<is_null_allowed>true</is_null_allowed>
				</field>
				<field id="pending_reason" xsi:type="AttributeText">
					<sql>pending_reason</sql>
					<default_value/>
					<is_null_allowed>true</is_null_allowed>
				</field>
				<field id="parent_incident_id" xsi:type="AttributeExternalKey">
					<filter><![CDATA[SELECT Incident WHERE id != :this->id AND status NOT IN ('resolved','closed')]]></filter>
					<sql>parent_incident_id</sql>
					<target_class>Incident</target_class>
					<is_null_allowed>true</is_null_allowed>
					<on_target_delete>DEL_MANUAL</on_target_delete>
				</field>
				<field id="parent_incident_ref" xsi:type="AttributeExternalField">
					<extkey_attcode>parent_incident_id</extkey_attcode>
					<target_attcode>ref</target_attcode>
				</field>
				<field id="parent_problem_id" xsi:type="AttributeExternalKey">
					<sql>parent_problem_id</sql>
					<target_class>Problem</target_class>
					<is_null_allowed>true</is_null_allowed>
					<on_target_delete>DEL_MANUAL</on_target_delete>
				</field>
				<field id="parent_problem_ref" xsi:type="AttributeExternalField">
					<extkey_attcode>parent_problem_id</extkey_attcode>
					<target_attcode>ref</target_attcode>
				</field>
				<field id="parent_change_id" xsi:type="AttributeExternalKey">
					<filter><![CDATA[SELECT Change WHERE status != "closed"]]></filter>
					<sql>parent_change_id</sql>
					<target_class>Change</target_class>
					<is_null_allowed>true</is_null_allowed>
					<on_target_delete>DEL_MANUAL</on_target_delete>
				</field>
				<field id="parent_change_ref" xsi:type="AttributeExternalField">
					<extkey_attcode>parent_change_id</extkey_attcode>
					<target_attcode>ref</target_attcode>
				</field>
				<field id="related_request_list" xsi:type="AttributeLinkedSet">
					<linked_class>UserRequest</linked_class>
					<ext_key_to_me>parent_incident_id</ext_key_to_me>
					<edit_mode>add_remove</edit_mode>
					<count_min>0</count_min>
					<count_max>0</count_max>
				</field>
				<field id="child_incidents_list" xsi:type="AttributeLinkedSet">
					<linked_class>Incident</linked_class>
					<ext_key_to_me>parent_incident_id</ext_key_to_me>
					<edit_mode>add_remove</edit_mode>
					<count_min>0</count_min>
					<count_max>0</count_max>
				</field>
				<field id="public_log" xsi:type="AttributeCaseLog">
					<sql>public_log</sql>
					<default_value/>
					<is_null_allowed>true</is_null_allowed>
				</field>
				<field id="user_satisfaction" xsi:type="AttributeEnum">
					<values>
						<value id="1">1</value>
						<value id="2">2</value>
						<value id="3">3</value>
						<value id="4">4</value>
					</values>
					<sql>user_satisfaction</sql>
					<default_value>1</default_value>
					<is_null_allowed>true</is_null_allowed>
					<display_style>list</display_style>
				</field>
				<field id="user_comment" xsi:type="AttributeText">
					<sql>user_commment</sql>
					<default_value/>
					<is_null_allowed>true</is_null_allowed>
				</field>
			</fields>
			<lifecycle>
				<highlight_scale>
					<item id="warning">
						<rank>1</rank>
						<color>HIGHLIGHT_CLASS_WARNING</color>
						<icon>images/incident-deadline.png</icon>
					</item>
					<item id="critical">
						<rank>2</rank>
						<color>HIGHLIGHT_CLASS_CRITICAL</color>
						<icon>images/incident-escalated.png</icon>
					</item>
					<item id="closed">
						<rank>3</rank>
						<color>HIGHLIGHT_CLASS_NONE</color>
						<icon>images/incident-closed.png</icon>
					</item>
				</highlight_scale>
				<attribute>status</attribute>
				<stimuli>
					<stimulus id="ev_assign" xsi:type="StimulusUserAction"/>
					<stimulus id="ev_reassign" xsi:type="StimulusUserAction"/>
					<stimulus id="ev_pending" xsi:type="StimulusUserAction"/>
					<stimulus id="ev_timeout" xsi:type="StimulusInternal"/>
					<stimulus id="ev_autoresolve" xsi:type="StimulusInternal"/>
					<stimulus id="ev_autoclose" xsi:type="StimulusInternal"/>
					<stimulus id="ev_resolve" xsi:type="StimulusUserAction"/>
					<stimulus id="ev_close" xsi:type="StimulusUserAction"/>
					<stimulus id="ev_reopen" xsi:type="StimulusUserAction"/>
				</stimuli>
				<states>
					<state id="new">
						<flags>
							<attribute id="ref">
								<read_only/>
							</attribute>
							<attribute id="org_id">
								<mandatory/>
							</attribute>
							<attribute id="caller_id">
								<mandatory/>
							</attribute>
							<attribute id="team_id">
								<hidden/>
							</attribute>
							<attribute id="agent_id">
								<hidden/>
							</attribute>
							<attribute id="priority">
								<read_only/>
							</attribute>
							<attribute id="start_date">
								<read_only/>
							</attribute>
							<attribute id="last_update">
								<read_only/>
							</attribute>
							<attribute id="close_date">
								<hidden/>
							</attribute>
							<attribute id="escalation_flag">
								<hidden/>
							</attribute>
							<attribute id="escalation_reason">
								<hidden/>
							</attribute>
							<attribute id="assignment_date">
								<hidden/>
							</attribute>
							<attribute id="resolution_date">
								<hidden/>
							</attribute>
							<attribute id="last_pending_date">
								<hidden/>
							</attribute>
							<attribute id="time_spent">
								<hidden/>
							</attribute>
							<attribute id="resolution_code">
								<hidden/>
							</attribute>
							<attribute id="solution">
								<hidden/>
							</attribute>
							<attribute id="pending_reason">
								<hidden/>
							</attribute>
							<attribute id="user_satisfaction">
								<hidden/>
							</attribute>
							<attribute id="user_comment">
								<hidden/>
							</attribute>
							<attribute id="tto_escalation_deadline">
								<read_only/>
							</attribute>
							<attribute id="sla_tto_passed">
								<hidden/>
							</attribute>
							<attribute id="sla_tto_over">
								<hidden/>
							</attribute>
							<attribute id="sla_ttr_passed">
								<hidden/>
							</attribute>
							<attribute id="ttr_escalation_deadline">
								<hidden/>
							</attribute>
							<attribute id="sla_ttr_over">
								<hidden/>
							</attribute>
						</flags>
						<transitions>
							<transition id="ev_assign">
								<target>assigned</target>
								<actions>
									<action>
										<verb>SetCurrentDate</verb>
										<params>
											<param xsi:type="attcode">assignment_date</param>
										</params>
									</action>
								</actions>
							</transition>
							<transition id="ev_timeout">
								<target>escalated_tto</target>
								<actions/>
							</transition>
							<transition id="ev_autoresolve">
								<target>resolved</target>
								<actions>
									<action>
										<verb>SetCurrentDate</verb>
										<params>
											<param xsi:type="attcode">resolution_date</param>
										</params>
									</action>
									<action>
										<verb>SetElapsedTime</verb>
										<params>
											<param xsi:type="attcode">time_spent</param>
											<param xsi:type="attcode">start_date</param>
											<param xsi:type="string">DefaultWorkingTimeComputer</param>
										</params>
									</action>
									<action>
										<verb>ResolveChildTickets</verb>
										<params/>
									</action>
								</actions>
							</transition>
						</transitions>
					</state>
					<state id="escalated_tto">
						<highlight>
							<code>critical</code>
						</highlight>
						<inherit_flags_from>new</inherit_flags_from>
						<flags>
							<attribute id="team_id"/>
						</flags>
						<transitions>
							<transition id="ev_assign">
								<target>assigned</target>
								<actions>
									<action>
										<verb>SetAssignedDate</verb>
									</action>
								</actions>
							</transition>
						</transitions>
					</state>
					<state id="assigned">
						<inherit_flags_from>new</inherit_flags_from>
						<flags>
							<attribute id="team_id">
								<mandatory/>
								<must_prompt/>
								<read_only/>
							</attribute>
							<attribute id="agent_id">
								<mandatory/>
								<must_prompt/>
								<read_only/>
							</attribute>
							<attribute id="assignment_date">
								<read_only/>
							</attribute>
							<attribute id="tto_escalation_deadline">
								<hidden/>
							</attribute>
							<attribute id="sla_tto_passed">
								<read_only/>
							</attribute>
							<attribute id="sla_tto_over">
								<read_only/>
							</attribute>
							<attribute id="ttr_escalation_deadline">
								<read_only/>
							</attribute>
							<attribute id="caller_id"/>
							<attribute id="escalation_flag"/>
							<attribute id="escalation_reason"/>
						</flags>
						<transitions>
							<transition id="ev_pending">
								<target>pending</target>
								<actions>
									<action>
										<verb>SetCurrentDate</verb>
										<params>
											<param xsi:type="attcode">last_pending_date</param>
										</params>
									</action>
								</actions>
							</transition>
							<transition id="ev_resolve">
								<target>resolved</target>
								<actions>
									<action>
										<verb>SetCurrentDate</verb>
										<params>
											<param xsi:type="attcode">resolution_date</param>
										</params>
									</action>
									<action>
										<verb>SetElapsedTime</verb>
										<params>
											<param xsi:type="attcode">time_spent</param>
											<param xsi:type="attcode">start_date</param>
											<param xsi:type="string">DefaultWorkingTimeComputer</param>
										</params>
									</action>
									<action>
										<verb>ResolveChildTickets</verb>
										<params/>
									</action>
								</actions>
							</transition>
							<transition id="ev_reassign">
								<target>assigned</target>
								<actions/>
								<flags>
									<attribute id="agent_id">
										<must_change/>
									</attribute>
									<attribute id="team_id">
										<must_prompt/>
									</attribute>
								</flags>
							</transition>
							<transition id="ev_timeout">
								<target>escalated_ttr</target>
								<actions/>
							</transition>
							<transition id="ev_autoresolve">
								<target>resolved</target>
								<actions>
									<action>
										<verb>SetCurrentDate</verb>
										<params>
											<param xsi:type="attcode">resolution_date</param>
										</params>
									</action>
									<action>
										<verb>SetElapsedTime</verb>
										<params>
											<param xsi:type="attcode">time_spent</param>
											<param xsi:type="attcode">start_date</param>
											<param xsi:type="string">DefaultWorkingTimeComputer</param>
										</params>
									</action>
									<action>
										<verb>ResolveChildTickets</verb>
										<params/>
									</action>
								</actions>
							</transition>
						</transitions>
					</state>
					<state id="escalated_ttr">
						<highlight>
							<code>critical</code>
						</highlight>
						<inherit_flags_from>assigned</inherit_flags_from>
						<flags/>
						<transitions>
							<transition id="ev_pending">
								<target>pending</target>
								<actions>
									<action>
										<verb>SetCurrentDate</verb>
										<params>
											<param xsi:type="attcode">last_pending_date</param>
										</params>
									</action>
								</actions>
							</transition>
							<transition id="ev_resolve">
								<target>resolved</target>
								<actions>
									<action>
										<verb>SetCurrentDate</verb>
										<params>
											<param xsi:type="attcode">resolution_date</param>
										</params>
									</action>
									<action>
										<verb>SetElapsedTime</verb>
										<params>
											<param xsi:type="attcode">time_spent</param>
											<param xsi:type="attcode">start_date</param>
											<param xsi:type="string">DefaultWorkingTimeComputer</param>
										</params>
									</action>
									<action>
										<verb>ResolveChildTickets</verb>
										<params/>
									</action>
								</actions>
							</transition>
							<transition id="ev_reassign">
								<target>assigned</target>
								<actions/>
							</transition>
							<transition id="ev_autoresolve">
								<target>resolved</target>
								<actions>
									<action>
										<verb>SetCurrentDate</verb>
										<params>
											<param xsi:type="attcode">resolution_date</param>
										</params>
									</action>
									<action>
										<verb>SetElapsedTime</verb>
										<params>
											<param xsi:type="attcode">time_spent</param>
											<param xsi:type="attcode">start_date</param>
											<param xsi:type="string">DefaultWorkingTimeComputer</param>
										</params>
									</action>
									<action>
										<verb>ResolveChildTickets</verb>
										<params/>
									</action>
								</actions>
							</transition>
						</transitions>
					</state>
					<state id="pending">
						<inherit_flags_from>assigned</inherit_flags_from>
						<flags>
							<attribute id="last_pending_date">
								<read_only/>
							</attribute>
							<attribute id="ttr_escalation_deadline">
								<hidden/>
							</attribute>
							<attribute id="sla_tto_passed">
								<hidden/>
							</attribute>
							<attribute id="sla_tto_over">
								<hidden/>
							</attribute>
							<attribute id="pending_reason">
								<mandatory/>
								<must_prompt/>
							</attribute>
						</flags>
						<transitions>
							<transition id="ev_assign">
								<target>assigned</target>
								<actions>
								</actions>
							</transition>
							<transition id="ev_autoresolve">
								<target>resolved</target>
								<actions>
									<action>
										<verb>SetCurrentDate</verb>
										<params>
											<param xsi:type="attcode">resolution_date</param>
										</params>
									</action>
									<action>
										<verb>SetElapsedTime</verb>
										<params>
											<param xsi:type="attcode">time_spent</param>
											<param xsi:type="attcode">start_date</param>
											<param xsi:type="string">DefaultWorkingTimeComputer</param>
										</params>
									</action>
									<action>
										<verb>ResolveChildTickets</verb>
										<params/>
									</action>
								</actions>
							</transition>
						</transitions>
					</state>
					<state id="resolved">
						<highlight>
							<code>closed</code>
						</highlight>
						<inherit_flags_from>assigned</inherit_flags_from>
						<flags>
							<attribute id="caller_id">
								<read_only/>
							</attribute>
							<attribute id="origin">
								<read_only/>
							</attribute>
							<attribute id="private_log"/>
							<attribute id="impact">
								<read_only/>
							</attribute>
							<attribute id="urgency">
								<read_only/>
							</attribute>
							<attribute id="service_id">
								<mandatory/>
								<must_prompt/>
							</attribute>
							<attribute id="servicesubcategory_id">
								<must_prompt/>
							</attribute>
							<attribute id="escalation_flag">
								<read_only/>
							</attribute>
							<attribute id="escalation_reason">
								<read_only/>
							</attribute>
							<attribute id="parent_incident_id">
								<read_only/>
							</attribute>
							<attribute id="parent_change_id">
								<read_only/>
							</attribute>
							<attribute id="parent_problem_id">
								<read_only/>
							</attribute>
							<attribute id="title">
								<read_only/>
							</attribute>
							<attribute id="description">
								<read_only/>
							</attribute>
							<attribute id="org_id">
								<read_only/>
							</attribute>
							<attribute id="team_id">
								<read_only/>
							</attribute>
							<attribute id="agent_id">
								<read_only/>
							</attribute>
							<attribute id="resolution_date">
								<read_only/>
							</attribute>
							<attribute id="time_spent">
								<read_only/>
							</attribute>
							<attribute id="resolution_code">
								<mandatory/>
								<must_prompt/>
							</attribute>
							<attribute id="solution">
								<mandatory/>
								<must_prompt/>
							</attribute>
							<attribute id="pending_reason">
								<read_only/>
							</attribute>
							<attribute id="sla_ttr_passed">
								<read_only/>
							</attribute>
							<attribute id="ttr_escalation_deadline">
								<hidden/>
							</attribute>
							<attribute id="sla_ttr_over">
								<read_only/>
							</attribute>
						</flags>
						<transitions>
							<transition id="ev_close">
								<target>closed</target>
								<actions>
									<action>
										<verb>SetCurrentDate</verb>
										<params>
											<param xsi:type="attcode">close_date</param>
										</params>
									</action>
								</actions>
							</transition>
							<transition id="ev_reopen">
								<target>assigned</target>
								<actions>
								</actions>
							</transition>
							<transition id="ev_autoresolve">
								<target>resolved</target>
								<actions>
									<action>
										<verb>SetCurrentDate</verb>
										<params>
											<param xsi:type="attcode">resolution_date</param>
										</params>
									</action>
									<action>
										<verb>SetElapsedTime</verb>
										<params>
											<param xsi:type="attcode">time_spent</param>
											<param xsi:type="attcode">start_date</param>
											<param xsi:type="string">DefaultWorkingTimeComputer</param>
										</params>
									</action>
									<action>
										<verb>ResolveChildTickets</verb>
										<params/>
									</action>
								</actions>
							</transition>
						</transitions>
					</state>
					<state id="closed">
						<highlight>
							<code>closed</code>
						</highlight>
						<inherit_flags_from>resolved</inherit_flags_from>
						<flags>
							<attribute id="public_log">
								<read_only/>
							</attribute>
							<attribute id="functionalcis_list">
								<read_only/>
							</attribute>
							<attribute id="contacts_list">
								<read_only/>
							</attribute>
							<attribute id="private_log">
								<read_only/>
							</attribute>
							<attribute id="service_id">
								<read_only/>
							</attribute>
							<attribute id="servicesubcategory_id">
								<read_only/>
							</attribute>
							<attribute id="close_date">
								<read_only/>
							</attribute>
							<attribute id="resolution_code">
								<read_only/>
							</attribute>
							<attribute id="solution">
								<read_only/>
							</attribute>
							<attribute id="pending_reason">
								<read_only/>
							</attribute>
							<attribute id="user_satisfaction">
								<read_only/>              
                				<must_prompt/>
							</attribute>
							<attribute id="user_comment">
								<read_only/>              
								<must_prompt/>
							</attribute>
						</flags>
						<transitions/>
					</state>
				</states>
			</lifecycle>
			<methods>
				<method id="SetAssignedDate">
					<comment><![CDATA[/**
	 * To be deprecated: use SetCurrentDate() instead
	 * @return void
	 */]]></comment>
					<static>false</static>
					<access>public</access>
					<type>LifecycleAction</type>
					<code><![CDATA[	public function SetAssignedDate($sStimulusCode)
	{
		$this->Set('assignment_date', time());
		return true;
	}]]></code>
				</method>
				<method id="SetLastPendingDate">
					<comment><![CDATA[/**
	 * To be deprecated: use SetCurrentDate() instead
	 * @return void
	 */]]></comment>
					<static>false</static>
					<access>public</access>
					<type>LifecycleAction</type>
					<code><![CDATA[	public function SetLastPendingDate($sStimulusCode)
	{
		$this->Set('last_pending_date', time());
		return true;
	}]]></code>
				</method>
				<method id="SetResolveDate">
					<comment><![CDATA[/**
	 * To be deprecated: use SetCurrentDate() and SetElapsedTime() instead
	 * @return void
	 */]]></comment>
					<static>false</static>
					<access>public</access>
					<type>LifecycleAction</type>
					<code><![CDATA[	public function SetResolveDate($sStimulusCode)
	{
		$this->Set('resolution_date', time());
                $iTimeSpent = time() - AttributeDateTime::GetAsUnixSeconds($this->Get('start_date'));
		$this->Set('time_spent', $iTimeSpent);
		return true;
	}]]></code>
				</method>
				<method id="SetClosureDate">
					<comment><![CDATA[/**
	 * To be deprecated: use SetCurrentDate() instead
	 * @return void
	 */]]></comment>
					<static>false</static>
					<access>public</access>
					<type>LifecycleAction</type>
					<code><![CDATA[	public function SetClosureDate($sStimulusCode)
	{
		$this->Set('close_date', time());
		return true;
	}]]></code>
				</method>
				<method id="DoCheckToWrite">
					<static>false</static>
					<access>public</access>
					<type>Overload-DBObject</type>
					<code><![CDATA[public function DoCheckToWrite()
  {
    parent::DoCheckToWrite();
    if (!$this->IsNew() && ($this->Get('parent_incident_id') == $this->GetKey()))
    {
      $this->m_aCheckIssues[] = Dict::Format('Class:Incident/Error:CannotAssignParentIncidentIdToSelf');
    }
  }]]></code>
				</method>
				<method id="ComputePriority">
					<comment>/** Compute the priority of the ticket based on its impact and urgency&#13;
						* @return integer The priority of the ticket 1(high) .. 3(low)&#13;
						*/</comment>
					<static>false</static>
					<access>public</access>
					<type>LifecycleAction</type>
					<code><![CDATA[        public function ComputePriority()
        {
                // priority[impact][urgency]
                $aPriorities = array(
                        // single person
                        1 => array(
                                        1 => 1,
                                        2 => 1,
                                        3 => 2,
                                        4 => 4,
                        ),
                        // a group
                        2 => array(
                                1 => 1,
                                2 => 2,
                                3 => 3,
                                4 => 4,
                        ),
                        // a departement!
                        3 => array(
                                        1 => 2,
                                        2 => 3,
                                        3 => 3,
                                        4 => 4,
                        ),
                );
                $iPriority = 1;
                if (isset($aPriorities[(int)$this->Get('impact')]) && isset($aPriorities[(int)$this->Get('impact')][(int)$this->Get('urgency')]))
                {
                        $iPriority = $aPriorities[(int)$this->Get('impact')][(int)$this->Get('urgency')];
                }
                return $iPriority;              
        }]]></code>
				</method>
				<method id="ComputeValues">
					<static>false</static>
					<access>public</access>
					<type>Overload-DBObject</type>
					<code><![CDATA[	public function ComputeValues()
	{

		// Compute the priority of the ticket
		$this->Set('priority', $this->ComputePriority());

		return parent::ComputeValues();
	}]]></code>
				</method>
				<method id="DisplayBareRelations">
					<static>false</static>
					<access>public</access>
					<type>Overload-cmdbAbstractObject</type>
					<code><![CDATA[	function DisplayBareRelations(WebPage $oPage, $bEditMode = false)
	{
		parent::DisplayBareRelations($oPage, $bEditMode);

		if (!$bEditMode)
		{
			if (MetaModel::IsValidClass('KnownError'))
			{
				//Search for known errors
				$oPage->SetCurrentTab(Dict::S('Class:UserRequest:KnownErrorList'));
				$iTicketID = $this->GetKey();;
				$oKnownErrorSet = new CMDBObjectSet(DBObjectSearch::FromOQL("SELECT KnownError AS ke JOIN lnkErrorToFunctionalCI AS l1 ON l1.error_id=ke.id JOIN FunctionalCI AS ci ON l1.functionalci_id=ci.id JOIN lnkFunctionalCIToTicket AS l2 ON l2.functionalci_id=ci.id WHERE l2.ticket_id=$iTicketID"));
				$iNumberKE=$oKnownErrorSet->count();
				if ($iNumberKE > 0)
				{
					$oPage->SetCurrentTab(Dict::S('Class:UserRequest:KnownErrorList')." ($iNumberKE)");
				}
				else
				{
					$oPage->SetCurrentTab(Dict::S('Class:UserRequest:KnownErrorList'));	
				}			
				self::DisplaySet($oPage, $oKnownErrorSet, array ('menu' => false));
			}
		}
	}]]></code>
				</method>
				<method id="resolveChilds">
					<comment><![CDATA[/**
	 * To be deprecated: use ResolveChildTickets() instead
	 */]]></comment>
					<static>false</static>
					<access>public</access>
					<type>LifecycleAction</type>
					<code><![CDATA[	public function resolveChilds($sStimulusCode)
	{
        if (MetaModel::IsValidClass('UserRequest'))
        {
    		$sOQL = "SELECT UserRequest WHERE parent_incident_id=:ticket";
    		$oChildRequestSet = new DBObjectSet(DBObjectSearch::FromOQL($sOQL),
    						array(),
    						array(
    							'ticket' => $this->GetKey(),
    							)
    						);
    		//automatically resolve child requests
    		while($oRequest = $oChildRequestSet->Fetch())
    		{
    			if ( $oRequest->Get('status') != 'resolved')
    			{
    				$oRequest->set('servicesubcategory_id',$this->Get('servicesubcategory_id'));
    				$oRequest->set('service_id',$this->Get('service_id'));		
    				$oRequest->set('team_id',$this->Get('team_id'));
    				$oRequest->set('agent_id',$this->Get('agent_id'));	
    				$oRequest->set('resolution_code',$this->Get('resolution_code'));
    				$oRequest->set('solution','Automatically resolved by incident:[[Incident:'.$this->Get('ref').']]');
    				$oRequest->ApplyStimulus('ev_autoresolve');
    				$oRequest->DBUpdate();
    			}
    		}
        }

		//automatically resolve child incidents
		$sOQL = "SELECT Incident WHERE parent_incident_id=:ticket";
		$oChildIncidentSet = new DBObjectSet(DBObjectSearch::FromOQL($sOQL),
						array(),
						array(
							'ticket' => $this->GetKey(),
							)
						);
		while($oIncident = $oChildIncidentSet->Fetch())
		{
			if ( $oIncident->Get('status') != 'resolved')
			{
				$oIncident->set('servicesubcategory_id',$this->Get('servicesubcategory_id'));
				$oIncident->set('service_id',$this->Get('service_id'));		
				$oIncident->set('team_id',$this->Get('team_id'));
				$oIncident->set('agent_id',$this->Get('agent_id'));	
				$oIncident->set('resolution_code',$this->Get('resolution_code'));
				$oIncident->set('solution','Automatically resolved by incident:[[Incident:'.$this->Get('ref').']]');
				$oIncident->ApplyStimulus('ev_autoresolve');
				$oIncident->DBUpdate();
			}
		}
		return true;

	}]]></code>
				</method>
				<method id="ResolveChildTickets">
					<comment><![CDATA[/**
	 * Cascade the resolution to child User Request and Incidents
	 * @return true (returning false would stop the ongoing transition)
	 */]]></comment>
					<static>false</static>
					<access>public</access>
					<type>LifecycleAction</type>
					<arguments>
					</arguments>
					<code><![CDATA[	public function ResolveChildTickets()
	{
        static $aRequests = array(); // prevent infinite recursion
        static $Incidents = array(); // prevent infinite recursion
  
		if (MetaModel::IsValidClass('UserRequest'))
		{    		
    		// Automatically resolve child requests
    		$sOQL = "SELECT UserRequest WHERE parent_incident_id = :ticket AND status != 'resolved'";
    		$oChildRequestSet = new DBObjectSet(DBObjectSearch::FromOQL($sOQL), array(), array('ticket' => $this->GetKey()));
    		while($oRequest = $oChildRequestSet->Fetch())
    		{
    			if (!array_key_exists($oRequest->GetKey(), $aRequests))
    			{
    				$aRequests[$oRequest->GetKey()] = true;
    				$oRequest->ResolveFrom($this);
    			}
    		}
		}

		// Automatically resolve child incidents
		$sOQL = "SELECT Incident WHERE parent_incident_id = :ticket AND status != 'resolved'";
		$oChildIncidentSet = new DBObjectSet(DBObjectSearch::FromOQL($sOQL), array(), array('ticket' => $this->GetKey()));
		while($oIncident = $oChildIncidentSet->Fetch())
		{
            if (!array_key_exists($oIncident->GetKey(), $Incidents))
            {
                $Incidents[$oIncident->GetKey()] = true;
			    $oIncident->ResolveFrom($this);
            }
		}
		return true;
	}]]></code>
				</method>
				<method id="ResolveFrom">
					<comment><![CDATA[/**
	 * Resolve the ticket from another resolved ticket
	 * @return void
	 */]]></comment>
					<static>false</static>
					<access>public</access>
					<type>Internal</type>
                    <code><![CDATA[	public function ResolveFrom($oParentTicket)
	{
		if ($this->Get('status') != 'resolved' && $this->Get('status') != 'closed' )
		{
			$aDummy = array();
			$aExcludedAttributes = array('team_id', 'agent_id');
		    foreach(MetaModel::ListAttributeDefs(get_class($this)) as $sAttCode => $oAttDef)
		    {
		    	// Exclude inter dependant attributes to keep consistency
		    	if(in_array($sAttCode, $aExcludedAttributes))
		    	{
		    		continue;
		    	}
		    	
		         if (($this->GetAttributeFlags($sAttCode, $aDummy, 'resolved') & OPT_ATT_MANDATORY) && empty($this->Get($sAttCode)))
		         {
		            $this->Set($sAttCode, $oParentTicket->Get($sAttCode));
		         }
		    }
		  if (($this->Get('team_id') == 0) || ($this->Get('agent_id') ==0))  
           {  
                  $this->Set('team_id', $oParentTicket->Get('team_id'));
                  $this->Set('agent_id', $oParentTicket->Get('agent_id'));
           }
			$sParent = '[['.get_class($oParentTicket).':'.$oParentTicket->Get('ref').']]';
			$this->Set('solution', Dict::Format('Tickets:ResolvedFrom', $sParent, MetaModel::GetName(get_class($oParentTicket))));
			$this->ApplyStimulus('ev_autoresolve');
			$this->DBUpdate();
		}
	}]]></code>				
				</method>
				<method id="UpdateChildRequestLog">
					<static>false</static>
					<access>public</access>
					<type>LifecycleAction</type>
					<code><![CDATA[	public function UpdateChildRequestLog()
	{
        if (!MetaModel::IsValidClass('UserRequest')) return true; // Do nothing
  
		$oLog = $this->Get('public_log');
		$sLogPublic = $oLog->GetModifiedEntry('html');
		if ($sLogPublic != '')
		{
			$sOQL = "SELECT UserRequest WHERE parent_incident_id=:ticket";
			$oChildRequestSet = new DBObjectSet(DBObjectSearch::FromOQL($sOQL),
							array(),
							array(
								'ticket' => $this->GetKey(),
								)
							);
			while($oRequest = $oChildRequestSet->Fetch())
			{
				$oRequest->set('public_log',$sLogPublic);
				$oRequest->DBUpdate();
			}

		}
		$oLog = $this->Get('private_log');
		$sLogPrivate = $oLog->GetModifiedEntry('html');
		if ($sLogPrivate != '')
		{
			$sOQL = "SELECT UserRequest WHERE parent_incident_id=:ticket";
			$oChildRequestSet = new DBObjectSet(DBObjectSearch::FromOQL($sOQL),
							array(),
							array(
								'ticket' => $this->GetKey(),
								)
							);
			while($oRequest = $oChildRequestSet->Fetch())
			{
				$oRequest->set('private_log',$sLogPrivate);
				$oRequest->DBUpdate();
			}
		}
		return true;

	}]]></code>
				</method>
				<method id="UpdateChildIncidentLog">
					<static>false</static>
					<access>public</access>
					<type>LifecycleAction</type>
					<code><![CDATA[	public function UpdateChildIncidentLog()
	{
		$oLog = $this->Get('public_log');
		$sLogPublic = $oLog->GetModifiedEntry('html');
		if ($sLogPublic != '')
		{
			$sOQL = "SELECT Incident WHERE parent_incident_id=:ticket";
			$oChildIncidentSet = new DBObjectSet(DBObjectSearch::FromOQL($sOQL),
							array(),
							array(
								'ticket' => $this->GetKey(),
								)
							);
			while($oIncident = $oChildIncidentSet->Fetch())
			{
				$oIncident->set('public_log',$sLogPublic);
				$oIncident->DBUpdate();
			}

		}
		$oLog = $this->Get('private_log');
		$sLogPrivate = $oLog->GetModifiedEntry('html');
		if ($sLogPrivate != '')
		{
			$sOQL = "SELECT Incident WHERE parent_incident_id=:ticket";
			$oChildIncidentSet = new DBObjectSet(DBObjectSearch::FromOQL($sOQL),
							array(),
							array(
								'ticket' => $this->GetKey(),
								)
							);
			while($oIncident = $oChildIncidentSet->Fetch())
			{
				$oIncident->set('private_log',$sLogPrivate);
				$oIncident->DBUpdate();
			}
		}
		return true;

	}]]></code>
				</method>
				<method id="ComputeImpactedItems">
					<static>false</static>
					<access>public</access>
					<type>LifecycleAction</type>
					<code><![CDATA[	public function ComputeImpactedItems()
	{
        // This method is kept for backward compatibility
        // in case a delta redefines it, but you may call
        // UpdateImpactedItems directly
		$this->UpdateImpactedItems();
	}]]></code>
				</method>
				<method id="OnInsert">
					<static>false</static>
					<access>protected</access>
					<type>Overload-DBObject</type>
					<code><![CDATA[	protected function OnInsert()

	{
        parent::OnInsert();    
		$this->ComputeImpactedItems();
		$this->SetIfNull('last_update', time());
		$this->SetIfNull('start_date', time());
	}]]></code>
				</method>
				<method id="OnUpdate">
					<static>false</static>
					<access>protected</access>
					<type>Overload-DBObject</type>
					<code><![CDATA[	protected function OnUpdate()
	{
        parent::OnUpdate(); 
        $aChanges = $this->ListChanges();
        if (array_key_exists('functionalcis_list', $aChanges))
        {
            $this->UpdateImpactedItems();
        }
		$this->Set('last_update', time());
		$this->UpdateChildRequestLog();
		$this->UpdateChildIncidentLog();
	}]]></code>
				</method>
			</methods>
			<presentation>
				<details>
					<items>
						<item id="functionalcis_list">
							<rank>10</rank>
						</item>
						<item id="contacts_list">
							<rank>20</rank>
						</item>
						<item id="child_incidents_list">
							<rank>30</rank>
						</item>
						<item id="related_request_list">
							<rank>40</rank>
						</item>
						<item id="workorders_list">
							<rank>50</rank>
						</item>
						<item id="col:col1">
							<rank>60</rank>
							<items>
								<item id="fieldset:Ticket:baseinfo">
									<rank>10</rank>
									<items>
										<item id="org_id">
											<rank>10</rank>
										</item>
										<item id="caller_id">
											<rank>20</rank>
										</item>
										<item id="status">
											<rank>30</rank>
										</item>
										<item id="origin">
											<rank>40</rank>
										</item>
										<item id="title">
											<rank>50</rank>
										</item>
										<item id="description">
											<rank>60</rank>
										</item>
									</items>
								</item>
								<item id="fieldset:Ticket:moreinfo">
									<rank>20</rank>
									<items>
										<item id="service_id">
											<rank>10</rank>
										</item>
										<item id="servicesubcategory_id">
											<rank>20</rank>
										</item>
										<item id="escalation_flag">
											<rank>30</rank>
										</item>
										<item id="escalation_reason">
											<rank>40</rank>
										</item>
										<item id="pending_reason">
											<rank>50</rank>
										</item>
									</items>
								</item>
							</items>
						</item>
						<item id="col:col2">
							<rank>70</rank>
							<items>
								<item id="fieldset:Ticket:Type">
									<rank>10</rank>
									<items>
										<item id="impact">
											<rank>10</rank>
										</item>
										<item id="urgency">
											<rank>20</rank>
										</item>
										<item id="priority">
											<rank>30</rank>
										</item>
									</items>
								</item>
								<item id="fieldset:Ticket:contact">
									<rank>20</rank>
									<items>
										<item id="team_id">
											<rank>10</rank>
										</item>
										<item id="agent_id">
											<rank>20</rank>
										</item>
									</items>
								</item>
								<item id="fieldset:Ticket:date">
									<rank>30</rank>
									<items>
										<item id="start_date">
											<rank>10</rank>
										</item>
										<item id="last_update">
											<rank>20</rank>
										</item>
										<item id="assignment_date">
											<rank>30</rank>
										</item>
										<item id="tto_escalation_deadline">
											<rank>40</rank>
										</item>
										<item id="ttr_escalation_deadline">
											<rank>50</rank>
										</item>
										<item id="last_pending_date">
											<rank>60</rank>
										</item>
										<item id="resolution_date">
											<rank>70</rank>
										</item>
										<item id="close_date">
											<rank>80</rank>
										</item>
									</items>
								</item>
							</items>
						</item>
						<item id="col:col3">
							<rank>80</rank>
							<items>
								<item id="fieldset:Ticket:relation">
									<rank>10</rank>
									<items>
										<item id="parent_incident_id">
											<rank>10</rank>
										</item>
										<item id="parent_problem_id">
											<rank>20</rank>
										</item>
										<item id="parent_change_id">
											<rank>30</rank>
										</item>
									</items>
								</item>
								<item id="fieldset:Ticket:resolution">
									<rank>20</rank>
									<items>
										<item id="resolution_code">
											<rank>10</rank>
										</item>
										<item id="solution">
											<rank>20</rank>
										</item>
										<item id="time_spent">
											<rank>30</rank>
										</item>
										<item id="user_satisfaction">
											<rank>40</rank>
										</item>
										<item id="user_comment">
											<rank>50</rank>
										</item>
									</items>
								</item>
								<item id="fieldset:Ticket:SLA">
									<rank>30</rank>
									<items>
										<item id="sla_tto_passed">
											<rank>10</rank>
										</item>
										<item id="sla_tto_over">
											<rank>20</rank>
										</item>
										<item id="sla_ttr_passed">
											<rank>30</rank>
										</item>
										<item id="sla_ttr_over">
											<rank>40</rank>
										</item>
									</items>
								</item>
							</items>
						</item>
					</items>
				</details>
				<search>
					<items>
						<item id="ref">
							<rank>10</rank>
						</item>
						<item id="org_id">
							<rank>20</rank>
						</item>
						<item id="title">
							<rank>30</rank>
						</item>
						<item id="description">
							<rank>40</rank>
						</item>
						<item id="start_date">
							<rank>50</rank>
						</item>
						<item id="resolution_date">
							<rank>70</rank>
						</item>
						<item id="close_date">
							<rank>80</rank>
						</item>
						<item id="status">
							<rank>90</rank>
						</item>
						<item id="operational_status">
							<rank>95</rank>
						</item>
						<item id="caller_id">
							<rank>100</rank>
						</item>
						<item id="origin">
							<rank>110</rank>
						</item>
						<item id="impact">
							<rank>120</rank>
						</item>
						<item id="urgency">
							<rank>130</rank>
						</item>
						<item id="priority">
							<rank>140</rank>
						</item>
						<item id="service_id">
							<rank>150</rank>
						</item>
						<item id="servicesubcategory_id">
							<rank>160</rank>
						</item>
						<item id="team_id">
							<rank>170</rank>
						</item>
						<item id="agent_id">
							<rank>180</rank>
						</item>
						<item id="escalation_flag">
							<rank>190</rank>
						</item>
						<item id="resolution_code">
							<rank>200</rank>
						</item>
						<item id="user_satisfaction">
							<rank>210</rank>
						</item>
						<item id="sla_tto_passed">
							<rank>220</rank>
						</item>
						<item id="sla_ttr_passed">
							<rank>230</rank>
						</item>
					</items>
				</search>
				<list>
					<items>
						<item id="title">
							<rank>10</rank>
						</item>
						<item id="org_id">
							<rank>20</rank>
						</item>
						<item id="caller_id">
							<rank>30</rank>
						</item>
						<item id="start_date">
							<rank>40</rank>
						</item>
						<item id="status">
							<rank>50</rank>
						</item>
						<item id="agent_id">
							<rank>60</rank>
						</item>
					</items>
				</list>
			</presentation>
		</class>
	</classes>
	<menus>
		<menu id="IncidentManagement" xsi:type="MenuGroup" _delta="define">
			<rank>35</rank>
			<enable_stimulus/>
		</menu>
		<menu id="Incident:Overview" xsi:type="DashboardMenuNode" _delta="define">
			<rank>0</rank>
			<parent>IncidentManagement</parent>
			<definition>
				<layout>DashboardLayoutTwoCols</layout>
				<title>UI:IncidentMgmtMenuOverview:Title</title>
				<cells>
					<cell id="0">
						<rank>0</rank>
						<dashlets>
							<dashlet id="1" xsi:type="DashletGroupByPie">
								<title>UI-IncidentManagementOverview-IncidentByPriority-last-14-days</title>
								<query>SELECT Incident WHERE DATE_SUB(NOW(), INTERVAL 14 DAY) &lt; start_date</query>
								<group_by>priority</group_by>
								<style>pie</style>
							</dashlet>
						</dashlets>
					</cell>
					<cell id="1">
						<rank>1</rank>
						<dashlets>
							<dashlet id="2" xsi:type="DashletGroupByBars">
								<title>UI-IncidentManagementOverview-Last-14-days</title>
								<query>SELECT Incident WHERE DATE_SUB(NOW(), INTERVAL 14 DAY) &lt; start_date</query>
								<group_by>start_date:day_of_month</group_by>
								<style>bars</style>
							</dashlet>
						</dashlets>
					</cell>
					<cell id="2">
						<rank>2</rank>
						<dashlets>
							<dashlet id="3" xsi:type="DashletGroupByTable">
								<title>UI-IncidentManagementOverview-OpenIncidentByStatus</title>
								<query>SELECT Incident WHERE status NOT IN ('closed','rejected')</query>
								<group_by>status</group_by>
								<style>table</style>
							</dashlet>
						</dashlets>
					</cell>
					<cell id="3">
						<rank>3</rank>
						<dashlets>
							<dashlet id="4" xsi:type="DashletGroupByTable">
								<title>UI-IncidentManagementOverview-OpenIncidentByAgent</title>
								<query>SELECT Incident WHERE status NOT IN ('closed','rejected')</query>
								<group_by>agent_id</group_by>
								<style>table</style>
							</dashlet>
						</dashlets>
					</cell>
					<cell id="4">
						<rank>4</rank>
						<dashlets>
							<dashlet id="5" xsi:type="DashletGroupByTable">
								<title>UI-IncidentManagementOverview-OpenIncidentByCustomer</title>
								<query>SELECT Incident WHERE status NOT IN ('closed','rejected')</query>
								<group_by>org_id</group_by>
								<style>table</style>
							</dashlet>
						</dashlets>
					</cell>
				</cells>
			</definition>
		</menu>
		<menu id="NewIncident" xsi:type="NewObjectMenuNode" _delta="define">
			<rank>1</rank>
			<parent>IncidentManagement</parent>
			<class>Incident</class>
		</menu>
		<menu id="SearchIncidents" xsi:type="SearchMenuNode" _delta="define">
			<rank>2</rank>
			<parent>IncidentManagement</parent>
			<class>Incident</class>
		</menu>
		<menu id="Incident:Shortcuts" xsi:type="TemplateMenuNode" _delta="define">
			<rank>3</rank>
			<parent>IncidentManagement</parent>
			<template_file/>
		</menu>
		<menu id="Incident:MyIncidents" xsi:type="OQLMenuNode" _delta="define">
			<rank>0</rank>
			<parent>Incident:Shortcuts</parent>
			<oql><![CDATA[SELECT Incident WHERE agent_id = :current_contact_id AND status NOT IN ("closed","resolved")]]></oql>
			<do_search/>
			<auto_reload>fast</auto_reload>
		</menu>
		<menu id="Incident:EscalatedIncidents" xsi:type="OQLMenuNode" _delta="define">
			<rank>1</rank>
			<parent>Incident:Shortcuts</parent>
			<oql><![CDATA[SELECT Incident WHERE status IN ("escalated_tto", "escalated_ttr") OR escalation_flag="yes"]]></oql>
			<do_search/>
			<auto_reload>fast</auto_reload>
		</menu>
		<menu id="Incident:OpenIncidents" xsi:type="OQLMenuNode" _delta="define">
			<rank>2</rank>
			<parent>Incident:Shortcuts</parent>
			<oql><![CDATA[SELECT Incident WHERE status NOT IN ("closed")]]></oql>
			<do_search>1</do_search>
			<auto_reload>fast</auto_reload>
		</menu>
	</menus>
	<user_rights>
		<profiles>
			<profile id="2">
				<groups>
					<group id="Incident" _delta="define">
						<actions>
							<action id="action:write">allow</action>
							<action id="stimulus:ev_close">allow</action>
							<action id="stimulus:ev_reopen">allow</action>
						</actions>
					</group>
				</groups>
			</profile>
		</profiles>
	</user_rights>
	<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="redefine">Incident</class>
												</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' AND request_type = 'incident']]></oql_view>
						</scope>
					</scopes>
				</class>
			</classes>
		</module_design>
	</module_designs>
	<module_parameters>
		<parameters id="itop-tickets">
			<relation_context>
				<UserRequest>
					<impacts>
						<down>
							<items type="array">
								<item id="open_incidents" _delta="define">
									<oql><![CDATA[SELECT FCI, I FROM FunctionalCI AS FCI JOIN lnkFunctionalCIToTicket AS L ON L.functionalci_id = FCI.id JOIN Incident AS I ON L.ticket_id = I.id WHERE (I.status NOT IN ('closed', 'resolved')) AND (L.impact_code != 'not_impacted') AND (I.id != :this->id)]]></oql>
									<dict>Tickets:Related:OpenIncidents</dict>
									<icon>itop-incident-mgmt-itil/images/incident-red.png</icon>
									<default>yes</default>
								</item>
							</items>
						</down>
					</impacts>
				</UserRequest>
				<Incident>
					<impacts>
						<down>
							<items type="array">
								<item id="open_incidents" _delta="define">
									<oql><![CDATA[SELECT FCI, I FROM FunctionalCI AS FCI JOIN lnkFunctionalCIToTicket AS L ON L.functionalci_id = FCI.id JOIN Incident AS I ON L.ticket_id = I.id WHERE (I.status NOT IN ('closed', 'resolved')) AND (L.impact_code != 'not_impacted') AND (I.id != :this->id)]]></oql>
									<dict>Tickets:Related:OpenIncidents</dict>
									<icon>itop-incident-mgmt-itil/images/incident-red.png</icon>
									<default>yes</default>
								</item>
							</items>
						</down>
					</impacts>
				</Incident>
				<Change>
					<impacts>
						<down>
							<items type="array">
								<item id="open_incidents" _delta="define">
									<oql><![CDATA[SELECT FCI, I FROM FunctionalCI AS FCI JOIN lnkFunctionalCIToTicket AS L ON L.functionalci_id = FCI.id JOIN Incident AS I ON L.ticket_id = I.id WHERE (I.status NOT IN ('closed', 'resolved')) AND (L.impact_code != 'not_impacted') AND (I.id != :this->id)]]></oql>
									<dict>Tickets:Related:OpenIncidents</dict>
									<icon>itop-incident-mgmt-itil/images/incident-red.png</icon>
									<default>yes</default>
								</item>
							</items>
						</down>
					</impacts>
				</Change>
			</relation_context>
		</parameters>
		<parameters id="itop-config-mgmt">
			<relation_context>
				<FunctionalCI>
					<impacts>
						<down>
							<items type="array">
								<item id="open_incidents" _delta="define">
									<oql><![CDATA[SELECT FCI, I FROM FunctionalCI AS FCI JOIN lnkFunctionalCIToTicket AS L ON L.functionalci_id = FCI.id JOIN Incident AS I ON L.ticket_id = I.id WHERE (I.status NOT IN ('closed', 'resolved')) AND (L.impact_code != 'not_impacted')]]></oql>
									<dict>Tickets:Related:OpenIncidents</dict>
									<icon>itop-incident-mgmt-itil/images/incident-red.png</icon>
									<default>yes</default>
								</item>
							</items>
						</down>
						<up>
							<items type="array">
								<item id="open_incidents" _delta="define">
									<oql><![CDATA[SELECT FCI, I FROM FunctionalCI AS FCI JOIN lnkFunctionalCIToTicket AS L ON L.functionalci_id = FCI.id JOIN Incident AS I ON L.ticket_id = I.id WHERE (I.status NOT IN ('closed', 'resolved')) AND (L.impact_code != 'not_impacted')]]></oql>
									<dict>Tickets:Related:OpenIncidents</dict>
									<icon>itop-incident-mgmt-itil/images/incident-red.png</icon>
									<default>yes</default>
								</item>
							</items>
						</up>
					</impacts>
				</FunctionalCI>
			</relation_context>
		</parameters>
	</module_parameters>
</itop_design>
