Merge pull request #8841 from ATM-Marc/FIX_6.0_pdf_note_incoterm

FIX: pdf: overlap when linked elements and incoterms/public note displayed
This commit is contained in:
Laurent Destailleur
2018-05-25 12:03:27 +02:00
committed by GitHub
8 changed files with 80 additions and 118 deletions

View File

@@ -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,14 +338,14 @@ class pdf_einstein extends ModelePDFCommandes
}
if ($notetoshow)
{
$tab_top -= 2;
$substitutionarray=pdf_getSubstitutionArray($outputlangs, null, $object);
complete_substitutions_array($substitutionarray, $outputlangs, $object);
$notetoshow = make_substitutions($notetoshow, $substitutionarray, $outputlangs);
$tab_top = 88 + $height_incoterms;
$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;
@@ -358,12 +353,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;

View File

@@ -213,16 +213,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;
@@ -230,12 +228,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;

View File

@@ -366,18 +366,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);
@@ -388,8 +384,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;
}
}
@@ -408,14 +403,14 @@ class pdf_crabe extends ModelePDFFactures
}
if ($notetoshow)
{
$substitutionarray=pdf_getSubstitutionArray($outputlangs, null, $object);
$tab_top -= 2;
$substitutionarray=pdf_getSubstitutionArray($outputlangs, null, $object);
complete_substitutions_array($substitutionarray, $outputlangs, $object);
$notetoshow = make_substitutions($notetoshow, $substitutionarray, $outputlangs);
$tab_top = 88 + $height_incoterms;
$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;
@@ -423,12 +418,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;

View File

@@ -339,18 +339,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);
@@ -361,8 +357,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;
}
}
@@ -389,14 +384,14 @@ class pdf_azur extends ModelePDFPropales
}
if ($notetoshow)
{
$tab_top -= 2;
$substitutionarray=pdf_getSubstitutionArray($outputlangs, null, $object);
complete_substitutions_array($substitutionarray, $outputlangs, $object);
$notetoshow = make_substitutions($notetoshow, $substitutionarray, $outputlangs);
$tab_top = 88 + $height_incoterms;
$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;
@@ -404,12 +399,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;

View File

@@ -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;
@@ -1082,8 +1073,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)
{
@@ -1100,7 +1097,7 @@ class pdf_canelle extends ModelePDFSuppliersInvoices
$carac_emetteur .= pdf_build_address($outputlangs, $this->emetteur, $object->thirdparty, '', 0, 'source', $object);
// 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;
@@ -1152,7 +1149,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;
@@ -1175,6 +1172,8 @@ class pdf_canelle extends ModelePDFSuppliersInvoices
$pdf->SetXY($posx+2,$posy);
$pdf->MultiCell($widthrecbox, 4, $carac_client, 0, 'L');
}
return $top_shift;
}
/**

View File

@@ -310,24 +310,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);
@@ -338,18 +335,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;
@@ -357,13 +353,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;
@@ -1207,8 +1198,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)
{
@@ -1225,7 +1222,7 @@ class pdf_muscadet extends ModelePDFSuppliersOrders
$carac_emetteur .= pdf_build_address($outputlangs, $this->emetteur, $object->thirdparty, '', 0, 'source', $object);
// 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;
@@ -1277,7 +1274,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;
@@ -1300,6 +1297,8 @@ class pdf_muscadet extends ModelePDFSuppliersOrders
$pdf->SetXY($posx+2,$posy);
$pdf->MultiCell($widthrecbox, 4, $carac_client, 0, 'L');
}
return $top_shift;
}
/**

View File

@@ -340,15 +340,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;
@@ -365,14 +363,14 @@ class pdf_aurore extends ModelePDFSupplierProposal
}
if ($notetoshow)
{
$substitutionarray=pdf_getSubstitutionArray($outputlangs, null, $object);
$tab_top -= 2;
$substitutionarray=pdf_getSubstitutionArray($outputlangs, null, $object);
complete_substitutions_array($substitutionarray, $outputlangs, $object);
$notetoshow = make_substitutions($notetoshow, $substitutionarray, $outputlangs);
$tab_top = 88;
$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;
@@ -380,12 +378,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;
@@ -1339,8 +1332,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)
{
@@ -1358,7 +1357,7 @@ class pdf_aurore extends ModelePDFSupplierProposal
$carac_emetteur .= pdf_build_address($outputlangs, $this->emetteur, $object->thirdparty, '', 0, 'source', $object);
// 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;
@@ -1412,7 +1411,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;
@@ -1435,6 +1434,7 @@ class pdf_aurore extends ModelePDFSupplierProposal
}
$pdf->SetTextColor(0,0,0);
return $top_shift;
}
/**

View File

@@ -341,11 +341,11 @@ if (empty($reshook))
if (! $error)
{
$result = $object->insertExtraFields('COMPANY_MODIFY');
if ($result < 0)
{
setEventMessages($object->error, $object->errors, 'errors');
$error++;
}
if ($result < 0)
{
setEventMessages($object->error, $object->errors, 'errors');
$error++;
}
}
if ($error) $action = 'edit_extras';
@@ -781,6 +781,7 @@ if (empty($reshook))
{
$error++;
$object->error .= $object->db->lasterror();
setEventMessages($object->error, $object->errors, 'errors');
}
}