Bonjour,
J'ai fais un patch pour l'INSERM, qui permet d'ajouter un champs de
recherche 'applitif - nom' dans les tickets afin de pouvoir faire une
recherche dessus.
Il est fait pour glpi 0.80.
Cordialement,
--
David DURIEUX
Tel : +33 (0)4.82.53.30.53
Mail : [email protected]
Site Web : http://www.siprossii.com/
SIPROSSII
Les LafĂ´rets
69430 Beaujeu
FRANCE
Index: hook.php
===================================================================
--- hook.php (revision 200)
+++ hook.php (working copy)
@@ -256,6 +256,15 @@
array('table' => 'glpi_plugin_appliances_appliances',
'joinparams' => $sopt[1210]['joinparams'])));
}
+ if ($itemtype == 'Ticket') {
+ $sopt[1212]['table'] = 'glpi_plugin_appliances_appliances';
+ $sopt[1212]['field'] = 'name';
+ $sopt[1212]['linkfield'] = 'items_id';
+
+ $sopt[1212]['massiveaction'] = false;
+ $sopt[1212]['name'] = $LANG['plugin_appliances']['title'][1]." - ".
+ $LANG['common'][16];
+ }
}
return $sopt;
}
@@ -471,4 +480,62 @@
$INJECTABLE_TYPES['PluginAppliancesApplianceInjection'] = 'appliances';
}
+
+
+function plugin_appliances_addWhere($link,$nott,$type,$id,$val,$searchtype) {
+
+ $searchopt = &Search::getOptions($type);
+ $table = $searchopt[$id]["table"];
+ $field = $searchopt[$id]["field"];
+
+ switch ($type) {
+
+ case 'Ticket':
+ if ($table.".".$field == "glpi_plugin_appliances_appliances.name") {
+ $out = '';
+ switch ($searchtype) {
+ case "contains" :
+ $SEARCH = Search::makeTextSearch($val, $nott);
+ break;
+
+ case "equals" :
+ if ($nott) {
+ $SEARCH = " <> '$val'";
+ } else {
+ $SEARCH = " = '$val'";
+ }
+ break;
+
+ case "notequals" :
+ if ($nott) {
+ $SEARCH = " = '$val'";
+ } else {
+ $SEARCH = " <> '$val'";
+ }
+ break;
+
+ }
+ if (in_array($searchtype, array('equals', 'notequals'))) {
+ if ($table != getTableForItemType($type) || $type == 'States') {
+ $out = " $link (`glpi_plugin_appliances_appliances_items_id`.`id`".$SEARCH;
+ } else {
+ $out = " $link (`glpi_plugin_appliances_appliances_items_id`.`$field`".$SEARCH;
+ }
+ if ($searchtype=='notequals') {
+ $nott = !$nott;
+ }
+ // Add NULL if $val = 0 and not negative search
+ // Or negative search on real value
+ if ((!$nott && $val==0) || ($nott && $val != 0)) {
+ $out .= " OR `glpi_plugin_appliances_appliances_items_id`.`id` IS NULL";
+ }
+ $out .= ')';
+ } else {
+ $out = Search::makeTextCriteria("`glpi_plugin_appliances_appliances_items_id`.".$field,$val,$nott,$link);
+ }
+ return $out." AND `glpi_tickets`.`itemtype`='PluginAppliancesAppliance'";
+ }
+ break;
+ }
+}
?>
\ No newline at end of file
_______________________________________________
Glpi-dev mailing list
[email protected]
https://mail.gna.org/listinfo/glpi-dev