Fix pdf cell padding for model cyan, erathosthene, espadon, cornas

This commit is contained in:
ATM john 2020-02-24 21:43:33 +01:00
parent 6de74e774e
commit 7f2dd19bb0
6 changed files with 39 additions and 139 deletions

View File

@ -1112,16 +1112,17 @@ abstract class CommonDocGenerator
* print standard column content
*
* @param TCPDF $pdf pdf object
* @param object $object CommonObject
* @param float $curY curent Y position
* @param string $colKey the column key
* @param object $object CommonObject
* @param $i
* @param $outputlangs
* @param float $curY curent Y position
* @param $hideref
* @param $hidedesc
* @param $issupplierline
* @return null
*/
function printColDescContent($pdf, &$curY, $colKey, $object, $i, $outputlangs, $hideref = 0, $hidedesc = 0, $issupplierline = 0)
public function printColDescContent($pdf, &$curY, $colKey, $object, $i, $outputlangs, $hideref = 0, $hidedesc = 0, $issupplierline = 0)
{
// load desc col params
$colDef = $this->cols[$colKey];

View File

@ -546,9 +546,7 @@ class pdf_eratosthene extends ModelePDFCommandes
$this->pdfTabTitles($pdf, $tab_top, $tab_height, $outputlangs, $hidetop);
$pdf->rollbackTransaction(true);
$iniY = $tab_top + $this->tabTitleHeight + 2;
$curY = $tab_top + $this->tabTitleHeight + 2;
$nexY = $tab_top + $this->tabTitleHeight + 2;
$nexY = $tab_top + $this->tabTitleHeight;
// Loop on each lines
$pageposbeforeprintlines = $pdf->getPage();
@ -567,12 +565,9 @@ class pdf_eratosthene extends ModelePDFCommandes
$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;
$posYAfterImage = 0;
$posYAfterDescription = 0;
if ($this->getColumnStatus('photo'))
{
@ -603,19 +598,8 @@ class pdf_eratosthene extends ModelePDFCommandes
if ($this->getColumnStatus('desc'))
{
$pdf->startTransaction();
pdf_writelinedesc($pdf, $object, $i, $outputlangs, $this->getColumnContentWidth('desc'), 3, $this->getColumnContentXStart('desc'), $curY, $hideref, $hidedesc);
$posYAfterDescription = $pdf->GetY();
// Display extrafield if needed
$params = array(
'display' => 'list',
'printableEnable' => array(3),
'printableEnableNotEmpty' => array(4)
);
$extrafieldDesc = $this->getExtrafieldsInHtml($object->lines[$i], $outputlangs, $params);
if(!empty($extrafieldDesc)){
$this->printStdColumnContent($pdf, $posYAfterDescription, 'desc', $extrafieldDesc);
}
$this->printColDescContent($pdf, $curY, 'desc', $object, $i, $outputlangs, $hideref, $hidedesc);
$pageposafter = $pdf->getPage();
if ($pageposafter > $pageposbefore) // There is a pagebreak
@ -624,7 +608,8 @@ class pdf_eratosthene extends ModelePDFCommandes
$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->getColumnContentWidth('desc'), 3, $this->getColumnContentXStart('desc'), $curY, $hideref, $hidedesc);
$this->printColDescContent($pdf, $curY, 'desc', $object, $i, $outputlangs, $hideref, $hidedesc);
$pageposafter = $pdf->getPage();
$posyafter = $pdf->GetY();
if ($posyafter > ($this->page_hauteur - ($heightforfooter + $heightforfreetext + $heightforinfotot))) // There is no space left for total+free text
@ -651,7 +636,6 @@ class pdf_eratosthene extends ModelePDFCommandes
{
$pdf->commitTransaction();
}
$posYAfterDescription = $pdf->GetY();
}
@ -788,11 +772,10 @@ class pdf_eratosthene extends ModelePDFCommandes
$pdf->setPage($pageposafter);
$pdf->SetLineStyle(array('dash'=>'1,1', 'color'=>array(80, 80, 80)));
//$pdf->SetDrawColor(190,190,200);
$pdf->line($this->marge_gauche, $nexY + 1, $this->page_largeur - $this->marge_droite, $nexY + 1);
$pdf->line($this->marge_gauche, $nexY, $this->page_largeur - $this->marge_droite, $nexY);
$pdf->SetLineStyle(array('dash'=>0));
}
$nexY += 2; // Add space between lines
// Detect if some page were added automatically and output _tableau for past pages
while ($pagenb < $pageposafter)
@ -1704,7 +1687,7 @@ class pdf_eratosthene extends ModelePDFCommandes
// Default field style for content
$this->defaultContentsFieldsStyle = array(
'align' => 'R', // R,C,L
'padding' => array(0.5, 1, 0.5, 1), // Like css 0 => top , 1 => right, 2 => bottom, 3 => left
'padding' => array(1, 0.5, 1, 0.5), // Like css 0 => top , 1 => right, 2 => bottom, 3 => left
);
// Default field style for content
@ -1741,10 +1724,11 @@ class pdf_eratosthene extends ModelePDFCommandes
'align' => 'L',
// 'textkey' => 'yourLangKey', // if there is no label, yourLangKey will be translated to replace label
// 'label' => ' ', // the final label
'padding' => array(0.5, 1, 0.5, 1), // Like css 0 => top , 1 => right, 2 => bottom, 3 => left
'padding' => array(0.5, 1, 0.5, 1.5), // Like css 0 => top , 1 => right, 2 => bottom, 3 => left
),
'content' => array(
'align' => 'L',
'padding' => array(1, 0.5, 1, 1.5), // Like css 0 => top , 1 => right, 2 => bottom, 3 => left
),
);

