From a230e31f29617e49e82b93914e2370f303e7acd2 Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Sun, 4 Dec 2011 10:59:57 +0100 Subject: [PATCH] New: add possibility to use fiscal month start for reset numbering counter --- htdocs/core/lib/functions2.lib.php | 7 ++++--- htdocs/langs/en_US/admin.lang | 2 +- htdocs/langs/fr_FR/admin.lang | 2 +- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/htdocs/core/lib/functions2.lib.php b/htdocs/core/lib/functions2.lib.php index c27329d0192..2e423d2c1a1 100644 --- a/htdocs/core/lib/functions2.lib.php +++ b/htdocs/core/lib/functions2.lib.php @@ -435,9 +435,10 @@ function get_next_value($db,$mask,$table,$field,$where='',$objsoc='',$date='',$m // Define $sqlwhere // If a restore to zero after a month is asked we check if there is already a value for this year. - if (! empty($reg[2]) && preg_match('/^@/',$reg[2])) $maskraz=preg_replace('/^@/','',$reg[2]); - if (! empty($reg[3]) && preg_match('/^@/',$reg[3])) $maskraz=preg_replace('/^@/','',$reg[3]); - if ($maskraz >= 0) + if (! empty($reg[2]) && preg_match('/^@/',$reg[2])) $maskraz=preg_replace('/^@/','',$reg[2]); + if (! empty($reg[3]) && preg_match('/^@/',$reg[3])) $maskraz=preg_replace('/^@/','',$reg[3]); + if ($maskraz == 0) $maskraz = $conf->global->SOCIETE_FISCAL_MONTH_START; + if ($maskraz > 0) { if ($maskraz > 12) return 'ErrorBadMaskBadRazMonth'; diff --git a/htdocs/langs/en_US/admin.lang b/htdocs/langs/en_US/admin.lang index 8b00ca7c90d..024c3c53380 100644 --- a/htdocs/langs/en_US/admin.lang +++ b/htdocs/langs/en_US/admin.lang @@ -264,7 +264,7 @@ SetupIsReadyForUse=Install is finished and Dolibarr is ready to use with this ne CurrentVersion=Dolibarr current version CallUpdatePage=Go to the page that updates the database structure and datas: %s. LastStableVersion=Last stable version -GenericMaskCodes=You may enter any numbering mask. In this mask, the following tags could be used:
{000000} corresponds to a number which will be incremented on each %s. Enter as many zeros as the desired length of the counter. The counter will be completed by zeros from the left in order to have as many zeros as the mask.
{000000+000} same as previous but an offset corresponding to the number to the right of the + sign is applied starting on first %s.
{000000@x} same as previous but the counter is reset to zero when month x is reached (x between 1 and 12). If this option is used and x is 2 or higher, then sequence {yy}{mm} or {yyyy}{mm} is also required.
{dd} day (01 to 31).
{mm} month (01 to 12).
{yy}, {yyyy} or {y} year over 2, 4 or 1 numbers.
+GenericMaskCodes=You may enter any numbering mask. In this mask, the following tags could be used:
{000000} corresponds to a number which will be incremented on each %s. Enter as many zeros as the desired length of the counter. The counter will be completed by zeros from the left in order to have as many zeros as the mask.
{000000+000} same as previous but an offset corresponding to the number to the right of the + sign is applied starting on first %s.
{000000@x} same as previous but the counter is reset to zero when month x is reached (x between 1 and 12, or 0 to use the early months of fiscal year defined in your configuration). If this option is used and x is 2 or higher, then sequence {yy}{mm} or {yyyy}{mm} is also required.
{dd} day (01 to 31).
{mm} month (01 to 12).
{yy}, {yyyy} or {y} year over 2, 4 or 1 numbers.
GenericMaskCodes2={cccc} the client code
{cccc000} the client code on n characters is followed by a client's ref counter without offset and zeroized with the global counter.
{tttt} The code of company type on n characters (see dictionnary-company types).
GenericMaskCodes3=All other characters in the mask will remain intact.
Spaces are not allowed.
GenericMaskCodes4a=Example on the 99th %s of the third party TheCompany done 2007-01-31:
diff --git a/htdocs/langs/fr_FR/admin.lang b/htdocs/langs/fr_FR/admin.lang index 0a1b6e2826e..54208fba078 100644 --- a/htdocs/langs/fr_FR/admin.lang +++ b/htdocs/langs/fr_FR/admin.lang @@ -265,7 +265,7 @@ SetupIsReadyForUse= L'installation est terminée et Dolibarr est prêt à être CurrentVersion= Version en cours de Dolibarr CallUpdatePage= Appeler la page de l'outil de mise à jour de la structure et données de la base: %s. LastStableVersion= Dernière version stable disponible -GenericMaskCodes= Vous pouvez saisir tout masque de numérotation. Dans ce masque, les balises suivantes peuvent être utilisées:
{000000} correspond à un numéro qui sera incrémenté à chaque %s. Mettre autant de zéro que la longueur désirée du compteur. Le compteur sera complété par des 0 à gauche afin d'avoir autant de zéro que dans le masque.
{000000+000} idem précédemment mais un offset correspondant au nombre à droite du + est appliqué dès la première %s.
{000000@x} idem précédemment mais le compteur est remis à zéro le xème mois de l'année (x entre 1 et 12). Si cette option est utilisée et x vaut 2 ou plus, alors la séquence {yy}{mm} ou {yyyy}{mm} est obligatoire.
{dd} jour (01 à 31).
{mm} mois (01 à 12).
{yy}, {yyyy} ou {y} année sur 2, 4 ou 1 chiffres.
+GenericMaskCodes= Vous pouvez saisir tout masque de numérotation. Dans ce masque, les balises suivantes peuvent être utilisées:
{000000} correspond à un numéro qui sera incrémenté à chaque %s. Mettre autant de zéro que la longueur désirée du compteur. Le compteur sera complété par des 0 à gauche afin d'avoir autant de zéro que dans le masque.
{000000+000} idem précédemment mais un offset correspondant au nombre à droite du + est appliqué dès la première %s.
{000000@x} idem précédemment mais le compteur est remis à zéro le xème mois de l'année (x entre 1 et 12, ou 0 pour utiliser le mois de début d'exercice fiscal défini dans votre configuration). Si cette option est utilisée et x vaut 2 ou plus, alors la séquence {yy}{mm} ou {yyyy}{mm} est obligatoire.
{dd} jour (01 à 31).
{mm} mois (01 à 12).
{yy}, {yyyy} ou {y} année sur 2, 4 ou 1 chiffres.
GenericMaskCodes2= {cccc} le code client sur n lettres
{cccc000} le code client sur n lettres est suivi d'un compteur propre au client sans offset, complété par des zéros pour en avoir autant que dans le masque, et remis à zéro en même temps que le compteur global.
{tttt} Le code type entreprise sur n caractères (voir dictionnaires-types de sociétés).
GenericMaskCodes3= Tout autre caractère dans le masque sera laissé inchangé.
Les espaces ne sont pas permis.
GenericMaskCodes4a= Exemple sur la 99eme %s du tiers LaCompanie faite le 31/03/2007: