mirror of
https://github.com/Combodo/iTop.git
synced 2026-04-23 02:28:44 +02:00
N°463 - Load localized Query Phrases at Setup
This commit is contained in:
@@ -84,7 +84,7 @@ class QueryOQL extends Query
|
||||
"key_type" => "autoincrement",
|
||||
"name_attcode" => "name",
|
||||
"state_attcode" => "",
|
||||
"reconc_keys" => array(),
|
||||
"reconc_keys" => array('oql', 'is_template'),
|
||||
"db_table" => "priv_query_oql",
|
||||
"db_key_field" => "id",
|
||||
"db_finalclass_field" => "",
|
||||
|
||||
106
datamodels/2.x/itop-tickets/data/en_us.data.itop-tickets.xml
Normal file
106
datamodels/2.x/itop-tickets/data/en_us.data.itop-tickets.xml
Normal file
@@ -0,0 +1,106 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<Set>
|
||||
<QueryOQL alias="QueryOQL" id="8">
|
||||
<name>Agent of the Ticket</name>
|
||||
<description>Can be used in Notification, to notify the agent of a Ticket.</description>
|
||||
<is_template>yes</is_template>
|
||||
<oql>SELECT Person WHERE id=:this->agent_id</oql>
|
||||
<fields>id,email</fields>
|
||||
<finalclass>QueryOQL</finalclass>
|
||||
<friendlyname>Agent of the Ticket</friendlyname>
|
||||
</QueryOQL>
|
||||
<QueryOQL alias="QueryOQL" id="4">
|
||||
<name>Agent of the Ticket unless the agent himself triggered the notification</name>
|
||||
<description>Can be used in Notification, to notify the agent of a Ticket.
|
||||
No email will be send if the person who triggered that notification is the agent himself.
|
||||
</description>
|
||||
<is_template>yes</is_template>
|
||||
<oql>SELECT Person WHERE id=:this->agent_id AND id != :current_contact_id</oql>
|
||||
<fields>id,email</fields>
|
||||
<finalclass>QueryOQL</finalclass>
|
||||
<friendlyname>Agent of the Ticket unless the agent himself triggered the notification</friendlyname>
|
||||
</QueryOQL>
|
||||
<QueryOQL alias="QueryOQL" id="3">
|
||||
<name>Caller and Contacts linked to the Ticket</name>
|
||||
<description>Can be used in Notification, to notify the caller and all contacts associated to a Ticket</description>
|
||||
<is_template>yes</is_template>
|
||||
<oql>SELECT Contact AS C JOIN lnkContactToTicket AS L ON L.contact_id=C.id WHERE L.ticket_id=:this->id
|
||||
UNION
|
||||
SELECT Person WHERE id=:this->caller_id
|
||||
</oql>
|
||||
<fields>id,email</fields>
|
||||
<finalclass>QueryOQL</finalclass>
|
||||
<friendlyname>Caller and Contacts linked to the Ticket</friendlyname>
|
||||
</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>SELECT Person WHERE id=:this->caller_id</oql>
|
||||
<fields>id,email</fields>
|
||||
<finalclass>QueryOQL</finalclass>
|
||||
<friendlyname>Caller of the Ticket</friendlyname>
|
||||
</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>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>
|
||||
<friendlyname>Contacts linked to the Ticket</friendlyname>
|
||||
</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>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>
|
||||
<friendlyname>Manager of the Ticket caller</friendlyname>
|
||||
</QueryOQL>
|
||||
<QueryOQL alias="QueryOQL" id="9">
|
||||
<name>Person who triggered the notification</name>
|
||||
<description>Can be used in Notification, to notify the person whom by their action triggered the notification.
|
||||
If used alone, it returns the person connected to iTop and running that query.
|
||||
</description>
|
||||
<is_template>yes</is_template>
|
||||
<oql>SELECT Person WHERE id = :current_contact_id</oql>
|
||||
<fields>id,email</fields>
|
||||
<finalclass>QueryOQL</finalclass>
|
||||
<friendlyname>Person who triggered the notification</friendlyname>
|
||||
</QueryOQL>
|
||||
<QueryOQL alias="QueryOQL" id="6">
|
||||
<name>Team members of the Ticket</name>
|
||||
<description>Can be used in Notification, to notify the team members, to which the Ticket was dispatched.</description>
|
||||
<is_template>yes</is_template>
|
||||
<oql>SELECT Person AS P JOIN lnkPersonToTeam AS L ON L.person_id=P.id
|
||||
WHERE L.team_id = :this->team_id
|
||||
</oql>
|
||||
<fields>id,email</fields>
|
||||
<finalclass>QueryOQL</finalclass>
|
||||
<friendlyname>Team members of the Ticket</friendlyname>
|
||||
</QueryOQL>
|
||||
<QueryOQL alias="QueryOQL" id="5">
|
||||
<name>Team members of the Ticket other than the agent</name>
|
||||
<description>Can be used in Notification, to notify the team members, to which the Ticket was dispatched.
|
||||
The agent himself is excluded from that list.
|
||||
</description>
|
||||
<is_template>yes</is_template>
|
||||
<oql>SELECT Person AS P JOIN lnkPersonToTeam AS L ON L.person_id=P.id
|
||||
WHERE L.team_id = :this->team_id AND P.id != :this->agent_id
|
||||
</oql>
|
||||
<fields>id,email</fields>
|
||||
<finalclass>QueryOQL</finalclass>
|
||||
<friendlyname>Team members of the Ticket other than the agent</friendlyname>
|
||||
</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>SELECT Team WHERE id = :this->team_id</oql>
|
||||
<fields>id,email</fields>
|
||||
<finalclass>QueryOQL</finalclass>
|
||||
<friendlyname>Team of the Ticket</friendlyname>
|
||||
</QueryOQL>
|
||||
</Set>
|
||||
94
datamodels/2.x/itop-tickets/data/fr_fr.data.itop-tickets.xml
Normal file
94
datamodels/2.x/itop-tickets/data/fr_fr.data.itop-tickets.xml
Normal file
@@ -0,0 +1,94 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<Set>
|
||||
<QueryOQL alias="QueryOQL" id="8">
|
||||
<name>L'agent du ticket</name>
|
||||
<description>Utilisable dans les notifications, pour informer l'agent en charge du ticket.</description>
|
||||
<is_template>yes</is_template>
|
||||
<oql>SELECT Person WHERE id=:this->agent_id</oql>
|
||||
<fields>id,email</fields>
|
||||
<finalclass>QueryOQL</finalclass>
|
||||
</QueryOQL>
|
||||
<QueryOQL alias="QueryOQL" id="4">
|
||||
<name>L'agent du ticket s'il n'a pas déclenché la notification</name>
|
||||
<description>Utilisable dans les notifications, pour informer l'agent en charge du ticket, sauf si c'est l'agent lui-même qui déclenche la notification
|
||||
</description>
|
||||
<is_template>yes</is_template>
|
||||
<oql>SELECT Person WHERE id=:this->agent_id AND id != :current_contact_id</oql>
|
||||
<fields>id,email</fields>
|
||||
<finalclass>QueryOQL</finalclass>
|
||||
</QueryOQL>
|
||||
<QueryOQL alias="QueryOQL" id="3">
|
||||
<name>Le demandeur et les contacts liés au Ticket</name>
|
||||
<description>Utilisable dans les notifications, pour informer le demandeur ainsi que tout les contacts liés au ticket</description>
|
||||
<is_template>yes</is_template>
|
||||
<oql>SELECT Contact AS C JOIN lnkContactToTicket AS L ON L.contact_id=C.id WHERE L.ticket_id=:this->id
|
||||
UNION SELECT Person WHERE id=:this->caller_id
|
||||
</oql>
|
||||
<fields>id,email</fields>
|
||||
<finalclass>QueryOQL</finalclass>
|
||||
</QueryOQL>
|
||||
<QueryOQL alias="QueryOQL" id="1">
|
||||
<name>Le demandeur du Ticket</name>
|
||||
<description>Utilisable dans les notifications, pour informer le demandeur du ticket</description>
|
||||
<is_template>yes</is_template>
|
||||
<oql>SELECT Person WHERE id=:this->caller_id</oql>
|
||||
<fields>id,email</fields>
|
||||
<finalclass>QueryOQL</finalclass>
|
||||
</QueryOQL>
|
||||
<QueryOQL alias="QueryOQL" id="2">
|
||||
<name>Les contacts liés au Ticket</name>
|
||||
<description>Utilisable dans les notifications, pour informer tout les contacts liés au ticket</description>
|
||||
<is_template>yes</is_template>
|
||||
<oql>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>
|
||||
</QueryOQL>
|
||||
<QueryOQL alias="QueryOQL" id="7">
|
||||
<name>Le manager du demandeur</name>
|
||||
<description>Utilisable dans les notifications, pour informer le manager du demandeur d'un Ticket</description>
|
||||
<is_template>yes</is_template>
|
||||
<oql>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>
|
||||
</QueryOQL>
|
||||
<QueryOQL alias="QueryOQL" id="9">
|
||||
<name>La personne qui a déclenché la notification</name>
|
||||
<description>Utilisable dans les notifications, pour informer la personne qui a effectué l'action qui a provoqué la notification.
|
||||
Utilisée seule, cette requête retourne la personne liée à l'utilisateur iTop qui l'execute.
|
||||
</description>
|
||||
<is_template>yes</is_template>
|
||||
<oql>SELECT Person WHERE id = :current_contact_id</oql>
|
||||
<fields>id,email</fields>
|
||||
<finalclass>QueryOQL</finalclass>
|
||||
</QueryOQL>
|
||||
<QueryOQL alias="QueryOQL" id="6">
|
||||
<name>Les membres de l'équipe en charge du Ticket</name>
|
||||
<description>Utilisable dans les notifications, pour informer les membres de l'équipe en charge du ticket.</description>
|
||||
<is_template>yes</is_template>
|
||||
<oql>SELECT Person AS P JOIN lnkPersonToTeam AS L ON L.person_id=P.id
|
||||
WHERE L.team_id = :this->team_id
|
||||
</oql>
|
||||
<fields>id,email</fields>
|
||||
<finalclass>QueryOQL</finalclass>
|
||||
</QueryOQL>
|
||||
<QueryOQL alias="QueryOQL" id="5">
|
||||
<name>Les membres de l'équipe hors l'agent</name>
|
||||
<description>Utilisable dans les notifications, pour informer les membres de l'équipe en charge du ticket.
|
||||
L'agent lui-même est exclus de cette liste.
|
||||
</description>
|
||||
<is_template>yes</is_template>
|
||||
<oql>SELECT Person AS P JOIN lnkPersonToTeam AS L ON L.person_id=P.id
|
||||
WHERE L.team_id = :this->team_id AND P.id != :this->agent_id
|
||||
</oql>
|
||||
<fields>id,email</fields>
|
||||
<finalclass>QueryOQL</finalclass>
|
||||
</QueryOQL>
|
||||
<QueryOQL alias="QueryOQL" id="10">
|
||||
<name>L'équipe du Ticket</name>
|
||||
<description>Utilisable dans les notifications, pour informer l'équipe en charge du ticket, via son email générique.</description>
|
||||
<is_template>yes</is_template>
|
||||
<oql>SELECT Team WHERE id = :this->team_id</oql>
|
||||
<fields>id,email</fields>
|
||||
<finalclass>QueryOQL</finalclass>
|
||||
</QueryOQL>
|
||||
</Set>
|
||||
@@ -67,5 +67,33 @@ class TicketsInstaller extends ModuleInstallerAPI
|
||||
utils::EnrichRaisedException($oTrigger, $e);
|
||||
}
|
||||
}
|
||||
// It's not very clear if it make sense to test a particular version,
|
||||
// as the loading mechanism checks object existence using reconc_keys
|
||||
// and do not recreate them, nor update existing.
|
||||
// Without test, new entries added to the data files, would be automatically loaded
|
||||
if (($sPreviousVersion === '') ||
|
||||
(version_compare($sPreviousVersion, $sCurrentVersion, '<')
|
||||
and version_compare($sPreviousVersion, '3.0.1', '<'))) {
|
||||
$oDataLoader = new XMLDataLoader();
|
||||
|
||||
CMDBObject::SetTrackInfo("Initialization");
|
||||
$oMyChange = CMDBObject::GetCurrentChange();
|
||||
|
||||
$sFileName = '';
|
||||
$oFileConfig = new Config(APPCONF.'production/'.ITOP_CONFIG_FILE);
|
||||
if (is_object($oFileConfig)) 2
|
||||
{
|
||||
$sLang = str_replace(' ', '_', strtolower($oFileConfig->GetDefaultLanguage()));
|
||||
$sFileName = dirname(__FILE__)."/data/{$sLang}.data.itop-tickets.xml";
|
||||
SetupLog::Info("Searching file: $sFileName");
|
||||
}
|
||||
if (!file_exists($sFileName)) {
|
||||
$sFileName = dirname(__FILE__)."/data/en_us.data.itop-tickets.xml";
|
||||
}
|
||||
SetupLog::Info("Loading file: $sFileName");
|
||||
$oDataLoader->StartSession($oMyChange);
|
||||
$oDataLoader->LoadFile($sFileName, false, true);
|
||||
$oDataLoader->EndSession();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -179,10 +179,12 @@ class XMLDataLoader
|
||||
|
||||
/**
|
||||
* Helper function to load the objects from a standard XML file into the database
|
||||
*
|
||||
* @param $sFilePath string The full path to the XML file to load
|
||||
* @param $bUpdateKeyCacheOnly bool Set to true to *just* update the keys cache but not reload the objects
|
||||
* @param bool $bSearch Set to true to create objects only if they do not already exist based on reconciliation keys
|
||||
*/
|
||||
function LoadFile($sFilePath, $bUpdateKeyCacheOnly = false)
|
||||
function LoadFile($sFilePath, $bUpdateKeyCacheOnly = false, bool $bSearch = false)
|
||||
{
|
||||
global $aKeys;
|
||||
|
||||
@@ -298,7 +300,7 @@ class XMLDataLoader
|
||||
}
|
||||
}
|
||||
}
|
||||
$this->StoreObject($sClass, $oTargetObj, $iSrcId, $bUpdateKeyCacheOnly, $bUpdateKeyCacheOnly);
|
||||
$this->StoreObject($sClass, $oTargetObj, $iSrcId, $bSearch || $bUpdateKeyCacheOnly, $bUpdateKeyCacheOnly);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user