View File

@ -418,9 +418,7 @@ class pdf_espadon extends ModelePdfExpedition
$pdf->rollbackTransaction(true);
$iniY = $tab_top + $this->tabTitleHeight + 2;
$curY = $tab_top + $this->tabTitleHeight + 2;
$nexY = $tab_top + $this->tabTitleHeight + 2;
$nexY = $tab_top + $this->tabTitleHeight;
// Loop on each lines
for ($i = 0; $i < $nblines; $i++)
@ -473,40 +471,15 @@ class pdf_espadon extends ModelePdfExpedition
if ($this->getColumnStatus('desc'))
{
$pdf->startTransaction();
pdf_writelinedesc($pdf, $object, $i, $outputlangs, $this->getColumnContentWidth('desc'), 3, $this->getColumnContentXStart('desc'), $curY, $hideref, $hidedesc);
$posYAfterDescription = $pdf->GetY();
// Display extrafield if needed
$params = array(
'display' => 'list',
'printableEnable' => array(3),
'printableEnableNotEmpty' => array(4)
);
$extrafieldDesc = $this->getExtrafieldsInHtml($object->lines[$i], $outputlangs, $params);
if(!empty($extrafieldDesc)){
$this->printStdColumnContent($pdf, $posYAfterDescription, 'desc', $extrafieldDesc);
}
$this->printColDescContent($pdf, $curY, 'desc', $object, $i, $outputlangs, $hideref, $hidedesc);
$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->getColumnContentWidth('desc'), 3, $this->getColumnContentXStart('desc'), $curY, $hideref, $hidedesc);
$posYAfterDescription = $pdf->GetY();
// Display extrafield if needed
$params = array(
'display' => 'list',
'printableEnable' => array(3),
'printableEnableNotEmpty' => array(4)
);
$extrafieldDesc = $this->getExtrafieldsInHtml($object->lines[$i], $outputlangs, $params);
if(!empty($extrafieldDesc)){
$this->printStdColumnContent($pdf, $posYAfterDescription, 'desc', $extrafieldDesc);
}
$this->printColDescContent($pdf, $curY, 'desc', $object, $i, $outputlangs, $hideref, $hidedesc);
$pageposafter = $pdf->getPage();
$posyafter = $pdf->GetY();
@ -607,16 +580,13 @@ class pdf_espadon extends ModelePdfExpedition
}
}
$nexY += 3;
if ($weighttxt && $voltxt) $nexY += 2;
// Add line
if (!empty($conf->global->MAIN_PDF_DASH_BETWEEN_LINES) && $i < ($nblines - 1))
{
$pdf->setPage($pageposafter);
$pdf->SetLineStyle(array('dash'=>'1,1', 'color'=>array(80, 80, 80)));
//$pdf->SetDrawColor(190,190,200);
$pdf->line($this->marge_gauche, $nexY - 1, $this->page_largeur - $this->marge_droite, $nexY - 1);
$pdf->line($this->marge_gauche, $nexY, $this->page_largeur - $this->marge_droite, $nexY);
$pdf->SetLineStyle(array('dash'=>0));
}
@ -1146,7 +1116,7 @@ class pdf_espadon extends ModelePdfExpedition
// Default field style for content
$this->defaultContentsFieldsStyle = array(
'align' => 'R', // R,C,L
'padding' => array(0.5, 1, 0.5, 1), // Like css 0 => top , 1 => right, 2 => bottom, 3 => left
'padding' => array(1, 0.5, 1, 0.5), // Like css 0 => top , 1 => right, 2 => bottom, 3 => left
);
// Default field style for content
@ -1183,10 +1153,10 @@ class pdf_espadon extends ModelePdfExpedition
'align' => 'L',
// 'textkey' => 'yourLangKey', // if there is no label, yourLangKey will be translated to replace label
// 'label' => ' ', // the final label
'padding' => array(0.5, 1, 0.5, 1), // Like css 0 => top , 1 => right, 2 => bottom, 3 => left
'padding' => array(0.5, 1, 0.5, 1.5), // Like css 0 => top , 1 => right, 2 => bottom, 3 => left
),
'content' => array(
'align' => 'L',
'padding' => array(1, 0.5, 1, 1.5), // Like css 0 => top , 1 => right, 2 => bottom, 3 => left
),
);

