--- /tmp/dsg/dolibarr/htdocs/core/modules/supplier_invoice/doc/github_19.0.3_pdf_canelle.modules.php +++ /tmp/dsg/dolibarr/htdocs/core/modules/supplier_invoice/doc/client_pdf_canelle.modules.php @@ -5 +5 @@ - * Copyright (C) 2018-2021 Frédéric France + * Copyright (C) 2018 Frédéric France @@ -41,2 +41,75 @@ - /** - * @var DoliDb Database handler + /** + * @var DoliDb Database handler + */ + public $db; + + /** + * @var string model name + */ + public $name; + + /** + * @var string model description (short text) + */ + public $description; + + /** + * @var int Save the name of generated file as the main doc when generating a doc with this template + */ + public $update_main_doc_field; + + /** + * @var string document type + */ + public $type; + + /** + * @var array Minimum version of PHP required by module. + * e.g.: PHP ≥ 5.5 = array(5, 5) + */ + public $phpmin = array(5, 5); + + /** + * Dolibarr version of the loaded document + * @var string + */ + public $version = 'dolibarr'; + + /** + * @var int page_largeur + */ + public $page_largeur; + + /** + * @var int page_hauteur + */ + public $page_hauteur; + + /** + * @var array format + */ + public $format; + + /** + * @var int marge_gauche + */ + public $marge_gauche; + + /** + * @var int marge_droite + */ + public $marge_droite; + + /** + * @var int marge_haute + */ + public $marge_haute; + + /** + * @var int marge_basse + */ + public $marge_basse; + + /** + * Issuer + * @var Societe object that emits @@ -44,27 +117,2 @@ - public $db; - - /** - * @var string model name - */ - public $name; - - /** - * @var string model description (short text) - */ - public $description; - - /** - * @var int Save the name of generated file as the main doc when generating a doc with this template - */ - public $update_main_doc_field; - - /** - * @var string document type - */ - public $type; - - /** - * Dolibarr version of the loaded document - * @var string - */ - public $version = 'dolibarr'; + public $emetteur; + @@ -78,2 +126,2 @@ - public function __construct($db) - { + public function __construct($db) + { @@ -88,3 +136,2 @@ - $this->update_main_doc_field = 1; // Save the name of generated file as the main doc when generating a doc with this template - - // Page dimensions + + // Dimension page @@ -96,12 +143,13 @@ - $this->marge_gauche = getDolGlobalInt('MAIN_PDF_MARGIN_LEFT', 10); - $this->marge_droite = getDolGlobalInt('MAIN_PDF_MARGIN_RIGHT', 10); - $this->marge_haute = getDolGlobalInt('MAIN_PDF_MARGIN_TOP', 10); - $this->marge_basse = getDolGlobalInt('MAIN_PDF_MARGIN_BOTTOM', 10); - - $this->option_logo = 1; // Display logo - $this->option_tva = 1; // Manage the vat option FACTURE_TVAOPTION - $this->option_modereg = 1; // Display payment mode - $this->option_condreg = 1; // Display payment terms - $this->option_multilang = 1; // Available in several languages - - // Define column position + $this->marge_gauche = isset($conf->global->MAIN_PDF_MARGIN_LEFT) ? $conf->global->MAIN_PDF_MARGIN_LEFT : 10; + $this->marge_droite = isset($conf->global->MAIN_PDF_MARGIN_RIGHT) ? $conf->global->MAIN_PDF_MARGIN_RIGHT : 10; + $this->marge_haute = isset($conf->global->MAIN_PDF_MARGIN_TOP) ? $conf->global->MAIN_PDF_MARGIN_TOP : 10; + $this->marge_basse = isset($conf->global->MAIN_PDF_MARGIN_BOTTOM) ? $conf->global->MAIN_PDF_MARGIN_BOTTOM : 10; + + $this->option_logo = 1; // Affiche logo + $this->option_tva = 1; // Gere option tva FACTURE_TVAOPTION + $this->option_modereg = 1; // Affiche mode reglement + $this->option_condreg = 1; // Affiche conditions reglement + $this->option_codeproduitservice = 1; // Affiche code produit-service + $this->option_multilang = 1; // Dispo en plusieurs langues + + // Define column position @@ -109,2 +157,8 @@ - - if (getDolGlobalInt('PRODUCT_USE_UNITS')) { + $this->posxtva = 112; + $this->posxup = 126; + $this->posxqty = 145; + $this->posxunit = 162; + $this->posxdiscount = 162; + $this->postotalht = 174; + + if ($conf->global->PRODUCT_USE_UNITS) { @@ -115,14 +169,5 @@ - } else { - $this->posxtva = 106; - $this->posxup = 122; - $this->posxqty = 145; - $this->posxunit = 162; - } - $this->posxdiscount = 162; - $this->postotalht = 174; - - /* if (!empty($conf->global->MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT) || !empty($conf->global->MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT_COLUMN)) { - $this->posxtva = $this->posxup; - } */ - $this->posxpicture = $this->posxtva - (!getDolGlobalString('MAIN_DOCUMENTS_WITH_PICTURE_WIDTH') ? 20 : $conf->global->MAIN_DOCUMENTS_WITH_PICTURE_WIDTH); // width of images - if ($this->page_largeur < 210) { // To work with US executive format + } + //if (! empty($conf->global->MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT)) $this->posxtva=$this->posxup; + $this->posxpicture = $this->posxtva - (empty($conf->global->MAIN_DOCUMENTS_WITH_PICTURE_WIDTH) ? 20 : $conf->global->MAIN_DOCUMENTS_WITH_PICTURE_WIDTH); // width of images + if ($this->page_largeur < 210) // To work with US executive format + { @@ -139,3 +184,2 @@ - $this->tva_array = array(); - $this->localtax1 = array(); - $this->localtax2 = array(); + $this->localtax1 = array(); + $this->localtax2 = array(); @@ -144,18 +188,18 @@ - } - - - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps - /** - * Function to build pdf onto disk - * - * @param FactureFournisseur $object Object to generate - * @param Translate $outputlangs Lang output object - * @param string $srctemplatepath Full path of source filename for generator using a template file - * @param int $hidedetails Do not show line details - * @param int $hidedesc Do not show desc - * @param int $hideref Do not show ref - * @return int 1=OK, 0=KO - */ - public function write_file($object, $outputlangs = '', $srctemplatepath = '', $hidedetails = 0, $hidedesc = 0, $hideref = 0) - { - // phpcs:enable + } + + + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps + /** + * Function to build pdf onto disk + * + * @param FactureFournisseur $object Object to generate + * @param Translate $outputlangs Lang output object + * @param string $srctemplatepath Full path of source filename for generator using a template file + * @param int $hidedetails Do not show line details + * @param int $hidedesc Do not show desc + * @param int $hideref Do not show ref + * @return int 1=OK, 0=KO + */ + public function write_file($object, $outputlangs = '', $srctemplatepath = '', $hidedetails = 0, $hidedesc = 0, $hideref = 0) + { + // phpcs:enable @@ -165,7 +209,2 @@ - if (!is_object($object->thirdparty)) { - $object->fetch_thirdparty(); - } - if (!is_object($object->thirdparty)) { - $object->thirdparty = $mysoc; // If fetch_thirdparty fails, object has no socid (specimen) - } - + if (!is_object($object->thirdparty)) $object->fetch_thirdparty(); + if (!is_object($object->thirdparty)) $object->thirdparty = $mysoc; // If fetch_thirdparty fails, object has no socid (specimen) @@ -173,7 +212,3 @@ - if (!$this->emetteur->country_code) { - $this->emetteur->country_code = substr($langs->defaultlang, -2); // By default, if was not defined - } - - if (!is_object($outputlangs)) { - $outputlangs = $langs; - } + if (!$this->emetteur->country_code) $this->emetteur->country_code = substr($langs->defaultlang, -2); // By default, if was not defined + + if (!is_object($outputlangs)) $outputlangs = $langs; @@ -181,3 +216 @@ - if (getDolGlobalString('MAIN_USE_FPDF')) { - $outputlangs->charset_output = 'ISO-8859-1'; - } + if (!empty($conf->global->MAIN_USE_FPDF)) $outputlangs->charset_output = 'ISO-8859-1'; @@ -190,4 +223,7 @@ - if ($conf->fournisseur->facture->dir_output) { - $deja_regle = $object->getSommePaiement((isModEnabled("multicurrency") && $object->multicurrency_tx != 1) ? 1 : 0); - $amount_credit_notes_included = $object->getSumCreditNotesUsed((isModEnabled("multicurrency") && $object->multicurrency_tx != 1) ? 1 : 0); - $amount_deposits_included = $object->getSumDepositsUsed((isModEnabled("multicurrency") && $object->multicurrency_tx != 1) ? 1 : 0); + if ($conf->fournisseur->facture->dir_output) + { + $object->fetch_thirdparty(); + + $deja_regle = $object->getSommePaiement(($conf->multicurrency->enabled && $object->multicurrency_tx != 1) ? 1 : 0); + $amount_credit_notes_included = $object->getSumCreditNotesUsed(($conf->multicurrency->enabled && $object->multicurrency_tx != 1) ? 1 : 0); + $amount_deposits_included = $object->getSumDepositsUsed(($conf->multicurrency->enabled && $object->multicurrency_tx != 1) ? 1 : 0); @@ -196 +232,2 @@ - if ($object->specimen) { + if ($object->specimen) + { @@ -199 +236,3 @@ - } else { + } + else + { @@ -202 +241 @@ - $dir = $conf->fournisseur->facture->dir_output.'/'.get_exdir($object->id, 2, 0, 0, $object, 'invoice_supplier').$objectref; + $dir = $conf->fournisseur->facture->dir_output.'/'.get_exdir($object->id, 2, 0, 0, $object, 'invoice_supplier').$objectref; @@ -204,7 +243,7 @@ - if (getDolGlobalString('SUPPLIER_REF_IN_NAME')) { - $file = $dir."/".$objectref.($objectrefsupplier ? "_".$objectrefsupplier : "").".pdf"; - } - } - - if (!file_exists($dir)) { - if (dol_mkdir($dir) < 0) { + if (!empty($conf->global->SUPPLIER_REF_IN_NAME)) $file = $dir."/".$objectref.($objectrefsupplier ? "_".$objectrefsupplier : "").".pdf"; + } + + if (!file_exists($dir)) + { + if (dol_mkdir($dir) < 0) + { @@ -216 +255,2 @@ - if (file_exists($dir)) { + if (file_exists($dir)) + { @@ -218 +258,2 @@ - if (!is_object($hookmanager)) { + if (!is_object($hookmanager)) + { @@ -232,24 +273,21 @@ - $pdf = pdf_getInstance($this->format); - $default_font_size = pdf_getPDFFontSize($outputlangs); // Must be after pdf_getInstance - $pdf->SetAutoPageBreak(1, 0); - - $heightforinfotot = 50 + (4 * $nbpayments); // Height reserved to output the info and total part and payment part - if ($heightforinfotot > 220) { - $heightforinfotot = 220; - } - $heightforfreetext = (isset($conf->global->MAIN_PDF_FREETEXT_HEIGHT) ? $conf->global->MAIN_PDF_FREETEXT_HEIGHT : 5); // Height reserved to output the free text on last page - $heightforfooter = $this->marge_basse + 8; // Height reserved to output the footer (value include bottom margin) - if (getDolGlobalString('MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS')) { - $heightforfooter += 6; - } - - if (class_exists('TCPDF')) { - $pdf->setPrintHeader(false); - $pdf->setPrintFooter(false); - } - $pdf->SetFont(pdf_getPDFFont($outputlangs)); - // Set path to the background PDF File - if (getDolGlobalString('MAIN_ADD_PDF_BACKGROUND')) { - $pagecount = $pdf->setSourceFile($conf->mycompany->multidir_output[$object->entity].'/' . getDolGlobalString('MAIN_ADD_PDF_BACKGROUND')); - $tplidx = $pdf->importPage(1); - } + $pdf = pdf_getInstance($this->format); + $default_font_size = pdf_getPDFFontSize($outputlangs); // Must be after pdf_getInstance + $pdf->SetAutoPageBreak(1, 0); + + $heightforinfotot = 50 + (4 * $nbpayments); // Height reserved to output the info and total part and payment part + $heightforfreetext = (isset($conf->global->MAIN_PDF_FREETEXT_HEIGHT) ? $conf->global->MAIN_PDF_FREETEXT_HEIGHT : 5); // Height reserved to output the free text on last page + $heightforfooter = $this->marge_basse + 8; // Height reserved to output the footer (value include bottom margin) + if ($conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS > 0) $heightforfooter += 6; + + if (class_exists('TCPDF')) + { + $pdf->setPrintHeader(false); + $pdf->setPrintFooter(false); + } + $pdf->SetFont(pdf_getPDFFont($outputlangs)); + // Set path to the background PDF File + if (!empty($conf->global->MAIN_ADD_PDF_BACKGROUND)) + { + $pagecount = $pdf->setSourceFile($conf->mycompany->multidir_output[$object->entity].'/'.$conf->global->MAIN_ADD_PDF_BACKGROUND); + $tplidx = $pdf->importPage(1); + } @@ -266,2 +304,22 @@ - if (getDolGlobalString('MAIN_DISABLE_PDF_COMPRESSION')) { - $pdf->SetCompression(false); + if (!empty($conf->global->MAIN_DISABLE_PDF_COMPRESSION)) $pdf->SetCompression(false); + + $pdf->SetMargins($this->marge_gauche, $this->marge_haute, $this->marge_droite); // Left, Top, Right + + // Set $this->atleastonediscount if you have at least one discount + for ($i = 0; $i < $nblines; $i++) + { + if ($object->lines[$i]->remise_percent) + { + $this->atleastonediscount++; + } + } + if (empty($this->atleastonediscount)) + { + $delta = ($this->postotalht - $this->posxdiscount); + $this->posxpicture += $delta; + $this->posxtva += $delta; + $this->posxup += $delta; + $this->posxqty += $delta; + $this->posxunit += $delta; + $this->posxdiscount += $delta; + // post of fields after are not modified, stay at same position @@ -270,20 +328 @@ - $pdf->SetMargins($this->marge_gauche, $this->marge_haute, $this->marge_droite); // Left, Top, Right - - // Set $this->atleastonediscount if you have at least one discount - for ($i = 0; $i < $nblines; $i++) { - if ($object->lines[$i]->remise_percent) { - $this->atleastonediscount++; - } - } - if (empty($this->atleastonediscount)) { - $delta = ($this->postotalht - $this->posxdiscount); - $this->posxpicture += $delta; - $this->posxtva += $delta; - $this->posxup += $delta; - $this->posxqty += $delta; - $this->posxunit += $delta; - $this->posxdiscount += $delta; - // post of fields after are not modified, stay at same position - } - - // New page + // New page @@ -291,3 +330 @@ - if (!empty($tplidx)) { - $pdf->useTemplate($tplidx); - } + if (!empty($tplidx)) $pdf->useTemplate($tplidx); @@ -301 +338 @@ - $tab_top_newpage = (!getDolGlobalInt('MAIN_PDF_DONOTREPEAT_HEAD') ? 42 + $top_shift : 10); + $tab_top_newpage = (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD) ? 42 + $top_shift : 10); @@ -304 +341,2 @@ - if (isModEnabled('incoterm')) { + if ($conf->incoterm->enabled) + { @@ -306 +344,2 @@ - if ($desc_incoterms) { + if ($desc_incoterms) + { @@ -322,12 +361,3 @@ - // Displays notes - $notetoshow = empty($object->note_public) ? '' : $object->note_public; - - // Extrafields in note - if (getDolGlobalString('INVOICE_ADD_EXTRAFIELD_IN_NOTE')) { - $extranote = $this->getExtrafieldsInHtml($object, $outputlangs); - if (!empty($extranote)) { - $notetoshow = dol_concatdesc($notetoshow, $extranote); - } - } - - if ($notetoshow) { + // Display notes + if (!empty($object->note_public)) + { @@ -342 +372 @@ - $pdf->writeHTMLCell(190, 3, $this->posxdesc - 1, $tab_top - 1, dol_htmlentitiesbr($notetoshow), 0, 1); + $pdf->writeHTMLCell(190, 3, $this->posxdesc - 1, $tab_top - 1, dol_htmlentitiesbr($object->note_public), 0, 1); @@ -358 +388,2 @@ - for ($i = 0; $i < $nblines; $i++) { + for ($i = 0; $i < $nblines; $i++) + { @@ -364,4 +395,2 @@ - //$imglinesize = array(); - //if (!empty($realpatharray[$i])) { - // $imglinesize = pdf_getSizeForImage($realpatharray[$i]); - //} + $imglinesize = array(); + if (!empty($realpatharray[$i])) $imglinesize = pdf_getSizeForImage($realpatharray[$i]); @@ -374 +402,0 @@ - $posYAfterImage = 0; @@ -382 +410,2 @@ - if ($pageposafter > $pageposbefore) { // There is a pagebreak + if ($pageposafter > $pageposbefore) // There is a pagebreak + { @@ -389,2 +418,4 @@ - if ($posyafter > ($this->page_hauteur - ($heightforfooter + $heightforfreetext + $heightforinfotot))) { // There is no space left for total+free text - if ($i == ($nblines - 1)) { // No more lines, and no space left to show total, so we create a new page + if ($posyafter > ($this->page_hauteur - ($heightforfooter + $heightforfreetext + $heightforinfotot))) // There is no space left for total+free text + { + if ($i == ($nblines - 1)) // No more lines, and no space left to show total, so we create a new page + { @@ -392,6 +423,2 @@ - if (!empty($tplidx)) { - $pdf->useTemplate($tplidx); - } - if (!getDolGlobalInt('MAIN_PDF_DONOTREPEAT_HEAD')) { - $this->_pagehead($pdf, $object, 0, $outputlangs); - } + if (!empty($tplidx)) $pdf->useTemplate($tplidx); + if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) $this->_pagehead($pdf, $object, 0, $outputlangs); @@ -400 +427,3 @@ - } else { + } + else + { @@ -403 +432 @@ - if (getDolGlobalString('MAIN_PDF_DATA_ON_FIRST_PAGE')) { + if (!empty($conf->global->MAIN_PDF_DATA_ON_FIRST_PAGE)) @@ -405 +434 @@ - } else { + else @@ -407 +435,0 @@ - } @@ -409 +437,3 @@ - } else { // No pagebreak + } + else // No pagebreak + { @@ -415 +445 @@ - $pageposafter = $pdf->getPage(); + $pageposafter = $pdf->getPage(); @@ -422,2 +452 @@ - $pdf->setPage($pageposafter); - $curY = $tab_top_newpage; + $pdf->setPage($pageposafter); $curY = $tab_top_newpage; @@ -429,5 +458,6 @@ - if (!getDolGlobalString('MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT')) { - $vat_rate = pdf_getlinevatrate($object, $i, $outputlangs, $hidedetails); - $pdf->SetXY($this->posxtva, $curY); - $pdf->MultiCell($this->posxup - $this->posxtva - 1, 3, $vat_rate, 0, 'R'); - } + if (empty($conf->global->MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT)) + { + $vat_rate = pdf_getlinevatrate($object, $i, $outputlangs, $hidedetails); + $pdf->SetXY($this->posxtva, $curY); + $pdf->MultiCell($this->posxup - $this->posxtva - 1, 3, $vat_rate, 0, 'R'); + } @@ -446 +476,2 @@ - if (getDolGlobalInt('PRODUCT_USE_UNITS')) { + if (!empty($conf->global->PRODUCT_USE_UNITS)) + { @@ -453 +484,2 @@ - if ($object->lines[$i]->remise_percent) { + if ($object->lines[$i]->remise_percent) + { @@ -455 +487 @@ - $remise_percent = pdf_getlineremisepercent($object, $i, $outputlangs, $hidedetails); + $remise_percent = pdf_getlineremisepercent($object, $i, $outputlangs, $hidedetails); @@ -461,9 +493,6 @@ - $pdf->SetXY($this->postotalht, $curY); - $pdf->MultiCell($this->page_largeur - $this->marge_droite - $this->postotalht, 3, $total_excl_tax, 0, 'R', 0); - - // Collection of totals by VAT value in $this->tva["taux"]=total_tva - if (isModEnabled("multicurrency") && $object->multicurrency_tx != 1) { - $tvaligne = $object->lines[$i]->multicurrency_total_tva; - } else { - $tvaligne = $object->lines[$i]->total_tva; - } + $pdf->SetXY($this->postotalht, $curY); + $pdf->MultiCell($this->page_largeur - $this->marge_droite - $this->postotalht, 3, $total_excl_tax, 0, 'R', 0); + + // Collecte des totaux par valeur de tva dans $this->tva["taux"]=total_tva + if ($conf->multicurrency->enabled && $object->multicurrency_tx != 1) $tvaligne = $object->lines[$i]->multicurrency_total_tva; + else $tvaligne = $object->lines[$i]->total_tva; @@ -474,4 +503 @@ - // TODO remise_percent is an obsolete field for object parent - /*if (!empty($object->remise_percent)) { - $tvaligne -= ($tvaligne * $object->remise_percent) / 100; - }*/ + if (!empty($object->remise_percent)) $tvaligne -= ($tvaligne * $object->remise_percent) / 100; @@ -483,12 +509,4 @@ - if (($object->lines[$i]->info_bits & 0x01) == 0x01) { - $vatrate .= '*'; - } - if (empty($this->tva[$vatrate])) { - $this->tva[$vatrate] = 0; - } - if (empty($this->localtax1[$localtax1rate])) { - $this->localtax1[$localtax1rate] = 0; - } - if (empty($this->localtax2[$localtax2rate])) { - $this->localtax2[$localtax2rate] = 0; - } + if (($object->lines[$i]->info_bits & 0x01) == 0x01) $vatrate .= '*'; + if (empty($this->tva[$vatrate])) $this->tva[$vatrate] = 0; + if (empty($this->localtax1[$localtax1rate])) $this->localtax1[$localtax1rate] = 0; + if (empty($this->localtax2[$localtax2rate])) $this->localtax2[$localtax2rate] = 0; @@ -499,3 +517 @@ - if ($posYAfterImage > $posYAfterDescription) { - $nexY = $posYAfterImage; - } + if ($posYAfterImage > $posYAfterDescription) $nexY = $posYAfterImage; @@ -504 +520,2 @@ - if (getDolGlobalString('MAIN_PDF_DASH_BETWEEN_LINES') && $i < ($nblines - 1)) { + if (!empty($conf->global->MAIN_PDF_DASH_BETWEEN_LINES) && $i < ($nblines - 1)) + { @@ -515 +532,2 @@ - while ($pagenb < $pageposafter) { + while ($pagenb < $pageposafter) + { @@ -517 +535,2 @@ - if ($pagenb == 1) { + if ($pagenb == 1) + { @@ -519 +538,3 @@ - } else { + } + else + { @@ -526,2 +547,7 @@ - if (!getDolGlobalInt('MAIN_PDF_DONOTREPEAT_HEAD')) { - $this->_pagehead($pdf, $object, 0, $outputlangs); + if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) $this->_pagehead($pdf, $object, 0, $outputlangs); + } + if (isset($object->lines[$i + 1]->pagebreak) && $object->lines[$i + 1]->pagebreak) + { + if ($pagenb == 1) + { + $this->_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforfooter, 0, $outputlangs, 0, 1, $object->multicurrency_code); @@ -529,5 +555,2 @@ - } - if (isset($object->lines[$i + 1]->pagebreak) && $object->lines[$i + 1]->pagebreak) { - if ($pagenb == 1) { - $this->_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforfooter, 0, $outputlangs, 0, 1, $object->multicurrency_code); - } else { + else + { @@ -539,3 +562 @@ - if (!empty($tplidx)) { - $pdf->useTemplate($tplidx); - } + if (!empty($tplidx)) $pdf->useTemplate($tplidx); @@ -543,3 +564 @@ - if (!getDolGlobalInt('MAIN_PDF_DONOTREPEAT_HEAD')) { - $this->_pagehead($pdf, $object, 0, $outputlangs); - } + if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) $this->_pagehead($pdf, $object, 0, $outputlangs); @@ -550 +569,2 @@ - if ($pagenb == 1) { + if ($pagenb == 1) + { @@ -553 +573,3 @@ - } else { + } + else + { @@ -565 +587,2 @@ - if (($deja_regle || $amount_credit_notes_included || $amount_deposits_included) && !getDolGlobalString('SUPPLIER_INVOICE_NO_PAYMENT_DETAILS')) { + if (($deja_regle || $amount_credit_notes_included || $amount_deposits_included) && empty($conf->global->SUPPLIER_INVOICE_NO_PAYMENT_DETAILS)) + { @@ -571,3 +594 @@ - if (method_exists($pdf, 'AliasNbPages')) { - $pdf->AliasNbPages(); - } + if (method_exists($pdf, 'AliasNbPages')) $pdf->AliasNbPages(); @@ -584,3 +605,4 @@ - if ($reshook < 0) { - $this->error = $hookmanager->error; - $this->errors = $hookmanager->errors; + if ($reshook < 0) + { + $this->error = $hookmanager->error; + $this->errors = $hookmanager->errors; @@ -589 +611,2 @@ - dolChmod($file); + if (!empty($conf->global->MAIN_UMASK)) + @chmod($file, octdec($conf->global->MAIN_UMASK)); @@ -594 +617,3 @@ - } else { + } + else + { @@ -598 +623,3 @@ - } else { + } + else + { @@ -602 +629 @@ - } + } @@ -605 +632 @@ - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps @@ -609,6 +636,6 @@ - * @param TCPDF $pdf Object PDF - * @param FactureFournisseur $object Object invoice - * @param int $deja_regle Amount already paid (in the currency of invoice) - * @param int $posy Position depart - * @param Translate $outputlangs Objet langs - * @return int Position of cursor after output + * @param PDF $pdf Object PDF + * @param Object $object Object invoice + * @param int $deja_regle Amount already paid (in the currency of invoice) + * @param int $posy Position depart + * @param Translate $outputlangs Objet langs + * @return int Position pour suite @@ -618 +645 @@ - // phpcs:enable + // phpcs:enable @@ -622,3 +649 @@ - if ($object->type == 2 && getDolGlobalString('INVOICE_POSITIVE_CREDIT_NOTE')) { - $sign = -1; - } + if ($object->type == 2 && !empty($conf->global->INVOICE_POSITIVE_CREDIT_NOTE)) $sign = -1; @@ -628 +653 @@ - $tab2_top = $posy; + $tab2_top = $posy; @@ -633,3 +658,3 @@ - $col1x = 120; - $col2x = 170; - if ($this->page_largeur < 210) { // To work with US executive format + $col1x = 120; $col2x = 170; + if ($this->page_largeur < 210) // To work with US executive format + { @@ -645 +670 @@ - $pdf->SetXY($col1x, $tab2_top); + $pdf->SetXY($col1x, $tab2_top + 0); @@ -648,2 +673,2 @@ - $total_ht = ((isModEnabled("multicurrency") && isset($object->multicurrency_tx) && $object->multicurrency_tx != 1) ? $object->multicurrency_total_ht : $object->total_ht); - $pdf->SetXY($col2x, $tab2_top); + $total_ht = (($conf->multicurrency->enabled && isset($object->multicurrency_tx) && $object->multicurrency_tx != 1) ? $object->multicurrency_total_ht : $object->total_ht); + $pdf->SetXY($col2x, $tab2_top + 0); @@ -655 +680 @@ - $total_ttc = (isModEnabled("multicurrency") && $object->multicurrency_tx != 1) ? $object->multicurrency_total_ttc : $object->total_ttc; + $total_ttc = ($conf->multicurrency->enabled && $object->multicurrency_tx != 1) ? $object->multicurrency_total_ttc : $object->total_ttc; @@ -658,2 +683,4 @@ - foreach ($this->tva as $tvakey => $tvaval) { - if ($tvakey > 0) { // We do not display rate 0 + foreach ($this->tva as $tvakey => $tvaval) + { + if ($tvakey > 0) // On affiche pas taux 0 + { @@ -667 +694,2 @@ - if (preg_match('/\*/', $tvakey)) { + if (preg_match('/\*/', $tvakey)) + { @@ -680 +708,2 @@ - if (!$this->atleastoneratenotnull) { // If no vat at all + if (!$this->atleastoneratenotnull) // If no vat at all + { @@ -688 +717,2 @@ - if (getDolGlobalString('FACTURE_LOCAL_TAX1_OPTION') == 'localtax1on' && $object->total_localtax1 > 0) { + if (!empty($conf->global->FACTURE_LOCAL_TAX1_OPTION) && $conf->global->FACTURE_LOCAL_TAX1_OPTION == 'localtax1on' && $object->total_localtax1 > 0) + { @@ -697 +727,2 @@ - if (getDolGlobalString('FACTURE_LOCAL_TAX2_OPTION') == 'localtax2on' && $object->total_localtax2 > 0) { + if (!empty($conf->global->FACTURE_LOCAL_TAX2_OPTION) && $conf->global->FACTURE_LOCAL_TAX2_OPTION == 'localtax2on' && $object->total_localtax2 > 0) + { @@ -704,2 +735,4 @@ - } else { - //if (!empty($conf->global->FACTURE_LOCAL_TAX1_OPTION) && $conf->global->FACTURE_LOCAL_TAX1_OPTION=='localtax1on') + } + else + { + //if (! empty($conf->global->FACTURE_LOCAL_TAX1_OPTION) && $conf->global->FACTURE_LOCAL_TAX1_OPTION=='localtax1on') @@ -709 +742,2 @@ - if ($tvakey != 0) { // On affiche pas taux 0 + if ($tvakey != 0) // On affiche pas taux 0 + { @@ -716 +750,2 @@ - if (preg_match('/\*/', $tvakey)) { + if (preg_match('/\*/', $tvakey)) + { @@ -730 +765 @@ - //if (!empty($conf->global->FACTURE_LOCAL_TAX2_OPTION) && $conf->global->FACTURE_LOCAL_TAX2_OPTION=='localtax2on') + //if (! empty($conf->global->FACTURE_LOCAL_TAX2_OPTION) && $conf->global->FACTURE_LOCAL_TAX2_OPTION=='localtax2on') @@ -734 +769,2 @@ - if ($tvakey != 0) { // On affiche pas taux 0 + if ($tvakey != 0) // On affiche pas taux 0 + { @@ -741 +777,2 @@ - if (preg_match('/\*/', $tvakey)) { + if (preg_match('/\*/', $tvakey)) + { @@ -767,2 +804,2 @@ - $creditnoteamount = $object->getSumCreditNotesUsed((isModEnabled("multicurrency") && $object->multicurrency_tx != 1) ? 1 : 0); // Warning, this also include excess received - $depositsamount = $object->getSumDepositsUsed((isModEnabled("multicurrency") && $object->multicurrency_tx != 1) ? 1 : 0); + $creditnoteamount = $object->getSumCreditNotesUsed(($conf->multicurrency->enabled && $object->multicurrency_tx != 1) ? 1 : 0); // Warning, this also include excess received + $depositsamount = $object->getSumDepositsUsed(($conf->multicurrency->enabled && $object->multicurrency_tx != 1) ? 1 : 0); @@ -771,5 +808,4 @@ - if (!empty($object->paye)) { - $resteapayer = 0; - } - - if (($deja_regle > 0 || $creditnoteamount > 0 || $depositsamount > 0) && !getDolGlobalString('INVOICE_NO_PAYMENT_DETAILS')) { + if (!empty($object->paye)) $resteapayer = 0; + + if (($deja_regle > 0 || $creditnoteamount > 0 || $depositsamount > 0) && empty($conf->global->INVOICE_NO_PAYMENT_DETAILS)) + { @@ -784 +820,2 @@ - if ($creditnoteamount) { + if ($creditnoteamount) + { @@ -794 +831,2 @@ - if ($object->close_code == FactureFournisseur::CLOSECODE_DISCOUNTVAT) { + if ($object->close_code == FactureFournisseur::CLOSECODE_DISCOUNTVAT) + { @@ -826 +864 @@ - * @param TCPDF $pdf Object PDF + * @param PDF $pdf Object PDF @@ -842,3 +880 @@ - if ($hidetop) { - $hidetop = -1; - } + if ($hidetop) $hidetop = -1; @@ -849 +885 @@ - // Amount in (at tab_top - 1) + // Amount in (at tab_top - 1) @@ -853 +889,2 @@ - if (empty($hidetop)) { + if (empty($hidetop)) + { @@ -859,3 +896 @@ - if (getDolGlobalString('MAIN_PDF_TITLE_BACKGROUND_COLOR')) { - $pdf->Rect($this->marge_gauche, $tab_top, $this->page_largeur - $this->marge_droite - $this->marge_gauche, 5, 'F', null, explode(',', getDolGlobalString('MAIN_PDF_TITLE_BACKGROUND_COLOR'))); - } + if (!empty($conf->global->MAIN_PDF_TITLE_BACKGROUND_COLOR)) $pdf->Rect($this->marge_gauche, $tab_top, $this->page_largeur - $this->marge_droite - $this->marge_gauche, 5, 'F', null, explode(',', $conf->global->MAIN_PDF_TITLE_BACKGROUND_COLOR)); @@ -870 +905,2 @@ - if (empty($hidetop)) { + if (empty($hidetop)) + { @@ -877,7 +913,9 @@ - if (!getDolGlobalString('MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT') && !getDolGlobalString('MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT_COLUMN')) { - $pdf->line($this->posxtva - 1, $tab_top, $this->posxtva - 1, $tab_top + $tab_height); - if (empty($hidetop)) { - $pdf->SetXY($this->posxtva - 3, $tab_top + 1); - $pdf->MultiCell($this->posxup - $this->posxtva + 3, 2, $outputlangs->transnoentities("VAT"), '', 'C'); - } - } + if (empty($conf->global->MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT) && empty($conf->global->MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT_COLUMN)) + { + $pdf->line($this->posxtva - 1, $tab_top, $this->posxtva - 1, $tab_top + $tab_height); + if (empty($hidetop)) + { + $pdf->SetXY($this->posxtva - 3, $tab_top + 1); + $pdf->MultiCell($this->posxup - $this->posxtva + 3, 2, $outputlangs->transnoentities("VAT"), '', 'C'); + } + } @@ -886 +924,2 @@ - if (empty($hidetop)) { + if (empty($hidetop)) + { @@ -892 +931,2 @@ - if (empty($hidetop)) { + if (empty($hidetop)) + { @@ -897 +937,2 @@ - if (getDolGlobalInt('PRODUCT_USE_UNITS')) { + if (!empty($conf->global->PRODUCT_USE_UNITS)) + { @@ -901,11 +942,7 @@ - $pdf->MultiCell( - $this->posxdiscount - $this->posxunit - 1, - 2, - $outputlangs->transnoentities("Unit"), - '', - 'C' - ); - } - } - - if ($this->atleastonediscount) { + $pdf->MultiCell($this->posxdiscount - $this->posxunit - 1, 2, $outputlangs->transnoentities("Unit"), '', + 'C'); + } + } + + if ($this->atleastonediscount) + { @@ -913 +950,2 @@ - if (empty($hidetop)) { + if (empty($hidetop)) + { @@ -920 +958,2 @@ - if (empty($hidetop)) { + if (empty($hidetop)) + { @@ -927 +966 @@ - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps @@ -931,6 +970,5 @@ - * @param TCPDF $pdf Object PDF - * @param Object $object Object to show - * @param int $posy Position y in PDF - * @param Translate $outputlangs Object langs for output - * @param int $heightforfooter Height for footer - * @return int Return integer <0 if KO, >0 if OK + * @param PDF $pdf Object PDF + * @param Object $object Object to show + * @param int $posy Position y in PDF + * @param Translate $outputlangs Object langs for output + * @return int <0 if KO, >0 if OK @@ -938 +976 @@ - protected function _tableau_versements(&$pdf, $object, $posy, $outputlangs, $heightforfooter = 0) + protected function _tableau_versements(&$pdf, $object, $posy, $outputlangs) @@ -940 +978 @@ - // phpcs:enable + // phpcs:enable @@ -944,3 +982 @@ - if ($object->type == 2 && getDolGlobalString('INVOICE_POSITIVE_CREDIT_NOTE')) { - $sign = -1; - } + if ($object->type == 2 && !empty($conf->global->INVOICE_POSITIVE_CREDIT_NOTE)) $sign = -1; @@ -952 +988,2 @@ - if ($this->page_largeur < 210) { // To work with US executive format + if ($this->page_largeur < 210) // To work with US executive format + { @@ -984 +1021 @@ - $sql = "SELECT p.datep as date, p.fk_paiement as type, p.num_paiement as num_payment, pf.amount as amount, pf.multicurrency_amount,"; + $sql = "SELECT p.datep as date, p.fk_paiement as type, p.num_paiement as num, pf.amount as amount, pf.multicurrency_amount,"; @@ -988 +1025 @@ - $sql .= " WHERE pf.fk_paiementfourn = p.rowid and pf.fk_facturefourn = ".((int) $object->id); + $sql .= " WHERE pf.fk_paiementfourn = p.rowid and pf.fk_facturefourn = ".$object->id; @@ -991,2 +1028,3 @@ - if ($resql) { - $num = $this->db->num_rows($resql); + if ($resql) + { + $num = $this->db->num_rows($resql); @@ -995 +1033 @@ - $y += 3; + $y += 3; @@ -1001 +1039 @@ - $pdf->MultiCell(20, 3, price($sign * ((isModEnabled("multicurrency") && $object->multicurrency_tx != 1) ? $row->multicurrency_amount : $row->amount)), 0, 'L', 0); + $pdf->MultiCell(20, 3, price($sign * (($conf->multicurrency->enabled && $object->multicurrency_tx != 1) ? $row->multicurrency_amount : $row->amount)), 0, 'L', 0); @@ -1007 +1045 @@ - $pdf->MultiCell(30, 3, $row->num_payment, 0, 'L', 0); + $pdf->MultiCell(30, 3, $row->num, 0, 'L', 0); @@ -1013 +1051,3 @@ - } else { + } + else + { @@ -1017 +1056,0 @@ - return -1; @@ -1024 +1063 @@ - * @param TCPDF $pdf Object PDF + * @param PDF $pdf Object PDF @@ -1028 +1067 @@ - * @return int + * @return void @@ -1045,2 +1083,0 @@ - $w = 100; - @@ -1059,2 +1096,2 @@ - $height=pdf_getHeightForLogo($logo); - $pdf->Image($logo, $this->marge_gauche, $posy, 0, $height); // width=0 (auto) + $height=pdf_getHeightForLogo($logo); + $pdf->Image($logo, $this->marge_gauche, $posy, 0, $height); // width=0 (auto) @@ -1072,2 +1109,2 @@ - $text = $this->emetteur->name; - $pdf->MultiCell(100, 4, $outputlangs->convToOutputCharset($text), 0, 'L'); + $text = $this->emetteur->name; + $pdf->MultiCell(100, 4, $outputlangs->convToOutputCharset($text), 0, 'L'); @@ -1079,11 +1116 @@ - $title = $outputlangs->transnoentities("PdfInvoiceTitle"); - if ($object->type == 1) { - $title = $outputlangs->transnoentities("InvoiceReplacement"); - } - if ($object->type == 2) { - $title = $outputlangs->transnoentities("InvoiceAvoir"); - } - if ($object->type == 3) { - $title = $outputlangs->transnoentities("InvoiceDeposit"); - } - $pdf->MultiCell($w, 3, $title." ".$outputlangs->convToOutputCharset($object->ref), '', 'R'); + $pdf->MultiCell(100, 3, $outputlangs->transnoentities("SupplierInvoice")." ".$outputlangs->convToOutputCharset($object->ref), '', 'R'); @@ -1092,2 +1119,3 @@ - if ($object->ref_supplier) { - $posy += 4; + if ($object->ref_supplier) + { + $posy += 4; @@ -1095 +1123 @@ - $pdf->SetXY($posx, $posy); + $pdf->SetXY($posx, $posy); @@ -1097 +1125 @@ - $pdf->MultiCell($w, 4, $outputlangs->transnoentities("RefSupplier")." : ".$object->ref_supplier, '', 'R'); + $pdf->MultiCell(100, 4, $outputlangs->transnoentities("RefSupplier")." : ".$object->ref_supplier, '', 'R'); @@ -1103 +1131,2 @@ - if (getDolGlobalString('PDF_SHOW_PROJECT_TITLE')) { + if (!empty($conf->global->PDF_SHOW_PROJECT)) + { @@ -1105,2 +1134,3 @@ - if (!empty($object->project->ref)) { - $posy += 3; + if (!empty($object->project->ref)) + { + $posy += 4; @@ -1107,0 +1138 @@ + $langs->load("projects"); @@ -1109,17 +1140,6 @@ - $pdf->MultiCell($w, 3, $outputlangs->transnoentities("Project")." : ".(empty($object->project->title) ? '' : $object->project->title), '', 'R'); - } - } - - if (getDolGlobalString('PDF_SHOW_PROJECT')) { - $object->fetch_projet(); - if (!empty($object->project->ref)) { - $outputlangs->load("projects"); - $posy += 4; - $pdf->SetXY($posx, $posy); - $langs->load("projects"); - $pdf->SetTextColor(0, 0, 60); - $pdf->MultiCell($w, 3, $outputlangs->transnoentities("Project")." : ".(empty($object->project->ref) ? '' : $object->project->ref), '', 'R'); - } - } - - if ($object->date) { + $pdf->MultiCell(100, 3, $outputlangs->transnoentities("Project")." : ".(empty($object->project->ref) ? '' : $object->projet->ref), '', 'R'); + } + } + + if ($object->date) + { @@ -1129,2 +1149,4 @@ - $pdf->MultiCell($w, 4, $outputlangs->transnoentities("Date")." : ".dol_print_date($object->date, "day", false, $outputlangs, true), '', 'R'); - } else { + $pdf->MultiCell(100, 4, $outputlangs->transnoentities("Date")." : ".dol_print_date($object->date, "day", false, $outputlangs, true), '', 'R'); + } + else + { @@ -1134,4 +1156,5 @@ - $pdf->MultiCell($w, 4, strtolower($outputlangs->transnoentities("OrderToProcess")), '', 'R'); - } - - if ($object->thirdparty->code_fournisseur) { + $pdf->MultiCell(100, 4, strtolower($outputlangs->transnoentities("OrderToProcess")), '', 'R'); + } + + if ($object->thirdparty->code_fournisseur) + { @@ -1141 +1164 @@ - $pdf->MultiCell($w, 3, $outputlangs->transnoentities("SupplierCode")." : ".$outputlangs->transnoentities($object->thirdparty->code_fournisseur), '', 'R'); + $pdf->MultiCell(100, 3, $outputlangs->transnoentities("SupplierCode")." : ".$outputlangs->transnoentities($object->thirdparty->code_fournisseur), '', 'R'); @@ -1151 +1174,2 @@ - if ($current_y < $pdf->getY()) { + if ($current_y < $pdf->getY()) + { @@ -1155 +1179,2 @@ - if ($showaddress) { + if ($showaddress) + { @@ -1157,16 +1182,10 @@ - $carac_emetteur = ''; - // Add internal contact of object if defined - $arrayidcontact = $object->getIdContact('internal', 'SALESREPFOLL'); - if (count($arrayidcontact) > 0) { - $object->fetch_user($arrayidcontact[0]); - $labelbeforecontactname = ($outputlangs->transnoentities("FromContactName") != 'FromContactName' ? $outputlangs->transnoentities("FromContactName") : $outputlangs->transnoentities("Name")); - $carac_emetteur .= ($carac_emetteur ? "\n" : '').$labelbeforecontactname.": ".$outputlangs->convToOutputCharset($object->user->getFullName($outputlangs)); - $carac_emetteur .= (getDolGlobalInt('PDF_SHOW_PHONE_AFTER_USER_CONTACT') || getDolGlobalInt('PDF_SHOW_EMAIL_AFTER_USER_CONTACT')) ? ' (' : ''; - $carac_emetteur .= (getDolGlobalInt('PDF_SHOW_PHONE_AFTER_USER_CONTACT') && !empty($object->user->office_phone)) ? $object->user->office_phone : ''; - $carac_emetteur .= (getDolGlobalInt('PDF_SHOW_PHONE_AFTER_USER_CONTACT') && getDolGlobalInt('PDF_SHOW_EMAIL_AFTER_USER_CONTACT')) ? ', ' : ''; - $carac_emetteur .= (getDolGlobalInt('PDF_SHOW_EMAIL_AFTER_USER_CONTACT') && !empty($object->user->email)) ? $object->user->email : ''; - $carac_emetteur .= (getDolGlobalInt('PDF_SHOW_PHONE_AFTER_USER_CONTACT') || getDolGlobalInt('PDF_SHOW_EMAIL_AFTER_USER_CONTACT')) ? ')' : ''; - $carac_emetteur .= "\n"; - } - - $carac_emetteur .= pdf_build_address($outputlangs, $this->emetteur, $object->thirdparty, '', 0, 'source', $object); + $carac_emetteur = ''; + // Add internal contact of proposal if defined + $arrayidcontact = $object->getIdContact('internal', 'SALESREPFOLL'); + if (count($arrayidcontact) > 0) + { + $object->fetch_user($arrayidcontact[0]); + $carac_emetteur .= ($carac_emetteur ? "\n" : '').$outputlangs->convToOutputCharset($object->user->getFullName($outputlangs))."\n"; + } + + $carac_emetteur .= pdf_build_address($outputlangs, $this->emetteur, $object->thirdparty, '', 0, 'source', $object); @@ -1177,3 +1196 @@ - if (getDolGlobalString('MAIN_INVERT_SENDER_RECIPIENT')) { - $posx = $this->page_largeur - $this->marge_droite - 80; - } + if (!empty($conf->global->MAIN_INVERT_SENDER_RECIPIENT)) $posx = $this->page_largeur - $this->marge_droite - 80; @@ -1186 +1203 @@ - $pdf->MultiCell(80, 5, $outputlangs->transnoentities("BillFrom"), 0, 'L'); + $pdf->MultiCell(66, 5, $outputlangs->transnoentities("BillFrom").":", 0, 'L'); @@ -1208 +1225,2 @@ - if (count($arrayidcontact) > 0) { + if (count($arrayidcontact) > 0) + { @@ -1213,2 +1231,3 @@ - // Recipient name - if ($usecontact && ($object->contact->socid != $object->thirdparty->id && (!isset($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT) || getDolGlobalString('MAIN_USE_COMPANY_NAME_OF_CONTACT')))) { + //Recipient name + // On peut utiliser le nom de la societe du contact + if ($usecontact && !empty($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT)) { @@ -1226,3 +1245 @@ - if ($this->page_largeur < 210) { - $widthrecbox = 84; // To work with US executive format - } + if ($this->page_largeur < 210) $widthrecbox = 84; // To work with US executive format @@ -1231,3 +1248 @@ - if (getDolGlobalString('MAIN_INVERT_SENDER_RECIPIENT')) { - $posx = $this->marge_gauche; - } + if (!empty($conf->global->MAIN_INVERT_SENDER_RECIPIENT)) $posx = $this->marge_gauche; @@ -1239 +1254 @@ - $pdf->MultiCell($widthrecbox, 5, $outputlangs->transnoentities("BillTo"), 0, 'L'); + $pdf->MultiCell($widthrecbox, 5, $outputlangs->transnoentities("BillTo").":", 0, 'L'); @@ -1259,14 +1274,15 @@ - /** - * Show footer of page. Need this->emetteur object - * - * @param TCPDF $pdf PDF - * @param FactureFournisseur $object Object to show - * @param Translate $outputlangs Object lang for output - * @param int $hidefreetext 1=Hide free text - * @return int Return height of bottom margin including footer text - */ - protected function _pagefoot(&$pdf, $object, $outputlangs, $hidefreetext = 0) - { - $showdetails = getDolGlobalInt('MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS', 0); - return pdf_pagefoot($pdf, $outputlangs, 'SUPPLIER_INVOICE_FREE_TEXT', $this->emetteur, $this->marge_basse, $this->marge_gauche, $this->page_hauteur, $object, $showdetails, $hidefreetext); - } + /** + * Show footer of page. Need this->emetteur object + * + * @param PDF $pdf PDF + * @param FactureFournisseur $object Object to show + * @param Translate $outputlangs Object lang for output + * @param int $hidefreetext 1=Hide free text + * @return int Return height of bottom margin including footer text + */ + protected function _pagefoot(&$pdf, $object, $outputlangs, $hidefreetext = 0) + { + global $conf; + $showdetails = $conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS; + return pdf_pagefoot($pdf, $outputlangs, 'SUPPLIER_INVOICE_FREE_TEXT', $this->emetteur, $this->marge_basse, $this->marge_gauche, $this->page_hauteur, $object, $showdetails, $hidefreetext); + }