From 3f0f7a2b1b0a014d8ee6060f81def358c4e7d402 Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Wed, 25 Apr 2007 19:01:06 +0000 Subject: [PATCH] =?UTF-8?q?Ajout=20de=20fonctionnalit=E9es=20sur=20le=20mo?= =?UTF-8?q?dele=20de=20num=E9rotation=20param=E9trable=20"pluton"=20-=20to?= =?UTF-8?q?ujours=20en=20phase=20de=20test=20!!?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../modules/facture/pluton/pluton.modules.php | 108 ++++++++++++++++-- 1 file changed, 99 insertions(+), 9 deletions(-) diff --git a/htdocs/includes/modules/facture/pluton/pluton.modules.php b/htdocs/includes/modules/facture/pluton/pluton.modules.php index 21e71873741..c11f826a0a2 100644 --- a/htdocs/includes/modules/facture/pluton/pluton.modules.php +++ b/htdocs/includes/modules/facture/pluton/pluton.modules.php @@ -1,6 +1,6 @@ - * Copyright (C) 2004-2005 Laurent Destailleur +/* Copyright (C) 2003-2007 Rodolphe Quiedeville + * Copyright (C) 2004-2007 Laurent Destailleur * Copyright (C) 2005-2007 Regis Houssin * * This program is free software; you can redistribute it and/or modify @@ -38,6 +38,9 @@ require_once(DOL_DOCUMENT_ROOT ."/includes/modules/facture/modules_facture.php") */ class mod_facture_pluton extends ModeleNumRefFactures { + var $prefixinvoice=''; + var $prefixcreditnote=''; + var $error=''; /** \brief Renvoi la description du modele de numérotation * \return string Texte descripif @@ -60,7 +63,17 @@ function info() $texte.= ' ('.$langs->trans('IsNotDefined').')
'; } - $texte.= 'Préfix de la facture'; + $texte.= 'Utiliser le préfix commerciale des tiers'; + if ($conf->global->FACTURE_USE_COMPANY_PREFIX) + { + $texte.= ' ('.$langs->trans('DefinedAndHasThisValue').' : '.$conf->global->FACTURE_USE_COMPANY_PREFIX.')
'; + } + else + { + $texte.= ' ('.$langs->trans('IsNotDefined').')
'; + } + + $texte.= 'Préfix des factures'; if ($conf->global->FACTURE_NUM_PREFIX) { $texte.= ' ('.$langs->trans('DefinedAndHasThisValue').' : '.$conf->global->FACTURE_NUM_PREFIX.')
'; @@ -70,6 +83,16 @@ function info() $texte.= ' ('.$langs->trans('IsNotDefined').')
'; } + $texte.= 'Préfix des avoirs'; + if ($conf->global->AVOIR_NUM_PREFIX) + { + $texte.= ' ('.$langs->trans('DefinedAndHasThisValue').' : '.$conf->global->AVOIR_NUM_PREFIX.')
'; + } + else + { + $texte.= ' ('.$langs->trans('IsNotDefined').')
'; + } + $texte.= 'Nombre de chiffres sur le compteur'; if ($conf->global->FACTURE_NUM_QUANTIFY_METER) { @@ -80,6 +103,26 @@ function info() $texte.= ' ('.$langs->trans('IsNotDefined').')
'; } + $texte.= 'Nombre de chiffres pour l\'année (1,2 ou 4)'; + if ($conf->global->FACTURE_NUM_BIT_YEAR) + { + $texte.= ' ('.$langs->trans('DefinedAndHasThisValue').' : '.$conf->global->FACTURE_NUM_BIT_YEAR.')
'; + } + else + { + $texte.= ' ('.$langs->trans('IsNotDefined').')
'; + } + + $texte.= 'Afficher le mois de création des factures'; + if ($conf->global->FACTURE_VIEW_MONTH) + { + $texte.= ' ('.$langs->trans('DefinedAndHasThisValue').' : '.$conf->global->FACTURE_VIEW_MONTH.')
'; + } + else + { + $texte.= ' ('.$langs->trans('IsNotDefined').')
'; + } + $texte.= 'Le compteur se remet à zéro en début d\'année'; if ($conf->global->FACTURE_NUM_RESTART_BEGIN_YEAR) { @@ -110,9 +153,31 @@ function info() { global $conf; - $prefix = $conf->global->FACTURE_NUM_PREFIX; - $numExample = $prefix."0600001"; - return $numExample; + // On récupère le préfix + if ($conf->global->FACTURE_USE_COMPANY_PREFIX) + { + $prefix = 'PREF'; + } + else if ($conf->global->FACTURE_NUM_PREFIX) + { + $prefix = $conf->global->FACTURE_NUM_PREFIX; + } + + // On récupère l'année en cours + $numbityear = 4 - $conf->global->FACTURE_NUM_BIT_YEAR; + $yy = substr(strftime("%Y",time()),$numbityear); + + // On récupère le mois en cours + if ($conf->global->FACTURE_VIEW_MONTH) $mm = strftime("%m",time()); + + // On récupère le nombre de chiffres du compteur + $arg = '%0'.$conf->global->FACTURE_NUM_QUANTIFY_METER.'s'; + $num = sprintf($arg,1); + + // Construction de l'exemple de numérotation + $numExample = $prefix.$mm.$yy.$num; + + return $numExample; } /** \brief Renvoi prochaine valeur attribuée @@ -124,8 +189,31 @@ function info() { global $db,$conf; + $this->prefixinvoice = $conf->global->FACTURE_NUM_PREFIX; + $this->prefixcreditnote = $conf->global->AVOIR_NUM_PREFIX; + + // On récupère le préfix + if ($conf->global->FACTURE_USE_COMPANY_PREFIX) + { + if ($objsoc->prefix_comm) + { + $prefix = $objsoc->prefix_comm; + } + else + { + $prefix = 'PREF'; + } + } + else if ($facture->type == 2) + { + $prefix=$this->prefixcreditnote; + } + else + { + $prefix=$this->prefixinvoice; + } + // On défini l'année fiscale - $prefix = $conf->global->FACTURE_NUM_PREFIX; $current_month = date("n"); if (is_object($facture) && $facture->date) @@ -137,13 +225,15 @@ function info() $create_month = $current_month; } + $numbityear = 4 - $conf->global->FACTURE_NUM_BIT_YEAR; + 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 = substr(strftime("%Y",mktime(0,0,0,date("m"),date("d"),date("Y")+1)),$numbityear); } else { - $yy = strftime("%y",time()); + $yy = substr(strftime("%Y",time()),$numbityear); } // On récupère la valeur max (réponse immédiate car champ indéxé)