[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Noalyss-commit] [noalyss] 04/119: Bug : use ilike instead of tilde
From: |
Dany De Bontridder |
Subject: |
[Noalyss-commit] [noalyss] 04/119: Bug : use ilike instead of tilde |
Date: |
Mon, 26 Oct 2020 18:26:59 -0400 (EDT) |
sparkyx pushed a commit to branch master
in repository noalyss.
commit 57d3beff295bf5ce77b42585d9874d47411867b1
Author: Dany De Bontridder <dany@alchimerys.be>
AuthorDate: Sun Aug 2 13:40:13 2020 +0200
Bug : use ilike instead of tilde
---
html/js/scripts.js | 4 ++--
include/ajax/ajax_anc_search.php | 2 +-
include/ajax/ajax_auto_anc_card.php | 14 ++++++++++++--
include/class/contact.class.php | 2 +-
include/class/dossier.class.php | 12 ++++++------
include/class/fiche.class.php | 4 ++--
include/class/follow_up.class.php | 4 ++--
include/class/user.class.php | 20 ++++++++++++--------
8 files changed, 38 insertions(+), 24 deletions(-)
diff --git a/html/js/scripts.js b/html/js/scripts.js
index 404e99e..f2f6e0c 100644
--- a/html/js/scripts.js
+++ b/html/js/scripts.js
@@ -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',
{
diff --git a/include/ajax/ajax_anc_search.php b/include/ajax/ajax_anc_search.php
index 00c114e..c9f9437 100644
--- a/include/ajax/ajax_anc_search.php
+++ b/include/ajax/ajax_anc_search.php
@@ -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)
diff --git a/include/ajax/ajax_auto_anc_card.php
b/include/ajax/ajax_auto_anc_card.php
index a047326..aa4622c 100644
--- a/include/ajax/ajax_auto_anc_card.php
+++ b/include/ajax/ajax_auto_anc_card.php
@@ -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);
diff --git a/include/class/contact.class.php b/include/class/contact.class.php
index 389074c..4bd785c 100644
--- a/include/class/contact.class.php
+++ b/include/class/contact.class.php
@@ -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);
diff --git a/include/class/dossier.class.php b/include/class/dossier.class.php
index 1f62b04..25e0425 100644
--- a/include/class/dossier.class.php
+++ b/include/class/dossier.class.php
@@ -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;
}
diff --git a/include/class/fiche.class.php b/include/class/fiche.class.php
index 876351e..214b100 100644
--- a/include/class/fiche.class.php
+++ b/include/class/fiche.class.php
@@ -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');
diff --git a/include/class/follow_up.class.php
b/include/class/follow_up.class.php
index 29164ce..6d77d83 100644
--- a/include/class/follow_up.class.php
+++ b/include/class/follow_up.class.php
@@ -1320,9 +1320,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']))."%')".
")";
}
diff --git a/include/class/user.class.php b/include/class/user.class.php
index d258120..5cee775 100644
--- a/include/class/user.class.php
+++ b/include/class/user.class.php
@@ -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';
- [Noalyss-commit] [noalyss] branch master updated (44dbd49 -> bc168d2), Dany De Bontridder, 2020/10/26
- [Noalyss-commit] [noalyss] 07/119: prevent divide by zero in formula, Dany De Bontridder, 2020/10/26
- [Noalyss-commit] [noalyss] 09/119: compatibility PHP74 : join() : glue before piece, Dany De Bontridder, 2020/10/26
- [Noalyss-commit] [noalyss] 06/119: reconcilaction : possibility to select only one operation, Dany De Bontridder, 2020/10/26
- [Noalyss-commit] [noalyss] 13/119: Bug 1834 : order POST over GET, Dany De Bontridder, 2020/10/26
- [Noalyss-commit] [noalyss] 05/119: Bug : syntax error, Dany De Bontridder, 2020/10/26
- [Noalyss-commit] [noalyss] 04/119: Bug : use ilike instead of tilde,
Dany De Bontridder <=
- [Noalyss-commit] [noalyss] 02/119: Bug : correct search remove ~, Dany De Bontridder, 2020/10/26
- [Noalyss-commit] [noalyss] 08/119: remove extract, Dany De Bontridder, 2020/10/26
- [Noalyss-commit] [noalyss] 03/119: Merge branch 'master' of gitlab.noalyss.eu:noalyss/noalyss, Dany De Bontridder, 2020/10/26
- [Noalyss-commit] [noalyss] 01/119: Fix warning with empty array, Dany De Bontridder, 2020/10/26
- [Noalyss-commit] [noalyss] 10/119: Fix bug : cannot use % when searching NEW : space can be used now, Dany De Bontridder, 2020/10/26
- [Noalyss-commit] [noalyss] 14/119: doc, Dany De Bontridder, 2020/10/26
- [Noalyss-commit] [noalyss] 11/119: Improve use of the security, Dany De Bontridder, 2020/10/26
- [Noalyss-commit] [noalyss] 17/119: javascript : add function to concat 2 json objects, Dany De Bontridder, 2020/10/26
- [Noalyss-commit] [noalyss] 18/119: javascript: remove hardcoding of dialog box for manage_table, Dany De Bontridder, 2020/10/26
- [Noalyss-commit] [noalyss] 30/119: Bug 1834 : duplicate , cannot confirm an duplicated operation because the $_GET is taken in priority, Dany De Bontridder, 2020/10/26