View File

@ -582,9 +582,7 @@ class pdf_sponge extends ModelePDFFactures
$this->pdfTabTitles($pdf, $tab_top, $tab_height, $outputlangs, $hidetop);
$pdf->rollbackTransaction(true);
$iniY = $tab_top + $this->tabTitleHeight + 2;
$curY = $tab_top + $this->tabTitleHeight + 2;
$nexY = $tab_top + $this->tabTitleHeight + 0;
$nexY = $tab_top + $this->tabTitleHeight;
// Loop on each lines
$pageposbeforeprintlines = $pdf->getPage();
@ -605,7 +603,6 @@ class pdf_sponge extends ModelePDFFactures
$showpricebeforepagebreak = 1;
$posYAfterImage = 0;
$posYAfterDescription = 0;
if ($this->getColumnStatus('photo'))
{
@ -640,6 +637,7 @@ class pdf_sponge extends ModelePDFFactures
$this->printColDescContent($pdf, $curY, 'desc', $object, $i, $outputlangs, $hideref, $hidedesc);
$pageposafter = $pdf->getPage();
if ($pageposafter > $pageposbefore) // There is a pagebreak
{
$pdf->rollbackTransaction(true);

View File

@ -564,9 +564,7 @@ class pdf_cyan extends ModelePDFPropales
$this->pdfTabTitles($pdf, $tab_top, $tab_height, $outputlangs, $hidetop);
$pdf->rollbackTransaction(true);
$iniY = $tab_top + $this->tabTitleHeight + 2;
$curY = $tab_top + $this->tabTitleHeight + 2;
$nexY = $tab_top + $this->tabTitleHeight + 2;
$nexY = $tab_top + $this->tabTitleHeight;
// Loop on each lines
$pageposbeforeprintlines = $pdf->getPage();
@ -621,40 +619,17 @@ class pdf_cyan extends ModelePDFPropales
if ($this->getColumnStatus('desc'))
{
$pdf->startTransaction();
pdf_writelinedesc($pdf, $object, $i, $outputlangs, $this->getColumnContentWidth('desc'), 3, $this->getColumnContentXStart('desc'), $curY, $hideref, $hidedesc);
$posYAfterDescription = $pdf->GetY();
// Display extrafield if needed
$params = array(
'display' => 'list',
'printableEnable' => array(3),
'printableEnableNotEmpty' => array(4)
);
$extrafieldDesc = $this->getExtrafieldsInHtml($object->lines[$i], $outputlangs, $params);
if(!empty($extrafieldDesc)){
$this->printStdColumnContent($pdf, $posYAfterDescription, 'desc', $extrafieldDesc);
}
$this->printColDescContent($pdf, $curY, 'desc', $object, $i, $outputlangs, $hideref, $hidedesc);
$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->getColumnContentWidth('desc'), 3, $this->getColumnContentXStart('desc'), $curY, $hideref, $hidedesc);
$posYAfterDescription = $pdf->GetY();
// Display extrafield if needed
$params = array(
'display' => 'list',
'printableEnable' => array(3),
'printableEnableNotEmpty' => array(4)
);
$extrafieldDesc = $this->getExtrafieldsInHtml($object->lines[$i], $outputlangs, $params);
if(!empty($extrafieldDesc)){
$this->printStdColumnContent($pdf, $posYAfterDescription, 'desc', $extrafieldDesc);
}
$pdf->setPageOrientation('', 1, $heightforfooter); // The only function to edit the bottom margin of current page to set it.
$this->printColDescContent($pdf, $curY, 'desc', $object, $i, $outputlangs, $hideref, $hidedesc);
$pageposafter = $pdf->getPage();
$posyafter = $pdf->GetY();
@ -819,11 +794,11 @@ class pdf_cyan extends ModelePDFPropales
$pdf->setPage($pageposafter);
$pdf->SetLineStyle(array('dash'=>'1,1', 'color'=>array(80, 80, 80)));
//$pdf->SetDrawColor(190,190,200);
$pdf->line($this->marge_gauche, $nexY + 1, $this->page_largeur - $this->marge_droite, $nexY + 1);
$pdf->line($this->marge_gauche, $nexY, $this->page_largeur - $this->marge_droite, $nexY);
$pdf->SetLineStyle(array('dash'=>0));
}
$nexY += 2; // Add space between lines
// Detect if some page were added automatically and output _tableau for past pages
while ($pagenb < $pageposafter)
@ -1865,7 +1840,7 @@ class pdf_cyan extends ModelePDFPropales
// Default field style for content
$this->defaultContentsFieldsStyle = array(
'align' => 'R', // R,C,L
'padding' => array(0.5, 1, 0.5, 1), // Like css 0 => top , 1 => right, 2 => bottom, 3 => left
'padding' => array(1, 0.5, 1, 0.5), // Like css 0 => top , 1 => right, 2 => bottom, 3 => left
);
// Default field style for content
@ -1902,10 +1877,11 @@ class pdf_cyan extends ModelePDFPropales
'align' => 'L',
// 'textkey' => 'yourLangKey', // if there is no label, yourLangKey will be translated to replace label
// 'label' => ' ', // the final label
'padding' => array(0.5, 1, 0.5, 1), // Like css 0 => top , 1 => right, 2 => bottom, 3 => left
'padding' => array(0.5, 1, 0.5, 1.5), // Like css 0 => top , 1 => right, 2 => bottom, 3 => left
),
'content' => array(
'align' => 'L',
'padding' => array(1, 0.5, 1, 1.5), // Like css 0 => top , 1 => right, 2 => bottom, 3 => left
),
);

