diff --git a/ChangeLog b/ChangeLog index f95e57f188f..68cbd8313af 100644 --- a/ChangeLog +++ b/ChangeLog @@ -36,7 +36,8 @@ For users: - New: Added a "force LDAP synchronize" on member and contact cards. - New: Can split a discount into two smaller discount. This allows to use a discount on an invoice even if invoice amount is lower than discount - credit available. + credit available. +- New: Can use variables into the free text on PDF (__TOTAL_TTC_, __TOTAL_VAT...) - Fix: "Now" link works when date popup is not used. - Fix: Debug seriously the email notification module. - Fix: Error Call to a member function trans when refusing a supplier order. diff --git a/htdocs/facture.class.php b/htdocs/facture.class.php index 3b65cf151dc..0a1bb27c10e 100644 --- a/htdocs/facture.class.php +++ b/htdocs/facture.class.php @@ -2646,14 +2646,13 @@ class Facture extends CommonObject /** - * \brief Initialise la facture avec valeurs fictives al�atoire - * Sert � g�n�rer une facture pour l'aperu des mod�les ou dem + * \brief Initialise an example of invoice with random values + * Used to build preivew of invoices or demo */ function initAsSpecimen() { global $user,$langs,$conf; - // Charge tableau des id de soci�t� socids $socids = array(); $sql = "SELECT rowid"; @@ -2668,15 +2667,14 @@ class Facture extends CommonObject $num_socs = $this->db->num_rows($resql); $i = 0; while ($i < $num_socs) - { - $i++; + { + $i++; - $row = $this->db->fetch_row($resql); - $socids[$i] = $row[0]; - } + $row = $this->db->fetch_row($resql); + $socids[$i] = $row[0]; + } } - // Charge tableau des produits prodids $prodids = array(); $sql = "SELECT rowid"; @@ -2690,11 +2688,11 @@ class Facture extends CommonObject $num_prods = $this->db->num_rows($resql); $i = 0; while ($i < $num_prods) - { - $i++; - $row = $this->db->fetch_row($resql); - $prodids[$i] = $row[0]; - } + { + $i++; + $row = $this->db->fetch_row($resql); + $prodids[$i] = $row[0]; + } } // Initialize parameters @@ -3057,7 +3055,7 @@ class FactureLigne { global $user,$langs,$conf; - // Clean parameters + // Clean parameters $this->desc=trim($this->desc); // Check parameters diff --git a/htdocs/includes/modules/cheque/pdf/pdf_blochet.class.php b/htdocs/includes/modules/cheque/pdf/pdf_blochet.class.php index 7595244a429..48c0cf530e4 100644 --- a/htdocs/includes/modules/cheque/pdf/pdf_blochet.class.php +++ b/htdocs/includes/modules/cheque/pdf/pdf_blochet.class.php @@ -131,7 +131,7 @@ class BordereauChequeBlochet extends FPDF $pdf->SetDrawColor(128,128,128); $pdf->SetDrawColor(128,128,128); - $pdf->SetTitle($outputlangs->convToOutputCharset($fac->ref)); + $pdf->SetTitle($outputlangs->transnoentities("CheckReceipt")." ".$number); $pdf->SetSubject($outputlangs->transnoentities("CheckReceipt")); $pdf->SetCreator("Dolibarr ".DOL_VERSION); $pdf->SetAuthor($outputlangs->convToOutputCharset($user->fullname)); @@ -141,6 +141,7 @@ class BordereauChequeBlochet extends FPDF $pdf->SetMargins($this->marge_gauche, $this->marge_haute, $this->marge_droite); // Left, Top, Right $pdf->SetAutoPageBreak(1,0); + $lignes=$this->line_per_page; // There is no line in such PDF. $pages = intval($lignes / $this->line_per_page); @@ -313,15 +314,15 @@ class BordereauChequeBlochet extends FPDF /** * \brief Show footer of page * \param pdf Object PDF - * \param object Object invoice - * \param outputlang Object lang for output + * \param object Object cheque receipt + * \param outputlangs Object lang for output * \remarks Need this->emetteur object */ function _pagefoot(&$pdf,$object,$outputlangs) { global $conf; - //return pdf_pagefoot($pdf,$outputlangs,'BANK_CHEQUERECEIPT_FREE_TEXT',$this->emetteur,$this->marge_basse,$this->marge_gauche,$this->page_hauteur); + //return pdf_pagefoot($pdf,$outputlangs,'BANK_CHEQUERECEIPT_FREE_TEXT',$this->emetteur,$this->marge_basse,$this->marge_gauche,$this->page_hauteur,$object); $paramfreetext='BANK_CHEQUERECEIPT_FREE_TEXT'; $marge_basse=$this->marge_basse; $marge_gauche=$this->marge_gauche; diff --git a/htdocs/includes/modules/commande/pdf_edison.modules.php b/htdocs/includes/modules/commande/pdf_edison.modules.php index ca8b79922ee..1fc949cd310 100644 --- a/htdocs/includes/modules/commande/pdf_edison.modules.php +++ b/htdocs/includes/modules/commande/pdf_edison.modules.php @@ -494,13 +494,16 @@ class pdf_edison extends ModelePDFCommandes $pdf->Text(11, 94, $outputlangs->transnoentities("Order")." ".$outputlangs->convToOutputCharset($object->ref)); } - /* - * \brief Affiche le pied de page - * \param pdf objet PDF - */ - function _pagefoot(&$pdf,$object,$outputlangs) + /** + * \brief Show footer of page + * \param pdf PDF factory + * \param object Object invoice + * \param outputlangs Object lang for output + * \remarks Need this->emetteur object + */ + function _pagefoot(&$pdf,$object,$outputlangs) { - return pdf_pagefoot($pdf,$outputlangs,'COMMANDE_FREE_TEXT',$this->emetteur,$this->marge_basse,$this->marge_gauche,$this->page_hauteur); + return pdf_pagefoot($pdf,$outputlangs,'COMMANDE_FREE_TEXT',$this->emetteur,$this->marge_basse,$this->marge_gauche,$this->page_hauteur,$object); } } diff --git a/htdocs/includes/modules/commande/pdf_einstein.modules.php b/htdocs/includes/modules/commande/pdf_einstein.modules.php index 88d256a3fc8..db70a888922 100644 --- a/htdocs/includes/modules/commande/pdf_einstein.modules.php +++ b/htdocs/includes/modules/commande/pdf_einstein.modules.php @@ -317,7 +317,7 @@ class pdf_einstein extends ModelePDFCommandes $this->_tableau($pdf, $tab_top_newpage, $tab_height_newpage, $nexY, $outputlangs); } - $this->_pagefoot($pdf,$outputlangs); + $this->_pagefoot($pdf,$com,$outputlangs); // New page $pdf->AddPage(); @@ -356,7 +356,7 @@ class pdf_einstein extends ModelePDFCommandes } // Pied de page - $this->_pagefoot($pdf,$outputlangs); + $this->_pagefoot($pdf,$com,$outputlangs); $pdf->AliasNbPages(); $pdf->Close(); @@ -888,13 +888,16 @@ class pdf_einstein extends ModelePDFCommandes } } - /* - * \brief Affiche le pied de page - * \param pdf objet PDF + /** + * \brief Show footer of page + * \param pdf PDF factory + * \param object Object invoice + * \param outputlangs Object lang for output + * \remarks Need this->emetteur object */ - function _pagefoot(&$pdf,$outputlangs) + function _pagefoot(&$pdf,$object,$outputlangs) { - return pdf_pagefoot($pdf,$outputlangs,'COMMANDE_FREE_TEXT',$this->emetteur,$this->marge_basse,$this->marge_gauche,$this->page_hauteur); + return pdf_pagefoot($pdf,$outputlangs,'COMMANDE_FREE_TEXT',$this->emetteur,$this->marge_basse,$this->marge_gauche,$this->page_hauteur,$object); } } diff --git a/htdocs/includes/modules/expedition/pdf/pdf_expedition_merou.modules.php b/htdocs/includes/modules/expedition/pdf/pdf_expedition_merou.modules.php index 2ce7c1a0a66..4274baf3e83 100644 --- a/htdocs/includes/modules/expedition/pdf/pdf_expedition_merou.modules.php +++ b/htdocs/includes/modules/expedition/pdf/pdf_expedition_merou.modules.php @@ -224,7 +224,7 @@ Class pdf_expedition_merou extends ModelePdfExpedition if ($nexY > ($tab_top+$tab_height-10) && $i < $nblignes - 1) { $this->_tableau($pdf, $tab_top, $tab_height, $nexY, $outputlangs); - $this->_pagefoot($pdf, $outputlangs); + $this->_pagefoot($pdf, $object, $outputlangs); $pdf->AliasNbPages(); $curY = $iniY; @@ -239,7 +239,7 @@ Class pdf_expedition_merou extends ModelePdfExpedition } } //Insertion du pied de page - $this->_pagefoot($pdf, $outputlangs); + $this->_pagefoot($pdf, $object, $outputlangs); $pdf->AliasNbPages(); @@ -293,10 +293,13 @@ Class pdf_expedition_merou extends ModelePdfExpedition $pdf->Rect(10, $tab_top, 190, $tab_height); } - //******************************** - // Generation du Pied de page - //******************************** - function _pagefoot(&$pdf, $outputlangs) + /** + * \brief Show footer of page + * \param pdf PDF factory + * \param object Object invoice + * \param outputlangs Object lang for output + */ + function _pagefoot(&$pdf, $object, $outputlangs) { $pdf->SetFont('Arial','',8); $pdf->SetY(-23); diff --git a/htdocs/includes/modules/expedition/pdf/pdf_expedition_rouget.modules.php b/htdocs/includes/modules/expedition/pdf/pdf_expedition_rouget.modules.php index 65ff9fd4868..5732ba473a3 100644 --- a/htdocs/includes/modules/expedition/pdf/pdf_expedition_rouget.modules.php +++ b/htdocs/includes/modules/expedition/pdf/pdf_expedition_rouget.modules.php @@ -371,14 +371,14 @@ Class pdf_expedition_rouget extends ModelePdfExpedition /** * \brief Show footer of page - * \param pdf Object PDF + * \param pdf PDF factory * \param object Object invoice - * \param outputlang Object lang for output + * \param outputlangs Object lang for output * \remarks Need this->emetteur object */ function _pagefoot(&$pdf,$object,$outputlangs) { - return pdf_pagefoot($pdf,$outputlangs,'SENDING_FREE_TEXT',$this->emetteur,$this->marge_basse,$this->marge_gauche,$this->page_hauteur); + return pdf_pagefoot($pdf,$outputlangs,'SENDING_FREE_TEXT',$this->emetteur,$this->marge_basse,$this->marge_gauche,$this->page_hauteur,$object); } } diff --git a/htdocs/includes/modules/facture/pdf_crabe.modules.php b/htdocs/includes/modules/facture/pdf_crabe.modules.php index 7efb39b6a53..9ab282d418f 100644 --- a/htdocs/includes/modules/facture/pdf_crabe.modules.php +++ b/htdocs/includes/modules/facture/pdf_crabe.modules.php @@ -872,7 +872,7 @@ class pdf_crabe extends ModelePDFFactures * \param pdf Object PDF * \param object Object invoice * \param showadress 0=no, 1=yes - * \param outputlang Object lang for output + * \param outputlangs Object lang for output */ function _pagehead(&$pdf, $object, $showadress=1, $outputlangs) { @@ -1168,14 +1168,14 @@ class pdf_crabe extends ModelePDFFactures /** * \brief Show footer of page - * \param pdf Object PDF + * \param pdf PDF factory * \param object Object invoice * \param outputlang Object lang for output * \remarks Need this->emetteur object */ function _pagefoot(&$pdf,$object,$outputlangs) { - return pdf_pagefoot($pdf,$outputlangs,'FACTURE_FREE_TEXT',$this->emetteur,$this->marge_basse,$this->marge_gauche,$this->page_hauteur); + return pdf_pagefoot($pdf,$outputlangs,'FACTURE_FREE_TEXT',$this->emetteur,$this->marge_basse,$this->marge_gauche,$this->page_hauteur,$object); } } diff --git a/htdocs/includes/modules/facture/pdf_oursin.modules.php b/htdocs/includes/modules/facture/pdf_oursin.modules.php index de1f63e4347..0cf528eae23 100644 --- a/htdocs/includes/modules/facture/pdf_oursin.modules.php +++ b/htdocs/includes/modules/facture/pdf_oursin.modules.php @@ -1061,14 +1061,16 @@ class pdf_oursin extends ModelePDFFactures $pdf->Text(200 - $pdf->GetStringWidth($titre), 94, $titre); } - /* - * \brief Affiche le pied de page de la facture - * \param pdf objet PDF - * \param fac objet facture + /** + * \brief Show footer of page + * \param pdf PDF factory + * \param object Object invoice + * \param outputlang Object lang for output + * \remarks Need this->emetteur object */ function _pagefoot(&$pdf, $object, $outputlangs) { - return pdf_pagefoot($pdf,$outputlangs,'FACTURE_FREE_TEXT',$this->emetteur,$this->marge_basse,$this->marge_gauche,$this->page_hauteur); + return pdf_pagefoot($pdf,$outputlangs,'FACTURE_FREE_TEXT',$this->emetteur,$this->marge_basse,$this->marge_gauche,$this->page_hauteur,$object); } } diff --git a/htdocs/includes/modules/fichinter/pdf_soleil.modules.php b/htdocs/includes/modules/fichinter/pdf_soleil.modules.php index 3bd8c674c9e..12db4b2562a 100644 --- a/htdocs/includes/modules/fichinter/pdf_soleil.modules.php +++ b/htdocs/includes/modules/fichinter/pdf_soleil.modules.php @@ -317,7 +317,7 @@ class pdf_soleil extends ModelePDFFicheinter $pdf->SetFont('Arial','', 9); // On repositionne la police par defaut - $this->_pagefoot($pdf,$outputlangs); + $this->_pagefoot($pdf,$fichinter,$outputlangs); $pdf->AliasNbPages(); $pdf->Close(); @@ -343,13 +343,16 @@ class pdf_soleil extends ModelePDFFicheinter return 0; // Erreur par defaut } - /* - * \brief Affiche le pied de page - * \param pdf objet PDF + /** + * \brief Show footer of page + * \param pdf PDF factory + * \param object Object invoice + * \param outputlangs Object lang for output + * \remarks Need this->emetteur object */ - function _pagefoot(&$pdf,$outputlangs) + function _pagefoot(&$pdf,$object,$outputlangs) { - return pdf_pagefoot($pdf,$outputlangs,'FICHEINTER_FREE_TEXT',$this->emetteur,$this->marge_basse,$this->marge_gauche,$this->page_hauteur); + return pdf_pagefoot($pdf,$outputlangs,'FICHEINTER_FREE_TEXT',$this->emetteur,$this->marge_basse,$this->marge_gauche,$this->page_hauteur,$object); } } diff --git a/htdocs/includes/modules/livraison/pdf/pdf_sirocco.modules.php b/htdocs/includes/modules/livraison/pdf/pdf_sirocco.modules.php index a44fb0d6c24..6931f3c3147 100644 --- a/htdocs/includes/modules/livraison/pdf/pdf_sirocco.modules.php +++ b/htdocs/includes/modules/livraison/pdf/pdf_sirocco.modules.php @@ -270,7 +270,7 @@ class pdf_sirocco extends ModelePDFDeliveryOrder $this->_tableau($pdf, $tab_top_newpage, $tab_height_newpage, $nexY, $outputlangs); } - $this->_pagefoot($pdf, $outputlangs); + $this->_pagefoot($pdf, $object, $outputlangs); // New page $pdf->AddPage(); @@ -299,7 +299,7 @@ class pdf_sirocco extends ModelePDFDeliveryOrder /* * Pied de page */ - $this->_pagefoot($pdf,$outputlangs); + $this->_pagefoot($pdf, $object, $outputlangs); $pdf->AliasNbPages(); $pdf->Close(); @@ -501,12 +501,15 @@ class pdf_sirocco extends ModelePDFDeliveryOrder } /** - * \brief Affiche le pied de page - * \param pdf objet PDF + * \brief Show footer of page + * \param pdf PDF factory + * \param object Object invoice + * \param outputlangs Object lang for output + * \remarks Need this->emetteur object */ - function _pagefoot(&$pdf,$outputlangs) + function _pagefoot(&$pdf,$object,$outputlangs) { - return pdf_pagefoot($pdf,$outputlangs,'DELIVERY_FREE_TEXT',$this->emetteur,$this->marge_basse,$this->marge_gauche,$this->page_hauteur); + return pdf_pagefoot($pdf,$outputlangs,'DELIVERY_FREE_TEXT',$this->emetteur,$this->marge_basse,$this->marge_gauche,$this->page_hauteur,$object); } } diff --git a/htdocs/includes/modules/livraison/pdf/pdf_typhon.modules.php b/htdocs/includes/modules/livraison/pdf/pdf_typhon.modules.php index 2a9ecc9335e..ef17545a7de 100644 --- a/htdocs/includes/modules/livraison/pdf/pdf_typhon.modules.php +++ b/htdocs/includes/modules/livraison/pdf/pdf_typhon.modules.php @@ -333,7 +333,7 @@ class pdf_typhon extends ModelePDFDeliveryOrder $this->_tableau($pdf, $tab_top_newpage, $tab_height_newpage, $nexY, $outputlangs); } - $this->_pagefoot($pdf, $outputlangs); + $this->_pagefoot($pdf, $object, $outputlangs); // New page $pdf->AddPage(); @@ -363,7 +363,7 @@ class pdf_typhon extends ModelePDFDeliveryOrder /* * Pied de page */ - $this->_pagefoot($pdf,$outputlangs); + $this->_pagefoot($pdf,$object,$outputlangs); $pdf->AliasNbPages(); $pdf->Close(); @@ -638,12 +638,15 @@ class pdf_typhon extends ModelePDFDeliveryOrder } /** - * \brief Affiche le pied de page - * \param pdf objet PDF + * \brief Show footer of page + * \param pdf PDF factory + * \param object Object invoice + * \param outputlangs Object lang for output + * \remarks Need this->emetteur object */ - function _pagefoot(&$pdf,$outputlangs) + function _pagefoot(&$pdf,$object,$outputlangs) { - return pdf_pagefoot($pdf,$outputlangs,'DELIVERY_FREE_TEXT',$this->emetteur,$this->marge_basse,$this->marge_gauche,$this->page_hauteur); + return pdf_pagefoot($pdf,$outputlangs,'DELIVERY_FREE_TEXT',$this->emetteur,$this->marge_basse,$this->marge_gauche,$this->page_hauteur,$object); } } diff --git a/htdocs/includes/modules/propale/pdf_propale_azur.modules.php b/htdocs/includes/modules/propale/pdf_propale_azur.modules.php index 74cbab8b194..318adf65448 100644 --- a/htdocs/includes/modules/propale/pdf_propale_azur.modules.php +++ b/htdocs/includes/modules/propale/pdf_propale_azur.modules.php @@ -332,7 +332,7 @@ class pdf_propale_azur extends ModelePDFPropales $this->_tableau($pdf, $tab_top_newpage, $tab_height_newpage, $nexY, $outputlangs); } - $this->_pagefoot($pdf,$outputlangs); + $this->_pagefoot($pdf,$propale,$outputlangs); // New page $pdf->AddPage(); @@ -372,7 +372,7 @@ class pdf_propale_azur extends ModelePDFPropales } // Pied de page - $this->_pagefoot($pdf,$outputlangs); + $this->_pagefoot($pdf,$propale,$outputlangs); $pdf->AliasNbPages(); $pdf->Close(); @@ -963,13 +963,16 @@ class pdf_propale_azur extends ModelePDFPropales } } - /* - * \brief Affiche le pied de page - * \param pdf objet PDF + /** + * \brief Show footer of page + * \param pdf PDF factory + * \param object Object invoice + * \param outputlangs Object lang for output + * \remarks Need this->emetteur object */ - function _pagefoot(&$pdf,$outputlangs) + function _pagefoot(&$pdf,$object,$outputlangs) { - return pdf_pagefoot($pdf,$outputlangs,'PROPALE_FREE_TEXT',$this->emetteur,$this->marge_basse,$this->marge_gauche,$this->page_hauteur); + return pdf_pagefoot($pdf,$outputlangs,'PROPALE_FREE_TEXT',$this->emetteur,$this->marge_basse,$this->marge_gauche,$this->page_hauteur,$object); } } diff --git a/htdocs/includes/modules/propale/pdf_propale_jaune.modules.php b/htdocs/includes/modules/propale/pdf_propale_jaune.modules.php index ff52f22615a..f759736924a 100644 --- a/htdocs/includes/modules/propale/pdf_propale_jaune.modules.php +++ b/htdocs/includes/modules/propale/pdf_propale_jaune.modules.php @@ -499,14 +499,16 @@ class pdf_propale_jaune extends ModelePDFPropales $pdf->MultiCell(86,4, $carac_client); } - /* - * \brief Affiche le pied de page - * \param pdf Object PDF - * \param object Object proposal + /** + * \brief Show footer of page + * \param pdf PDF factory + * \param object Object invoice + * \param outputlangs Object lang for output + * \remarks Need this->emetteur object */ function _pagefoot(&$pdf,$object,$outputlangs) { - return pdf_pagefoot($pdf,$outputlangs,'PROPALE_FREE_TEXT',$this->emetteur,$this->marge_basse,$this->marge_gauche,$this->page_hauteur); + return pdf_pagefoot($pdf,$outputlangs,'PROPALE_FREE_TEXT',$this->emetteur,$this->marge_basse,$this->marge_gauche,$this->page_hauteur,$object); } } diff --git a/htdocs/includes/modules/supplier_order/pdf/pdf_muscadet.modules.php b/htdocs/includes/modules/supplier_order/pdf/pdf_muscadet.modules.php index c4ba2b60db5..c6fc87ec6eb 100644 --- a/htdocs/includes/modules/supplier_order/pdf/pdf_muscadet.modules.php +++ b/htdocs/includes/modules/supplier_order/pdf/pdf_muscadet.modules.php @@ -306,7 +306,7 @@ class pdf_muscadet extends ModelePDFSuppliersOrders $this->_tableau($pdf, $tab_top_newpage, $tab_height_newpage, $nexY, $outputlangs); } - $this->_pagefoot($pdf, $outputlangs); + $this->_pagefoot($pdf, $com, $outputlangs); // New page $pdf->AddPage(); @@ -356,7 +356,7 @@ class pdf_muscadet extends ModelePDFSuppliersOrders /* * Pied de page */ - $this->_pagefoot($pdf, $outputlangs); + $this->_pagefoot($pdf, $com, $outputlangs); $pdf->AliasNbPages(); $pdf->Close(); @@ -572,7 +572,7 @@ class pdf_muscadet extends ModelePDFSuppliersOrders * \param pdf Object PDF * \param object Object invoice * \param showadress 0=no, 1=yes - * \param outputlang Object lang for output + * \param outputlangs Object lang for output */ function _pagehead(&$pdf, $object, $showadress=1, $outputlangs) { @@ -705,12 +705,14 @@ class pdf_muscadet extends ModelePDFSuppliersOrders /** * \brief Show footer of page - * \param pdf Object PDF + * \param pdf PDF factory + * \param object Object invoice * \param outputlang Object lang for output + * \remarks Need this->emetteur object */ - function _pagefoot(&$pdf, $outputlangs) + function _pagefoot(&$pdf, $object, $outputlangs) { - return pdf_pagefoot($pdf,$outputlangs,'FACTURESUPPLIER_FREE_TEXT',$this->emetteur,$this->marge_basse,$this->marge_gauche,$this->page_hauteur); + return pdf_pagefoot($pdf,$outputlangs,'FACTURESUPPLIER_FREE_TEXT',$this->emetteur,$this->marge_basse,$this->marge_gauche,$this->page_hauteur,$object); } } diff --git a/htdocs/lib/functions.lib.php b/htdocs/lib/functions.lib.php index 82319d5e135..b484bd616b8 100644 --- a/htdocs/lib/functions.lib.php +++ b/htdocs/lib/functions.lib.php @@ -2767,7 +2767,7 @@ function make_substitutions($chaine,$substitutionarray) { foreach ($substitutionarray as $key => $value) { - $chaine=ereg_replace($key,$value,$chaine); + $chaine=ereg_replace("$key","$value",$chaine); // We must keep the " to work when value is 123.5 for example } return $chaine; } diff --git a/htdocs/lib/pdf.lib.php b/htdocs/lib/pdf.lib.php index 71fd4e37c82..ac323ffe1da 100644 --- a/htdocs/lib/pdf.lib.php +++ b/htdocs/lib/pdf.lib.php @@ -105,22 +105,36 @@ function pdf_bank(&$pdf,$outputlangs,$curx,$cury,$account) /** * \brief Show footer of page for PDF generation - * \param pdf Object PDF + * \param pdf The PDF factory * \param outputlang Object lang for output * \param paramfreetext Constant name of free text * \param fromcompany Object company - * \param marge_basse - * \param marge_gauche - * \param page_hauteur + * \param marge_basse Margin bottom + * \param marge_gauche Margin left + * \param page_hauteur Page height + * \param object Object shown in PDF */ -function pdf_pagefoot(&$pdf,$outputlangs,$paramfreetext,$fromcompany,$marge_basse,$marge_gauche,$page_hauteur) +function pdf_pagefoot(&$pdf,$outputlangs,$paramfreetext,$fromcompany,$marge_basse,$marge_gauche,$page_hauteur,$object) { global $conf; $outputlangs->load("dict"); + $ligne=''; // Line of free text - $ligne=(! empty($conf->global->$paramfreetext))?$outputlangs->convToOutputCharset($conf->global->$paramfreetext):""; + if (! empty($conf->global->$paramfreetext)) + { + // Make substitution + $substitutionarray=array( + '__FROM_NAME__' => $fromcompany->nom, + '__FROM_EMAIL__' => $fromcompany->email, + '__TOTAL_TTC__' => $object->total_ttc, + '__TOTAL_HT__' => $object->total_ht, + '__TOTAL_VAT__' => $object->total_vat + ); + $newfreetext=make_substitutions($conf->global->$paramfreetext,$substitutionarray); + $ligne.=$outputlangs->convToOutputCharset($newfreetext); + } // First line of company infos @@ -176,7 +190,7 @@ function pdf_pagefoot(&$pdf,$outputlangs,$paramfreetext,$fromcompany,$marge_bass $pdf->SetDrawColor(224,224,224); // On positionne le debut du bas de page selon nbre de lignes de ce bas de page - $nbofligne=dol_nboflines_bis($ligne,0,$outputlangs->charset_output); + $nbofligne=dol_nboflines_bis($ligne,0,$outputlangs->charset_output); //print 'nbofligne='.$nbofligne; exit; //print 'e'.$ligne.'t'.dol_nboflines($ligne);exit; $posy=$marge_basse + ($nbofligne*3) + ($ligne1?3:0) + ($ligne2?3:0); @@ -186,7 +200,7 @@ function pdf_pagefoot(&$pdf,$outputlangs,$paramfreetext,$fromcompany,$marge_bass $pdf->SetXY($marge_gauche,-$posy); $width=20000; $align='L'; // By default, ask a manual break: We use a large value 20000, to not have automatic wrap. This make user understand, he need to add CR on its text. if ($conf->global->MAIN_USE_AUTOWRAP_ON_FREETEXT) { $width=200; $align='C'; } - $pdf->MultiCell($width, 3, $ligne, 0, $align, 0); + $pdf->MultiCell($width, 3, $ligne, 0, $align, 0); $posy-=($nbofligne*3); // 6 of ligne + 3 of MultiCell }