From 379b3a63ab483505021d03e2e2ef36c620eba24a Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Fri, 9 Apr 2010 06:47:13 +0000 Subject: [PATCH] Add possibility to add linked object block in object card for external module Fix: templates integration --- htdocs/compta/propal.php | 80 ++++------------------------------------ 1 file changed, 7 insertions(+), 73 deletions(-) diff --git a/htdocs/compta/propal.php b/htdocs/compta/propal.php index 3d5f086252b..2deb6372f27 100644 --- a/htdocs/compta/propal.php +++ b/htdocs/compta/propal.php @@ -504,85 +504,19 @@ if ($id > 0 || ! empty($ref)) /* - * Commandes rattachees + * Linked object block */ - if($conf->commande->enabled) + $propal->load_object_linked($propal->id,$propal->element); + + foreach($propal->linked_object as $object => $objectid) { - $propal->loadOrders(); - $coms = $propal->commandes; - if (sizeof($coms) > 0) + if($conf->$object->enabled) { - $total=0; - if ($somethingshown) { print '
'; $somethingshown=1; } - print_titre($langs->trans('RelatedOrders')); - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - $var=true; - for ($i = 0 ; $i < sizeof($coms) ; $i++) - { - $var=!$var; - print '\n"; - print ''; - print ''; - print ''; - print "\n"; - $total = $total + $objp->total; - } - print '
'.$langs->trans("Ref").''.$langs->trans("Date").''.$langs->trans("Price").''.$langs->trans("Status").'
'; - print ''.img_object($langs->trans("ShowOrder"),"order").' '.$coms[$i]->ref."'.dol_print_date($coms[$i]->date,'day').''.price($coms[$i]->total_ttc).''.$coms[$i]->getLibStatut(3).'
'; + $propal->showLinkedObjectBlock($object,$objectid,$somethingshown); + $somethingshown = 1; } } - - /* - * Factures associees - */ - $linkedInvoices = $propal->getInvoiceArrayList(); - - if (is_array($linkedInvoices)) - { - $num_fac_asso = sizeOf($linkedInvoices); - - $i = 0; $total = 0; - if ($somethingshown) { print '
'; $somethingshown=1; } - if ($num_fac_asso > 1) print_titre($langs->trans("RelatedBills")); - else print_titre($langs->trans("RelatedBill")); - print ''; - print ""; - print ''; - print ''; - print ''; - print ''; - print "\n"; - - require_once(DOL_DOCUMENT_ROOT.'/compta/facture/facture.class.php'); - $staticfacture=new Facture($db); - - $var=True; - foreach($linkedInvoices as $key => $invoice) - { - $var=!$var; - print ""; - print ''; - print ''; - print ''; - print ''; - print ""; - $total = $total + $invoice->total; - $i++; - } - print ""; - print ""; - print "\n"; - print "
'.$langs->trans("Ref").''.$langs->trans("Date").''.$langs->trans("Price").''.$langs->trans("Status").'
'.img_object($langs->trans("ShowBill"),"bill").' '.$invoice->facnumber.''.dol_print_date($invoice->df,'day').''.price($invoice->total).''.$staticfacture->LibStatut($invoice->paye,$invoice->fk_statut,3).'
".$langs->trans("TotalHT")."".price($total)." 
"; - } - - print ''; // List of actions on element