* Search:
- #691: Adds search on postcode and thus on "arrondissements" -JAC
+ - #791: Adds the possibility to do an exact search -JAC
================================================================================
VERSION 0.9.17 19 07 2008
if (Env::i('with_soundex') && strlen($s) > 1) {
$t = soundex_fr($s);
$where[] = "sn$i.soundex = '$t'";
+ } elseif (Env::i('exact')) {
+ $where[] = "sn$i.token = '$s'";
} else {
$t = str_replace('*', '%', $s).'%';
$t = str_replace('%%', '%', $t);
function compare()
{
$val = addslashes($this->value);
+ if (Env::i('exact')) return "='$val'";
return $this->exact ? "='$val'" : " LIKE '%$val%'";
}
* @param field nom de champ de la bdd concerné par la clause */
function get_single_where_statement($field)
{
- $regexp = strtr(addslashes($this->value), '-*', '_%');
+ $val = addslashes($this->value);
+ if (Env::i('exact')) return "$field = '$val'";
+ $regexp = strtr($val, '-*', '_%');
return "$field LIKE '$regexp%'";
}
function get_single_where_statement($field)
{
- $regexp = strtr(addslashes($this->value), '-*', '_%');
+ $val = addslashes($this->value);
+ if (Env::i('exact')) return "$field = '$val'";
+ $regexp = strtr($val, '-*', '_%');
return "$field LIKE '$regexp%' OR $field LIKE '% $regexp%' OR $field LIKE '%-$regexp%'";
}
<label for="order">Mettre les fiches modifiées récemment en premier.</label>
</td>
</tr>
+ <tr>
+ <td colspan="2">
+ <input type='checkbox' name='exact' id="exact" {if $smarty.request.exact}checked='checked'{/if} value='1'/>
+ <label for="exact">Faire une recherche exacte.</label>
+ </td>
+ </tr>
{/if}
<tr><td colspan="2"></td></tr>
<tr>