diff --git a/ChangeLog b/ChangeLog index a6fa992f319..f72d5f3e5a4 100644 --- a/ChangeLog +++ b/ChangeLog @@ -7,11 +7,11 @@ English Dolibarr ChangeLog For users: - New: [ task #289 ] Can reorder tasks. - New: Add field "signature" into thirdparty card. If filled, text is added - at end of predefined email texts. If option MAIL_DO_NOT_USE_SIGN is on, this - feature is disabled. + at end of predefined email texts. If option MAIL_DO_NOT_USE_SIGN is on, this + feature is disabled. - New: Add link "Back to list" on all cards. - New: After first install, warning are visible onto mandatory setup not - configured. Show also total number of activated modules. + configured. Show also total number of activated modules. - New: Can filter list of proposal, order or invoice on sales representative. - New: Add supplier ref on supplier orders. - New: Can export supplier orders. @@ -25,10 +25,10 @@ For users: - New: Can edit and resiliate member status from list. - New: Can insert URL links into elements lines. Also reported into PDF. - New: When a member is validated, we can subscribe to mailing-lists - according to its type. + according to its type. - New: Add link to third party into sells and purchase journal. - New: Suggest a method to generate a backup file for user with no access - to mysqldump binary. + to mysqldump binary. - New: Can use extrafields on contacts/addresses. - New: Support unique field for extrafields. - New: Extra fields supports more types (int, string, double, date, datetime). @@ -57,7 +57,8 @@ For users: - New: Added ODT Template tag {object_total_discount} - New: Add new import options: Third parties bank details, warehouses and stocks, categories and suppliers prices - New: English bank account need a bank code (called sort code) to identify an account. - +- New: Add hidden option MAIN_PDF_MARGIN_LEFT, MAIN_PDF_MARGIN_RIGHT, MAIN_PDF_MARGIN_TOP, MAIN_PDF_MARGIN_BOTTOM + to force margins of generated PDF. New experimental modules: - New: Add margin management module. - New: Add commissions management module. diff --git a/build/rpm/dolibarr_generic.spec b/build/rpm/dolibarr_generic.spec index 6c14db9663e..3575914401a 100755 --- a/build/rpm/dolibarr_generic.spec +++ b/build/rpm/dolibarr_generic.spec @@ -148,10 +148,11 @@ cui hai bisogno ed essere facile da usare. %{__mkdir} -p $RPM_BUILD_ROOT%{_datadir}/pixmaps %{__install} -m 644 doc/images/dolibarr_48x48.png $RPM_BUILD_ROOT%{_datadir}/pixmaps/%{name}.png %{__mkdir} -p $RPM_BUILD_ROOT%{_datadir}/applications -%if 0%{?fedora} || 0%{?rhel_version} || 0%{?centos_version} || 0%{?mdkversion} || 0%{?suse_version} -desktop-file-install --delete-original --dir=$RPM_BUILD_ROOT%{_datadir}/applications build/rpm/%{name}.desktop -%endif %{__install} -m 644 build/rpm/dolibarr.desktop $RPM_BUILD_ROOT%{_datadir}/applications/%{name}.desktop +%if 0%{?fedora} || 0%{?rhel_version} || 0%{?centos_version} || 0%{?mdkversion} || 0%{?suse_version} +#Commented as it fails with error: /usr/bin/install: cannot stat build/rpm/dolibarr.desktop: No such file or directory +#desktop-file-install --delete-original --dir=$RPM_BUILD_ROOT%{_datadir}/applications build/rpm/%{name}.desktop --vendor="" +%endif %{__mkdir} -p $RPM_BUILD_ROOT%{_datadir}/%{name}/build/rpm %{__mkdir} -p $RPM_BUILD_ROOT%{_datadir}/%{name}/build/tgz diff --git a/htdocs/compta/facture.php b/htdocs/compta/facture.php index 5963d2b13ec..39c202065b9 100644 --- a/htdocs/compta/facture.php +++ b/htdocs/compta/facture.php @@ -949,7 +949,7 @@ else if ($action == 'add' && $user->rights->facture->creer) else if (($action == 'addline' || $action == 'addline_predef') && $user->rights->facture->creer) { $langs->load('errors'); - $error = false; + $error = 0; $idprod=GETPOST('idprod', 'int'); $product_desc = (GETPOST('product_desc')?GETPOST('product_desc'):(GETPOST('np_desc')?GETPOST('np_desc'):(GETPOST('dp_desc')?GETPOST('dp_desc'):''))); @@ -959,12 +959,12 @@ else if (($action == 'addline' || $action == 'addline_predef') && $user->rights- if ((empty($idprod) || GETPOST('usenewaddlineform')) && ($price_ht < 0) && (GETPOST('qty') < 0)) { setEventMessage($langs->trans('ErrorBothFieldCantBeNegative', $langs->transnoentitiesnoconv('UnitPriceHT'), $langs->transnoentitiesnoconv('Qty')), 'errors'); - $error = true; + $error++; } if (empty($idprod) && GETPOST('type') < 0) { setEventMessage($langs->trans('ErrorFieldRequired', $langs->transnoentitiesnoconv('Type')), 'errors'); - $error = true; + $error++; } if ((empty($idprod) || GETPOST('usenewaddlineform')) && (!($price_ht >= 0) || $price_ht == '')) // Unit price can be 0 but not '' { @@ -974,12 +974,12 @@ else if (($action == 'addline' || $action == 'addline_predef') && $user->rights- if (! GETPOST('qty') && GETPOST('qty') == '') { setEventMessage($langs->trans('ErrorFieldRequired', $langs->transnoentitiesnoconv('Qty')), 'errors'); - $error = true; + $error++; } if (empty($idprod) && empty($product_desc)) { setEventMessage($langs->trans('ErrorFieldRequired', $langs->transnoentitiesnoconv('Description')), 'errors'); - $error = true; + $error++; } if (! $error && (GETPOST('qty') >= 0) && (! empty($product_desc) || ! empty($idprod))) diff --git a/htdocs/core/lib/pdf.lib.php b/htdocs/core/lib/pdf.lib.php index 0efb375c4f4..139dd9c7320 100644 --- a/htdocs/core/lib/pdf.lib.php +++ b/htdocs/core/lib/pdf.lib.php @@ -678,7 +678,7 @@ function pdf_pagefoot(&$pdf,$outputlangs,$paramfreetext,$fromcompany,$marge_bass $pdf->MultiCell($width, 3, $line, 0, $align, 0); $posy-=$freetextheight; } - + $pdf->SetY(-$posy); $pdf->line($dims['lm'], $dims['hk']-$posy, $dims['wk']-$dims['rm'], $dims['hk']-$posy); $posy--; @@ -798,7 +798,6 @@ function pdf_writelinedesc(&$pdf,$object,$i,$outputlangs,$w,$h,$posx,$posy,$hide $labelproductservice=pdf_getlinedesc($object,$i,$outputlangs,$hideref,$hidedesc,$issupplierline); // Description $pdf->writeHTMLCell($w, $h, $posx, $posy, $outputlangs->convToOutputCharset($labelproductservice), 0, 1); - return $labelproductservice; } } diff --git a/htdocs/core/modules/action/rapport.pdf.php b/htdocs/core/modules/action/rapport.pdf.php index 7bcbc8e8057..2318c10a550 100644 --- a/htdocs/core/modules/action/rapport.pdf.php +++ b/htdocs/core/modules/action/rapport.pdf.php @@ -42,6 +42,12 @@ class CommActionRapport var $title; var $subject; + var $marge_gauche; + var $marge_droite; + var $marge_haute; + var $marge_basse; + + /** * Constructor * @@ -51,7 +57,7 @@ class CommActionRapport */ function __construct($db, $month, $year) { - global $langs; + global $conf,$langs; $langs->load("commercial"); $this->db = $db; @@ -66,10 +72,10 @@ class CommActionRapport $this->page_largeur = $formatarray['width']; $this->page_hauteur = $formatarray['height']; $this->format = array($this->page_largeur,$this->page_hauteur); - $this->marge_gauche=5; - $this->marge_droite=5; - $this->marge_haute=10; - $this->marge_basse=10; + $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->title=$langs->transnoentitiesnoconv("ActionsReport").' '.$this->year."-".$this->month; $this->subject=$langs->transnoentitiesnoconv("ActionsReport").' '.$this->year."-".$this->month; @@ -113,7 +119,8 @@ class CommActionRapport { $pdf=pdf_getInstance($this->format); $heightforinfotot = 50; // Height reserved to output the info and total part - $heightforfooter = 25; // Height reserved to output the footer (value include bottom margin) + $heightforfreetext= 5; // Height reserved to output the free text on last page + $heightforfooter = $this->marge_basse + 10; // Height reserved to output the footer (value include bottom margin) $pdf->SetAutoPageBreak(1,0); if (class_exists('TCPDF')) diff --git a/htdocs/core/modules/cheque/pdf/pdf_blochet.class.php b/htdocs/core/modules/cheque/pdf/pdf_blochet.class.php index 4c86e9db9d8..73e3107a3d5 100644 --- a/htdocs/core/modules/cheque/pdf/pdf_blochet.class.php +++ b/htdocs/core/modules/cheque/pdf/pdf_blochet.class.php @@ -60,10 +60,10 @@ class BordereauChequeBlochet extends ModeleChequeReceipts $this->page_largeur = $formatarray['width']; $this->page_hauteur = $formatarray['height']; $this->format = array($this->page_largeur,$this->page_hauteur); - $this->marge_gauche=10; - $this->marge_droite=20; - $this->marge_haute=10; - $this->marge_basse=10; + $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; // Recupere emmetteur $this->emetteur=$mysoc; @@ -116,7 +116,8 @@ class BordereauChequeBlochet extends ModeleChequeReceipts // Create PDF instance $pdf=pdf_getInstance($this->format); $heightforinfotot = 50; // Height reserved to output the info and total part - $heightforfooter = 25; // Height reserved to output the footer (value include bottom margin) + $heightforfreetext= 5; // Height reserved to output the free text on last page + $heightforfooter = $this->marge_basse + 10; // Height reserved to output the footer (value include bottom margin) $pdf->SetAutoPageBreak(1,0); if (class_exists('TCPDF')) diff --git a/htdocs/core/modules/commande/doc/pdf_einstein.modules.php b/htdocs/core/modules/commande/doc/pdf_einstein.modules.php index ed4446f0661..81192c56b16 100644 --- a/htdocs/core/modules/commande/doc/pdf_einstein.modules.php +++ b/htdocs/core/modules/commande/doc/pdf_einstein.modules.php @@ -78,10 +78,10 @@ class pdf_einstein extends ModelePDFCommandes $this->page_largeur = $formatarray['width']; $this->page_hauteur = $formatarray['height']; $this->format = array($this->page_largeur,$this->page_hauteur); - $this->marge_gauche=10; - $this->marge_droite=10; - $this->marge_haute=10; - $this->marge_basse=10; + $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 @@ -98,7 +98,7 @@ class pdf_einstein extends ModelePDFCommandes // Get source company $this->emetteur=$mysoc; - if (! $this->emetteur->country_code) $this->emetteur->country_code=substr($langs->defaultlang,-2); // By default, if was not defined + if (empty($this->emetteur->country_code)) $this->emetteur->country_code=substr($langs->defaultlang,-2); // By default, if was not defined // Define position of columns $this->posxdesc=$this->marge_gauche+1; @@ -126,13 +126,13 @@ class pdf_einstein extends ModelePDFCommandes /** * Function to build pdf onto disk * - * @param int $object Id of object to generate - * @param object $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 - * @param object $hookmanager Hookmanager object + * @param Object $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 + * @param object $hookmanager Hookmanager object * @return int 1=OK, 0=KO */ function write_file($object,$outputlangs,$srctemplatepath='',$hidedetails=0,$hidedesc=0,$hideref=0,$hookmanager=false) @@ -184,9 +184,11 @@ class pdf_einstein extends ModelePDFCommandes { $nblignes = count($object->lines); - $pdf=pdf_getInstance($this->format); - $heightforinfotot = 50; // Height reserved to output the info and total part (value include bottom margin) - $heightforfooter = 25; // Height reserved to output the footer (value include bottom margin) + // Create pdf instance + $pdf=pdf_getInstance($this->format); + $heightforinfotot = 50; // Height reserved to output the info and total part + $heightforfreetext= 5; // Height reserved to output the free text on last page + $heightforfooter = $this->marge_basse + 10; // Height reserved to output the footer (value include bottom margin) $pdf->SetAutoPageBreak(1,0); if (class_exists('TCPDF')) @@ -273,12 +275,45 @@ class pdf_einstein extends ModelePDFCommandes $pdf->SetTextColor(0,0,0); $pdf->setTopMargin($tab_top_newpage); - $pdf->setPageOrientation('', 1, $heightforfooter+$heightforinfotot); // The only function to edit the bottom margin of current page to set it. + $pdf->setPageOrientation('', 1, $heightforfooter+$heightforfreetext+$heightforinfotot); // The only function to edit the bottom margin of current page to set it. $pageposbefore=$pdf->getPage(); // Description of product line $curX = $this->posxdesc-1; + + $showpricebeforepagebreak=1; + + $pdf->startTransaction(); pdf_writelinedesc($pdf,$object,$i,$outputlangs,$this->posxtva-$curX,3,$curX,$curY,$hideref,$hidedesc,0,$hookmanager); + $pageposafter=$pdf->getPage(); + if ($pageposafter > $pageposbefore) // There is a pagebreak + { + $pdf->rollbackTransaction(true); + $pageposafter=$pageposbefore; + //print $pageposafter.'-'.$pageposbefore;exit; + $pdf->setPageOrientation('', 1, $heightforfooter); // The only function to edit the bottom margin of current page to set it. + pdf_writelinedesc($pdf,$object,$i,$outputlangs,$this->posxtva-$curX,4,$curX,$curY,$hideref,$hidedesc,0,$hookmanager); + $posyafter=$pdf->GetY(); + if ($posyafter > ($this->page_hauteur - ($heightforfooter+$heightforfreetext+$heightforinfotot))) // There is no space left for total+free text + { + if ($i == ($nblignes-1)) // No more lines, and no space left to show total, so we create a new page + { + $pdf->AddPage('','',true); + if (! empty($tplidx)) $pdf->useTemplate($tplidx); + if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) $this->_pagehead($pdf, $object, 0, $outputlangs, $hookmanager); + $pdf->setPage($pagenb+1); + } + } + else + { + // We found a page break + $showpricebeforepagebreak=0; + } + } + else // No pagebreak + { + $pdf->commitTransaction(); + } $nexY = $pdf->GetY(); $pageposafter=$pdf->getPage(); @@ -287,7 +322,7 @@ class pdf_einstein extends ModelePDFCommandes $pdf->setPageOrientation('', 1, 0); // The only function to edit the bottom margin of current page to set it. // We suppose that a too long description is moved completely on next page - if ($pageposafter > $pageposbefore) { + if ($pageposafter > $pageposbefore && empty($showpricebeforepagebreak)) { $pdf->setPage($pageposafter); $curY = $tab_top_newpage; } @@ -388,13 +423,13 @@ class pdf_einstein extends ModelePDFCommandes // Show square if ($pagenb == 1) { - $this->_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforinfotot - $heightforfooter, 0, $outputlangs, 0, 0); - $bottomlasttab=$this->page_hauteur - $heightforinfotot - $heightforfooter + 1; + $this->_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforinfotot - $heightforfreetext - $heightforfooter, 0, $outputlangs, 0, 0); + $bottomlasttab=$this->page_hauteur - $heightforinfotot - $heightforfreetext - $heightforfooter + 1; } else { - $this->_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforinfotot - $heightforfooter, 0, $outputlangs, 1, 0); - $bottomlasttab=$this->page_hauteur - $heightforinfotot - $heightforfooter + 1; + $this->_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforinfotot - $heightforfreetext - $heightforfooter, 0, $outputlangs, 1, 0); + $bottomlasttab=$this->page_hauteur - $heightforinfotot - $heightforfreetext - $heightforfooter + 1; } // Affiche zone infos @@ -819,7 +854,7 @@ class pdf_einstein extends ModelePDFCommandes * @param string $tab_height Height of table (rectangle) * @param int $nexY Y (not used) * @param Translate $outputlangs Langs object - * @param int $hidetop Hide top bar of array + * @param int $hidetop 1=Hide top bar of array and title, 0=Hide nothing, -1=Hide only title * @param int $hidebottom Hide bottom bar of array * @return void */ diff --git a/htdocs/core/modules/expedition/doc/pdf_expedition_merou.modules.php b/htdocs/core/modules/expedition/doc/pdf_expedition_merou.modules.php index 956bde9a7f6..3f866e4a2fd 100644 --- a/htdocs/core/modules/expedition/doc/pdf_expedition_merou.modules.php +++ b/htdocs/core/modules/expedition/doc/pdf_expedition_merou.modules.php @@ -56,10 +56,10 @@ class pdf_expedition_merou extends ModelePdfExpedition $this->page_largeur = $formatarray['width']; $this->page_hauteur = round($formatarray['height']/2); $this->format = array($this->page_largeur,$this->page_hauteur); - $this->marge_gauche=10; - $this->marge_droite=10; - $this->marge_haute=10; - $this->marge_basse=10; + $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; @@ -148,7 +148,8 @@ class pdf_expedition_merou extends ModelePdfExpedition $pdf=pdf_getInstance($this->format,'mm','l'); $heightforinfotot = 0; // Height reserved to output the info and total part - $heightforfooter = 28; // Height reserved to output the footer (value include bottom margin) + $heightforfreetext= 5; // Height reserved to output the free text on last page + $heightforfooter = $this->marge_basse + 10; // Height reserved to output the footer (value include bottom margin) $pdf->SetAutoPageBreak(1,0); if (class_exists('TCPDF')) @@ -281,13 +282,13 @@ class pdf_expedition_merou extends ModelePdfExpedition // Show square if ($pagenb == 1) { - $this->_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforinfotot - $heightforfooter, 0, $outputlangs, 0, 0); - $bottomlasttab=$this->page_hauteur - $heightforinfotot - $heightforfooter + 1; + $this->_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforinfotot - $heightforfreetext - $heightforfooter, 0, $outputlangs, 0, 0); + $bottomlasttab=$this->page_hauteur - $heightforinfotot - $heightforfreetext - $heightforfooter + 1; } else { - $this->_tableau($pdf, $tab_top_newpage - 1, $this->page_hauteur - $tab_top_newpage - $heightforinfotot - $heightforfooter, 0, $outputlangs, 1, 0); - $bottomlasttab=$this->page_hauteur - $heightforinfotot - $heightforfooter + 1; + $this->_tableau($pdf, $tab_top_newpage - 1, $this->page_hauteur - $tab_top_newpage - $heightforinfotot - $heightforfreetext - $heightforfooter, 0, $outputlangs, 1, 0); + $bottomlasttab=$this->page_hauteur - $heightforinfotot - $heightforfreetext - $heightforfooter + 1; } // Pied de page diff --git a/htdocs/core/modules/expedition/doc/pdf_expedition_rouget.modules.php b/htdocs/core/modules/expedition/doc/pdf_expedition_rouget.modules.php index 0998af96c34..6799179a7e2 100644 --- a/htdocs/core/modules/expedition/doc/pdf_expedition_rouget.modules.php +++ b/htdocs/core/modules/expedition/doc/pdf_expedition_rouget.modules.php @@ -55,10 +55,10 @@ class pdf_expedition_rouget extends ModelePdfExpedition $this->page_largeur = $formatarray['width']; $this->page_hauteur = $formatarray['height']; $this->format = array($this->page_largeur,$this->page_hauteur); - $this->marge_gauche=10; - $this->marge_droite=10; - $this->marge_haute=10; - $this->marge_basse=10; + $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; @@ -134,7 +134,8 @@ class pdf_expedition_rouget extends ModelePdfExpedition $pdf=pdf_getInstance($this->format); $heightforinfotot = 0; // Height reserved to output the info and total part - $heightforfooter = 25; // Height reserved to output the footer (value include bottom margin) + $heightforfreetext= 5; // Height reserved to output the free text on last page + $heightforfooter = $this->marge_basse + 10; // Height reserved to output the footer (value include bottom margin) $pdf->SetAutoPageBreak(1,0); if (class_exists('TCPDF')) @@ -236,7 +237,7 @@ class pdf_expedition_rouget extends ModelePdfExpedition $pdf->SetTextColor(0,0,0); $pdf->setTopMargin($tab_top_newpage); - $pdf->setPageOrientation('', 1, $heightforfooter+$heightforinfotot); // The only function to edit the bottom margin of current page to set it. + $pdf->setPageOrientation('', 1, $heightforfooter+$heightforfreetext+$heightforinfotot); // The only function to edit the bottom margin of current page to set it. $pageposbefore=$pdf->getPage(); // Description de la ligne produit @@ -301,13 +302,13 @@ class pdf_expedition_rouget extends ModelePdfExpedition // Show square if ($pagenb == 1) { - $this->_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforfooter - $heightforinfotot, 0, $outputlangs, 0, 0); - $bottomlasttab=$this->page_hauteur - $heightforfooter - $heightforinfotot + 1; + $this->_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforfooter - $heightforfreetext - $heightforinfotot, 0, $outputlangs, 0, 0); + $bottomlasttab=$this->page_hauteur - $heightforfooter - $heightforfreetext - $heightforinfotot + 1; } else { - $this->_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforfooter - $heightforinfotot, 0, $outputlangs, 1, 0); - $bottomlasttab=$this->page_hauteur - $heightforfooter - $heightforinfotot + 1; + $this->_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforfooter - $heightforfreetext - $heightforinfotot, 0, $outputlangs, 1, 0); + $bottomlasttab=$this->page_hauteur - $heightforfooter - $heightforfreetext - $heightforinfotot + 1; } // Pied de page @@ -541,8 +542,9 @@ class pdf_expedition_rouget extends ModelePdfExpedition { // Sender properties $carac_emetteur=''; - // Add internal contact of proposal if defined - $arrayidcontact=$object->$origin->getIdContact('internal','SALESREPFOLL'); + // Add internal contact of origin element if defined + $arrayidcontact=array(); + if (! empty($origin) && is_object($object->$origin)) $arrayidcontact=$object->$origin->getIdContact('internal','SALESREPFOLL'); if (count($arrayidcontact) > 0) { $object->fetch_user($arrayidcontact[0]); diff --git a/htdocs/core/modules/facture/doc/doc_generic_invoice_odt.modules.php b/htdocs/core/modules/facture/doc/doc_generic_invoice_odt.modules.php index 12e4fc86119..807eaef314b 100644 --- a/htdocs/core/modules/facture/doc/doc_generic_invoice_odt.modules.php +++ b/htdocs/core/modules/facture/doc/doc_generic_invoice_odt.modules.php @@ -157,8 +157,8 @@ class doc_generic_invoice_odt extends ModelePDFFactures 'line_price_ht'=>price($line->total_ht, 0, $outputlangs), 'line_price_ttc'=>price($line->total_ttc, 0, $outputlangs), 'line_price_vat'=>price($line->total_tva, 0, $outputlangs), - 'line_date_start'=>$line->date_start, - 'line_date_end'=>$line->date_end + 'line_date_start'=>dol_print_date($line->date_start, 'day', false, $outputlangs), + 'line_date_end'=>dol_print_date($line->date_end, 'day', false, $outputlangs), ); } @@ -381,7 +381,14 @@ class doc_generic_invoice_odt extends ModelePDFFactures } // Make substitutions into odt of user info - $tmparray=$this->get_substitutionarray_user($user,$outputlangs); + $array_user=$this->get_substitutionarray_user($user,$outputlangs); + $array_soc=$this->get_substitutionarray_mysoc($mysoc,$outputlangs); + $array_thirdparty=$this->get_substitutionarray_thirdparty($socobject,$outputlangs); + $array_objet=$this->get_substitutionarray_object($object,$outputlangs); + + $tmparray = array_merge($array_user,$array_soc,$array_thirdparty,$array_objet); + complete_substitutions_array($tmparray, $outputlangs, $object); + //var_dump($tmparray); exit; foreach($tmparray as $key=>$value) { @@ -400,66 +407,6 @@ class doc_generic_invoice_odt extends ModelePDFFactures catch(OdfException $e) { } - } - // Make substitutions into odt of mysoc - $tmparray=$this->get_substitutionarray_mysoc($mysoc,$outputlangs); - //var_dump($tmparray); exit; - foreach($tmparray as $key=>$value) - { - try { - if (preg_match('/logo$/',$key)) // Image - { - //var_dump($value);exit; - if (file_exists($value)) $odfHandler->setImage($key, $value); - else $odfHandler->setVars($key, 'ErrorFileNotFound', true, 'UTF-8'); - } - else // Text - { - $odfHandler->setVars($key, $value, true, 'UTF-8'); - } - } - catch(OdfException $e) - { - } - } - // Make substitutions into odt of thirdparty - $tmparray=$this->get_substitutionarray_thirdparty($socobject,$outputlangs); - foreach($tmparray as $key=>$value) - { - try { - if (preg_match('/logo$/',$key)) // Image - { - if (file_exists($value)) $odfHandler->setImage($key, $value); - else $odfHandler->setVars($key, 'ErrorFileNotFound', true, 'UTF-8'); - } - else // Text - { - $odfHandler->setVars($key, $value, true, 'UTF-8'); - } - } - catch(OdfException $e) - { - } - } - // Replace tags of object + external modules - $tmparray=$this->get_substitutionarray_object($object,$outputlangs); - complete_substitutions_array($tmparray, $outputlangs, $object); - foreach($tmparray as $key=>$value) - { - try { - if (preg_match('/logo$/',$key)) // Image - { - if (file_exists($value)) $odfHandler->setImage($key, $value); - else $odfHandler->setVars($key, 'ErrorFileNotFound', true, 'UTF-8'); - } - else // Text - { - $odfHandler->setVars($key, $value, true, 'UTF-8'); - } - } - catch(OdfException $e) - { - } } // Replace tags of lines try diff --git a/htdocs/core/modules/facture/doc/pdf_crabe.modules.php b/htdocs/core/modules/facture/doc/pdf_crabe.modules.php index cb9c5177b08..fae70279621 100755 --- a/htdocs/core/modules/facture/doc/pdf_crabe.modules.php +++ b/htdocs/core/modules/facture/doc/pdf_crabe.modules.php @@ -78,10 +78,10 @@ class pdf_crabe extends ModelePDFFactures $this->page_largeur = $formatarray['width']; $this->page_hauteur = $formatarray['height']; $this->format = array($this->page_largeur,$this->page_hauteur); - $this->marge_gauche=10; - $this->marge_droite=10; - $this->marge_haute=10; - $this->marge_basse=10; + $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 @@ -187,7 +187,8 @@ class pdf_crabe extends ModelePDFFactures $pdf=pdf_getInstance($this->format); $heightforinfotot = 50; // Height reserved to output the info and total part - $heightforfooter = 25; // Height reserved to output the footer (value include bottom margin) + $heightforfreetext= 5; // Height reserved to output the free text on last page + $heightforfooter = $this->marge_basse + 10; // Height reserved to output the footer (value include bottom margin) $pdf->SetAutoPageBreak(1,0); if (class_exists('TCPDF')) @@ -252,8 +253,6 @@ class pdf_crabe extends ModelePDFFactures // Rect prend une longueur en 3eme param $pdf->SetDrawColor(192,192,192); - //print $pdf->getStringHeight(200,'SPECIMEN',false,false); - //print "$this->marge_gauche, $tab_top-1, $this->page_largeur-$this->marge_gauche-$this->marge_droite, $height_note+1";exit; $pdf->Rect($this->marge_gauche, $tab_top-1, $this->page_largeur-$this->marge_gauche-$this->marge_droite, $height_note+1); $tab_height = $tab_height - $height_note; @@ -276,12 +275,47 @@ class pdf_crabe extends ModelePDFFactures $pdf->SetTextColor(0,0,0); $pdf->setTopMargin($tab_top_newpage); - $pdf->setPageOrientation('', 1, $heightforfooter+$heightforinfotot); // The only function to edit the bottom margin of current page to set it. + $pdf->setPageOrientation('', 1, $heightforfooter+$heightforfreetext+$heightforinfotot); // The only function to edit the bottom margin of current page to set it. $pageposbefore=$pdf->getPage(); // Description of product line $curX = $this->posxdesc-1; + + $showpricebeforepagebreak=1; + + $pdf->startTransaction(); pdf_writelinedesc($pdf,$object,$i,$outputlangs,$this->posxtva-$curX,3,$curX,$curY,$hideref,$hidedesc,0,$hookmanager); + $pageposafter=$pdf->getPage(); + if ($pageposafter > $pageposbefore) // There is a pagebreak + { + $pdf->rollbackTransaction(true); + $pageposafter=$pageposbefore; + //print $pageposafter.'-'.$pageposbefore;exit; + $pdf->setPageOrientation('', 1, $heightforfooter); // The only function to edit the bottom margin of current page to set it. + pdf_writelinedesc($pdf,$object,$i,$outputlangs,$this->posxtva-$curX,4,$curX,$curY,$hideref,$hidedesc,0,$hookmanager); + $pageposafter=$pdf->getPage(); + $posyafter=$pdf->GetY(); + //var_dump($posyafter); var_dump(($this->page_hauteur - ($heightforfooter+$heightforfreetext+$heightforinfotot))); exit; + if ($posyafter > ($this->page_hauteur - ($heightforfooter+$heightforfreetext+$heightforinfotot))) // There is no space left for total+free text + { + if ($i == ($nblignes-1)) // No more lines, and no space left to show total, so we create a new page + { + $pdf->AddPage('','',true); + if (! empty($tplidx)) $pdf->useTemplate($tplidx); + if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) $this->_pagehead($pdf, $object, 0, $outputlangs, $hookmanager); + $pdf->setPage($pagenb+1); + } + } + else + { + // We found a page break + $showpricebeforepagebreak=0; + } + } + else // No pagebreak + { + $pdf->commitTransaction(); + } $nexY = $pdf->GetY(); $pageposafter=$pdf->getPage(); @@ -290,7 +324,7 @@ class pdf_crabe extends ModelePDFFactures $pdf->setPageOrientation('', 1, 0); // The only function to edit the bottom margin of current page to set it. // We suppose that a too long description is moved completely on next page - if ($pageposafter > $pageposbefore) { + if ($pageposafter > $pageposbefore && empty($showpricebeforepagebreak)) { $pdf->setPage($pageposafter); $curY = $tab_top_newpage; } @@ -390,13 +424,13 @@ class pdf_crabe extends ModelePDFFactures // Show square if ($pagenb == 1) { - $this->_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforinfotot - $heightforfooter, 0, $outputlangs, 0, 0); - $bottomlasttab=$this->page_hauteur - $heightforinfotot - $heightforfooter + 1; + $this->_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforinfotot - $heightforfreetext - $heightforfooter, 0, $outputlangs, 0, 0); + $bottomlasttab=$this->page_hauteur - $heightforinfotot - $heightforfreetext - $heightforfooter + 1; } else { - $this->_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforinfotot - $heightforfooter, 0, $outputlangs, 1, 0); - $bottomlasttab=$this->page_hauteur - $heightforinfotot - $heightforfooter + 1; + $this->_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforinfotot - $heightforfreetext - $heightforfooter, 0, $outputlangs, 1, 0); + $bottomlasttab=$this->page_hauteur - $heightforinfotot - $heightforfreetext - $heightforfooter + 1; } // Affiche zone infos @@ -466,14 +500,18 @@ class pdf_crabe extends ModelePDFFactures $tab3_top = $posy + 8; $tab3_width = 80; $tab3_height = 4; + if ($this->page_largeur < 210) // To work with US executive format + { + $tab3_posx -= 20; + } $default_font_size = pdf_getPDFFontSize($outputlangs); - $pdf->SetFont('','', $default_font_size - 2); - $pdf->SetXY($tab3_posx, $tab3_top - 5); - $pdf->MultiCell(60, 5, $outputlangs->transnoentities("PaymentsAlreadyDone"), 0, 'L', 0); + $pdf->SetFont('','', $default_font_size - 3); + $pdf->SetXY($tab3_posx, $tab3_top - 4); + $pdf->MultiCell(60, 3, $outputlangs->transnoentities("PaymentsAlreadyDone"), 0, 'L', 0); - $pdf->line($tab3_posx, $tab3_top-1+$tab3_height, $tab3_posx+$tab3_width, $tab3_top-1+$tab3_height); + $pdf->line($tab3_posx, $tab3_top, $tab3_posx+$tab3_width, $tab3_top); $pdf->SetFont('','', $default_font_size - 4); $pdf->SetXY($tab3_posx, $tab3_top); @@ -485,6 +523,8 @@ class pdf_crabe extends ModelePDFFactures $pdf->SetXY($tab3_posx+58, $tab3_top); $pdf->MultiCell(20, 3, $outputlangs->transnoentities("Num"), 0, 'L', 0); + $pdf->line($tab3_posx, $tab3_top-1+$tab3_height, $tab3_posx+$tab3_width, $tab3_top-1+$tab3_height); + $y=0; $pdf->SetFont('','', $default_font_size - 4); diff --git a/htdocs/core/modules/fichinter/doc/pdf_soleil.modules.php b/htdocs/core/modules/fichinter/doc/pdf_soleil.modules.php index f5b42c904c1..723b766daa9 100644 --- a/htdocs/core/modules/fichinter/doc/pdf_soleil.modules.php +++ b/htdocs/core/modules/fichinter/doc/pdf_soleil.modules.php @@ -71,10 +71,10 @@ class pdf_soleil extends ModelePDFFicheinter $this->page_largeur = $formatarray['width']; $this->page_hauteur = $formatarray['height']; $this->format = array($this->page_largeur,$this->page_hauteur); - $this->marge_gauche=10; - $this->marge_droite=10; - $this->marge_haute=10; - $this->marge_basse=10; + $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 = 0; // Gere option tva FACTURE_TVAOPTION @@ -141,7 +141,8 @@ class pdf_soleil extends ModelePDFFicheinter { $pdf=pdf_getInstance($this->format); $heightforinfotot = 50; // Height reserved to output the info and total part - $heightforfooter = 25; // Height reserved to output the footer (value include bottom margin) + $heightforfreetext= 5; // Height reserved to output the free text on last page + $heightforfooter = $this->marge_basse + 10; // Height reserved to output the footer (value include bottom margin) $pdf->SetAutoPageBreak(1,0); if (class_exists('TCPDF')) @@ -249,7 +250,7 @@ class pdf_soleil extends ModelePDFFicheinter $pdf->SetTextColor(0,0,0); $pdf->setTopMargin($tab_top_newpage); - $pdf->setPageOrientation('', 1, $heightforfooter+$heightforinfotot); // The only function to edit the bottom margin of current page to set it. + $pdf->setPageOrientation('', 1, $heightforfooter+$heightforfreetext+$heightforinfotot); // The only function to edit the bottom margin of current page to set it. $pageposbefore=$pdf->getPage(); // Description of product line @@ -310,12 +311,12 @@ class pdf_soleil extends ModelePDFFicheinter // Show square if ($pagenb == 1) { - $this->_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforinfotot - $heightforfooter, 0, $outputlangs, 0, 0); + $this->_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforinfotot - $heightforfreetext - $heightforfooter, 0, $outputlangs, 0, 0); $bottomlasttab=$this->page_hauteur - $heightforfooter - $heightforfooter + 1; } else { - $this->_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforinfotot - $heightforfooter, 0, $outputlangs, 1, 0); + $this->_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforinfotot - $heightforfreetext - $heightforfooter, 0, $outputlangs, 1, 0); $bottomlasttab=$this->page_hauteur - $heightforfooter - $heightforfooter + 1; } diff --git a/htdocs/core/modules/livraison/pdf/pdf_typhon.modules.php b/htdocs/core/modules/livraison/pdf/pdf_typhon.modules.php index 52da05fbfd2..9b0b79168b8 100644 --- a/htdocs/core/modules/livraison/pdf/pdf_typhon.modules.php +++ b/htdocs/core/modules/livraison/pdf/pdf_typhon.modules.php @@ -64,10 +64,10 @@ class pdf_typhon extends ModelePDFDeliveryOrder $this->page_largeur = $formatarray['width']; $this->page_hauteur = $formatarray['height']; $this->format = array($this->page_largeur,$this->page_hauteur); - $this->marge_gauche=10; - $this->marge_droite=10; - $this->marge_haute=10; - $this->marge_basse=10; + $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 FAC_PDF_LOGO $this->option_tva = 1; // Gere option tva FACTURE_TVAOPTION @@ -151,7 +151,8 @@ class pdf_typhon extends ModelePDFDeliveryOrder { $pdf=pdf_getInstance($this->format); $heightforinfotot = 50; // Height reserved to output the info and total part - $heightforfooter = 25; // Height reserved to output the footer (value include bottom margin) + $heightforfreetext= 5; // Height reserved to output the free text on last page + $heightforfooter = $this->marge_basse + 10; // Height reserved to output the footer (value include bottom margin) $pdf->SetAutoPageBreak(1,0); if (class_exists('TCPDF')) @@ -251,7 +252,7 @@ class pdf_typhon extends ModelePDFDeliveryOrder $pdf->SetTextColor(0,0,0); $pdf->setTopMargin($tab_top_newpage); - $pdf->setPageOrientation('', 1, $heightforfooter+$heightforinfotot-50); // The only function to edit the bottom margin of current page to set it. + $pdf->setPageOrientation('', 1, $heightforfooter+$heightforfreetext+$heightforinfotot); // The only function to edit the bottom margin of current page to set it. $pageposbefore=$pdf->getPage(); // Description of product line @@ -344,12 +345,12 @@ class pdf_typhon extends ModelePDFDeliveryOrder // Show square if ($pagenb == 1) { - $this->_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforinfotot - $heightforfooter, 0, $outputlangs, 0, 0); + $this->_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforinfotot - $heightforfreetext - $heightforfooter, 0, $outputlangs, 0, 0); $bottomlasttab=$this->page_hauteur - $heightforinfotot - $heightforfooter + 1; } else { - $this->_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforinfotot - $heightforfooter, 0, $outputlangs, 1, 0); + $this->_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforinfotot - $heightforfreetext - $heightforfooter, 0, $outputlangs, 1, 0); $bottomlasttab=$this->page_hauteur - $heightforinfotot - $heightforfooter + 1; } diff --git a/htdocs/core/modules/project/pdf/pdf_baleine.modules.php b/htdocs/core/modules/project/pdf/pdf_baleine.modules.php index 38337c4314e..b023097035b 100644 --- a/htdocs/core/modules/project/pdf/pdf_baleine.modules.php +++ b/htdocs/core/modules/project/pdf/pdf_baleine.modules.php @@ -62,10 +62,10 @@ class pdf_baleine extends ModelePDFProjects $this->page_largeur = $formatarray['width']; $this->page_hauteur = $formatarray['height']; $this->format = array($this->page_largeur,$this->page_hauteur); - $this->marge_gauche=10; - $this->marge_droite=10; - $this->marge_haute=10; - $this->marge_basse=10; + $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 FAC_PDF_LOGO $this->option_tva = 1; // Gere option tva FACTURE_TVAOPTION @@ -128,7 +128,8 @@ class pdf_baleine extends ModelePDFProjects { $pdf=pdf_getInstance($this->format); $heightforinfotot = 50; // Height reserved to output the info and total part - $heightforfooter = 25; // Height reserved to output the footer (value include bottom margin) + $heightforfreetext= 5; // Height reserved to output the free text on last page + $heightforfooter = $this->marge_basse + 10; // Height reserved to output the footer (value include bottom margin) $pdf->SetAutoPageBreak(1,0); if (class_exists('TCPDF')) @@ -265,13 +266,13 @@ class pdf_baleine extends ModelePDFProjects // Show square if ($pagenb == 1) { - $this->_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforinfotot - $heightforfooter, 0, $outputlangs, 0, 0); - $bottomlasttab=$this->page_hauteur - $heightforinfotot - $heightforfooter + 1; + $this->_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforinfotot - $heightforfreetext - $heightforfooter, 0, $outputlangs, 0, 0); + $bottomlasttab=$this->page_hauteur - $heightforinfotot - $heightforfreetext - $heightforfooter + 1; } else { - $this->_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforinfotot - $heightforfooter, 0, $outputlangs, 1, 0); - $bottomlasttab=$this->page_hauteur - $heightforinfotot - $heightforfooter + 1; + $this->_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforinfotot - $heightforfreetext - $heightforfooter, 0, $outputlangs, 1, 0); + $bottomlasttab=$this->page_hauteur - $heightforinfotot - $heightforfreetext - $heightforfooter + 1; } /* diff --git a/htdocs/core/modules/propale/doc/pdf_azur.modules.php b/htdocs/core/modules/propale/doc/pdf_azur.modules.php index 1258c0c5286..f805a2bf936 100644 --- a/htdocs/core/modules/propale/doc/pdf_azur.modules.php +++ b/htdocs/core/modules/propale/doc/pdf_azur.modules.php @@ -77,10 +77,10 @@ class pdf_azur extends ModelePDFPropales $this->page_largeur = $formatarray['width']; $this->page_hauteur = $formatarray['height']; $this->format = array($this->page_largeur,$this->page_hauteur); - $this->marge_gauche=10; - $this->marge_droite=10; - $this->marge_haute=10; - $this->marge_basse=10; + $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 @@ -97,7 +97,7 @@ class pdf_azur extends ModelePDFPropales // Get source company $this->emetteur=$mysoc; - if (! $this->emetteur->country_code) $this->emetteur->country_code=substr($langs->defaultlang,-2); // By default, if was not defined + if (empty($this->emetteur->country_code)) $this->emetteur->country_code=substr($langs->defaultlang,-2); // By default, if was not defined // Define position of columns $this->posxdesc=$this->marge_gauche+1; @@ -186,7 +186,8 @@ class pdf_azur extends ModelePDFPropales // Create pdf instance $pdf=pdf_getInstance($this->format); $heightforinfotot = 50; // Height reserved to output the info and total part - $heightforfooter = 25; // Height reserved to output the footer (value include bottom margin) + $heightforfreetext= 5; // Height reserved to output the free text on last page + $heightforfooter = $this->marge_basse + 10; // Height reserved to output the footer (value include bottom margin) $pdf->SetAutoPageBreak(1,0); if (class_exists('TCPDF')) @@ -234,10 +235,8 @@ class pdf_azur extends ModelePDFPropales $pdf->SetTextColor(0,0,0); $tab_top = 90; - $tab_top_middlepage = (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)?42:10); $tab_top_newpage = (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)?42:10); $tab_height = 130; - $tab_height_middlepage = 200; $tab_height_newpage = 150; // Affiche notes @@ -274,7 +273,7 @@ class pdf_azur extends ModelePDFPropales $pdf->SetTextColor(0,0,0); $pdf->setTopMargin($tab_top_newpage); - $pdf->setPageOrientation('', 1, $heightforfooter+$heightforinfotot); // The only function to edit the bottom margin of current page to set it. + $pdf->setPageOrientation('', 1, $heightforfooter+$heightforfreetext+$heightforinfotot); // The only function to edit the bottom margin of current page to set it. $pageposbefore=$pdf->getPage(); // Description of product line @@ -283,7 +282,7 @@ class pdf_azur extends ModelePDFPropales $showpricebeforepagebreak=1; $pdf->startTransaction(); - pdf_writelinedesc($pdf,$object,$i,$outputlangs,$this->posxtva-$curX,4,$curX,$curY,$hideref,$hidedesc,0,$hookmanager); + pdf_writelinedesc($pdf,$object,$i,$outputlangs,$this->posxtva-$curX,3,$curX,$curY,$hideref,$hidedesc,0,$hookmanager); $pageposafter=$pdf->getPage(); if ($pageposafter > $pageposbefore) // There is a pagebreak { @@ -293,7 +292,8 @@ class pdf_azur extends ModelePDFPropales $pdf->setPageOrientation('', 1, $heightforfooter); // The only function to edit the bottom margin of current page to set it. pdf_writelinedesc($pdf,$object,$i,$outputlangs,$this->posxtva-$curX,4,$curX,$curY,$hideref,$hidedesc,0,$hookmanager); $pageposafter=$pdf->getPage(); - if ($pageposafter == $pageposbefore) // There is no pagebreak after second try with small margin + $posyafter=$pdf->GetY(); + if ($posyafter > ($this->page_hauteur - ($heightforfooter+$heightforfreetext+$heightforinfotot))) // There is no space left for total+free text { if ($i == ($nblignes-1)) // No more lines, and no space left to show total, so we create a new page { @@ -332,31 +332,31 @@ class pdf_azur extends ModelePDFPropales { $vat_rate = pdf_getlinevatrate($object, $i, $outputlangs, $hidedetails, $hookmanager); $pdf->SetXY($this->posxtva, $curY); - $pdf->MultiCell($this->posxup-$this->posxtva-1, 4, $vat_rate, 0, 'R'); + $pdf->MultiCell($this->posxup-$this->posxtva-1, 3, $vat_rate, 0, 'R'); } // Unit price before discount $up_excl_tax = pdf_getlineupexcltax($object, $i, $outputlangs, $hidedetails, $hookmanager); $pdf->SetXY($this->posxup, $curY); - $pdf->MultiCell($this->posxqty-$this->posxup-1, 4, $up_excl_tax, 0, 'R', 0); + $pdf->MultiCell($this->posxqty-$this->posxup-1, 3, $up_excl_tax, 0, 'R', 0); // Quantity $qty = pdf_getlineqty($object, $i, $outputlangs, $hidedetails, $hookmanager); $pdf->SetXY($this->posxqty, $curY); - $pdf->MultiCell($this->posxdiscount-$this->posxqty-1, 4, $qty, 0, 'R'); + $pdf->MultiCell($this->posxdiscount-$this->posxqty-1, 3, $qty, 0, 'R'); // Enough for 6 chars // Discount on line - $pdf->SetXY($this->posxdiscount, $curY); if ($object->lines[$i]->remise_percent) { + $pdf->SetXY($this->posxdiscount-2, $curY); $remise_percent = pdf_getlineremisepercent($object, $i, $outputlangs, $hidedetails, $hookmanager); - $pdf->MultiCell($this->postotalht-$this->posxdiscount-1, 4, $remise_percent, 0, 'R'); + $pdf->MultiCell($this->postotalht-$this->posxdiscount+2, 3, $remise_percent, 0, 'R'); } // Total HT line $total_excl_tax = pdf_getlinetotalexcltax($object, $i, $outputlangs, $hidedetails, $hookmanager); $pdf->SetXY($this->postotalht, $curY); - $pdf->MultiCell($this->page_largeur-$this->marge_droite-$this->postotalht, 4, $total_excl_tax, 0, 'R', 0); + $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 $tvaligne=$object->lines[$i]->total_tva; @@ -421,13 +421,13 @@ class pdf_azur extends ModelePDFPropales // Show square if ($pagenb == 1) { - $this->_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforinfotot - $heightforfooter, 0, $outputlangs, 0, 0); - $bottomlasttab=$this->page_hauteur - $heightforinfotot - $heightforfooter + 1; + $this->_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforinfotot - $heightforfreetext - $heightforfooter, 0, $outputlangs, 0, 0); + $bottomlasttab=$this->page_hauteur - $heightforinfotot - $heightforfreetext - $heightforfooter + 1; } else { - $this->_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforinfotot - $heightforfooter, 0, $outputlangs, 1, 0); - $bottomlasttab=$this->page_hauteur - $heightforinfotot - $heightforfooter + 1; + $this->_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforinfotot - $heightforfreetext - $heightforfooter, 0, $outputlangs, 1, 0); + $bottomlasttab=$this->page_hauteur - $heightforinfotot - $heightforfreetext - $heightforfooter + 1; } // Affiche zone infos @@ -489,7 +489,7 @@ class pdf_azur extends ModelePDFPropales * Show payments table * * @param PDF &$pdf Object PDF - * @param Object $object Object invoice + * @param Object $object Object proposal * @param int $posy Position y in PDF * @param Translate $outputlangs Object langs for output * @return int <0 if KO, >0 if OK @@ -560,7 +560,7 @@ class pdf_azur extends ModelePDFPropales } // Show payments conditions - if (empty($conf->global->PROPALE_PDF_HIDE_PAYMENTERMCOND) && ($object->cond_reglement_code || $object->cond_reglement)) + if (empty($conf->global->PROPALE_PDF_HIDE_PAYMENTTERMCOND) && ($object->cond_reglement_code || $object->cond_reglement)) { $pdf->SetFont('','B', $default_font_size - 2); $pdf->SetXY($this->marge_gauche, $posy); @@ -576,7 +576,7 @@ class pdf_azur extends ModelePDFPropales $posy=$pdf->GetY()+3; } - if (empty($conf->global->PROPALE_PDF_HIDE_PAYMENTERMCOND)) + if (empty($conf->global->PROPALE_PDF_HIDE_PAYMENTTERMCOND)) { // Check a payment mode is defined /* Not required on a proposal @@ -696,6 +696,7 @@ class pdf_azur extends ModelePDFPropales } $largcol2 = ($this->page_largeur - $this->marge_droite - $col2x); + $useborder=0; $index = 0; // Total HT @@ -704,7 +705,7 @@ class pdf_azur extends ModelePDFPropales $pdf->MultiCell($col2x-$col1x, $tab2_hl, $outputlangs->transnoentities("TotalHT"), 0, 'L', 1); $pdf->SetXY($col2x, $tab2_top + 0); - $pdf->MultiCell($largcol2, $tab2_hl, price($object->total_ht + $object->remise), 0, 'R', 1); + $pdf->MultiCell($largcol2, $tab2_hl, price($object->total_ht + (! empty($object->remise)?$object->remise:0)), 0, 'R', 1); // Show VAT by rates and total $pdf->SetFillColor(248,248,248); @@ -757,9 +758,9 @@ class pdf_azur extends ModelePDFPropales { $index++; $pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index); - $pdf->MultiCell($col2x-$col1x, $tab2_hl, $outputlangs->transnoentities("TotalLT1".$mysoc->pays_code), 0, 'L', 1); + $pdf->MultiCell($col2x-$col1x, $tab2_hl, $outputlangs->transnoentities("TotalLT1".$mysoc->country_code), $useborder, 'L', 1); $pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index); - $pdf->MultiCell($largcol2, $tab2_hl, price($object->total_localtax1), 0, 'R', 1); + $pdf->MultiCell($largcol2, $tab2_hl, price($object->total_localtax1), $useborder, 'R', 1); } // Total LocalTax2 @@ -767,9 +768,9 @@ class pdf_azur extends ModelePDFPropales { $index++; $pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index); - $pdf->MultiCell($col2x-$col1x, $tab2_hl, $outputlangs->transnoentities("TotalLT2".$mysoc->pays_code), 0, 'L', 1); + $pdf->MultiCell($col2x-$col1x, $tab2_hl, $outputlangs->transnoentities("TotalLT2".$mysoc->country_code), $useborder, 'L', 1); $pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index); - $pdf->MultiCell($largcol2, $tab2_hl, price($object->total_localtax2), 0, 'R', 1); + $pdf->MultiCell($largcol2, $tab2_hl, price($object->total_localtax2), $useborder, 'R', 1); } } else @@ -792,7 +793,7 @@ class pdf_azur extends ModelePDFPropales $tvakey=str_replace('*','',$tvakey); $tvacompl = " (".$outputlangs->transnoentities("NonPercuRecuperable").")"; } - $totalvat = $outputlangs->transnoentities("TotalLT1".$mysoc->pays_code).' '; + $totalvat = $outputlangs->transnoentities("TotalLT1".$mysoc->country_code).' '; $totalvat.=vatrate($tvakey,1).$tvacompl; $pdf->MultiCell($col2x-$col1x, $tab2_hl, $totalvat, 0, 'L', 1); @@ -820,7 +821,7 @@ class pdf_azur extends ModelePDFPropales $tvakey=str_replace('*','',$tvakey); $tvacompl = " (".$outputlangs->transnoentities("NonPercuRecuperable").")"; } - $totalvat =$outputlangs->transnoentities("TotalLT2".$mysoc->pays_code).' '; + $totalvat =$outputlangs->transnoentities("TotalLT2".$mysoc->country_code).' '; $totalvat.=vatrate($tvakey,1).$tvacompl; $pdf->MultiCell($col2x-$col1x, $tab2_hl, $totalvat, 0, 'L', 1); @@ -832,8 +833,6 @@ class pdf_azur extends ModelePDFPropales } } - $useborder=0; - // Total TTC $index++; $pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index); @@ -888,7 +887,6 @@ class pdf_azur extends ModelePDFPropales $pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index); $pdf->MultiCell($largcol2, $tab2_hl, price($resteapayer), $useborder, 'R', 1); - // Fin $pdf->SetFont('','', $default_font_size - 1); $pdf->SetTextColor(0,0,0); } @@ -903,9 +901,9 @@ class pdf_azur extends ModelePDFPropales * @param PDF &$pdf Object PDF * @param string $tab_top Top position of table * @param string $tab_height Height of table (rectangle) - * @param int $nexY Y + * @param int $nexY Y (not used) * @param Translate $outputlangs Langs object - * @param int $hidetop Hide top bar of array + * @param int $hidetop 1=Hide top bar of array and title, 0=Hide nothing, -1=Hide only title * @param int $hidebottom Hide bottom bar of array * @return void */ diff --git a/htdocs/core/modules/rapport/pdf_paiement.class.php b/htdocs/core/modules/rapport/pdf_paiement.class.php index d18c14b6b6d..4df1c3579c8 100644 --- a/htdocs/core/modules/rapport/pdf_paiement.class.php +++ b/htdocs/core/modules/rapport/pdf_paiement.class.php @@ -51,10 +51,10 @@ class pdf_paiement $this->page_largeur = $formatarray['width']; $this->page_hauteur = $formatarray['height']; $this->format = array($this->page_largeur,$this->page_hauteur); - $this->marge_gauche=10; - $this->marge_droite=10; - $this->marge_haute=10; - $this->marge_basse=10; + $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->tab_top = 30; 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 f505e9f93a1..f752ffaf6b0 100755 --- a/htdocs/core/modules/supplier_invoice/pdf/pdf_canelle.modules.php +++ b/htdocs/core/modules/supplier_invoice/pdf/pdf_canelle.modules.php @@ -77,10 +77,10 @@ class pdf_canelle extends ModelePDFSuppliersInvoices $this->page_largeur = $formatarray['width']; $this->page_hauteur = $formatarray['height']; $this->format = array($this->page_largeur,$this->page_hauteur); - $this->marge_gauche=10; - $this->marge_droite=10; - $this->marge_haute=10; - $this->marge_basse=10; + $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 @@ -185,7 +185,8 @@ class pdf_canelle extends ModelePDFSuppliersInvoices $pdf=pdf_getInstance($this->format); $heightforinfotot = 50; // Height reserved to output the info and total part - $heightforfooter = 25; // Height reserved to output the footer (value include bottom margin) + $heightforfreetext= 5; // Height reserved to output the free text on last page + $heightforfooter = $this->marge_basse + 10; // Height reserved to output the footer (value include bottom margin) $pdf->SetAutoPageBreak(1,0); if (class_exists('TCPDF')) @@ -271,7 +272,7 @@ class pdf_canelle extends ModelePDFSuppliersInvoices $pdf->SetTextColor(0,0,0); $pdf->setTopMargin($tab_top_newpage); - $pdf->setPageOrientation('', 1, $heightforfooter+$heightforinfotot); // The only function to edit the bottom margin of current page to set it. + $pdf->setPageOrientation('', 1, $heightforfooter+$heightforfreetext+$heightforinfotot); // The only function to edit the bottom margin of current page to set it. $pageposbefore=$pdf->getPage(); // Description of product line @@ -376,13 +377,13 @@ class pdf_canelle extends ModelePDFSuppliersInvoices // Show square if ($pagenb == 1) { - $this->_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforinfotot - $heightforfooter, 0, $outputlangs, 0, 0); - $bottomlasttab=$this->page_hauteur - $heightforinfotot - $heightforfooter + 1; + $this->_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforinfotot - $heightforfreetext - $heightforfooter, 0, $outputlangs, 0, 0); + $bottomlasttab=$this->page_hauteur - $heightforinfotot - $heightforfreetext - $heightforfooter + 1; } else { - $this->_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforinfotot - $heightforfooter, 0, $outputlangs, 1, 0); - $bottomlasttab=$this->page_hauteur - $heightforinfotot - $heightforfooter + 1; + $this->_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforinfotot - $heightforfreetext - $heightforfooter, 0, $outputlangs, 1, 0); + $bottomlasttab=$this->page_hauteur - $heightforinfotot - $heightforfreetext - $heightforfooter + 1; } // Affiche zone totaux @@ -738,14 +739,18 @@ class pdf_canelle extends ModelePDFSuppliersInvoices $tab3_top = $posy + 8; $tab3_width = 80; $tab3_height = 4; + if ($this->page_largeur < 210) // To work with US executive format + { + $tab3_posx -= 20; + } $default_font_size = pdf_getPDFFontSize($outputlangs); - $pdf->SetFont('','', $default_font_size - 2); - $pdf->SetXY($tab3_posx, $tab3_top - 5); - $pdf->MultiCell(60, 5, $outputlangs->transnoentities("PaymentsAlreadyDone"), 0, 'L', 0); + $pdf->SetFont('','', $default_font_size - 3); + $pdf->SetXY($tab3_posx, $tab3_top - 4); + $pdf->MultiCell(60, 3, $outputlangs->transnoentities("PaymentsAlreadyDone"), 0, 'L', 0); - $pdf->line($tab3_posx, $tab3_top-1+$tab3_height, $tab3_posx+$tab3_width, $tab3_top-1+$tab3_height); + $pdf->line($tab3_posx, $tab3_top, $tab3_posx+$tab3_width, $tab3_top); $pdf->SetFont('','', $default_font_size - 4); $pdf->SetXY($tab3_posx, $tab3_top); @@ -757,6 +762,8 @@ class pdf_canelle extends ModelePDFSuppliersInvoices $pdf->SetXY($tab3_posx+58, $tab3_top); $pdf->MultiCell(20, 3, $outputlangs->transnoentities("Num"), 0, 'L', 0); + $pdf->line($tab3_posx, $tab3_top-1+$tab3_height, $tab3_posx+$tab3_width, $tab3_top-1+$tab3_height); + $y=0; $pdf->SetFont('','', $default_font_size - 4); 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 f1d143076ff..f686c6508ea 100644 --- a/htdocs/core/modules/supplier_order/pdf/pdf_muscadet.modules.php +++ b/htdocs/core/modules/supplier_order/pdf/pdf_muscadet.modules.php @@ -80,10 +80,10 @@ class pdf_muscadet extends ModelePDFSuppliersOrders $this->page_largeur = $formatarray['width']; $this->page_hauteur = $formatarray['height']; $this->format = array($this->page_largeur,$this->page_hauteur); - $this->marge_gauche=10; - $this->marge_droite=10; - $this->marge_haute=10; - $this->marge_basse=10; + $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 @@ -197,7 +197,8 @@ class pdf_muscadet extends ModelePDFSuppliersOrders $pdf=pdf_getInstance($this->format); $heightforinfotot = 50; // Height reserved to output the info and total part - $heightforfooter = 25; // Height reserved to output the footer (value include bottom margin) + $heightforfreetext= 5; // Height reserved to output the free text on last page + $heightforfooter = $this->marge_basse + 10; // Height reserved to output the footer (value include bottom margin) $pdf->SetAutoPageBreak(1,0); if (class_exists('TCPDF')) @@ -283,7 +284,7 @@ class pdf_muscadet extends ModelePDFSuppliersOrders $pdf->SetTextColor(0,0,0); $pdf->setTopMargin($tab_top_newpage); - $pdf->setPageOrientation('', 1, $heightforfooter+$heightforinfotot); // The only function to edit the bottom margin of current page to set it. + $pdf->setPageOrientation('', 1, $heightforfooter+$heightforfreetext+$heightforinfotot); // The only function to edit the bottom margin of current page to set it. $pageposbefore=$pdf->getPage(); // Description of product line @@ -393,13 +394,13 @@ class pdf_muscadet extends ModelePDFSuppliersOrders // Show square if ($pagenb == 1) { - $this->_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforinfotot - $heightforfooter, 0, $outputlangs, 0, 0); - $bottomlasttab=$this->page_hauteur - $heightforinfotot - $heightforfooter + 1; + $this->_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforinfotot - $heightforfreetext - $heightforfooter, 0, $outputlangs, 0, 0); + $bottomlasttab=$this->page_hauteur - $heightforinfotot - $heightforfreetext - $heightforfooter + 1; } else { - $this->_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforinfotot - $heightforfooter, 0, $outputlangs, 1, 0); - $bottomlasttab=$this->page_hauteur - $heightforinfotot - $heightforfooter + 1; + $this->_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforinfotot - $heightforfreetext - $heightforfooter, 0, $outputlangs, 1, 0); + $bottomlasttab=$this->page_hauteur - $heightforinfotot - $heightforfreetext - $heightforfooter + 1; } // Affiche zone infos