Bonjour,

La dropdown 'searchtype' des critères globaux du moteur de recherche
ne sont pas correctement chargés et ne contiennent que le type
'contains'.
Pour illustrer mon propos et reproduire ce comportement, il suffit de
rajouter un critère global et de sélectionner le type Logiciel. Le
champ du critère global sélectionné est le Nom et la dropdown
'searchtype' ne possède que "contient" alors qu'elle devrait lister
"contient","est" et "n'est pas".

Le patch suivant rajoute un appel à .trigger('change') sur l'objet
jQuery chargé d'écouter l'évènement. Cela a pour effet de charger
correctement cette liste lors de l'affichage de la dropdown des champs
du critère global sélectionné.

J'ai aussi supprimé les différents include du fichier
ajax/searchoption.php dans les fichiers ajax concernés car le
.trigger('change') permet à la fonction javascript généré par
updateItemOnEventJsCode de recharger la dropdown 'searchoption' à
l'affichage.

Cordialement,
--
Kevin 'kiniou' Roy
Index: ajax/searchoption.php
===================================================================
--- ajax/searchoption.php	(revision 22892)
+++ ajax/searchoption.php	(working copy)
@@ -93,7 +93,6 @@
    $_POST['value']      = stripslashes($_POST['value']);
    $_POST['searchopt']  = $searchopt;
 
-   include(GLPI_ROOT."/ajax/searchoptionvalue.php");
    echo "</span>\n";
    echo "</td></tr></table>";
 
Index: ajax/searchoptionvalue.php
===================================================================
--- ajax/searchoptionvalue.php	(revision 22892)
+++ ajax/searchoptionvalue.php	(working copy)
@@ -45,7 +45,11 @@
 Session::checkLoginUser();
 
 if (isset($_POST['searchtype'])) {
-   $searchopt      = $_POST['searchopt'];
+   if ( isset($_POST['searchopt'])) {
+      $searchopt      = $_POST['searchopt'];
+   } else {
+      $searchopt = array();
+   }
    $_POST['value'] = rawurldecode($_POST['value']);
 
    $fieldname = 'criteria';
Index: ajax/searchrow.php
===================================================================
--- ajax/searchrow.php	(revision 22892)
+++ ajax/searchrow.php	(working copy)
@@ -180,7 +180,6 @@
    $_POST['field']      = $value;
    $_POST['searchtype'] = (isset($criteria['searchtype'])?$criteria['searchtype']:"" );
    $_POST['value']      = (isset($criteria['value'])?stripslashes($criteria['value']):"" );
-   include (GLPI_ROOT."/ajax/searchoption.php");
    echo "</div>\n";
 
    $params = array('field'      => '__VALUE__',
@@ -194,4 +193,4 @@
 
    echo "</td></tr>\n";
 }
-?>
\ No newline at end of file
+?>
Index: ajax/updateMetaSearch.php
===================================================================
--- ajax/updateMetaSearch.php	(revision 22892)
+++ ajax/updateMetaSearch.php	(working copy)
@@ -70,7 +70,6 @@
 
 $_POST['meta'] = 1;
 
-include (GLPI_ROOT."/ajax/searchoption.php");
 echo "</span>\n";
 
 $params = array('field'      => '__VALUE__',
Index: inc/ajax.class.php
===================================================================
--- inc/ajax.class.php	(revision 22892)
+++ inc/ajax.class.php	(working copy)
@@ -499,7 +499,8 @@
                      $output .= "}";
                   }
                $output .=  "}";
-            $output .=");\n";
+            // trigger the event in order to correctly load ajax url at initial display.
+            $output .=").trigger('$event');\n";
          }
       }
       if ($display) {
_______________________________________________
Glpi-dev mailing list
Glpi-dev@gna.org
https://mail.gna.org/listinfo/glpi-dev

Reply via email to