|
@@ -382,10 +382,14 @@ class pdf_sponge extends ModelePDFFactures
|
|
|
$this->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
|
|
|
$this->heightforfooter = $this->marge_basse + (empty($conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS) ? 12 : 22); // Height reserved to output the footer (value include bottom margin)
|
|
|
|
|
|
- if ($this->getHeightForQRInvoice(1, $object, $langs) > 0) {
|
|
|
- // Shrink infotot to a base 30
|
|
|
- $this->heightforinfotot = 30 + (4 * $nbpayments); // Height reserved to output the info and total part and payment part
|
|
|
+ $heightforqrinvoice = $heightforqrinvoice_firstpage = 0;
|
|
|
+ if (getDolGlobalString('INVOICE_ADD_SWISS_QR_CODE') == 'bottom') {
|
|
|
+ if ($this->getHeightForQRInvoice(1, $object, $langs) > 0) {
|
|
|
+ // Shrink infotot to a base 30
|
|
|
+ $this->heightforinfotot = 30 + (4 * $nbpayments); // Height reserved to output the info and total part and payment part
|
|
|
+ }
|
|
|
}
|
|
|
+
|
|
|
if (class_exists('TCPDF')) {
|
|
|
$pdf->setPrintHeader(false);
|
|
|
$pdf->setPrintFooter(false);
|
|
@@ -502,6 +506,8 @@ class pdf_sponge extends ModelePDFFactures
|
|
|
$qrcodestring = '';
|
|
|
if (!empty($conf->global->INVOICE_ADD_ZATCA_QR_CODE)) {
|
|
|
$qrcodestring = $object->buildZATCAQRString();
|
|
|
+ } elseif (getDolGlobalString('INVOICE_ADD_SWISS_QR_CODE') == '1') {
|
|
|
+ $qrcodestring = $object->buildSwitzerlandQRString();
|
|
|
}
|
|
|
if ($qrcodestring) {
|
|
|
$qrcodecolor = array('25', '25', '25');
|
|
@@ -614,7 +620,6 @@ class pdf_sponge extends ModelePDFFactures
|
|
|
if (!getDolGlobalInt('MAIN_PDF_DONOTREPEAT_HEAD')) {
|
|
|
$this->_pagehead($pdf, $object, 0, $outputlangs, $outputlangsbis);
|
|
|
}
|
|
|
- // $this->_pagefoot($pdf,$object,$outputlangs,1);
|
|
|
$pdf->setTopMargin($this->tab_top_newpage);
|
|
|
// The only function to edit the bottom margin of current page to set it.
|
|
|
$pdf->setPageOrientation('', 1, $this->heightforfooter + $this->heightforfreetext);
|
|
@@ -659,7 +664,7 @@ class pdf_sponge extends ModelePDFFactures
|
|
|
|
|
|
// Add footer
|
|
|
$pdf->setPageOrientation('', 1, 0); // The only function to edit the bottom margin of current page to set it.
|
|
|
- $this->_pagefoot($pdf, $object, $outputlangs, 1);
|
|
|
+ $this->_pagefoot($pdf, $object, $outputlangs, 1, $this->getHeightForQRInvoice($pdf->getPage(), $object, $outputlangs));
|
|
|
|
|
|
$i++;
|
|
|
}
|
|
@@ -730,9 +735,9 @@ class pdf_sponge extends ModelePDFFactures
|
|
|
}
|
|
|
|
|
|
$pdf->setTopMargin($this->tab_top_newpage);
|
|
|
- $pageposbefore = $pdf->getPage();
|
|
|
- $page_bottom_margin = $this->heightforfooter + $this->heightforfreetext + $this->heightforinfotot + $this->getHeightForQRInvoice($pageposbefore, $object, $langs);
|
|
|
+ $page_bottom_margin = $this->heightforfooter + $this->heightforfreetext + $this->heightforinfotot + $this->getHeightForQRInvoice($pdf->getPage(), $object, $langs);
|
|
|
$pdf->setPageOrientation('', 1, $page_bottom_margin);
|
|
|
+ $pageposbefore = $pdf->getPage();
|
|
|
|
|
|
$showpricebeforepagebreak = 1;
|
|
|
$posYAfterImage = 0;
|
|
@@ -992,7 +997,7 @@ class pdf_sponge extends ModelePDFFactures
|
|
|
} else {
|
|
|
$this->_tableau($pdf, $this->tab_top_newpage, $this->page_hauteur - $this->tab_top_newpage - $this->heightforfooter - $heightforqrinvoice, 0, $outputlangs, 1, 1, $object->multicurrency_code, $outputlangsbis);
|
|
|
}
|
|
|
- $this->_pagefoot($pdf, $object, $outputlangs, 1);
|
|
|
+ $this->_pagefoot($pdf, $object, $outputlangs, 1, $this->getHeightForQRInvoice($pdf->getPage(), $object, $outputlangs));
|
|
|
$pagenb++;
|
|
|
$pdf->setPage($pagenb);
|
|
|
$pdf->setPageOrientation('', 1, 0); // The only function to edit the bottom margin of current page to set it.
|
|
@@ -1011,7 +1016,7 @@ class pdf_sponge extends ModelePDFFactures
|
|
|
} else {
|
|
|
$this->_tableau($pdf, $this->tab_top_newpage, $this->page_hauteur - $this->tab_top_newpage - $this->heightforfooter - $heightforqrinvoice, 0, $outputlangs, 1, 1, $object->multicurrency_code, $outputlangsbis);
|
|
|
}
|
|
|
- $this->_pagefoot($pdf, $object, $outputlangs, 1);
|
|
|
+ $this->_pagefoot($pdf, $object, $outputlangs, 1, $this->getHeightForQRInvoice($pdf->getPage(), $object, $outputlangs));
|
|
|
// New page
|
|
|
$pdf->AddPage();
|
|
|
if (!empty($tplidx)) {
|
|
@@ -1046,12 +1051,14 @@ class pdf_sponge extends ModelePDFFactures
|
|
|
}
|
|
|
|
|
|
// Pagefoot
|
|
|
- $this->_pagefoot($pdf, $object, $outputlangs);
|
|
|
+ $this->_pagefoot($pdf, $object, $outputlangs, 0, $this->getHeightForQRInvoice($pageposbefore, $object, $langs));
|
|
|
if (method_exists($pdf, 'AliasNbPages')) {
|
|
|
$pdf->AliasNbPages();
|
|
|
}
|
|
|
|
|
|
- $this->addSwissQRInvoice($pdf, $object, $outputlangs);
|
|
|
+ if (getDolGlobalString('INVOICE_ADD_SWISS_QR_CODE') == 'bottom') {
|
|
|
+ $this->addBottomQRInvoice($pdf, $object, $outputlangs);
|
|
|
+ }
|
|
|
$pdf->Close();
|
|
|
|
|
|
$pdf->Output($file, 'F');
|
|
@@ -1537,7 +1544,7 @@ class pdf_sponge extends ModelePDFFactures
|
|
|
|
|
|
foreach ($TPreviousIncoice as &$fac) {
|
|
|
if ($posy > $this->page_hauteur - 4 - $this->heightforfooter) {
|
|
|
- $this->_pagefoot($pdf, $object, $outputlangs, 1);
|
|
|
+ $this->_pagefoot($pdf, $object, $outputlangs, 1, $this->getHeightForQRInvoice($pdf->getPage(), $object, $outputlangs));
|
|
|
$pdf->addPage();
|
|
|
if (!getDolGlobalInt('MAIN_PDF_DONOTREPEAT_HEAD')) {
|
|
|
$this->_pagehead($pdf, $object, 0, $outputlangs, $outputlangsbis);
|
|
@@ -2449,12 +2456,13 @@ class pdf_sponge extends ModelePDFFactures
|
|
|
* @param Facture $object Object to show
|
|
|
* @param Translate $outputlangs Object lang for output
|
|
|
* @param int $hidefreetext 1=Hide free text
|
|
|
+ * @param int $heightforqrinvoice Height for QR invoices
|
|
|
* @return int Return height of bottom margin including footer text
|
|
|
*/
|
|
|
- protected function _pagefoot(&$pdf, $object, $outputlangs, $hidefreetext = 0)
|
|
|
+ protected function _pagefoot(&$pdf, $object, $outputlangs, $hidefreetext = 0, $heightforqrinvoice = 0)
|
|
|
{
|
|
|
$showdetails = getDolGlobalInt('MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS', 0);
|
|
|
- return pdf_pagefoot($pdf, $outputlangs, 'INVOICE_FREE_TEXT', $this->emetteur, $this->getHeightForQRInvoice($pdf->getPage(), $object, $outputlangs) + $this->marge_basse, $this->marge_gauche, $this->page_hauteur, $object, $showdetails, $hidefreetext, $this->page_largeur, $this->watermark);
|
|
|
+ return pdf_pagefoot($pdf, $outputlangs, 'INVOICE_FREE_TEXT', $this->emetteur, $heightforqrinvoice + $this->marge_basse, $this->marge_gauche, $this->page_hauteur, $object, $showdetails, $hidefreetext, $this->page_largeur, $this->watermark);
|
|
|
}
|
|
|
|
|
|
/**
|