Fix: la numérotation ne doit pas se remettre à zero en début de mois

This commit is contained in:
Regis Houssin 2007-04-28 10:27:01 +00:00
parent 0df19510d3
commit b44b8717d3

View File

@ -133,10 +133,10 @@ function info()
$texte.= ' ('.$langs->trans('IsNotDefined').')<br>'; $texte.= ' ('.$langs->trans('IsNotDefined').')<br>';
} }
$texte.= 'Le compteur se remet à zéro en début d\'année ou chaque mois (1:année, 2:mois)'; $texte.= 'Le compteur se remet à zéro en début d\'année';
if ($conf->global->FACTURE_NUM_RESTART_BEGIN_YEAR_OR_MONTH) if ($conf->global->FACTURE_NUM_RESTART_BEGIN_YEAR)
{ {
$texte.= ' ('.$langs->trans('DefinedAndHasThisValue').' : '.$conf->global->FACTURE_NUM_RESTART_BEGIN_YEAR_OR_MONTH.')<br>'; $texte.= ' ('.$langs->trans('DefinedAndHasThisValue').' : '.$conf->global->FACTURE_NUM_RESTART_BEGIN_YEAR.')<br>';
} }
else else
{ {
@ -274,13 +274,11 @@ function info()
// On récupère la valeur max (réponse immédiate car champ indéxé) // On récupère la valeur max (réponse immédiate car champ indéxé)
$posindice = $conf->global->FACTURE_NUM_QUANTIFY_METER; $posindice = $conf->global->FACTURE_NUM_QUANTIFY_METER;
$fisc=$prefix.$yy; $fisc=$prefix.$yy;
$current_month=$prefix.$yy.$mm;
$fayy=''; $fayy='';
$sql = "SELECT MAX(facnumber)"; $sql = "SELECT MAX(facnumber)";
$sql.= " FROM ".MAIN_DB_PREFIX."facture"; $sql.= " FROM ".MAIN_DB_PREFIX."facture";
$sql.= " WHERE facnumber like '${prefix}%'"; $sql.= " WHERE facnumber like '${prefix}%'";
if ($conf->global->FACTURE_NUM_RESTART_BEGIN_YEAR_OR_MONTH == 1) $sql.= " AND facnumber like '${fisc}%'"; if ($conf->global->FACTURE_NUM_RESTART_BEGIN_YEAR) $sql.= " AND facnumber like '${fisc}%'";
if ($conf->global->FACTURE_NUM_RESTART_BEGIN_YEAR_OR_MONTH == 2) $sql.= " AND facnumber like '${current_month}%'";
$resql=$db->query($sql); $resql=$db->query($sql);
if ($resql) if ($resql)
{ {