From 7cb283d0ea9800904c5da1d66a37a19305331b53 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 25 Aug 2014 19:16:37 +0200 Subject: [PATCH] Prepare code to be able to choose what to show into footer --- htdocs/core/lib/pdf.lib.php | 17 +++++++++++------ .../modules/cheque/pdf/pdf_blochet.class.php | 3 ++- .../commande/doc/pdf_einstein.modules.php | 3 ++- .../commande/doc/pdf_proforma.modules.php | 3 ++- .../modules/contract/doc/pdf_strato.modules.php | 3 ++- .../expedition/doc/pdf_rouget.modules.php | 3 ++- .../modules/facture/doc/pdf_crabe.modules.php | 3 ++- .../fichinter/doc/pdf_soleil.modules.php | 3 ++- .../livraison/pdf/pdf_typhon.modules.php | 7 ++++--- .../modules/project/pdf/pdf_baleine.modules.php | 7 ++++--- .../modules/propale/doc/pdf_azur.modules.php | 3 ++- .../pdf/pdf_canelle.modules.php | 3 ++- .../supplier_order/pdf/pdf_muscadet.modules.php | 7 ++++--- htdocs/langs/en_US/admin.lang | 1 + 14 files changed, 42 insertions(+), 24 deletions(-) diff --git a/htdocs/core/lib/pdf.lib.php b/htdocs/core/lib/pdf.lib.php index ade08400762..e0c6c9ee0e0 100644 --- a/htdocs/core/lib/pdf.lib.php +++ b/htdocs/core/lib/pdf.lib.php @@ -651,7 +651,7 @@ function pdf_bank(&$pdf,$outputlangs,$curx,$cury,$account,$onlynumber=0,$default * @param int $marge_gauche Margin left (no more used) * @param int $page_hauteur Page height (no more used) * @param Object $object Object shown in PDF - * @param int $showdetails Show company details into footer. This param seems to not be used by standard version. + * @param int $showdetails Show company details into footer. This param seems to not be used by standard version. (1=Show address, 2=Show managers, 3=Both) * @param int $hidefreetext 1=Hide free text, 0=Show free text * @return int Return height of bottom margin including footer text */ @@ -681,10 +681,10 @@ function pdf_pagefoot(&$pdf,$outputlangs,$paramfreetext,$fromcompany,$marge_bass } // First line of company infos + $line1=""; $line2=""; $line3=""; $line4=""; - if ($showdetails) + if ($showdetails && 1) { - $line1=""; // Company name if ($fromcompany->name) { @@ -716,7 +716,6 @@ function pdf_pagefoot(&$pdf,$outputlangs,$paramfreetext,$fromcompany,$marge_bass $line1.=($line1?" - ":"").$outputlangs->transnoentities("Fax").": ".$fromcompany->fax; } - $line2=""; // URL if ($fromcompany->url) { @@ -728,9 +727,16 @@ function pdf_pagefoot(&$pdf,$outputlangs,$paramfreetext,$fromcompany,$marge_bass $line2.=($line2?" - ":"").$fromcompany->email; } } + if (($showdetails && 2) || ($fromcompany->country_code == 'DE')) + { + // Managers + if ($fromcompany->managers) + { + $line2.=($line2?" - ":"").$fromcompany->managers; + } + } // Line 3 of company infos - $line3=""; // Juridical status if ($fromcompany->forme_juridique_code) { @@ -757,7 +763,6 @@ function pdf_pagefoot(&$pdf,$outputlangs,$paramfreetext,$fromcompany,$marge_bass } // Line 4 of company infos - $line4=""; // Prof Id 3 if ($fromcompany->idprof3) { diff --git a/htdocs/core/modules/cheque/pdf/pdf_blochet.class.php b/htdocs/core/modules/cheque/pdf/pdf_blochet.class.php index 96214f08d66..ecb4abd561c 100644 --- a/htdocs/core/modules/cheque/pdf/pdf_blochet.class.php +++ b/htdocs/core/modules/cheque/pdf/pdf_blochet.class.php @@ -352,7 +352,8 @@ class BordereauChequeBlochet extends ModeleChequeReceipts global $conf; $default_font_size = pdf_getPDFFontSize($outputlangs); - //return pdf_pagefoot($pdf,$outputlangs,'BANK_CHEQUERECEIPT_FREE_TEXT',$this->emetteur,$this->marge_basse,$this->marge_gauche,$this->page_hauteur,$object); + //$showdetails=0; + //return pdf_pagefoot($pdf,$outputlangs,'BANK_CHEQUERECEIPT_FREE_TEXT',$this->emetteur,$this->marge_basse,$this->marge_gauche,$this->page_hauteur,$object,$showdetails,$hidefreetext); $paramfreetext='BANK_CHEQUERECEIPT_FREE_TEXT'; $marge_basse=$this->marge_basse; $marge_gauche=$this->marge_gauche; diff --git a/htdocs/core/modules/commande/doc/pdf_einstein.modules.php b/htdocs/core/modules/commande/doc/pdf_einstein.modules.php index 712dd0b765c..236a4d52454 100644 --- a/htdocs/core/modules/commande/doc/pdf_einstein.modules.php +++ b/htdocs/core/modules/commande/doc/pdf_einstein.modules.php @@ -1271,7 +1271,8 @@ class pdf_einstein extends ModelePDFCommandes */ function _pagefoot(&$pdf,$object,$outputlangs,$hidefreetext=0) { - return pdf_pagefoot($pdf,$outputlangs,'COMMANDE_FREE_TEXT',$this->emetteur,$this->marge_basse,$this->marge_gauche,$this->page_hauteur,$object,0,$hidefreetext); + $showdetails=0; + return pdf_pagefoot($pdf,$outputlangs,'COMMANDE_FREE_TEXT',$this->emetteur,$this->marge_basse,$this->marge_gauche,$this->page_hauteur,$object,$showdetails,$hidefreetext); } } diff --git a/htdocs/core/modules/commande/doc/pdf_proforma.modules.php b/htdocs/core/modules/commande/doc/pdf_proforma.modules.php index 408fd543c93..38ca0a8748e 100644 --- a/htdocs/core/modules/commande/doc/pdf_proforma.modules.php +++ b/htdocs/core/modules/commande/doc/pdf_proforma.modules.php @@ -1228,7 +1228,8 @@ class pdf_proforma extends ModelePDFCommandes */ function _pagefoot(&$pdf,$object,$outputlangs,$hidefreetext=0) { - return pdf_pagefoot($pdf,$outputlangs,'COMMANDE_FREE_TEXT',$this->emetteur,$this->marge_basse,$this->marge_gauche,$this->page_hauteur,$object,0,$hidefreetext); + $showdetails=0; + return pdf_pagefoot($pdf,$outputlangs,'COMMANDE_FREE_TEXT',$this->emetteur,$this->marge_basse,$this->marge_gauche,$this->page_hauteur,$object,$showdetails,$hidefreetext); } } diff --git a/htdocs/core/modules/contract/doc/pdf_strato.modules.php b/htdocs/core/modules/contract/doc/pdf_strato.modules.php index 5fc0eb6dd2a..cee022805af 100644 --- a/htdocs/core/modules/contract/doc/pdf_strato.modules.php +++ b/htdocs/core/modules/contract/doc/pdf_strato.modules.php @@ -610,7 +610,8 @@ class pdf_strato extends ModelePDFContract */ function _pagefoot(&$pdf,$object,$outputlangs,$hidefreetext=0) { - return pdf_pagefoot($pdf,$outputlangs,'CONTRACT_FREE_TEXT',$this->emetteur,$this->marge_basse,$this->marge_gauche,$this->page_hauteur,$object,0,$hidefreetext); + $showdetails=0; + return pdf_pagefoot($pdf,$outputlangs,'CONTRACT_FREE_TEXT',$this->emetteur,$this->marge_basse,$this->marge_gauche,$this->page_hauteur,$object,$showdetails,$hidefreetext); } } diff --git a/htdocs/core/modules/expedition/doc/pdf_rouget.modules.php b/htdocs/core/modules/expedition/doc/pdf_rouget.modules.php index 6d0e44817a7..177a2bb4fa7 100644 --- a/htdocs/core/modules/expedition/doc/pdf_rouget.modules.php +++ b/htdocs/core/modules/expedition/doc/pdf_rouget.modules.php @@ -657,7 +657,8 @@ class pdf_rouget extends ModelePdfExpedition */ function _pagefoot(&$pdf,$object,$outputlangs,$hidefreetext=0) { - return pdf_pagefoot($pdf,$outputlangs,'SHIPPING_FREE_TEXT',$this->emetteur,$this->marge_basse,$this->marge_gauche,$this->page_hauteur,$object,0,$hidefreetext); + $showdetails=0; + return pdf_pagefoot($pdf,$outputlangs,'SHIPPING_FREE_TEXT',$this->emetteur,$this->marge_basse,$this->marge_gauche,$this->page_hauteur,$object,$showdetails,$hidefreetext); } } diff --git a/htdocs/core/modules/facture/doc/pdf_crabe.modules.php b/htdocs/core/modules/facture/doc/pdf_crabe.modules.php index d07bd93825c..3c3cca12440 100644 --- a/htdocs/core/modules/facture/doc/pdf_crabe.modules.php +++ b/htdocs/core/modules/facture/doc/pdf_crabe.modules.php @@ -1455,7 +1455,8 @@ class pdf_crabe extends ModelePDFFactures */ function _pagefoot(&$pdf,$object,$outputlangs,$hidefreetext=0) { - return pdf_pagefoot($pdf,$outputlangs,'FACTURE_FREE_TEXT',$this->emetteur,$this->marge_basse,$this->marge_gauche,$this->page_hauteur,$object,0,$hidefreetext); + $showdetails=0; + return pdf_pagefoot($pdf,$outputlangs,'FACTURE_FREE_TEXT',$this->emetteur,$this->marge_basse,$this->marge_gauche,$this->page_hauteur,$object,$showdetails,$hidefreetext); } } diff --git a/htdocs/core/modules/fichinter/doc/pdf_soleil.modules.php b/htdocs/core/modules/fichinter/doc/pdf_soleil.modules.php index f2055e8d643..284dc62a0b7 100644 --- a/htdocs/core/modules/fichinter/doc/pdf_soleil.modules.php +++ b/htdocs/core/modules/fichinter/doc/pdf_soleil.modules.php @@ -595,7 +595,8 @@ class pdf_soleil extends ModelePDFFicheinter */ function _pagefoot(&$pdf,$object,$outputlangs,$hidefreetext=0) { - return pdf_pagefoot($pdf,$outputlangs,'FICHINTER_FREE_TEXT',$this->emetteur,$this->marge_basse,$this->marge_gauche,$this->page_hauteur,$object,0,$hidefreetext); + $showdetails=0; + return pdf_pagefoot($pdf,$outputlangs,'FICHINTER_FREE_TEXT',$this->emetteur,$this->marge_basse,$this->marge_gauche,$this->page_hauteur,$object,$showdetails,$hidefreetext); } } diff --git a/htdocs/core/modules/livraison/pdf/pdf_typhon.modules.php b/htdocs/core/modules/livraison/pdf/pdf_typhon.modules.php index 095e325cb81..75bdc06aaed 100644 --- a/htdocs/core/modules/livraison/pdf/pdf_typhon.modules.php +++ b/htdocs/core/modules/livraison/pdf/pdf_typhon.modules.php @@ -358,7 +358,7 @@ class pdf_typhon extends ModelePDFDeliveryOrder //$qty = pdf_getlineqty($object, $i, $outputlangs, $hidedetails); $pdf->SetXY($this->posxqty, $curY); $pdf->MultiCell($this->posxremainingqty - $this->posxqty, 3, $object->lines[$i]->qty_shipped, 0, 'R'); - + // Remaining to ship $pdf->SetXY($this->posxremainingqty, $curY); $qtyRemaining = $object->lines[$i]->qty_asked - $object->commande->expeditions[$object->lines[$i]->fk_origin_line]; @@ -613,7 +613,7 @@ class pdf_typhon extends ModelePDFDeliveryOrder $pdf->SetXY($this->posxdesc-1, $tab_top+1); $pdf->MultiCell($this->posxcomm - $this->posxdesc,2, $outputlangs->transnoentities("Designation"),'','L'); } - + // Modif SEB pour avoir une col en plus pour les commentaires clients $pdf->line($this->posxcomm, $tab_top, $this->posxcomm, $tab_top + $tab_height); if (empty($hidetop)) { @@ -863,7 +863,8 @@ class pdf_typhon extends ModelePDFDeliveryOrder */ function _pagefoot(&$pdf,$object,$outputlangs,$hidefreetext=0) { - return pdf_pagefoot($pdf,$outputlangs,'DELIVERY_FREE_TEXT',$this->emetteur,$this->marge_basse,$this->marge_gauche,$this->page_hauteur,$object,0,$hidefreetext); + $showdetails=0; + return pdf_pagefoot($pdf,$outputlangs,'DELIVERY_FREE_TEXT',$this->emetteur,$this->marge_basse,$this->marge_gauche,$this->page_hauteur,$object,$showdetails,$hidefreetext); } } diff --git a/htdocs/core/modules/project/pdf/pdf_baleine.modules.php b/htdocs/core/modules/project/pdf/pdf_baleine.modules.php index e6505c05283..e727f9ba90b 100644 --- a/htdocs/core/modules/project/pdf/pdf_baleine.modules.php +++ b/htdocs/core/modules/project/pdf/pdf_baleine.modules.php @@ -295,7 +295,7 @@ class pdf_baleine extends ModelePDFProjects $pdf->Close(); $pdf->Output($file,'F'); - + // Add pdfgeneration hook if (! is_object($hookmanager)) { @@ -306,7 +306,7 @@ class pdf_baleine extends ModelePDFProjects $parameters=array('file'=>$file,'object'=>$object,'outputlangs'=>$outputlangs); global $action; $reshook=$hookmanager->executeHooks('afterPDFCreation',$parameters,$this,$action); // Note that $action and $object may have been modified by some hooks - + if (! empty($conf->global->MAIN_UMASK)) @chmod($file, octdec($conf->global->MAIN_UMASK)); @@ -454,7 +454,8 @@ class pdf_baleine extends ModelePDFProjects */ function _pagefoot(&$pdf,$object,$outputlangs,$hidefreetext=0) { - return pdf_pagefoot($pdf,$outputlangs,'PROJECT_FREE_TEXT',$this->emetteur,$this->marge_basse,$this->marge_gauche,$this->page_hauteur,$object,0,$hidefreetext); + $showdetails=0; + return pdf_pagefoot($pdf,$outputlangs,'PROJECT_FREE_TEXT',$this->emetteur,$this->marge_basse,$this->marge_gauche,$this->page_hauteur,$object,$showdetails,$hidefreetext); } } diff --git a/htdocs/core/modules/propale/doc/pdf_azur.modules.php b/htdocs/core/modules/propale/doc/pdf_azur.modules.php index 4ac15330b42..4678b5a48af 100644 --- a/htdocs/core/modules/propale/doc/pdf_azur.modules.php +++ b/htdocs/core/modules/propale/doc/pdf_azur.modules.php @@ -1362,7 +1362,8 @@ class pdf_azur extends ModelePDFPropales */ function _pagefoot(&$pdf,$object,$outputlangs,$hidefreetext=0) { - return pdf_pagefoot($pdf,$outputlangs,'PROPALE_FREE_TEXT',$this->emetteur,$this->marge_basse,$this->marge_gauche,$this->page_hauteur,$object,0,$hidefreetext); + $showdetails=0; + return pdf_pagefoot($pdf,$outputlangs,'PROPALE_FREE_TEXT',$this->emetteur,$this->marge_basse,$this->marge_gauche,$this->page_hauteur,$object,$showdetails,$hidefreetext); } } diff --git a/htdocs/core/modules/supplier_invoice/pdf/pdf_canelle.modules.php b/htdocs/core/modules/supplier_invoice/pdf/pdf_canelle.modules.php index 848778275eb..49a46c79e2e 100644 --- a/htdocs/core/modules/supplier_invoice/pdf/pdf_canelle.modules.php +++ b/htdocs/core/modules/supplier_invoice/pdf/pdf_canelle.modules.php @@ -1052,7 +1052,8 @@ class pdf_canelle extends ModelePDFSuppliersInvoices */ function _pagefoot(&$pdf, $object, $outputlangs,$hidefreetext=0) { - return pdf_pagefoot($pdf,$outputlangs,'SUPPLIER_INVOICE_FREE_TEXT',$this->emetteur,$this->marge_basse,$this->marge_gauche,$this->page_hauteur,$object,0,$hidefreetext); + $showdetails=0; + return pdf_pagefoot($pdf,$outputlangs,'SUPPLIER_INVOICE_FREE_TEXT',$this->emetteur,$this->marge_basse,$this->marge_gauche,$this->page_hauteur,$object,$showdetails,$hidefreetext); } } diff --git a/htdocs/core/modules/supplier_order/pdf/pdf_muscadet.modules.php b/htdocs/core/modules/supplier_order/pdf/pdf_muscadet.modules.php index d601167c26d..1c9315a61bd 100644 --- a/htdocs/core/modules/supplier_order/pdf/pdf_muscadet.modules.php +++ b/htdocs/core/modules/supplier_order/pdf/pdf_muscadet.modules.php @@ -701,7 +701,7 @@ class pdf_muscadet extends ModelePDFSuppliersOrders foreach( $this->localtax1 as $localtax_type => $localtax_rate ) { if (in_array((string) $localtax_type, array('2','4','6'))) continue; - + foreach( $localtax_rate as $tvakey => $tvaval ) { if ($tvakey != 0) // On affiche pas taux 0 @@ -733,7 +733,7 @@ class pdf_muscadet extends ModelePDFSuppliersOrders foreach( $this->localtax2 as $localtax_type => $localtax_rate ) { if (in_array((string) $localtax_type, array('2','4','6'))) continue; - + foreach( $localtax_rate as $tvakey => $tvaval ) { if ($tvakey != 0) // On affiche pas taux 0 @@ -1105,7 +1105,8 @@ class pdf_muscadet extends ModelePDFSuppliersOrders */ function _pagefoot(&$pdf, $object, $outputlangs, $hidefreetext=0) { - return pdf_pagefoot($pdf,$outputlangs,'SUPPLIER_ORDER_FREE_TEXT',$this->emetteur,$this->marge_basse,$this->marge_gauche,$this->page_hauteur,$object,0,$hidefreetext); + $showdetails=0; + return pdf_pagefoot($pdf,$outputlangs,'SUPPLIER_ORDER_FREE_TEXT',$this->emetteur,$this->marge_basse,$this->marge_gauche,$this->page_hauteur,$object,$showdetails,$hidefreetext); } } diff --git a/htdocs/langs/en_US/admin.lang b/htdocs/langs/en_US/admin.lang index e4cf7ab08ce..da61d43c1ad 100644 --- a/htdocs/langs/en_US/admin.lang +++ b/htdocs/langs/en_US/admin.lang @@ -1082,6 +1082,7 @@ NotificationsDesc=EMails notifications feature allows you to silently send autom ModelModules=Documents templates DocumentModelOdt=Generate documents from OpenDocuments templates (.ODT or .ODS files for OpenOffice, KOffice, TextEdit,...) WatermarkOnDraft=Watermark on draft document +JSOnPaimentBill=Activate feature to autofill payment lines on payment form CompanyIdProfChecker=Rules on Professional Ids MustBeUnique=Must be unique ? MustBeMandatory=Mandatory to create third parties ?