Bug : use ilike instead of tilde

This commit is contained in:
Dany De Bontridder 2020-08-02 13:40:13 +02:00 committed by Dany De Bontridder
parent 42aa751b17
commit 86777bec6a
8 changed files with 38 additions and 24 deletions

View file

@ -1224,7 +1224,7 @@ function fill_box(req)
*@param dossier_id
*@param od_id from table op_predef
*/
function mod_predf_op(dossier_id, od_id)
function mod_predf_op(dossier_id, od_id,p_ledger)
{
var target = "mod_predf_op";
removeDiv(target);
@ -1234,7 +1234,7 @@ function mod_predf_op(dossier_id, od_id)
add_div(div);
var qs = "gDossier=" + dossier_id + '&op=mod_predf&id=' + od_id;
var qs = "gDossier=" + dossier_id + '&op=mod_predf&id=' + od_id+'&ledger_id='+p_ledger;
var action = new Ajax.Request('ajax_misc.php',
{

View file

@ -71,7 +71,7 @@ if ( isset($_REQUEST['go']))
$plabel=$http->request("plabel");
$sql="select po_name , po_description from poste_analytique ".
"where pa_id=$1 and ".
" (po_name ~* $2 or po_description ~* $3) order by po_name";
" (po_name ilike '%'||$2||'%' or po_description ilike '%'|| $3||'%') order by po_name";
$array=$cn->get_array($sql,array($c2,$plabel,$plabel));
if (empty($array) == true)

View file

@ -13,12 +13,22 @@ $cn=Dossier::connect();
if ( isset($_REQUEST['pa_id']) )
{
$res=$cn->exec_sql("select po_name,po_description from poste_analytique where pa_id=$1 and (po_description ~* $2 or po_name ~* $3) order by po_id limit 12",
$res=$cn->exec_sql("select po_name,po_description
from poste_analytique
where
pa_id=$1
and (po_description ilike '%'|| $2||'%' or po_name ilike '%'|| $3 ||'%')
order by po_id limit 12",
array($_REQUEST['pa_id'],$_POST['anccard'],$_POST['anccard']));
}
else
{
$res=$cn->exec_sql("select po_name,po_description from poste_analytique where po_description ~* $1 or po_name ~* $2 order by po_id limit 12 ",
$res=$cn->exec_sql("select po_name,po_description
from poste_analytique
where
po_description ilike '%'|| $1 ||'%'
or po_name ilike '%'|| $2||'%'
order by po_id limit 12 ",
array($_POST['anccard'],$_POST['anccard']));
}
$nb=Database::num_row($res);

View file

@ -71,7 +71,7 @@ class contact extends Fiche
$search=" and f_id in
(select f_id from fiche_Detail
where
ad_id=1 and ad_value ~* '$p_search') ";
ad_id=1 and ad_value ilike '%$p_search%') ";
}
// Get The result Array
$step_contact=$this->get_by_category($offset,$search.$extra_sql.$p_sql);

View file

@ -80,8 +80,8 @@ class Dossier
$l_sql="select *, 'W' as priv_priv "
."from ac_dossier "
."where "
."dos_name ~* $2 "
."or dos_description ~* $2 "
."dos_name ilike '%'|| $2 ||'%'"
."or dos_description ilike '%'|| $2 || '%' "
."ORDER BY dos_name $str_limit ";
$a_row=$cn->get_array($l_sql, $p_text);
return $a_row;
@ -93,7 +93,7 @@ class Dossier
natural join ac_users
where
use_login=$1
and ( dos_name ~* $2 or dos_description ~* $2)
and ( dos_name ilike '%'|| $2 || '%' or dos_description ilike '%'|| $2|| '%' )
order by dos_name
$str_limit
@ -104,10 +104,10 @@ class Dossier
}
else if ($p_type=='X')
{
$l_sql=' select * from ac_dossier where dos_id not in
$l_sql=" select * from ac_dossier where dos_id not in
(select dos_id from jnt_use_dos where use_id=$1)
and ( dos_name ~* $2 or dos_description ~* $2)
order by dos_name '.$str_limit;
and ( dos_name ilike '%'|| $2|| '%' or dos_description ilike '%'|| $2 || '%')
order by dos_name ".$str_limit;
$a_row=$cn->get_array($l_sql, array($p_login, $p_text));
return $a_row;
}

View file

@ -262,7 +262,7 @@ class Fiche
{
$a=sql_string($p_search);
$sql="select * from vw_fiche_attr where frd_id=".$p_frd_id.
" and vw_name ~* '$p_search'";
" and vw_name ilike '%$p_search%'";
}
$Ret=$this->cn->exec_sql($sql.$p_sql);
@ -1776,7 +1776,7 @@ class Fiche
$search.=" and f_id in
(select distinct f_id from fiche_detail
where
ad_id in (1,32,30,23,18,13) and ad_value ~* '$p_search')";
ad_id in (1,32,30,23,18,13) and ad_value ilike '%$p_search%')";
}
// Get The result Array
$step_tiers=$this->get_by_category($offset,$search.$filter_amount,'name');

View file

@ -1322,9 +1322,9 @@ class Follow_Up
if (isset($_REQUEST['action_query']))
{
// if a query is request build the sql stmt
$action_query="and (ag_title ~* '".sql_string($_REQUEST['action_query'])."' ".
$action_query="and (ag_title ilike '%".sql_string($_REQUEST['action_query'])."%' ".
"or ag_ref ='".trim(sql_string($_REQUEST['action_query'])).
"' or ag_id in (select ag_id from action_gestion_comment where agc_comment ~* '".trim(sql_string($_REQUEST['action_query']))."')".
"' or ag_id in (select ag_id from action_gestion_comment where agc_comment ilike '%".trim(sql_string($_REQUEST['action_query']))."%')".
")";
}

View file

@ -1050,20 +1050,24 @@ class User
{
// show only available folders
// if user is not an admin
$Res = $cn->exec_sql("select distinct dos_id,dos_name,dos_description
$Res = $cn->exec_sql("select
distinct dos_id,dos_name,dos_description
from ac_users
natural join jnt_use_dos
natural join ac_dossier
natural join jnt_use_dos
natural join ac_dossier
where
use_login= $1
and use_active = 1
and ( dos_name ~* $2 or dos_description ~* $2 )
use_login= $1
and use_active = 1
and ( dos_name ilike '%' || $2 || '%' or dos_description ilike '%' || $2 || '%' )
order by dos_name", array($this->login, $p_filter));
}
else
{
$Res = $cn->exec_sql("select distinct dos_id,dos_name,dos_description from ac_dossier
where dos_name ~* $1 or dos_description ~* $1 order by dos_name", array($p_filter));
$Res = $cn->exec_sql("select
distinct dos_id,dos_name,dos_description from ac_dossier
where
dos_name ilike '%' || $1|| '%' or dos_description ilike '%' || $1 || '%'
order by dos_name", array($p_filter));
}
require_once NOALYSS_INCLUDE.'/class/database.class.php';