View File

@ -496,9 +496,7 @@ class pdf_cornas extends ModelePDFSuppliersOrders
$height_note = 0;
}
$iniY = $tab_top + 7;
$curY = $tab_top + 7;
$nexY = $tab_top + 7;
$nexY = $tab_top + 5;
// Use new auto collum system
$this->prepareArrayColumnField($object, $outputlangs, $hidedetails, $hidedesc, $hideref);
@ -555,40 +553,14 @@ class pdf_cornas extends ModelePDFSuppliersOrders
if ($this->getColumnStatus('desc'))
{
$pdf->startTransaction();
pdf_writelinedesc($pdf, $object, $i, $outputlangs, $this->getColumnContentWidth('desc'), 3, $this->getColumnContentXStart('desc'), $curY, $hideref, $hidedesc);
$posYAfterDescription = $pdf->GetY();
// Display extrafield if needed
$params = array(
'display' => 'list',
'printableEnable' => array(3),
'printableEnableNotEmpty' => array(4)
);
$extrafieldDesc = $this->getExtrafieldsInHtml($object->lines[$i], $outputlangs, $params);
if(!empty($extrafieldDesc)){
$this->printStdColumnContent($pdf, $posYAfterDescription, 'desc', $extrafieldDesc);
}
$this->printColDescContent($pdf, $curY, 'desc', $object, $i, $outputlangs, $hideref, $hidedesc, 1);
$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->getColumnContentWidth('desc'), 3, $this->getColumnContentXStart('desc'), $curY, $hideref, $hidedesc);
$posYAfterDescription = $pdf->GetY();
// Display extrafield if needed
$params = array(
'display' => 'list',
'printableEnable' => array(3),
'printableEnableNotEmpty' => array(4)
);
$extrafieldDesc = $this->getExtrafieldsInHtml($object->lines[$i], $outputlangs, $params);
if(!empty($extrafieldDesc)){
$this->printStdColumnContent($pdf, $posYAfterDescription, 'desc', $extrafieldDesc);
}
$this->printColDescContent($pdf, $curY, 'desc', $object, $i, $outputlangs, $hideref, $hidedesc, 1);
$pageposafter = $pdf->getPage();
$posyafter = $pdf->GetY();
@ -750,12 +722,10 @@ class pdf_cornas extends ModelePDFSuppliersOrders
$pdf->setPage($pageposafter);
$pdf->SetLineStyle(array('dash'=>'1,1', 'color'=>array(80, 80, 80)));
//$pdf->SetDrawColor(190,190,200);
$pdf->line($this->marge_gauche, $nexY + 1, $this->page_largeur - $this->marge_droite, $nexY + 1);
$pdf->line($this->marge_gauche, $nexY, $this->page_largeur - $this->marge_droite, $nexY);
$pdf->SetLineStyle(array('dash'=>0));
}
$nexY += 2; // Add space between lines
// Detect if some page were added automatically and output _tableau for past pages
while ($pagenb < $pageposafter)
{
@ -1509,7 +1479,7 @@ class pdf_cornas extends ModelePDFSuppliersOrders
// Default field style for content
$this->defaultContentsFieldsStyle = array(
'align' => 'R', // R,C,L
'padding' => array(0.5, 1, 0.5, 1), // Like css 0 => top , 1 => right, 2 => bottom, 3 => left
'padding' => array(1, 0.5, 1, 0.5), // Like css 0 => top , 1 => right, 2 => bottom, 3 => left
);
// Default field style for content
@ -1546,10 +1516,11 @@ class pdf_cornas extends ModelePDFSuppliersOrders
'align' => 'L',
// 'textkey' => 'yourLangKey', // if there is no label, yourLangKey will be translated to replace label
// 'label' => ' ', // the final label
'padding' => array(0.5, 1, 0.5, 1), // Like css 0 => top , 1 => right, 2 => bottom, 3 => left
'padding' => array(0.5, 1, 0.5, 1.5), // Like css 0 => top , 1 => right, 2 => bottom, 3 => left
),
'content' => array(
'align' => 'L',
'padding' => array(1, 0.5, 1, 1.5), // Like css 0 => top , 1 => right, 2 => bottom, 3 => left
),
);