Fix cell padding sponge
This commit is contained in:
parent
11b6cae4f1
commit
3c4e7f7b07
@ -1096,14 +1096,58 @@ abstract class CommonDocGenerator
|
|||||||
if (empty($columnText)) return;
|
if (empty($columnText)) return;
|
||||||
$pdf->SetXY($this->getColumnContentXStart($colKey), $curY); // Set curent position
|
$pdf->SetXY($this->getColumnContentXStart($colKey), $curY); // Set curent position
|
||||||
$colDef = $this->cols[$colKey];
|
$colDef = $this->cols[$colKey];
|
||||||
|
// save curent cell padding
|
||||||
$curentCellPaddinds = $pdf->getCellPaddings();
|
$curentCellPaddinds = $pdf->getCellPaddings();
|
||||||
$pdf->setCellPadding(0);
|
// set cell padding with column content definition
|
||||||
$pdf->writeHTMLCell($this->getColumnContentWidth($colKey), 2, $this->getColumnContentXStart($colKey), $curY, $columnText, 0, 1, 0, true, $colDef['content']['align']);
|
$pdf->setCellPaddings($colDef['content']['padding'][3], $colDef['content']['padding'][0], $colDef['content']['padding'][1], $colDef['content']['padding'][2]);
|
||||||
$curentCellPaddinds = $pdf->getCellPaddings();
|
$pdf->writeHTMLCell($colDef['width'], 2, $colDef['xStartPos'], $curY, $columnText, 0, 1, 0, true, $colDef['content']['align']);
|
||||||
|
|
||||||
|
// restore cell padding
|
||||||
$pdf->setCellPaddings($curentCellPaddinds['L'], $curentCellPaddinds['T'], $curentCellPaddinds['R'], $curentCellPaddinds['B']);
|
$pdf->setCellPaddings($curentCellPaddinds['L'], $curentCellPaddinds['T'], $curentCellPaddinds['R'], $curentCellPaddinds['B']);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* print standard column content
|
||||||
|
*
|
||||||
|
* @param TCPDF $pdf pdf object
|
||||||
|
* @param object $object CommonObject
|
||||||
|
* @param string $colKey the column key
|
||||||
|
* @param $i
|
||||||
|
* @param $outputlangs
|
||||||
|
* @param float $curY curent Y position
|
||||||
|
* @param $hideref
|
||||||
|
* @param $hidedesc
|
||||||
|
* @param $issupplierline
|
||||||
|
*/
|
||||||
|
function printColDescContent($pdf, &$curY, $colKey, $object, $i, $outputlangs, $hideref = 0, $hidedesc = 0, $issupplierline = 0){
|
||||||
|
// load desc col params
|
||||||
|
$colDef = $this->cols[$colKey];
|
||||||
|
// save curent cell padding
|
||||||
|
$curentCellPaddinds = $pdf->getCellPaddings();
|
||||||
|
// set cell padding with column content definition
|
||||||
|
$pdf->setCellPaddings($colDef['content']['padding'][3], $colDef['content']['padding'][0], $colDef['content']['padding'][1], $colDef['content']['padding'][2]);
|
||||||
|
|
||||||
|
// line description
|
||||||
|
pdf_writelinedesc($pdf, $object, $i, $outputlangs, $colDef['width'], 3, $colDef['xStartPos'], $curY, $hideref, $hidedesc, $issupplierline);
|
||||||
|
$posYAfterDescription = $pdf->GetY() - $colDef['content']['padding'][0];
|
||||||
|
|
||||||
|
// restore cell padding
|
||||||
|
$pdf->setCellPaddings($curentCellPaddinds['L'], $curentCellPaddinds['T'], $curentCellPaddinds['R'], $curentCellPaddinds['B']);
|
||||||
|
|
||||||
|
// 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, $colKey, $extrafieldDesc);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* get extrafield content for pdf writeHtmlCell compatibility
|
* get extrafield content for pdf writeHtmlCell compatibility
|
||||||
* usage for PDF line columns and object note block
|
* usage for PDF line columns and object note block
|
||||||
|
|||||||
@ -584,7 +584,7 @@ class pdf_sponge extends ModelePDFFactures
|
|||||||
|
|
||||||
$iniY = $tab_top + $this->tabTitleHeight + 2;
|
$iniY = $tab_top + $this->tabTitleHeight + 2;
|
||||||
$curY = $tab_top + $this->tabTitleHeight + 2;
|
$curY = $tab_top + $this->tabTitleHeight + 2;
|
||||||
$nexY = $tab_top + $this->tabTitleHeight + 2;
|
$nexY = $tab_top + $this->tabTitleHeight + 0;
|
||||||
|
|
||||||
// Loop on each lines
|
// Loop on each lines
|
||||||
$pageposbeforeprintlines = $pdf->getPage();
|
$pageposbeforeprintlines = $pdf->getPage();
|
||||||
@ -637,37 +637,15 @@ class pdf_sponge extends ModelePDFFactures
|
|||||||
if ($this->getColumnStatus('desc'))
|
if ($this->getColumnStatus('desc'))
|
||||||
{
|
{
|
||||||
$pdf->startTransaction();
|
$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();
|
$pageposafter = $pdf->getPage();
|
||||||
if ($pageposafter > $pageposbefore) // There is a pagebreak
|
if ($pageposafter > $pageposbefore) // There is a pagebreak
|
||||||
{
|
{
|
||||||
$pdf->rollbackTransaction(true);
|
$pdf->rollbackTransaction(true);
|
||||||
$pdf->setPageOrientation('', 1, $heightforfooter); // The only function to edit the bottom margin of current page to set it.
|
$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();
|
$this->printColDescContent($pdf, $curY, 'desc', $object, $i, $outputlangs, $hideref, $hidedesc);
|
||||||
$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);
|
|
||||||
}
|
|
||||||
|
|
||||||
$pageposafter = $pdf->getPage();
|
$pageposafter = $pdf->getPage();
|
||||||
$posyafter = $pdf->GetY();
|
$posyafter = $pdf->GetY();
|
||||||
@ -695,7 +673,6 @@ class pdf_sponge extends ModelePDFFactures
|
|||||||
{
|
{
|
||||||
$pdf->commitTransaction();
|
$pdf->commitTransaction();
|
||||||
}
|
}
|
||||||
$posYAfterDescription = $pdf->GetY();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$nexY = $pdf->GetY();
|
$nexY = $pdf->GetY();
|
||||||
@ -848,12 +825,10 @@ class pdf_sponge extends ModelePDFFactures
|
|||||||
$pdf->setPage($pageposafter);
|
$pdf->setPage($pageposafter);
|
||||||
$pdf->SetLineStyle(array('dash'=>'1,1', 'color'=>array(80, 80, 80)));
|
$pdf->SetLineStyle(array('dash'=>'1,1', 'color'=>array(80, 80, 80)));
|
||||||
//$pdf->SetDrawColor(190,190,200);
|
//$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));
|
$pdf->SetLineStyle(array('dash'=>0));
|
||||||
}
|
}
|
||||||
|
|
||||||
$nexY += 2; // Add space between lines
|
|
||||||
|
|
||||||
// Detect if some page were added automatically and output _tableau for past pages
|
// Detect if some page were added automatically and output _tableau for past pages
|
||||||
while ($pagenb < $pageposafter) {
|
while ($pagenb < $pageposafter) {
|
||||||
$pdf->setPage($pagenb);
|
$pdf->setPage($pagenb);
|
||||||
@ -2242,7 +2217,7 @@ class pdf_sponge extends ModelePDFFactures
|
|||||||
// Default field style for content
|
// Default field style for content
|
||||||
$this->defaultContentsFieldsStyle = array(
|
$this->defaultContentsFieldsStyle = array(
|
||||||
'align' => 'R', // R,C,L
|
'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
|
// Default field style for content
|
||||||
@ -2279,10 +2254,11 @@ class pdf_sponge extends ModelePDFFactures
|
|||||||
'align' => 'L',
|
'align' => 'L',
|
||||||
// 'textkey' => 'yourLangKey', // if there is no label, yourLangKey will be translated to replace label
|
// 'textkey' => 'yourLangKey', // if there is no label, yourLangKey will be translated to replace label
|
||||||
// 'label' => ' ', // the final 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, 0.5, 0.5, 0.5), // Like css 0 => top , 1 => right, 2 => bottom, 3 => left
|
||||||
),
|
),
|
||||||
'content' => array(
|
'content' => array(
|
||||||
'align' => 'L',
|
'align' => 'L',
|
||||||
|
'padding' => array(1, 0.5, 1, 1.5), // Like css 0 => top , 1 => right, 2 => bottom, 3 => left
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
|
||||||
@ -2429,4 +2405,5 @@ class pdf_sponge extends ModelePDFFactures
|
|||||||
$this->cols = $hookmanager->resArray;
|
$this->cols = $hookmanager->resArray;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user