From c295321faccc6ac0cd16eabc9493d461f77a27dd Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Mon, 4 Sep 2006 12:51:11 +0000 Subject: [PATCH] =?UTF-8?q?Modif:=20le=20mod=E8le=20de=20num=E9rotation=20?= =?UTF-8?q?orion=20se=20base=20sur=20la=20date=20de=20cr=E9ation=20de=20la?= =?UTF-8?q?=20facture=20pour=20incr=E9menter=20l'ann=E9e=20fiscale?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- htdocs/facture.class.php | 2 +- .../modules/facture/orion/orion.modules.php | 14 ++++++++------ 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/htdocs/facture.class.php b/htdocs/facture.class.php index 2d1b6444ab1..49654c431c7 100644 --- a/htdocs/facture.class.php +++ b/htdocs/facture.class.php @@ -1862,7 +1862,7 @@ class Facture extends CommonObject $obj = new $classname(); $numref = ""; - $numref = $obj->getNumRef($soc,$this); + $numref = $obj->getNumRef($soc,$this->date); if ( $numref != "") { diff --git a/htdocs/includes/modules/facture/orion/orion.modules.php b/htdocs/includes/modules/facture/orion/orion.modules.php index ff4b8b38334..a0364b85074 100644 --- a/htdocs/includes/modules/facture/orion/orion.modules.php +++ b/htdocs/includes/modules/facture/orion/orion.modules.php @@ -75,14 +75,16 @@ function info() /** \brief Renvoi prochaine valeur attribuée * \return string Valeur */ - function getNextValue() + function getNextValue($date_creation) { global $db,$conf; - - // D'abord on défini l'année fiscale + + // On défini l'année fiscale $prefix='FA'; $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)); } @@ -131,9 +133,9 @@ function info() * \param objsoc Objet société * \return string Texte descripif */ - function getNumRef($objsoc=0) + function getNumRef($objsoc=0,$date_creation) { - return $this->getNextValue(); + return $this->getNextValue($date_creation); } }