From 0400828b5d681bc24bef10839981296062fe1bcf Mon Sep 17 00:00:00 2001 From: x2000bedo Date: Sun, 15 Aug 2004 01:30:12 +0000 Subject: [PATCH] =?utf8?q?Mise=20=E0=20jour=20de=20search.php=20pour=20le?= =?utf8?q?=20soundex=20d=E9plac=E9?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Je reprendrai demain pour le formulaire de recherche avancée et les tests sur le soundex car des scripts sont lancés sur jam en ce moment apparemment et le CPU ne me permet pas de travailler. --- htdocs/search.php | 10 ++++++---- include/search.classes.inc.php | 4 ++-- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/htdocs/search.php b/htdocs/search.php index 9649bf6..04d1188 100644 --- a/htdocs/search.php +++ b/htdocs/search.php @@ -16,12 +16,14 @@ if (array_key_exists('rechercher', $_REQUEST)) { $with_soundex = ((isset($_REQUEST['with_soundex']) && $_REQUEST['with_soundex']==1)); if ($with_soundex) { - $nameField = new StringWithSoundexSField('name',array('s.nom_soundex','s.epouse_soundex','i.nom_soundex'),''); - $firstnameField = new StringWithSoundexSField('firstname',array('s.prenom_soundex','i.prenom_soundex'),''); + $nameField = new + StringWithSoundexSField('name',array('s.nom_soundex','s.epouse_soundex','i.nom_soundex'),'r.nom1'); + $firstnameField = new + StringWithSoundexSField('firstname',array('s.prenom_soundex','i.prenom_soundex'),'r.prenom1'); } else { - $nameField = new StringSField('name',array('r.nom1','r.nom2','r.nom3'),''); - $firstnameField = new StringSField('firstname',array('r.prenom1','r.prenom2'),''); + $nameField = new StringSField('name',array('r.nom1','r.nom2','r.nom3'),'r.nom1'); + $firstnameField = new StringSField('firstname',array('r.prenom1','r.prenom2'),'r.prenom1'); $with_soundex = ($nameField->length()==0 && $firstnameField->length()==0)?(-1):0; } $promo1Field = new PromoSField('promo1','egal1',array('r.promo'),''); diff --git a/include/search.classes.inc.php b/include/search.classes.inc.php index 134c947..e4086b6 100644 --- a/include/search.classes.inc.php +++ b/include/search.classes.inc.php @@ -125,12 +125,12 @@ class StringSField extends SField { //Nouvelle version plus rapide $regexp = str_replace('-',' ',$this->value); $regexp = str_replace('*','%',$regexp); - return $field." LIKE LCASE($regexp%)"; + return $field." LIKE LCASE('$regexp%')"; } /** clause ORDER BY correspondant à ce champ de formulaire */ function get_order_statement() { - if ($this->value!='') + if ($this->value!='' && $this->fieldResultName!='') return $this->fieldResultName.'!="'.$this->value.'"'; else return false; -- 2.1.4