diff --git a/htdocs/includes/modules/commande/mod_commande_diamant.php b/htdocs/includes/modules/commande/mod_commande_diamant.php index 10c7a338ddd..ced544156e4 100644 --- a/htdocs/includes/modules/commande/mod_commande_diamant.php +++ b/htdocs/includes/modules/commande/mod_commande_diamant.php @@ -89,9 +89,9 @@ class mod_commande_diamant extends ModeleNumRefCommandes /** \brief Renvoi prochaine valeur attribuée * \return string Valeur */ - function getNextValue() + function getNextValue($objsoc=0) { - global $db; + global $db, $conf; // D'abord on récupère la valeur max (réponse immédiate car champ indéxé) $cyy=''; @@ -121,24 +121,10 @@ class mod_commande_diamant extends ModeleNumRefCommandes } else { - $max=0; - } - - if (!defined("COMMANDE_DIAMANT_DELTA")) - { - define("COMMANDE_DIAMANT_DELTA", 0); - } - - if ($max == 0) - { - $delta = COMMANDE_DIAMANT_DELTA; - $num = sprintf("%05s",$delta); - } - else - { - $num = sprintf("%05s",$max+1); + $max=$conf->global->COMMANDE_DIAMANT_DELTA?$conf->global->COMMANDE_DIAMANT_DELTA:0; } + $num = sprintf("%05s",$max+1); $yy = strftime("%y",time()); return "C$yy$num";