Fix: Numbering errors

This commit is contained in:
Laurent Destailleur
2008-07-08 22:29:34 +00:00
parent 1c43e655dc
commit 940cf2bc31
3 changed files with 18 additions and 51 deletions

View File

@@ -121,7 +121,7 @@ class mod_facture_terre extends ModeleNumRefFactures
// D'abord on r<>cup<75>re la valeur max (r<>ponse imm<6D>diate car champ ind<6E>x<EFBFBD>)
$posindice=8;
$sql = "SELECT MAX(facnumber+SUBSTRING(facnumber,".$posindice.")) as ref";
$sql = "SELECT MAX(0+SUBSTRING(facnumber,".$posindice.")) as max";
$sql.= " FROM ".MAIN_DB_PREFIX."facture";
$sql.= " WHERE facnumber like '".$prefix."%'";
@@ -129,7 +129,7 @@ class mod_facture_terre extends ModeleNumRefFactures
if ($resql)
{
$obj = $db->fetch_object($resql);
if ($obj) $max = $obj->ref;
if ($obj) $max = $obj->max;
else $max=0;
}
else