Fix bug : cannot use % when searching

NEW : space can be used now
This commit is contained in:
Dany De Bontridder 2020-08-27 20:31:23 +02:00
parent 7f6ae783af
commit 03ad5cd3fd
3 changed files with 9 additions and 4 deletions

View file

@ -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',

View file

@ -441,7 +441,7 @@ case 'fs':
$r.='</span>';
$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.='<div> '.h2info(_('Recherche de fiche')).'</div>';
$html="";
$html.=HtmlInput::title_box(_('Recherche de fiche'), 'search_card');
$html.='<h3 class="notice">';
$html.=_("Aucune catégorie de fiche ne correspond à".
" votre demande, le journal pourrait n'avoir accès à aucune fiche");
$html.='</h3>';
$html.=HtmlInput::button_close("search_card");
break;
}
/* We limit the search to MAX_SEARCH_CARD records */

View file

@ -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%'))";
}