diff --git a/htdocs/core/modules/commande/doc/pdf_einstein.modules.php b/htdocs/core/modules/commande/doc/pdf_einstein.modules.php index 9fecdc277b5..334b9f0c12f 100644 --- a/htdocs/core/modules/commande/doc/pdf_einstein.modules.php +++ b/htdocs/core/modules/commande/doc/pdf_einstein.modules.php @@ -301,18 +301,14 @@ class pdf_einstein extends ModelePDFCommandes $tab_top = 90+$top_shift; $tab_top_newpage = (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)?42+$top_shift:10); - $tab_height = 130-$top_shift; - $tab_height_newpage = 150; - if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) $tab_height_newpage -= $top_shift; // Incoterm - $height_incoterms = 0; if ($conf->incoterm->enabled) { $desc_incoterms = $object->getIncotermsForPDF(); if ($desc_incoterms) { - $tab_top = 88; + $tab_top -= 2; $pdf->SetFont('','', $default_font_size - 1); $pdf->writeHTMLCell(190, 3, $this->posxdesc-1, $tab_top-1, dol_htmlentitiesbr($desc_incoterms), 0, 1); @@ -323,8 +319,7 @@ class pdf_einstein extends ModelePDFCommandes $pdf->SetDrawColor(192,192,192); $pdf->Rect($this->marge_gauche, $tab_top-1, $this->page_largeur-$this->marge_gauche-$this->marge_droite, $height_incoterms+1); - $tab_top = $nexY+6; - $height_incoterms += 4; + $tab_top = $nexY+6+$height_incoterms; } } @@ -343,10 +338,10 @@ class pdf_einstein extends ModelePDFCommandes } if ($notetoshow) { - $tab_top = 88 + $height_incoterms; + $tab_top -= 2; $pdf->SetFont('','', $default_font_size - 1); - $pdf->writeHTMLCell(190, 3, $this->posxdesc-1, $tab_top, dol_htmlentitiesbr($notetoshow), 0, 1); + $pdf->writeHTMLCell(190, 3, $this->posxdesc-1, $tab_top-1, dol_htmlentitiesbr($notetoshow), 0, 1); $nexY = $pdf->GetY(); $height_note=$nexY-$tab_top; @@ -354,12 +349,7 @@ class pdf_einstein extends ModelePDFCommandes $pdf->SetDrawColor(192,192,192); $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; - $tab_top = $nexY+6; - } - else - { - $height_note=0; + $tab_top = $nexY+6+$height_note; } $iniY = $tab_top + 7; diff --git a/htdocs/core/modules/contract/doc/pdf_strato.modules.php b/htdocs/core/modules/contract/doc/pdf_strato.modules.php index 77904beac0b..59c04c29413 100644 --- a/htdocs/core/modules/contract/doc/pdf_strato.modules.php +++ b/htdocs/core/modules/contract/doc/pdf_strato.modules.php @@ -214,16 +214,14 @@ class pdf_strato extends ModelePDFContract $tab_top = 90; $tab_top_newpage = (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)?42:10); - $tab_height = 130; - $tab_height_newpage = 150; // Affiche notes if (! empty($object->note_public)) { - $tab_top = 88; + $tab_top -= 2; $pdf->SetFont('','', $default_font_size - 1); - $pdf->writeHTMLCell(190, 3, $this->posxdesc-1, $tab_top, dol_htmlentitiesbr($object->note_public), 0, 1); + $pdf->writeHTMLCell(190, 3, $this->posxdesc-1, $tab_top-1, dol_htmlentitiesbr($object->note_public), 0, 1); $nexY = $pdf->GetY(); $height_note=$nexY-$tab_top; @@ -231,12 +229,7 @@ class pdf_strato extends ModelePDFContract $pdf->SetDrawColor(192,192,192); $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; - $tab_top = $nexY+6; - } - else - { - $height_note=0; + $tab_top = $nexY+6+$height_note; } $iniY = $tab_top + 7; diff --git a/htdocs/core/modules/facture/doc/pdf_crabe.modules.php b/htdocs/core/modules/facture/doc/pdf_crabe.modules.php index 88a47095b8c..1e4c4840d24 100644 --- a/htdocs/core/modules/facture/doc/pdf_crabe.modules.php +++ b/htdocs/core/modules/facture/doc/pdf_crabe.modules.php @@ -338,18 +338,14 @@ class pdf_crabe extends ModelePDFFactures $tab_top = 90+$top_shift; $tab_top_newpage = (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)?42+$top_shift:10); - $tab_height = 130-$top_shift; - $tab_height_newpage = 150; - if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) $tab_height_newpage -= $top_shift; // Incoterm - $height_incoterms = 0; if ($conf->incoterm->enabled) { $desc_incoterms = $object->getIncotermsForPDF(); if ($desc_incoterms) { - $tab_top = 88; + $tab_top -= 2; $pdf->SetFont('','', $default_font_size - 1); $pdf->writeHTMLCell(190, 3, $this->posxdesc-1, $tab_top-1, dol_htmlentitiesbr($desc_incoterms), 0, 1); @@ -360,8 +356,7 @@ class pdf_crabe extends ModelePDFFactures $pdf->SetDrawColor(192,192,192); $pdf->Rect($this->marge_gauche, $tab_top-1, $this->page_largeur-$this->marge_gauche-$this->marge_droite, $height_incoterms+1); - $tab_top = $nexY+6; - $height_incoterms += 4; + $tab_top = $nexY+6+$height_incoterms; } } @@ -380,10 +375,10 @@ class pdf_crabe extends ModelePDFFactures } if ($notetoshow) { - $tab_top = 88 + $height_incoterms; + $tab_top -= 2; $pdf->SetFont('','', $default_font_size - 1); - $pdf->writeHTMLCell(190, 3, $this->posxdesc-1, $tab_top, dol_htmlentitiesbr($notetoshow), 0, 1); + $pdf->writeHTMLCell(190, 3, $this->posxdesc-1, $tab_top-1, dol_htmlentitiesbr($notetoshow), 0, 1); $nexY = $pdf->GetY(); $height_note=$nexY-$tab_top; @@ -391,12 +386,7 @@ class pdf_crabe extends ModelePDFFactures $pdf->SetDrawColor(192,192,192); $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; - $tab_top = $nexY+6; - } - else - { - $height_note=0; + $tab_top = $nexY+6+$height_note; } $iniY = $tab_top + 7; diff --git a/htdocs/core/modules/propale/doc/pdf_azur.modules.php b/htdocs/core/modules/propale/doc/pdf_azur.modules.php index 03d0db86d8f..4048a19b1fd 100644 --- a/htdocs/core/modules/propale/doc/pdf_azur.modules.php +++ b/htdocs/core/modules/propale/doc/pdf_azur.modules.php @@ -337,18 +337,14 @@ class pdf_azur extends ModelePDFPropales $tab_top = 90+$top_shift; $tab_top_newpage = (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)?42+$top_shift:10); - $tab_height = 130-$top_shift; - $tab_height_newpage = 150; - if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) $tab_height_newpage -= $top_shift; // Incoterm - $height_incoterms = 0; if ($conf->incoterm->enabled) { $desc_incoterms = $object->getIncotermsForPDF(); if ($desc_incoterms) { - $tab_top = 88; + $tab_top -= 2; $pdf->SetFont('','', $default_font_size - 1); $pdf->writeHTMLCell(190, 3, $this->posxdesc-1, $tab_top-1, dol_htmlentitiesbr($desc_incoterms), 0, 1); @@ -359,8 +355,7 @@ class pdf_azur extends ModelePDFPropales $pdf->SetDrawColor(192,192,192); $pdf->Rect($this->marge_gauche, $tab_top-1, $this->page_largeur-$this->marge_gauche-$this->marge_droite, $height_incoterms+1); - $tab_top = $nexY+6; - $height_incoterms += 4; + $tab_top = $nexY+6+$height_incoterms; } } @@ -387,10 +382,10 @@ class pdf_azur extends ModelePDFPropales } if ($notetoshow) { - $tab_top = 88 + $height_incoterms; + $tab_top -= 2; $pdf->SetFont('','', $default_font_size - 1); - $pdf->writeHTMLCell(190, 3, $this->posxdesc-1, $tab_top, dol_htmlentitiesbr($notetoshow), 0, 1); + $pdf->writeHTMLCell(190, 3, $this->posxdesc-1, $tab_top-1, dol_htmlentitiesbr($notetoshow), 0, 1); $nexY = $pdf->GetY(); $height_note=$nexY-$tab_top; @@ -398,12 +393,7 @@ class pdf_azur extends ModelePDFPropales $pdf->SetDrawColor(192,192,192); $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; - $tab_top = $nexY+6; - } - else - { - $height_note=0; + $tab_top = $nexY+6+$height_note; } $iniY = $tab_top + 7; 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 11951e90207..c84c76e0ad7 100644 --- a/htdocs/core/modules/supplier_invoice/pdf/pdf_canelle.modules.php +++ b/htdocs/core/modules/supplier_invoice/pdf/pdf_canelle.modules.php @@ -260,24 +260,21 @@ class pdf_canelle extends ModelePDFSuppliersInvoices $pdf->AddPage(); if (! empty($tplidx)) $pdf->useTemplate($tplidx); $pagenb++; - $this->_pagehead($pdf, $object, 1, $outputlangs); + $top_shift = $this->_pagehead($pdf, $object, 1, $outputlangs); $pdf->SetFont('','', $default_font_size - 1); $pdf->MultiCell(0, 3, ''); // Set interline to 3 $pdf->SetTextColor(0,0,0); - $tab_top = 90; - $tab_top_newpage = (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)?42:10); - $tab_height = 130; - $tab_height_newpage = 150; + $tab_top = 90+$top_shift; + $tab_top_newpage = (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)?42+$top_shift:10); // Incoterm - $height_incoterms = 0; if ($conf->incoterm->enabled) { $desc_incoterms = $object->getIncotermsForPDF(); if ($desc_incoterms) { - $tab_top = 88; + $tab_top -= 2; $pdf->SetFont('','', $default_font_size - 1); $pdf->writeHTMLCell(190, 3, $this->posxdesc-1, $tab_top-1, dol_htmlentitiesbr($desc_incoterms), 0, 1); @@ -288,18 +285,17 @@ class pdf_canelle extends ModelePDFSuppliersInvoices $pdf->SetDrawColor(192,192,192); $pdf->Rect($this->marge_gauche, $tab_top-1, $this->page_largeur-$this->marge_gauche-$this->marge_droite, $height_incoterms+1); - $tab_top = $nexY+6; - $height_incoterms += 4; + $tab_top = $nexY+6+$height_incoterms; } } // Affiche notes if (! empty($object->note_public)) { - $tab_top = 88 + $height_incoterms; + $tab_top -= 2; $pdf->SetFont('','', $default_font_size - 1); - $pdf->writeHTMLCell(190, 3, $this->posxdesc-1, $tab_top, dol_htmlentitiesbr($object->note_public), 0, 1); + $pdf->writeHTMLCell(190, 3, $this->posxdesc-1, $tab_top-1, dol_htmlentitiesbr($object->note_public), 0, 1); $nexY = $pdf->GetY(); $height_note=$nexY-$tab_top; @@ -307,12 +303,7 @@ class pdf_canelle extends ModelePDFSuppliersInvoices $pdf->SetDrawColor(192,192,192); $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; - $tab_top = $nexY+6; - } - else - { - $height_note=0; + $tab_top = $nexY+6+$height_note; } $iniY = $tab_top + 7; @@ -1080,8 +1071,14 @@ class pdf_canelle extends ModelePDFSuppliersInvoices $posy+=1; $pdf->SetTextColor(0,0,60); + $top_shift = 0; // Show list of linked objects + $current_y = $pdf->getY(); $posy = pdf_writeLinkedObjects($pdf, $object, $outputlangs, $posx, $posy, 100, 3, 'R', $default_font_size); + if ($current_y < $pdf->getY()) + { + $top_shift = $pdf->getY() - $current_y; + } if ($showaddress) { @@ -1098,7 +1095,7 @@ class pdf_canelle extends ModelePDFSuppliersInvoices $carac_emetteur .= pdf_build_address($outputlangs, $this->emetteur, $object->thirdparty); // Show sender - $posy=42; + $posy=42+$top_shift; $posx=$this->marge_gauche; if (! empty($conf->global->MAIN_INVERT_SENDER_RECIPIENT)) $posx=$this->page_largeur-$this->marge_droite-80; $hautcadre=40; @@ -1150,7 +1147,7 @@ class pdf_canelle extends ModelePDFSuppliersInvoices // Show recipient $widthrecbox=100; if ($this->page_largeur < 210) $widthrecbox=84; // To work with US executive format - $posy=42; + $posy=42+$top_shift; $posx=$this->page_largeur-$this->marge_droite-$widthrecbox; if (! empty($conf->global->MAIN_INVERT_SENDER_RECIPIENT)) $posx=$this->marge_gauche; @@ -1173,6 +1170,8 @@ class pdf_canelle extends ModelePDFSuppliersInvoices $pdf->SetXY($posx+2,$posy); $pdf->MultiCell($widthrecbox, 4, $carac_client, 0, 'L'); } + + return $top_shift; } /** 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 b70a299fa03..f3a102307ec 100644 --- a/htdocs/core/modules/supplier_order/pdf/pdf_muscadet.modules.php +++ b/htdocs/core/modules/supplier_order/pdf/pdf_muscadet.modules.php @@ -272,24 +272,21 @@ class pdf_muscadet extends ModelePDFSuppliersOrders $pdf->AddPage(); if (! empty($tplidx)) $pdf->useTemplate($tplidx); $pagenb++; - $this->_pagehead($pdf, $object, 1, $outputlangs); + $top_shift = $this->_pagehead($pdf, $object, 1, $outputlangs); $pdf->SetFont('','', $default_font_size - 1); $pdf->MultiCell(0, 3, ''); // Set interline to 3 $pdf->SetTextColor(0,0,0); - $tab_top = 90; - $tab_top_newpage = (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)?42:10); - $tab_height = 130; - $tab_height_newpage = 150; + $tab_top = 90+$top_shift; + $tab_top_newpage = (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)?42+$top_shift:10); // Incoterm - $height_incoterms = 0; if ($conf->incoterm->enabled) { $desc_incoterms = $object->getIncotermsForPDF(); if ($desc_incoterms) { - $tab_top = 88; + $tab_top -= 2; $pdf->SetFont('','', $default_font_size - 1); $pdf->writeHTMLCell(190, 3, $this->posxdesc-1, $tab_top-1, dol_htmlentitiesbr($desc_incoterms), 0, 1); @@ -300,18 +297,17 @@ class pdf_muscadet extends ModelePDFSuppliersOrders $pdf->SetDrawColor(192,192,192); $pdf->Rect($this->marge_gauche, $tab_top-1, $this->page_largeur-$this->marge_gauche-$this->marge_droite, $height_incoterms+1); - $tab_top = $nexY+6; - $height_incoterms += 4; + $tab_top = $nexY+6+$height_incoterms; } } // Affiche notes if (! empty($object->note_public)) { - $tab_top = 88 + $height_incoterms; + $tab_top -= 2; $pdf->SetFont('','', $default_font_size - 1); - $pdf->writeHTMLCell(190, 3, $this->posxdesc-1, $tab_top, dol_htmlentitiesbr($object->note_public), 0, 1); + $pdf->writeHTMLCell(190, 3, $this->posxdesc-1, $tab_top-1, dol_htmlentitiesbr($object->note_public), 0, 1); $nexY = $pdf->GetY(); $height_note=$nexY-$tab_top; @@ -319,13 +315,8 @@ class pdf_muscadet extends ModelePDFSuppliersOrders $pdf->SetDrawColor(192,192,192); $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; $tab_top = $nexY+6; } - else - { - $height_note=0; - } $iniY = $tab_top + 7; $curY = $tab_top + 7; @@ -1130,8 +1121,14 @@ class pdf_muscadet extends ModelePDFSuppliersOrders $posy+=1; $pdf->SetTextColor(0,0,60); + $top_shift = 0; // Show list of linked objects + $current_y = $pdf->getY(); $posy = pdf_writeLinkedObjects($pdf, $object, $outputlangs, $posx, $posy, 100, 3, 'R', $default_font_size); + if ($current_y < $pdf->getY()) + { + $top_shift = $pdf->getY() - $current_y; + } if ($showaddress) { @@ -1148,7 +1145,7 @@ class pdf_muscadet extends ModelePDFSuppliersOrders $carac_emetteur .= pdf_build_address($outputlangs, $this->emetteur, $object->thirdparty); // Show sender - $posy=42; + $posy=42+$top_shift; $posx=$this->marge_gauche; if (! empty($conf->global->MAIN_INVERT_SENDER_RECIPIENT)) $posx=$this->page_largeur-$this->marge_droite-80; $hautcadre=40; @@ -1200,7 +1197,7 @@ class pdf_muscadet extends ModelePDFSuppliersOrders // Show recipient $widthrecbox=100; if ($this->page_largeur < 210) $widthrecbox=84; // To work with US executive format - $posy=42; + $posy=42+$top_shift; $posx=$this->page_largeur-$this->marge_droite-$widthrecbox; if (! empty($conf->global->MAIN_INVERT_SENDER_RECIPIENT)) $posx=$this->marge_gauche; @@ -1223,6 +1220,8 @@ class pdf_muscadet extends ModelePDFSuppliersOrders $pdf->SetXY($posx+2,$posy); $pdf->MultiCell($widthrecbox, 4, $carac_client, 0, 'L'); } + + return $top_shift; } /** diff --git a/htdocs/core/modules/supplier_proposal/doc/pdf_aurore.modules.php b/htdocs/core/modules/supplier_proposal/doc/pdf_aurore.modules.php index a6457dd7a2e..60a0b4808cc 100644 --- a/htdocs/core/modules/supplier_proposal/doc/pdf_aurore.modules.php +++ b/htdocs/core/modules/supplier_proposal/doc/pdf_aurore.modules.php @@ -289,15 +289,13 @@ class pdf_aurore extends ModelePDFSupplierProposal $pdf->AddPage(); if (! empty($tplidx)) $pdf->useTemplate($tplidx); $pagenb++; - $this->_pagehead($pdf, $object, 1, $outputlangs); + $top_shift = $this->_pagehead($pdf, $object, 1, $outputlangs); $pdf->SetFont('','', $default_font_size - 1); $pdf->MultiCell(0, 3, ''); // Set interline to 3 $pdf->SetTextColor(0,0,0); - $tab_top = 90; - $tab_top_newpage = (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)?42:10); - $tab_height = 130; - $tab_height_newpage = 150; + $tab_top = 90+$top_shift; + $tab_top_newpage = (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)?42+$top_shift:10); // Affiche notes $notetoshow=empty($object->note_public)?'':$object->note_public; @@ -314,10 +312,10 @@ class pdf_aurore extends ModelePDFSupplierProposal } if ($notetoshow) { - $tab_top = 88; + $tab_top -= 2; $pdf->SetFont('','', $default_font_size - 1); - $pdf->writeHTMLCell(190, 3, $this->posxdesc-1, $tab_top, dol_htmlentitiesbr($notetoshow), 0, 1); + $pdf->writeHTMLCell(190, 3, $this->posxdesc-1, $tab_top-1, dol_htmlentitiesbr($notetoshow), 0, 1); $nexY = $pdf->GetY(); $height_note=$nexY-$tab_top; @@ -325,12 +323,7 @@ class pdf_aurore extends ModelePDFSupplierProposal $pdf->SetDrawColor(192,192,192); $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; - $tab_top = $nexY+6; - } - else - { - $height_note=0; + $tab_top = $nexY+6+$height_note; } $iniY = $tab_top + 7; @@ -1300,8 +1293,14 @@ class pdf_aurore extends ModelePDFSupplierProposal $posy+=2; + $top_shift = 0; // Show list of linked objects + $current_y = $pdf->getY(); $posy = pdf_writeLinkedObjects($pdf, $object, $outputlangs, $posx, $posy, 100, 3, 'R', $default_font_size); + if ($current_y < $pdf->getY()) + { + $top_shift = $pdf->getY() - $current_y; + } if ($showaddress) { @@ -1319,7 +1318,7 @@ class pdf_aurore extends ModelePDFSupplierProposal $carac_emetteur .= pdf_build_address($outputlangs, $this->emetteur, $object->thirdparty); // Show sender - $posy=42; + $posy=42+$top_shift; $posx=$this->marge_gauche; if (! empty($conf->global->MAIN_INVERT_SENDER_RECIPIENT)) $posx=$this->page_largeur-$this->marge_droite-80; $hautcadre=40; @@ -1373,7 +1372,7 @@ class pdf_aurore extends ModelePDFSupplierProposal // Show recipient $widthrecbox=100; if ($this->page_largeur < 210) $widthrecbox=84; // To work with US executive format - $posy=42; + $posy=42+$top_shift; $posx=$this->page_largeur-$this->marge_droite-$widthrecbox; if (! empty($conf->global->MAIN_INVERT_SENDER_RECIPIENT)) $posx=$this->marge_gauche; @@ -1396,6 +1395,7 @@ class pdf_aurore extends ModelePDFSupplierProposal } $pdf->SetTextColor(0,0,0); + return $top_shift; } /**