From 40144eee8d828f06a14414fc372c4590d5ac95bd Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 3 Mar 2016 13:38:16 +0100 Subject: [PATCH] NEW linked object can show now the recurring invoices with other linked objects. --- .../tpl/linkedobjectblockForRec.tpl.php | 68 +++++++++++++++++++ htdocs/core/class/commonobject.class.php | 8 +++ htdocs/core/class/html.form.class.php | 10 ++- htdocs/langs/en_US/bills.lang | 1 + 4 files changed, 85 insertions(+), 2 deletions(-) create mode 100644 htdocs/compta/facture/tpl/linkedobjectblockForRec.tpl.php diff --git a/htdocs/compta/facture/tpl/linkedobjectblockForRec.tpl.php b/htdocs/compta/facture/tpl/linkedobjectblockForRec.tpl.php new file mode 100644 index 00000000000..a5870ac190e --- /dev/null +++ b/htdocs/compta/facture/tpl/linkedobjectblockForRec.tpl.php @@ -0,0 +1,68 @@ + + * Copyright (C) 2013 Juanjo Menent + * Copyright (C) 2014 Marcos GarcĂ­a + * + * 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 + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + * + */ +?> + + + +load("bills"); +echo '
'; +print load_fiche_titre($langs->trans("RelatedRecurringCustomerInvoices"), '', ''); +?> + + + + + + + + + $objectlink) +{ + $var=!$var; +?> + > + + + + + + + +
trans("Ref"); ?>trans("AmountHTShort"); ?>
getNomUrl(1); ?>rights->facture->lire) { + $total = $total + $objectlink->total_ht; + echo price($objectlink->total_ht); + } ?>">transnoentitiesnoconv("RemoveLink")); ?>
+ + \ No newline at end of file diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index 48683ee01df..a65573a7947 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -2524,6 +2524,9 @@ abstract class CommonObject if ($objecttype == 'facture') { $classpath = 'compta/facture/class'; } + else if ($objecttype == 'facturerec') { + $classpath = 'compta/facture/class'; $module = 'facture'; + } else if ($objecttype == 'propal') { $classpath = 'comm/propal/class'; } @@ -2548,7 +2551,9 @@ abstract class CommonObject $classpath = 'contrat/class'; $subelement = 'contrat'; $module = 'contratabonnement'; } + // Set classfile $classfile = strtolower($subelement); $classname = ucfirst($subelement); + if ($objecttype == 'invoice_supplier') { $classfile = 'fournisseur.facture'; $classname = 'FactureFournisseur'; } @@ -2558,6 +2563,9 @@ abstract class CommonObject else if ($objecttype == 'supplier_proposal') { $classfile = 'supplier_proposal'; $classname = 'SupplierProposal'; } + else if ($objecttype == 'facturerec') { + $classfile = 'facture-rec'; $classname = 'FactureRec'; + } // Here $module, $classfile and $classname are set if ($conf->$module->enabled && (($element != $this->element) || $alsosametype)) diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index c5ee5301210..be3452f10dc 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -5103,12 +5103,18 @@ class Form $subelement = $regs[2]; $tplpath = $element.'/'.$subelement; } - + $tplname='linkedobjectblock'; + // To work with non standard path if ($objecttype == 'facture') { $tplpath = 'compta/'.$element; if (empty($conf->facture->enabled)) continue; // Do not show if module disabled } + else if ($objecttype == 'facturerec') { + $tplpath = 'compta/facture'; + $tplname = 'linkedobjectblockForRec'; + if (empty($conf->facture->enabled)) continue; // Do not show if module disabled + } else if ($objecttype == 'propal') { $tplpath = 'comm/'.$element; if (empty($conf->propal->enabled)) continue; // Do not show if module disabled @@ -5138,7 +5144,7 @@ class Form $dirtpls=array_merge($conf->modules_parts['tpl'],array('/'.$tplpath.'/tpl')); foreach($dirtpls as $reldir) { - $res=@include dol_buildpath($reldir.'/linkedobjectblock.tpl.php'); + $res=@include dol_buildpath($reldir.'/'.$tplname.'.tpl.php'); if ($res) break; } } diff --git a/htdocs/langs/en_US/bills.lang b/htdocs/langs/en_US/bills.lang index d757137fb7b..970f42d8a2e 100644 --- a/htdocs/langs/en_US/bills.lang +++ b/htdocs/langs/en_US/bills.lang @@ -219,6 +219,7 @@ RemainderToBill=Remainder to bill SendBillByMail=Send invoice by email SendReminderBillByMail=Send reminder by email RelatedCommercialProposals=Related commercial proposals +RelatedRecurringCustomerInvoices=Related recurring customer invoices MenuToValid=To valid DateMaxPayment=Payment due before DateEcheance=Due date limit