diff --git a/application/query.class.inc.php b/application/query.class.inc.php
index eb84204cd..68862f569 100644
--- a/application/query.class.inc.php
+++ b/application/query.class.inc.php
@@ -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" => "",
diff --git a/datamodels/2.x/itop-tickets/data/en_us.data.itop-tickets.xml b/datamodels/2.x/itop-tickets/data/en_us.data.itop-tickets.xml
new file mode 100644
index 000000000..932850f64
--- /dev/null
+++ b/datamodels/2.x/itop-tickets/data/en_us.data.itop-tickets.xml
@@ -0,0 +1,106 @@
+
+
+
+ Agent of the Ticket
+ Can be used in Notification, to notify the agent of a Ticket.
+ yes
+ SELECT Person WHERE id=:this->agent_id
+ id,email
+ QueryOQL
+ Agent of the Ticket
+
+
+ Agent of the Ticket unless the agent himself triggered the notification
+ 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.
+
+ yes
+ SELECT Person WHERE id=:this->agent_id AND id != :current_contact_id
+ id,email
+ QueryOQL
+ Agent of the Ticket unless the agent himself triggered the notification
+
+
+ Caller and Contacts linked to the Ticket
+ Can be used in Notification, to notify the caller and all contacts associated to a Ticket
+ yes
+ 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
+
+ id,email
+ QueryOQL
+ Caller and Contacts linked to the Ticket
+
+
+ Caller of the Ticket
+ To be used in Notification, to notify the caller of a Ticket
+ yes
+ SELECT Person WHERE id=:this->caller_id
+ id,email
+ QueryOQL
+ Caller of the Ticket
+
+
+ Contacts linked to the Ticket
+ Can be used in Notification, to notify contacts associated to a Ticket
+ yes
+ SELECT Contact AS C JOIN lnkContactToTicket AS L ON L.contact_id=C.id WHERE L.ticket_id=:this->id
+ id,email
+ QueryOQL
+ Contacts linked to the Ticket
+
+
+ Manager of the Ticket caller
+ Can be used in Ticket Notification, to notify the manager of the caller.
+ yes
+ SELECT Person AS manager JOIN Person AS employee ON employee.manager_id = manager.id WHERE employee.id=:this->caller_id
+ id,email
+ QueryOQL
+ Manager of the Ticket caller
+
+
+ Person who triggered the notification
+ 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.
+
+ yes
+ SELECT Person WHERE id = :current_contact_id
+ id,email
+ QueryOQL
+ Person who triggered the notification
+
+
+ Team members of the Ticket
+ Can be used in Notification, to notify the team members, to which the Ticket was dispatched.
+ yes
+ SELECT Person AS P JOIN lnkPersonToTeam AS L ON L.person_id=P.id
+ WHERE L.team_id = :this->team_id
+
+ id,email
+ QueryOQL
+ Team members of the Ticket
+
+
+ Team members of the Ticket other than the agent
+ Can be used in Notification, to notify the team members, to which the Ticket was dispatched.
+ The agent himself is excluded from that list.
+
+ yes
+ 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
+
+ id,email
+ QueryOQL
+ Team members of the Ticket other than the agent
+
+
+ Team of the Ticket
+ Can be used in Notification, to notify the team generic email, to which the Ticket was dispatched.
+ yes
+ SELECT Team WHERE id = :this->team_id
+ id,email
+ QueryOQL
+ Team of the Ticket
+
+
diff --git a/datamodels/2.x/itop-tickets/data/fr_fr.data.itop-tickets.xml b/datamodels/2.x/itop-tickets/data/fr_fr.data.itop-tickets.xml
new file mode 100644
index 000000000..61e730240
--- /dev/null
+++ b/datamodels/2.x/itop-tickets/data/fr_fr.data.itop-tickets.xml
@@ -0,0 +1,94 @@
+
+
+
+ L'agent du ticket
+ Utilisable dans les notifications, pour informer l'agent en charge du ticket.
+ yes
+ SELECT Person WHERE id=:this->agent_id
+ id,email
+ QueryOQL
+
+
+ L'agent du ticket s'il n'a pas déclenché la notification
+ 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
+
+ yes
+ SELECT Person WHERE id=:this->agent_id AND id != :current_contact_id
+ id,email
+ QueryOQL
+
+
+ Le demandeur et les contacts liés au Ticket
+ Utilisable dans les notifications, pour informer le demandeur ainsi que tout les contacts liés au ticket
+ yes
+ 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
+
+ id,email
+ QueryOQL
+
+
+ Le demandeur du Ticket
+ Utilisable dans les notifications, pour informer le demandeur du ticket
+ yes
+ SELECT Person WHERE id=:this->caller_id
+ id,email
+ QueryOQL
+
+
+ Les contacts liés au Ticket
+ Utilisable dans les notifications, pour informer tout les contacts liés au ticket
+ yes
+ SELECT Contact AS C JOIN lnkContactToTicket AS L ON L.contact_id=C.id WHERE L.ticket_id=:this->id
+ id,email
+ QueryOQL
+
+
+ Le manager du demandeur
+ Utilisable dans les notifications, pour informer le manager du demandeur d'un Ticket
+ yes
+ SELECT Person AS manager JOIN Person AS employee ON employee.manager_id = manager.id WHERE employee.id=:this->caller_id
+ id,email
+ QueryOQL
+
+
+ La personne qui a déclenché la notification
+ 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.
+
+ yes
+ SELECT Person WHERE id = :current_contact_id
+ id,email
+ QueryOQL
+
+
+ Les membres de l'équipe en charge du Ticket
+ Utilisable dans les notifications, pour informer les membres de l'équipe en charge du ticket.
+ yes
+ SELECT Person AS P JOIN lnkPersonToTeam AS L ON L.person_id=P.id
+ WHERE L.team_id = :this->team_id
+
+ id,email
+ QueryOQL
+
+
+ Les membres de l'équipe hors l'agent
+ 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.
+
+ yes
+ 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
+
+ id,email
+ QueryOQL
+
+
+ L'équipe du Ticket
+ Utilisable dans les notifications, pour informer l'équipe en charge du ticket, via son email générique.
+ yes
+ SELECT Team WHERE id = :this->team_id
+ id,email
+ QueryOQL
+
+
diff --git a/datamodels/2.x/itop-tickets/module.itop-tickets.php b/datamodels/2.x/itop-tickets/module.itop-tickets.php
index bb793ca90..adce87f53 100755
--- a/datamodels/2.x/itop-tickets/module.itop-tickets.php
+++ b/datamodels/2.x/itop-tickets/module.itop-tickets.php
@@ -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();
+ }
}
}
diff --git a/setup/xmldataloader.class.inc.php b/setup/xmldataloader.class.inc.php
index bfb491237..fb34bd903 100644
--- a/setup/xmldataloader.class.inc.php
+++ b/setup/xmldataloader.class.inc.php
@@ -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;
}