From 60219fa84d97349250cd18f7213b487ea13f3faf Mon Sep 17 00:00:00 2001 From: aspangaro Date: Fri, 11 Nov 2016 07:06:45 +0100 Subject: [PATCH] Update tulip model --- .../mod_facture_fournisseur_tulip.php | 43 ++++++++++++++++--- 1 file changed, 36 insertions(+), 7 deletions(-) diff --git a/htdocs/core/modules/supplier_invoice/mod_facture_fournisseur_tulip.php b/htdocs/core/modules/supplier_invoice/mod_facture_fournisseur_tulip.php index ba31d979864..b7a3801a9cd 100644 --- a/htdocs/core/modules/supplier_invoice/mod_facture_fournisseur_tulip.php +++ b/htdocs/core/modules/supplier_invoice/mod_facture_fournisseur_tulip.php @@ -3,7 +3,8 @@ * Copyright (C) 2004-2008 Laurent Destailleur * Copyright (C) 2005-2009 Regis Houssin * Copyright (C) 2013 Philippe Grand - * Copyright (C) 2013 Juanjo Menent + * Copyright (C) 2013 Juanjo Menent + * Copyright (C) 2016 Alexandre Spangaro * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -59,6 +60,9 @@ class mod_facture_fournisseur_tulip extends ModeleNumRefSuppliersInvoices $texte.= ''; $texte.= ''; $texte.= ''; + $texte.= ''; + $texte.= ''; + $texte.= ''; $texte.= ''; $tooltip=$langs->trans("GenericMaskCodes",$langs->transnoentities("Invoice"),$langs->transnoentities("Invoice")); @@ -68,13 +72,28 @@ class mod_facture_fournisseur_tulip extends ModeleNumRefSuppliersInvoices $tooltip.=$langs->trans("GenericMaskCodes5"); // Parametrage du prefix - $texte.= ''; + $texte.= ''; $texte.= ''; $texte.= ''; $texte.= ''; + // Parametrage du prefix des replacement + $texte.= ''; + $texte.= ''; + $texte.= ''; + + // Parametrage du prefix des avoirs + $texte.= ''; + $texte.= ''; + $texte.= ''; + + // Parametrage du prefix des acomptes + $texte.= ''; + $texte.= ''; + $texte.= ''; + $texte.= '
'.$langs->trans("Mask").':
'.$langs->trans("Mask").' ('.$langs->trans("InvoiceStandard").'):'.$form->textwithpicto('',$tooltip,1,1).' 
'.$langs->trans("Mask").' ('.$langs->trans("InvoiceReplacement").'):'.$form->textwithpicto('',$tooltip,1,1).'
'.$langs->trans("Mask").' ('.$langs->trans("InvoiceAvoir").'):'.$form->textwithpicto('',$tooltip,1,1).'
'.$langs->trans("Mask").' ('.$langs->trans("InvoiceDeposit").'):'.$form->textwithpicto('',$tooltip,1,1).'
'; $texte.= ''; @@ -106,7 +125,7 @@ class mod_facture_fournisseur_tulip extends ModeleNumRefSuppliersInvoices * Return next value * * @param Societe $objsoc Object third party - * @param Object $object Object + * @param Object $object Object invoice * @param string $mode 'next' for next value or 'last' for last value * @return string Value if OK, 0 if KO */ @@ -116,16 +135,26 @@ class mod_facture_fournisseur_tulip extends ModeleNumRefSuppliersInvoices require_once DOL_DOCUMENT_ROOT .'/core/lib/functions2.lib.php'; - // On defini critere recherche compteur - $mask=$conf->global->SUPPLIER_INVOICE_TULIP_MASK; - + // Get Mask value + $mask = ''; + if (is_object($object) && $object->type == 1) + { + $mask=$conf->global->SUPPLIER_REPLACEMENT_TULIP_MASK; + if (! $mask) + { + $mask=$conf->global->SUPPLIER_INVOICE_TULIP_MASK; + } + } + else if (is_object($object) && $object->type == 2) $mask=$conf->global->SUPPLIER_CREDIT_TULIP_MASK; + else if (is_object($object) && $object->type == 3) $mask=$conf->global->SUPPLIER_DEPOSIT_TULIP_MASK; + else $mask=$conf->global->SUPPLIER_INVOICE_TULIP_MASK; if (! $mask) { $this->error='NotConfigured'; return 0; } - //Supplier invoices take invoice date instead of creation date for the mask + // Supplier invoices take invoice date instead of creation date for the mask $numFinal=get_next_value($db,$mask,'facture_fourn','ref','',$objsoc,$object->date); return $numFinal;