From 86650b04a6778457cb6561147ba3ab1373ce0400 Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Mon, 28 May 2007 18:03:42 +0000 Subject: [PATCH] =?UTF-8?q?Fix:=20on=20peut=20d=E9terminer=20un=20offset?= =?UTF-8?q?=20diff=E9rent=20pour=20les=20avoirs?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- htdocs/admin/facture.php | 3 ++- .../modules/facture/pluton/pluton.modules.php | 26 ++++++++++++++----- 2 files changed, 22 insertions(+), 7 deletions(-) diff --git a/htdocs/admin/facture.php b/htdocs/admin/facture.php index 207a5836bc2..b679f6e3bd5 100644 --- a/htdocs/admin/facture.php +++ b/htdocs/admin/facture.php @@ -172,7 +172,8 @@ if ($_GET["action"] == 'delete') if ($_POST["action"] == 'updateMatrice') dolibarr_set_const($db, "FACTURE_NUM_MATRICE",$_POST["matrice"]); if ($_POST["action"] == 'updatePrefixFacture') dolibarr_set_const($db, "FACTURE_NUM_PREFIX",$_POST["prefixfacture"]); if ($_POST["action"] == 'updatePrefixAvoir') dolibarr_set_const($db, "AVOIR_NUM_PREFIX",$_POST["prefixavoir"]); -if ($_POST["action"] == 'setOffset') dolibarr_set_const($db, "FACTURE_NUM_DELTA",$_POST["offset"]); +if ($_POST["action"] == 'setOffsetInvoice') dolibarr_set_const($db, "FACTURE_NUM_DELTA",$_POST["offsetinvoice"]); +if ($_POST["action"] == 'setOffsetCreditNote') dolibarr_set_const($db, "AVOIR_NUM_DELTA",$_POST["offsetcreditnote"]); if ($_POST["action"] == 'setFiscalMonth') dolibarr_set_const($db, "SOCIETE_FISCAL_MONTH_START",$_POST["fiscalmonth"]); if ($_POST["action"] == 'setNumRestart') dolibarr_set_const($db, "FACTURE_NUM_RESTART_BEGIN_YEAR",$_POST["numrestart"]); if ($_POST["action"] == 'setNumWithInvoice') dolibarr_set_const($db, "AVOIR_NUM_WITH_INVOICE",$_POST["numwithinvoice"]); diff --git a/htdocs/includes/modules/facture/pluton/pluton.modules.php b/htdocs/includes/modules/facture/pluton/pluton.modules.php index a18b56a9fe8..5e960fcd18a 100644 --- a/htdocs/includes/modules/facture/pluton/pluton.modules.php +++ b/htdocs/includes/modules/facture/pluton/pluton.modules.php @@ -91,11 +91,20 @@ function info() $texte.= ''.$form->textwithhelp('',$langs->trans("PrefixCreditNoteDesc"),1,1).''; $texte.= ''; - // On détermine un offset sur le compteur - $texte.= 'Appliquer un offset sur le compteur'; + // On détermine un offset sur le compteur des factures + $texte.= 'Appliquer un offset sur le compteur des factures'; $texte.= '
'; - $texte.= ''; - $texte.= ''; + $texte.= ''; + $texte.= ''; + $texte.= ''; + $texte.= ''.$form->textwithhelp('',$langs->trans("OffsetDesc"),1,1).''; + $texte.= '
'; + + // On détermine un offset sur le compteur des avoirs + $texte.= 'Appliquer un offset sur le compteur des avoirs'; + $texte.= '
'; + $texte.= ''; + $texte.= ''; $texte.= ''; $texte.= ''.$form->textwithhelp('',$langs->trans("OffsetDesc"),1,1).''; $texte.= '
'; @@ -196,7 +205,7 @@ function info() if ($row) $searchyy = substr($row[0],0,-$posindice); } - if ($conf->global->PROPALE_NUM_DELTA != '') + if ($conf->global->FACTURE_NUM_DELTA != '') { //on vérifie si il y a une année précédente //pour éviter que le delta soit appliqué de nouveau sur la nouvelle année @@ -226,11 +235,16 @@ function info() $max = $row[0]; } } - else if ($conf->global->FACTURE_NUM_DELTA != '' && !eregi('^'.$this->searchLastWithPreviousYear.'',$previousyy)) + else if ($facture->type == 1 && $conf->global->FACTURE_NUM_DELTA != '' && !eregi('^'.$this->searchLastWithPreviousYear.'',$previousyy)) { // on applique le delta une seule fois $max=$conf->global->FACTURE_NUM_DELTA?$conf->global->FACTURE_NUM_DELTA-1:0; } + else if ($facture->type == 2 && $conf->global->AVOIR_NUM_DELTA != '' && !eregi('^'.$this->searchLastWithPreviousYear.'',$previousyy)) + { + // on applique le delta une seule fois + $max=$conf->global->AVOIR_NUM_DELTA?$conf->global->AVOIR_NUM_DELTA-1:0; + } else { $max=0;