Fix: bug sur le module de numérotation orion.

Modif: gestion de la date de création sur le module de numérotation titan, ce dernier gère correctement la date de création car il se remet à zéro en début d'année fiscale.
This commit is contained in:
Regis Houssin 2006-09-04 13:44:22 +00:00
parent c295321fac
commit 778534883d
2 changed files with 26 additions and 8 deletions

View File

@ -75,14 +75,22 @@ function info()
/** \brief Renvoi prochaine valeur attribuée /** \brief Renvoi prochaine valeur attribuée
* \return string Valeur * \return string Valeur
*/ */
function getNextValue($date_creation) function getNextValue($date_creation = '')
{ {
global $db,$conf; global $db,$conf;
// 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");
$create_month = strftime("%m",$date_creation);
if ($date_creation != '')
{
$create_month = strftime("%m",$date_creation);
}
else
{
$create_month = $current_month;
}
if($conf->global->SOCIETE_FISCAL_MONTH_START && $current_month >= $conf->global->SOCIETE_FISCAL_MONTH_START && $create_month >= $conf->global->SOCIETE_FISCAL_MONTH_START) if($conf->global->SOCIETE_FISCAL_MONTH_START && $current_month >= $conf->global->SOCIETE_FISCAL_MONTH_START && $create_month >= $conf->global->SOCIETE_FISCAL_MONTH_START)
{ {
@ -133,7 +141,7 @@ function info()
* \param objsoc Objet société * \param objsoc Objet société
* \return string Texte descripif * \return string Texte descripif
*/ */
function getNumRef($objsoc=0,$date_creation) function getNumRef($objsoc=0,$date_creation = '')
{ {
return $this->getNextValue($date_creation); return $this->getNextValue($date_creation);
} }

View File

@ -75,14 +75,24 @@ 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)
if ($date_creation != '')
{
$create_month = strftime("%m",$date_creation);
}
else
{
$create_month = $current_month;
}
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));
} }
@ -135,9 +145,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);
} }
} }