Fix: le substr doit partir de la fin de la chaine

This commit is contained in:
Regis Houssin 2007-05-04 14:31:27 +00:00
parent c1453953c6
commit b4f236a54c
3 changed files with 3 additions and 3 deletions

View File

@ -398,7 +398,7 @@ function info()
if (eregi('^'.$searchLastWithNoYear.'',$comyy))
{
// Recherche rapide car restreint par un like sur champ indexé
$sql = "SELECT MAX(0+SUBSTRING(ref,$posindice))";
$sql = "SELECT MAX(0+SUBSTRING(ref,-".$posindice."))";
$sql.= " FROM ".MAIN_DB_PREFIX."commande";
$sql.= " WHERE ref like '${comyy}%'";
$resql=$db->query($sql);

View File

@ -437,7 +437,7 @@ function info()
if (eregi('^'.$searchLastWithNoYear.'',$fayy))
{
// Recherche rapide car restreint par un like sur champ indexé
$sql = "SELECT MAX(0+SUBSTRING(facnumber,$posindice))";
$sql = "SELECT MAX(0+SUBSTRING(facnumber,-".$posindice."))";
$sql.= " FROM ".MAIN_DB_PREFIX."facture";
$sql.= " WHERE facnumber like '${fayy}%'";
$resql=$db->query($sql);

View File

@ -398,7 +398,7 @@ function info()
if (eregi('^'.$searchLastWithNoYear.'',$pryy))
{
// Recherche rapide car restreint par un like sur champ indexé
$sql = "SELECT MAX(0+SUBSTRING(ref,$posindice))";
$sql = "SELECT MAX(0+SUBSTRING(ref,-".$posindice."))";
$sql.= " FROM ".MAIN_DB_PREFIX."propal";
$sql.= " WHERE ref like '${pryy}%'";
$resql=$db->query($sql);