Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
47 changes: 41 additions & 6 deletions application/query.class.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -113,17 +113,43 @@ public static function Init()
]
));

MetaModel::Init_AddAttribute(new AttributeExternalKey(
"owner_id",
[
"targetclass" => 'Contact',
"allowed_values" => null,
"sql" => 'owner_id',
"is_null_allowed" => true,
"depends_on" => [],
"display_style" => 'select',
"always_load_in_tables" => false,
"on_target_delete" => DEL_AUTO,
]
));

MetaModel::Init_AddAttribute(new AttributeEnumSet(
"usages",
[
"allowed_values" => null,
"possible_values" => new ValueSetEnumPadded("export,reference,notif,draft,dashlet"),
"sql" => "usages",
"depends_on" => [],
"is_null_allowed" => true,
"max_items" => 12,
]
));

// Display lists
MetaModel::Init_SetZListItems(
'details',
['name', 'is_template', 'description']
['name', 'is_template', 'owner_id', 'usages', 'description']
); // Attributes to be displayed for the complete details
MetaModel::Init_SetZListItems('list', ['description']); // Attributes to be displayed for a list
MetaModel::Init_SetZListItems('list', ['description', 'usages']); // Attributes to be displayed for a list
// Search criteria
MetaModel::Init_SetZListItems('standard_search', ['name', 'description', 'is_template']); // Criteria of the std search form
MetaModel::Init_SetZListItems(
'default_search',
['name', 'description', 'is_template']
['name', 'description', 'is_template', 'owner_id', 'usages']
); // Criteria of the default search form
// MetaModel::Init_SetZListItems('advanced_search', array('name')); // Criteria of the advanced search form
}
Expand All @@ -143,6 +169,15 @@ public function GetAttributeFlags($sAttCode, &$aReasons = [], $sTargetState = ''
return parent::GetAttributeFlags($sAttCode, $aReasons, $sTargetState);
}

public function GetInitialStateAttributeFlags($sAttCode, &$aReasons = [])
Comment thread
Copilot marked this conversation as resolved.
Comment thread
Copilot marked this conversation as resolved.
{
// read only attribute
if (in_array($sAttCode, ['export_count', 'export_last_date', 'export_last_user_id'])) {
return OPT_ATT_READONLY;
}
return parent::GetInitialStateAttributeFlags($sAttCode, $aReasons);
}

