[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Noalyss-commit] [noalyss] 31/119: Bug : use ilike instead of tilde
From: |
Dany De Bontridder |
Subject: |
[Noalyss-commit] [noalyss] 31/119: Bug : use ilike instead of tilde |
Date: |
Mon, 26 Oct 2020 18:27:10 -0400 (EDT) |
sparkyx pushed a commit to branch master
in repository noalyss.
commit 86777bec6afe06ff7bb3abab5c622722af2e4d0b
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 ce350f3..959788c 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 c8364d7..85d46b5 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 565612c..a6a8e21 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 64f86c9..48ad1e2 100644
--- a/include/class/follow_up.class.php
+++ b/include/class/follow_up.class.php
@@ -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']))."%')".
")";
}
diff --git a/include/class/user.class.php b/include/class/user.class.php
index f48f794..23051d0 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] 60/119: FollowUp Deatil : add the amount + tva from card, (continued)
- [Noalyss-commit] [noalyss] 60/119: FollowUp Deatil : add the amount + tva from card, Dany De Bontridder, 2020/10/26
- [Noalyss-commit] [noalyss] 74/119: Search concerned card with company , name , ... and export contact option to CSV, Dany De Bontridder, 2020/10/26
- [Noalyss-commit] [noalyss] 80/119: Follow Up : multiple card , search by category of card, Dany De Bontridder, 2020/10/26
- [Noalyss-commit] [noalyss] 15/119: doc, Dany De Bontridder, 2020/10/26
- [Noalyss-commit] [noalyss] 19/119: fix type, Dany De Bontridder, 2020/10/26
- [Noalyss-commit] [noalyss] 20/119: documentation, Dany De Bontridder, 2020/10/26
- [Noalyss-commit] [noalyss] 26/119: FollowUp : new right : delete action, Dany De Bontridder, 2020/10/26
- [Noalyss-commit] [noalyss] 40/119: ManageTable : you can set the style of the dialog box, Dany De Bontridder, 2020/10/26
- [Noalyss-commit] [noalyss] 36/119: javascript : add function to concat 2 json objects, Dany De Bontridder, 2020/10/26
- [Noalyss-commit] [noalyss] 32/119: Bug : syntax error, Dany De Bontridder, 2020/10/26
- [Noalyss-commit] [noalyss] 31/119: Bug : use ilike instead of tilde,
Dany De Bontridder <=
- [Noalyss-commit] [noalyss] 46/119: Follow-up : tag enable when create doc, Dany De Bontridder, 2020/10/26
- [Noalyss-commit] [noalyss] 48/119: Action and Document Add missing files, Dany De Bontridder, 2020/10/26
- [Noalyss-commit] [noalyss] 57/119: Upgrade DB to 145, Dany De Bontridder, 2020/10/26
- [Noalyss-commit] [noalyss] 54/119: Contact option , allow to use option for contact, Dany De Bontridder, 2020/10/26
- [Noalyss-commit] [noalyss] 70/119: Card can be disable if not used anymore, Dany De Bontridder, 2020/10/26
- [Noalyss-commit] [noalyss] 73/119: Contact option : export CSV, Dany De Bontridder, 2020/10/26
- [Noalyss-commit] [noalyss] 67/119: Link between contact option and document, Dany De Bontridder, 2020/10/26
- [Noalyss-commit] [noalyss] 75/119: Fix : by default new contact options were not added to document_type, Dany De Bontridder, 2020/10/26
- [Noalyss-commit] [noalyss] 63/119: Bug #1839 : : accentuated character broken, Dany De Bontridder, 2020/10/26
- [Noalyss-commit] [noalyss] 76/119: Add : upgrade scrip added, Dany De Bontridder, 2020/10/26