* Foundation, Inc., *
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA *
***************************************************************************
- $Id: advanced_search.php,v 1.13 2004-10-12 21:51:58 x2000bedo Exp $
+ $Id: advanced_search.php,v 1.14 2004-10-12 22:16:16 x2000bedo Exp $
***************************************************************************/
require("auto.prepend.inc.php");
$nameField = new RefWithSoundexSField('name',array('rn.nom1_soundex','rn.nom2_soundex','rn.nom3_soundex'),'recherche_soundex','rn','u.matricule = rn.matricule');
$firstnameField = new RefWithSoundexSField('firstname',array('rp.prenom1_soundex','rp.prenom2_soundex'),'recherche_soundex','rp','u.matricule = rp.matricule');
} else {
- $nameField = new StringSField('name',array('u.nom','u.epouse'),'');
+ $nameField = new NameSField('name',array('u.nom','u.epouse'),'');
$firstnameField = new StringSField('firstname',array('u.prenom'),'');
}
$promo1Field = new PromoSField('promo1','egal1',array('u.promo'),'');
* Foundation, Inc., *
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA *
***************************************************************************
- $Id: search.php,v 1.24 2004-10-12 21:51:58 x2000bedo Exp $
+ $Id: search.php,v 1.25 2004-10-12 22:16:16 x2000bedo Exp $
***************************************************************************/
require("auto.prepend.inc.php");
StringWithSoundexSField('firstname',array('r.prenom1_soundex','r.prenom2_soundex'),'');
}
else {
- $nameField = new StringSField('name',array('r.nom1','r.nom2','r.nom3'),'r.nom1');
+ $nameField = new NameSField('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;
}
* Foundation, Inc., *
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA *
***************************************************************************
- $Id: search.classes.inc.php,v 1.18 2004-10-12 22:00:15 x2000habouzit Exp $
+ $Id: search.classes.inc.php,v 1.19 2004-10-12 22:16:19 x2000bedo Exp $
***************************************************************************/
require_once("xorg.misc.inc.php");
}
}
+/** classe pour les noms : on cherche en plus du like 'foo%' le like '% foo' (particules)
++*/
+class NameSField extends StringSField {
+ function get_single_where_statement($field) {
+ $regexp = str_replace('-',' ',$this->value);
+ $regexp = str_replace('*','%',$regexp);
+ return "$field LIKE '$regexp%' OR $field LIKE '% $regexp%'";
+ }
+
+ function get_order_statement() {
+ if ($this->value!='' && $this->fieldResultName!='')
+ return $this->fieldResultName.' NOT LIKE "'.$this->value.'"';
+ else
+ return false;
+ }
+}
+
/** classe de champ texte avec soundex (nom par exemple)
*/
class StringWithSoundexSField extends StringSField {