/**
* Return export url.
*
Expand Down Expand Up @@ -214,15 +249,15 @@ public static function Init()
MetaModel::Init_SetZListItems(
'details',
[
'col:col1' => ['fieldset:Query:baseinfo' => ['name', 'is_template', 'description', 'oql', 'fields']],
'col:col1' => ['fieldset:Query:baseinfo' => ['name', 'is_template', 'owner_id', 'usages', 'description', 'oql', 'fields']],
'col:col2' => ['fieldset:Query:exportInfo' => ['export_count', 'export_last_date', 'export_last_user_id', 'export_last_user_contact']],
]
); // Attributes to be displayed for the complete details
MetaModel::Init_SetZListItems('list', ['description']); // Attributes to be displayed for a list
MetaModel::Init_SetZListItems('list', ['description', 'usages']); // Attributes to be displayed for a list
// Search criteria
MetaModel::Init_SetZListItems(
'standard_search',
['name', 'description', 'is_template', 'fields', 'oql']
['name', 'description', 'is_template', 'owner_id', 'usages', 'oql']
Comment thread
v-dumas marked this conversation as resolved.
); // Criteria of the std search form
Comment thread
v-dumas marked this conversation as resolved.
Comment thread
v-dumas marked this conversation as resolved.
}

Expand Down
26 changes: 13 additions & 13 deletions datamodels/2.x/itop-tickets/data/de_de.data.itop-tickets.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<is_template>yes</is_template>
<oql><![CDATA[SELECT Person WHERE id=:this->agent_id]]></oql>
<fields>id,email</fields>
<finalclass>QueryOQL</finalclass>
<usages>notif</usages>
</QueryOQL>
<QueryOQL alias="QueryOQL" id="4">
<name>Bearbeiter des Tickets, außer der Bearbeiter selbst löst eine Benachrichtigung aus.</name>
Expand All @@ -16,7 +16,7 @@
<is_template>yes</is_template>
<oql><![CDATA[SELECT Person WHERE id=:this->agent_id AND id != :current_contact_id]]></oql>
<fields>id,email</fields>
<finalclass>QueryOQL</finalclass>
<usages>notif</usages>
</QueryOQL>
<QueryOQL alias="QueryOQL" id="3">
<name>Melder und Kontaktliste des Tickets</name>
Expand All @@ -27,31 +27,31 @@
SELECT Person WHERE id=:this->caller_id
]]></oql>
<fields>id,email</fields>
<finalclass>QueryOQL</finalclass>
<usages>notif</usages>
</QueryOQL>
<QueryOQL alias="QueryOQL" id="1">
<name>Melder des Tickets</name>
<description>Kann in Benachrichtigungen verwendet werden, um den Melder zu verständigen.</description>
<is_template>yes</is_template>
<oql><![CDATA[SELECT Person WHERE id=:this->caller_id]]></oql>
<fields>id,email</fields>
<finalclass>QueryOQL</finalclass>
<usages>notif</usages>
</QueryOQL>
<QueryOQL alias="QueryOQL" id="2">
<name>Kontaktliste des Tickets</name>
<description>Kann in Benachrichtigungen verwendet werden, um alle verknüpften Kontakte eines Tickets zu verständigen</description>
<is_template>yes</is_template>
<oql><![CDATA[SELECT Contact AS C JOIN lnkContactToTicket AS L ON L.contact_id=C.id WHERE L.ticket_id=:this->id]]></oql>
<fields>id,email</fields>
<finalclass>QueryOQL</finalclass>
<usages>notif</usages>
</QueryOQL>
<QueryOQL alias="QueryOQL" id="7">
<name>Manager des Ticketmelders</name>
<description>Kann in Benachrichtigungen verwendet werden, um den Manager des Melders eines Tickets zu verständigen.</description>
<is_template>yes</is_template>
<oql><![CDATA[SELECT Person AS manager JOIN Person AS employee ON employee.manager_id = manager.id WHERE employee.id=:this->caller_id]]></oql>
<fields>id,email</fields>
<finalclass>QueryOQL</finalclass>
<usages>notif</usages>
</QueryOQL>
<QueryOQL alias="QueryOQL" id="9">
<name>Auslösende Person einer Benachrichtigung</name>
Expand All @@ -61,7 +61,7 @@
<is_template>yes</is_template>
<oql><![CDATA[SELECT Person WHERE id = :current_contact_id]]></oql>
<fields>id,email</fields>
<finalclass>QueryOQL</finalclass>
<usages>notif</usages>
</QueryOQL>
<QueryOQL alias="QueryOQL" id="6">
<name>Teammitglieder des Tickets</name>
Expand All @@ -71,7 +71,7 @@
WHERE L.team_id = :this->team_id
]]></oql>
<fields>id,email</fields>
<finalclass>QueryOQL</finalclass>
<usages>notif</usages>
</QueryOQL>
<QueryOQL alias="QueryOQL" id="5">
<name>Teammitglieder des Tickets, die nicht Bearbeiter sind</name>
Expand All @@ -83,15 +83,15 @@
WHERE L.team_id = :this->team_id AND P.id != :this->agent_id
]]></oql>
<fields>id,email</fields>
<finalclass>QueryOQL</finalclass>
<usages>notif</usages>
</QueryOQL>
<QueryOQL alias="QueryOQL" id="10">
<name>Team des Tickets</name>
<description>Kann in Benachrichtigungen verwendet werden, um das Team, an das das Ticket verteilt ist, über eine hinterlegte Team-Mail-Ad­res­se zu benachrichtigen.</description>
<is_template>yes</is_template>
<oql><![CDATA[SELECT Team WHERE id = :this->team_id]]></oql>
<fields>id,email</fields>
<finalclass>QueryOQL</finalclass>
<usages>notif</usages>
</QueryOQL>
<QueryOQL alias="QueryOQL" id="11">
<name>Kontaktliste eines Funktionales CI</name>
Expand All @@ -101,7 +101,7 @@
WHERE L.functionalci_id = :this->id
]]></oql>
<fields>id,email</fields>
<finalclass>QueryOQL</finalclass>
<usages>notif</usages>
</QueryOQL>
<QueryOQL alias="QueryOQL" id="12">
<name>Kontaktliste eines Dienstes</name>
Expand All @@ -111,7 +111,7 @@
WHERE L.service_id = :this->id
]]></oql>
<fields>id,email</fields>
<finalclass>QueryOQL</finalclass>
<usages>notif</usages>
</QueryOQL>
<QueryOQL alias="QueryOQL" id="13">
<name>Kontaktliste eines Vertrages</name>
Expand All @@ -121,6 +121,6 @@
WHERE L.contract_id = :this->id
]]></oql>
<fields>id,email</fields>
<finalclass>QueryOQL</finalclass>
<usages>notif</usages>
</QueryOQL>
</Set>
26 changes: 13 additions & 13 deletions datamodels/2.x/itop-tickets/data/en_us.data.itop-tickets.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<is_template>yes</is_template>
<oql><![CDATA[SELECT Person WHERE id=:this->agent_id]]></oql>
<fields>id,email</fields>
<finalclass>QueryOQL</finalclass>
<usages>notif</usages>
</QueryOQL>
<QueryOQL alias="QueryOQL" id="4">
<name>Agent of the Ticket unless the agent himself triggered the notification</name>
Expand All @@ -16,7 +16,7 @@
<is_template>yes</is_template>
<oql><![CDATA[SELECT Person WHERE id=:this->agent_id AND id != :current_contact_id]]></oql>
<fields>id,email</fields>
<finalclass>QueryOQL</finalclass>
<usages>notif</usages>
</QueryOQL>
<QueryOQL alias="QueryOQL" id="3">
<name>Caller and Contacts linked to the Ticket</name>
Expand All @@ -27,31 +27,31 @@
SELECT Person WHERE id=:this->caller_id
]]></oql>
<fields>id,email</fields>
<finalclass>QueryOQL</finalclass>
<usages>notif</usages>
</QueryOQL>
<QueryOQL alias="QueryOQL" id="1">
<name>Caller of the Ticket</name>
<description>To be used in Notification, to notify the caller of a Ticket</description>
<is_template>yes</is_template>
<oql><![CDATA[SELECT Person WHERE id=:this->caller_id]]></oql>
<fields>id,email</fields>
<finalclass>QueryOQL</finalclass>
<usages>notif</usages>
</QueryOQL>
<QueryOQL alias="QueryOQL" id="2">
<name>Contacts linked to the Ticket</name>
<description>Can be used in Notification, to notify contacts associated to a Ticket</description>
<is_template>yes</is_template>
<oql><![CDATA[SELECT Contact AS C JOIN lnkContactToTicket AS L ON L.contact_id=C.id WHERE L.ticket_id=:this->id]]></oql>
<fields>id,email</fields>
<finalclass>QueryOQL</finalclass>
<usages>notif</usages>
</QueryOQL>
<QueryOQL alias="QueryOQL" id="7">
<name>Manager of the Ticket caller</name>
<description>Can be used in Ticket Notification, to notify the manager of the caller.</description>
<is_template>yes</is_template>
<oql><![CDATA[SELECT Person AS manager JOIN Person AS employee ON employee.manager_id = manager.id WHERE employee.id=:this->caller_id]]></oql>
<fields>id,email</fields>
<finalclass>QueryOQL</finalclass>
<usages>notif</usages>
</QueryOQL>
<QueryOQL alias="QueryOQL" id="9">
<name>Person who triggered the notification</name>
Expand All @@ -61,7 +61,7 @@
<is_template>yes</is_template>
<oql><![CDATA[SELECT Person WHERE id = :current_contact_id]]></oql>
<fields>id,email</fields>
<finalclass>QueryOQL</finalclass>
<usages>notif</usages>
</QueryOQL>
<QueryOQL alias="QueryOQL" id="6">
<name>Team members of the Ticket</name>
Expand All @@ -71,7 +71,7 @@
WHERE L.team_id = :this->team_id
]]></oql>
<fields>id,email</fields>
<finalclass>QueryOQL</finalclass>
<usages>notif</usages>
</QueryOQL>
<QueryOQL alias="QueryOQL" id="5">
<name>Team members of the Ticket other than the agent</name>
Expand All @@ -83,15 +83,15 @@
WHERE L.team_id = :this->team_id AND P.id != :this->agent_id
]]></oql>
<fields>id,email</fields>
<finalclass>QueryOQL</finalclass>
<usages>notif</usages>
</QueryOQL>
<QueryOQL alias="QueryOQL" id="10">
<name>Team of the Ticket</name>
<description>Can be used in Notification, to notify the team generic email, to which the Ticket was dispatched.</description>
<is_template>yes</is_template>
<oql><![CDATA[SELECT Team WHERE id = :this->team_id]]></oql>
<fields>id,email</fields>
<finalclass>QueryOQL</finalclass>
<usages>notif</usages>
</QueryOQL>
<QueryOQL alias="QueryOQL" id="11">
<name>Contacts of a Functional CI</name>
Expand All @@ -101,7 +101,7 @@
WHERE L.functionalci_id = :this->id
]]></oql>
<fields>id,email</fields>
<finalclass>QueryOQL</finalclass>
<usages>notif</usages>
</QueryOQL>
<QueryOQL alias="QueryOQL" id="12">
<name>Contacts of a Service</name>
Expand All @@ -111,7 +111,7 @@
WHERE L.service_id = :this->id
]]></oql>
<fields>id,email</fields>
<finalclass>QueryOQL</finalclass>
<usages>notif</usages>
</QueryOQL>
<QueryOQL alias="QueryOQL" id="13">
<name>Contacts of a Contract</name>
Expand All @@ -121,6 +121,6 @@
WHERE L.contract_id = :this->id
]]></oql>
<fields>id,email</fields>
<finalclass>QueryOQL</finalclass>
<usages>notif</usages>
</QueryOQL>
</Set>
Loading