diff --git a/htdocs/compta/facture/tpl/linkedobjectblockForRec.tpl.php b/htdocs/compta/facture/tpl/linkedobjectblockForRec.tpl.php new file mode 100644 index 0000000000000000000000000000000000000000..a5870ac190e2c1ef9047eaa6f052b05d997049be --- /dev/null +++ b/htdocs/compta/facture/tpl/linkedobjectblockForRec.tpl.php @@ -0,0 +1,68 @@ +<?php +/* Copyright (C) 2010-2011 Regis Houssin <regis.houssin@capnetworks.com> + * Copyright (C) 2013 Juanjo Menent <jmenent@2byte.es> + * Copyright (C) 2014 Marcos GarcĂa <marcosgdf@gmail.com> + * + * 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 <http://www.gnu.org/licenses/>. + * + */ +?> + +<!-- BEGIN PHP TEMPLATE --> + +<?php + +global $user; + +$langs = $GLOBALS['langs']; +$linkedObjectBlock = $GLOBALS['linkedObjectBlock']; + +$langs->load("bills"); +echo '<br>'; +print load_fiche_titre($langs->trans("RelatedRecurringCustomerInvoices"), '', ''); +?> +<table class="noborder allwidth"> +<tr class="liste_titre"> + <td><?php echo $langs->trans("Ref"); ?></td> + <!-- <td align="center"><?php echo $langs->trans("RefCustomer"); ?></td> + <td align="center"><?php echo $langs->trans("Date"); ?></td>--> + <td align="right"><?php echo $langs->trans("AmountHTShort"); ?></td> + <!-- <td align="right"><?php echo $langs->trans("Status"); ?></td> --> + <td></td> +</tr> +<?php +$var=true; +$total=0; +foreach($linkedObjectBlock as $key => $objectlink) +{ + $var=!$var; +?> +<tr <?php echo $GLOBALS['bc'][$var]; ?> > + <td><?php echo $objectlink->getNomUrl(1); ?></td> + <!-- <td align="center"><?php echo $objectlink->ref_client; ?></td> + <td align="center"><?php echo dol_print_date($objectlink->date,'day'); ?></td> --> + <td align="right"><?php + if ($user->rights->facture->lire) { + $total = $total + $objectlink->total_ht; + echo price($objectlink->total_ht); + } ?></td> + <!-- <td align="right"><?php echo $objectlink->getLibStatut(3); ?></td> --> + <td align="right"><a href="<?php echo $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=dellink&dellinkid='.$key; ?>"><?php echo img_delete($langs->transnoentitiesnoconv("RemoveLink")); ?></a></td> +</tr> +<?php +} +?> +</table> + +<!-- END PHP TEMPLATE --> \ No newline at end of file diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index 48683ee01df4bfae9bce8c3d234554dccc7c9fbe..a65573a794728af53304e911a92eee0215650752 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 c5ee530121075bae9d079f742d910ec42cb5d717..be3452f10dc1b2f8e472434b5271e4a8c64896b1 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 d757137fb7b1688cc40a4cc10bbe9fd675c8e972..970f42d8a2eb257b48e9fda584960d1fe1227a5f 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