NEW linked object can show now the recurring invoices with other linked

objects.
This commit is contained in:
Laurent Destailleur 2016-03-03 13:38:16 +01:00
parent 3cbeca26e7
commit 40144eee8d
4 changed files with 85 additions and 2 deletions

View File

@ -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 -->

View File

@ -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))

View File

@ -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;
}
}

View File

@ -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