Skip to content

Commit

Permalink
Fix: pdf models are unstable and time consuming.
Browse files Browse the repository at this point in the history
  • Loading branch information
hregis committed Feb 22, 2013
1 parent 8a5f68d commit 7d0f02e
Showing 1 changed file with 21 additions and 14 deletions.
35 changes: 21 additions & 14 deletions htdocs/core/modules/livraison/pdf/pdf_typhon.modules.php
Expand Up @@ -214,7 +214,7 @@ function write_file($object,$outputlangs)
$pdf->SetTextColor(0,0,0);

$tab_top = 90;
$tab_top_newpage = (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)?42:10);
$tab_top_newpage = (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)?22:10);
$tab_height = 130;
$tab_height_newpage = 150;

Expand Down Expand Up @@ -252,7 +252,7 @@ function write_file($object,$outputlangs)
$pdf->SetTextColor(0,0,0);

$pdf->setTopMargin($tab_top_newpage);
$pdf->setPageOrientation('', 1, $heightforfooter+$heightforfreetext+$heightforinfotot); // The only function to edit the bottom margin of current page to set it.
$pdf->setPageOrientation('', 1, $heightforfooter+$heightforfreetext); // The only function to edit the bottom margin of current page to set it.
$pageposbefore=$pdf->getPage();

// Description of product line
Expand Down Expand Up @@ -323,11 +323,11 @@ function write_file($object,$outputlangs)
$pdf->setPage($pagenb);
if ($pagenb == 1)
{
$this->_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforfooter, 0, $outputlangs, 0);
$this->_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforfooter, 0, $outputlangs, 0, 1);
}
else
{
$this->_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforfooter, 0, $outputlangs, 1);
$this->_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforfooter, 0, $outputlangs, 1, 1);
}
$this->_pagefoot($pdf,$object,$outputlangs,1);
$pagenb++;
Expand Down Expand Up @@ -355,12 +355,12 @@ function write_file($object,$outputlangs)
// Show square
if ($pagenb == 1)
{
$this->_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforinfotot - $heightforfreetext - $heightforfooter, 0, $outputlangs, 0, 1);
$this->_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforinfotot - $heightforfreetext - $heightforfooter, 0, $outputlangs, 0);
$bottomlasttab=$this->page_hauteur - $heightforinfotot - $heightforfooter + 1;
}
else
{
$this->_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforinfotot - $heightforfreetext - $heightforfooter, 0, $outputlangs, 1, 1);
$this->_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforinfotot - $heightforfreetext - $heightforfooter, 0, $outputlangs, 1);
$bottomlasttab=$this->page_hauteur - $heightforinfotot - $heightforfooter + 1;
}

Expand Down Expand Up @@ -472,25 +472,32 @@ function _tableau(&$pdf, $tab_top, $tab_height, $nexY, $outputlangs, $hidetop=0,
// Rect prend une longueur en 3eme param
$pdf->Rect($this->marge_gauche, $tab_top, $this->page_largeur-$this->marge_gauche-$this->marge_droite, $tab_height);
// line prend une position y en 3eme param
$pdf->line($this->marge_gauche, $tab_top+6, $this->page_largeur-$this->marge_droite, $tab_top+6);
if (empty($hidetop))
$pdf->line($this->marge_gauche, $tab_top+6, $this->page_largeur-$this->marge_droite, $tab_top+6);

$pdf->SetTextColor(0,0,0);
$pdf->SetFont('','', $default_font_size - 1);

$pdf->SetXY($this->posxdesc-1, $tab_top+1);
$pdf->MultiCell(80,2, $outputlangs->transnoentities("Designation"),'','L');
if (empty($hidetop)) {
$pdf->SetXY($this->posxdesc-1, $tab_top+1);
$pdf->MultiCell(80,2, $outputlangs->transnoentities("Designation"),'','L');
}

// Modif SEB pour avoir une col en plus pour les commentaires clients
$pdf->line($this->posxcomm, $tab_top, $this->posxcomm, $tab_top + $tab_height);
$pdf->SetXY($this->posxcomm, $tab_top+1);
$pdf->MultiCell(80,2, $outputlangs->transnoentities("Comments"),'','L');
if (empty($hidetop)) {
$pdf->SetXY($this->posxcomm, $tab_top+1);
$pdf->MultiCell(80,2, $outputlangs->transnoentities("Comments"),'','L');
}

// Qty
$pdf->line($this->posxqty-1, $tab_top, $this->posxqty-1, $tab_top + $tab_height);
$pdf->SetXY($this->posxqty-1, $tab_top+1);
$pdf->MultiCell(30, 2, $outputlangs->transnoentities("QtyShipped"),'','R');
if (empty($hidetop)) {
$pdf->SetXY($this->posxqty-1, $tab_top+1);
$pdf->MultiCell(30, 2, $outputlangs->transnoentities("QtyShipped"),'','R');
}

if (!empty($hidebottom)) {
if (empty($hidebottom)) {
// Modif Seb cadres signatures
$pdf->SetFont('','', $default_font_size);
$larg_sign = ($this->page_largeur-$this->marge_gauche-$this->marge_droite)/3;
Expand Down

0 comments on commit 7d0f02e

Please sign in to comment.