diff --git a/html/js/card.js b/html/js/card.js index 8c7b918ad..6212658a0 100644 --- a/html/js/card.js +++ b/html/js/card.js @@ -274,7 +274,9 @@ function search_get_card(obj) } else { queryString+="&accvis=0"; } + queryString=encodeURI(queryString); $('asearch').innerHTML=loading(); + var action=new Ajax.Request ( 'ajax_misc.php', { method:'get', diff --git a/include/ajax/ajax_card.php b/include/ajax/ajax_card.php index 9b61631ba..74a3d5b8f 100644 --- a/include/ajax/ajax_card.php +++ b/include/ajax/ajax_card.php @@ -441,7 +441,7 @@ case 'fs': $r.=''; $r.=dossier::hidden().HtmlInput::hidden('op','fs'); $array=array(); - foreach (array('accvis','query','inp','jrn','label','typecard','price','tvaid') as $i) + foreach (array('accvis','inp','jrn','label','typecard','price','tvaid') as $i) { if (isset(${$i}) ) { @@ -449,6 +449,7 @@ case 'fs': $sql_array[$i]=${$i}; } } + $sql_array["query"]=$query; /* what is the type of the ledger */ $type="GL"; if (isset($jrn) && $jrn > 1) @@ -462,12 +463,13 @@ case 'fs': if ( strpos($sql," in ()") != 0) { - $html=Icon_Action::close('search_card'); - $html.='
'.h2info(_('Recherche de fiche')).'
'; + $html=""; + $html.=HtmlInput::title_box(_('Recherche de fiche'), 'search_card'); $html.='

'; $html.=_("Aucune catégorie de fiche ne correspond à". " votre demande, le journal pourrait n'avoir accès à aucune fiche"); $html.='

'; + $html.=HtmlInput::button_close("search_card"); break; } /* We limit the search to MAX_SEARCH_CARD records */ diff --git a/include/class/fiche.class.php b/include/class/fiche.class.php index 876351e36..565612c87 100644 --- a/include/class/fiche.class.php +++ b/include/class/fiche.class.php @@ -2131,8 +2131,9 @@ class Fiche { $query=sql_string($query); - if (strlen(trim($query))>1) + if (strlen(trim($query))>0) { + $query=str_replace(" ", "%", $query); $filter_query=$and."(vw_name ilike '%$query%' or quick_code ilike ('%$query%') " ." or vw_description ilike '%$query%' or tva_num ilike '%$query%' or accounting like upper('$query%'))"; }