Modif: le modèle de numérotation orion se base sur la date de création de la facture pour incrémenter l'année fiscale

This commit is contained in:
Regis Houssin 2006-09-04 12:51:11 +00:00
parent 7d60a68b10
commit c295321fac
2 changed files with 9 additions and 7 deletions

View File

@ -1862,7 +1862,7 @@ class Facture extends CommonObject
$obj = new $classname(); $obj = new $classname();
$numref = ""; $numref = "";
$numref = $obj->getNumRef($soc,$this); $numref = $obj->getNumRef($soc,$this->date);
if ( $numref != "") if ( $numref != "")
{ {

View File

@ -75,14 +75,16 @@ function info()
/** \brief Renvoi prochaine valeur attribuée /** \brief Renvoi prochaine valeur attribuée
* \return string Valeur * \return string Valeur
*/ */
function getNextValue() function getNextValue($date_creation)
{ {
global $db,$conf; global $db,$conf;
// D'abord on défini l'année fiscale // On défini l'année fiscale
$prefix='FA'; $prefix='FA';
$current_month = date("n"); $current_month = date("n");
if($conf->global->SOCIETE_FISCAL_MONTH_START && $current_month >= $conf->global->SOCIETE_FISCAL_MONTH_START) $create_month = strftime("%m",$date_creation);
if($conf->global->SOCIETE_FISCAL_MONTH_START && $current_month >= $conf->global->SOCIETE_FISCAL_MONTH_START && $create_month >= $conf->global->SOCIETE_FISCAL_MONTH_START)
{ {
$yy = strftime("%y",mktime(0,0,0,date("m"),date("d"),date("Y")+1)); $yy = strftime("%y",mktime(0,0,0,date("m"),date("d"),date("Y")+1));
} }
@ -131,9 +133,9 @@ function info()
* \param objsoc Objet société * \param objsoc Objet société
* \return string Texte descripif * \return string Texte descripif
*/ */
function getNumRef($objsoc=0) function getNumRef($objsoc=0,$date_creation)
{ {
return $this->getNextValue(); return $this->getNextValue($date_creation);
} }
} }