Voici un patch qui vérifie en premier lieu qu'on doit gérer ou pas
l'historique dans le post_addItem de commonDBRelation avant de charger
les items.
Sur un inventaire FusionInventory (nouvel ordinateur), je gagne entre 5
et 10% du traitement avec cette modification.
David
++
Index: inc/commondbrelation.class.php
===================================================================
--- inc/commondbrelation.class.php (revision 19806)
+++ inc/commondbrelation.class.php (working copy)
@@ -639,28 +639,30 @@
* @return nothing
**/
function post_addItem() {
+
+ if ((!isset($this->input['_no_history']) || !$this->input['_no_history'])) {
- $item1 = $this->getConnexityItem(static::$itemtype_1, static::$items_id_1);
- $item2 = $this->getConnexityItem(static::$itemtype_2, static::$items_id_2);
+ $item1 = $this->getConnexityItem(static::$itemtype_1, static::$items_id_1);
+ $item2 = $this->getConnexityItem(static::$itemtype_2, static::$items_id_2);
- if ((!isset($this->input['_no_history']) || !$this->input['_no_history'])
- && ($item1 !== false)
- && ($item2 !== false)) {
+ if (($item1 !== false)
+ && ($item2 !== false)) {
- if ($item1->dohistory && static::$logs_for_itemtype_1) {
- $changes[0] = '0';
- $changes[1] = "";
- $changes[2] = addslashes($this->getHistoryNameForItem2($item2, 'add'));
- Log::history($item1->getID(), $item1->getType(), $changes, $item2->getType(),
- static::$log_history_1_add);
- }
+ if ($item1->dohistory && static::$logs_for_itemtype_1) {
+ $changes[0] = '0';
+ $changes[1] = "";
+ $changes[2] = addslashes($this->getHistoryNameForItem2($item2, 'add'));
+ Log::history($item1->getID(), $item1->getType(), $changes, $item2->getType(),
+ static::$log_history_1_add);
+ }
- if ($item2->dohistory && static::$logs_for_itemtype_2) {
- $changes[0] = '0';
- $changes[1] = "";
- $changes[2] = addslashes($this->getHistoryNameForItem1($item1, 'add'));
- Log::history($item2->getID(), $item2->getType(), $changes, $item1->getType(),
- static::$log_history_2_add);
+ if ($item2->dohistory && static::$logs_for_itemtype_2) {
+ $changes[0] = '0';
+ $changes[1] = "";
+ $changes[2] = addslashes($this->getHistoryNameForItem1($item1, 'add'));
+ Log::history($item2->getID(), $item2->getType(), $changes, $item1->getType(),
+ static::$log_history_2_add);
+ }
}
}
}
_______________________________________________
Glpi-dev mailing list
[email protected]
https://mail.gna.org/listinfo/glpi-dev