Merge pull request #13185 from atm-john/12.0_new_allow_extrafields_on_pdf_extend_to_line_desc
NEW : Allow extrafields on pdf : extend to line desc
This commit is contained in:
commit
61cb1ec81a
@ -184,7 +184,7 @@ if ($action == 'add')
|
||||
GETPOST('langfile', 'alpha'),
|
||||
1,
|
||||
(GETPOST('totalizable', 'alpha')?1:0),
|
||||
(GETPOST('printable', 'alpha')?1:0)
|
||||
GETPOST('printable', 'alpha')
|
||||
);
|
||||
if ($result > 0)
|
||||
{
|
||||
@ -354,7 +354,7 @@ if ($action == 'update')
|
||||
GETPOST('langfile'),
|
||||
1,
|
||||
(GETPOST('totalizable', 'alpha')?1:0),
|
||||
(GETPOST('printable', 'alpha')?1:0)
|
||||
GETPOST('printable', 'alpha')
|
||||
);
|
||||
if ($result > 0)
|
||||
{
|
||||
|
||||
@ -1090,7 +1090,7 @@ abstract class CommonDocGenerator
|
||||
/**
|
||||
* print standard column content
|
||||
*
|
||||
* @param PDF $pdf pdf object
|
||||
* @param TCPDF $pdf pdf object
|
||||
* @param float $curY curent Y position
|
||||
* @param string $colKey the column key
|
||||
* @param string $columnText column text
|
||||
@ -1110,9 +1110,59 @@ abstract class CommonDocGenerator
|
||||
if (!$reshook)
|
||||
{
|
||||
if (empty($columnText)) return;
|
||||
$pdf->SetXY($this->getColumnContentXStart($colKey) - 1, $curY); // Set curent position
|
||||
$pdf->SetXY($this->getColumnContentXStart($colKey), $curY); // Set curent position
|
||||
$colDef = $this->cols[$colKey];
|
||||
$pdf->writeHTMLCell($this->getColumnContentWidth($colKey) + 2, 2, $this->getColumnContentXStart($colKey) - 1, $curY, $columnText, 0, 0, 0, true, $colDef['content']['align']);
|
||||
// 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]);
|
||||
$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']);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* print description column content
|
||||
*
|
||||
* @param TCPDF $pdf pdf object
|
||||
* @param float $curY curent Y position
|
||||
* @param string $colKey the column key
|
||||
* @param object $object CommonObject
|
||||
* @param int $i the $object->lines array key
|
||||
* @param Translate $outputlangs Output language
|
||||
* @param int $hideref hide ref
|
||||
* @param int $hidedesc hide desc
|
||||
* @param int $issupplierline if object need supplier product
|
||||
* @return null
|
||||
*/
|
||||
public 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);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1195,6 +1245,8 @@ abstract class CommonDocGenerator
|
||||
$defaultParams = array(
|
||||
'style' => '',
|
||||
'display' => 'auto', // auto, table, list
|
||||
'printableEnable' => array(1),
|
||||
'printableEnableNotEmpty' => array(2),
|
||||
|
||||
'table' => array(
|
||||
'maxItemsInRow' => 2,
|
||||
@ -1229,7 +1281,18 @@ abstract class CommonDocGenerator
|
||||
foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $label)
|
||||
{
|
||||
// Enable extrafield ?
|
||||
$enabled = !empty($extrafields->attributes[$object->table_element]['printable'][$key]);
|
||||
$enabled = 0;
|
||||
$disableOnEmpty = 0;
|
||||
if(!empty($extrafields->attributes[$object->table_element]['printable'][$key])) {
|
||||
$printable = intval($extrafields->attributes[$object->table_element]['printable'][$key]);
|
||||
if(in_array($printable, $params['printableEnable']) || in_array($printable, $params['printableEnableNotEmpty']) ) {
|
||||
$enabled = 1;
|
||||
}
|
||||
|
||||
if (in_array($printable, $params['printableEnableNotEmpty'])) {
|
||||
$disableOnEmpty = 1;
|
||||
}
|
||||
}
|
||||
|
||||
if(empty($enabled)){
|
||||
continue;
|
||||
@ -1241,6 +1304,11 @@ abstract class CommonDocGenerator
|
||||
$field->label = $outputlangs->transnoentities($label);
|
||||
$field->type = $extrafields->attributes[$object->table_element]['type'][$key];
|
||||
|
||||
// dont display if empty
|
||||
if($disableOnEmpty && empty($field->content)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$fields[] = $field;
|
||||
}
|
||||
}
|
||||
@ -1250,13 +1318,10 @@ abstract class CommonDocGenerator
|
||||
// Sort extrafields by rank
|
||||
uasort($fields, function ($a, $b) {
|
||||
return ($a->rank > $b->rank) ? -1 : 1;
|
||||
}
|
||||
);
|
||||
|
||||
|
||||
});
|
||||
|
||||
// define some HTML content with style
|
||||
$html.= '<style>'.$params['style'].'</style>';
|
||||
$html.= !empty($params['style'])?'<style>'.$params['style'].'</style>':'';
|
||||
|
||||
// auto select display format
|
||||
if($params['display'] == 'auto') {
|
||||
@ -1271,10 +1336,12 @@ abstract class CommonDocGenerator
|
||||
|
||||
if($params['display'] == 'list') {
|
||||
// Display in list format
|
||||
$i=0;
|
||||
foreach ($fields as $field) {
|
||||
$html .= !empty($html)?$params['list']['separator']:'';
|
||||
$html .= !empty($i)?$params['list']['separator']:'';
|
||||
$html .= '<strong>' . $field->label . ' : </strong>';
|
||||
$html .= $field->content;
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
elseif($params['display'] == 'table') {
|
||||
@ -1349,7 +1416,7 @@ abstract class CommonDocGenerator
|
||||
/**
|
||||
* Print standard column content
|
||||
*
|
||||
* @param PDF $pdf Pdf object
|
||||
* @param TCPDI $pdf Pdf object
|
||||
* @param float $tab_top Tab top position
|
||||
* @param float $tab_height Default tab height
|
||||
* @param Translate $outputlangs Output language
|
||||
@ -1385,18 +1452,35 @@ abstract class CommonDocGenerator
|
||||
}
|
||||
|
||||
if (empty($hidetop)) {
|
||||
$pdf->SetXY($colDef['xStartPos'] + $colDef['title']['padding'][3], $tab_top + $colDef['title']['padding'][0]);
|
||||
$textWidth = $colDef['width'] - $colDef['title']['padding'][3] - $colDef['title']['padding'][1];
|
||||
$pdf->MultiCell($textWidth, 2, $colDef['title']['label'], '', $colDef['title']['align']);
|
||||
// save curent cell padding
|
||||
$curentCellPaddinds = $pdf->getCellPaddings();
|
||||
|
||||
global $outputlangsbis;
|
||||
if (is_object($outputlangsbis)) {
|
||||
$pdf->SetXY($colDef['xStartPos'] + $colDef['title']['padding'][3], $tab_top + $colDef['title']['padding'][0] + 4);
|
||||
// set cell padding with column title definition
|
||||
$pdf->setCellPaddings($colDef['title']['padding'][3], $colDef['title']['padding'][0], $colDef['title']['padding'][1], 0.5);
|
||||
}
|
||||
else{
|
||||
// set cell padding with column title definition
|
||||
$pdf->setCellPaddings($colDef['title']['padding'][3], $colDef['title']['padding'][0], $colDef['title']['padding'][1], $colDef['title']['padding'][2]);
|
||||
}
|
||||
|
||||
$pdf->SetXY($colDef['xStartPos'], $tab_top);
|
||||
$textWidth = $colDef['width'];
|
||||
$pdf->MultiCell($textWidth, 2, $colDef['title']['label'], '', $colDef['title']['align']);
|
||||
|
||||
|
||||
if (is_object($outputlangsbis)) {
|
||||
$pdf->setCellPaddings($colDef['title']['padding'][3], 0, $colDef['title']['padding'][1], $colDef['title']['padding'][2]);
|
||||
$pdf->SetXY($colDef['xStartPos'], $pdf->GetY());
|
||||
$textbis = $outputlangsbis->transnoentities($colDef['title']['textkey']);
|
||||
$pdf->MultiCell($textWidth, 2, $textbis, '', $colDef['title']['align']);
|
||||
}
|
||||
|
||||
$this->tabTitleHeight = max($pdf->GetY() - $tab_top + $colDef['title']['padding'][2], $this->tabTitleHeight);
|
||||
$this->tabTitleHeight = max($pdf->GetY() - $tab_top, $this->tabTitleHeight);
|
||||
|
||||
// restore cell padding
|
||||
$pdf->setCellPaddings($curentCellPaddinds['L'], $curentCellPaddinds['T'], $curentCellPaddinds['R'], $curentCellPaddinds['B']);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1441,8 +1525,16 @@ abstract class CommonDocGenerator
|
||||
}
|
||||
|
||||
// Enable extrafield ?
|
||||
$enabled = !empty($extrafields->attributes[$object->table_element]['printable'][$key]);
|
||||
$enabled = 0;
|
||||
if(!empty($extrafields->attributes[$object->table_element]['printable'][$key])) {
|
||||
$printable = intval($extrafields->attributes[$object->table_element]['printable'][$key]);
|
||||
if($printable === 1 || $printable === 2) {
|
||||
$enabled = 1;
|
||||
}
|
||||
// Note : if $printable === 3 or 4 so, it's displayed after line description not in cols
|
||||
}
|
||||
|
||||
if (!$enabled){ continue; } // don't wast resourses if we don't need them...
|
||||
|
||||
// Load language if required
|
||||
if (!empty($extrafields->attributes[$object->table_element]['langfile'][$key])) $outputlangs->load($extrafields->attributes[$object->table_element]['langfile'][$key]);
|
||||
|
||||
@ -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,15 +598,18 @@ 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);
|
||||
$pageposafter = $pdf->getPage();
|
||||
|
||||
$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);
|
||||
|
||||
$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
|
||||
@ -638,7 +636,6 @@ class pdf_eratosthene extends ModelePDFCommandes
|
||||
{
|
||||
$pdf->commitTransaction();
|
||||
}
|
||||
$posYAfterDescription = $pdf->GetY();
|
||||
}
|
||||
|
||||
|
||||
@ -775,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)
|
||||
@ -1691,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, 0.5, 0.5, 0.5), // 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
|
||||
@ -1728,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, 0.5, 0.5, 0.5), // 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
|
||||
),
|
||||
);
|
||||
|
||||
|
||||
@ -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,15 +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);
|
||||
$pageposafter = $pdf->getPage();
|
||||
|
||||
$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);
|
||||
|
||||
$this->printColDescContent($pdf, $curY, 'desc', $object, $i, $outputlangs, $hideref, $hidedesc);
|
||||
|
||||
$pageposafter = $pdf->getPage();
|
||||
$posyafter = $pdf->GetY();
|
||||
@ -582,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));
|
||||
}
|
||||
|
||||
@ -1121,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, 0.5, 0.5, 0.5), // 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
|
||||
@ -1158,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, 0.5, 0.5, 0.5), // 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
|
||||
),
|
||||
);
|
||||
|
||||
|
||||
@ -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 + 2;
|
||||
$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'))
|
||||
{
|
||||
@ -637,13 +634,17 @@ class pdf_sponge extends ModelePDFFactures
|
||||
if ($this->getColumnStatus('desc'))
|
||||
{
|
||||
$pdf->startTransaction();
|
||||
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();
|
||||
|
||||
if ($pageposafter > $pageposbefore) // There is a pagebreak
|
||||
{
|
||||
$pdf->rollbackTransaction(true);
|
||||
$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();
|
||||
//var_dump($posyafter); var_dump(($this->page_hauteur - ($heightforfooter+$heightforfreetext+$heightforinfotot))); exit;
|
||||
@ -670,10 +671,9 @@ class pdf_sponge extends ModelePDFFactures
|
||||
{
|
||||
$pdf->commitTransaction();
|
||||
}
|
||||
$posYAfterDescription = $pdf->GetY();
|
||||
}
|
||||
|
||||
$nexY = $pdf->GetY();
|
||||
$nexY = $pdf->GetY();
|
||||
$pageposafter = $pdf->getPage();
|
||||
$pdf->setPage($pageposbefore);
|
||||
$pdf->setTopMargin($this->marge_haute);
|
||||
@ -823,12 +823,10 @@ class pdf_sponge extends ModelePDFFactures
|
||||
$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) {
|
||||
$pdf->setPage($pagenb);
|
||||
@ -2216,7 +2214,7 @@ class pdf_sponge extends ModelePDFFactures
|
||||
// Default field style for content
|
||||
$this->defaultContentsFieldsStyle = array(
|
||||
'align' => 'R', // R,C,L
|
||||
'padding' => array(0.5, 0.5, 0.5, 0.5), // 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
|
||||
@ -2257,6 +2255,7 @@ class pdf_sponge extends ModelePDFFactures
|
||||
),
|
||||
'content' => array(
|
||||
'align' => 'L',
|
||||
'padding' => array(1, 0.5, 1, 1.5), // Like css 0 => top , 1 => right, 2 => bottom, 3 => left
|
||||
),
|
||||
);
|
||||
|
||||
|
||||
@ -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,15 +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);
|
||||
|
||||
$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);
|
||||
|
||||
$this->printColDescContent($pdf, $curY, 'desc', $object, $i, $outputlangs, $hideref, $hidedesc);
|
||||
|
||||
$pageposafter = $pdf->getPage();
|
||||
$posyafter = $pdf->GetY();
|
||||
@ -794,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)
|
||||
@ -1840,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, 0.5, 0.5, 0.5), // 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
|
||||
@ -1877,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, 0.5, 0.5, 0.5), // 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
|
||||
),
|
||||
);
|
||||
|
||||
|
||||
@ -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,15 +553,15 @@ 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);
|
||||
$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);
|
||||
|
||||
$this->printColDescContent($pdf, $curY, 'desc', $object, $i, $outputlangs, $hideref, $hidedesc, 1);
|
||||
|
||||
$pageposafter = $pdf->getPage();
|
||||
$posyafter = $pdf->GetY();
|
||||
if ($posyafter > ($this->page_hauteur - ($heightforfooter + $heightforfreetext + $heightforinfotot))) // There is no space left for total+free text
|
||||
@ -724,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)
|
||||
{
|
||||
@ -1483,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, 0.5, 0.5, 0.5), // 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
|
||||
@ -1520,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, 0.5, 0.5, 0.5), // 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
|
||||
),
|
||||
);
|
||||
|
||||
|
||||
@ -198,7 +198,7 @@ $langs->load("modulebuilder");
|
||||
</td><td class="valeur"><input id="list" class="minwidth100" type="text" name="list" value="<?php echo GETPOST('list', 'int')!='' ? GETPOST('list', 'int') : '1'; ?>"></td></tr>
|
||||
<!-- Visibility for PDF-->
|
||||
<tr><td class="extra_pdf"><?php echo $form->textwithpicto($langs->trans("DisplayOnPdf"), $langs->trans("DisplayOnPdfDesc")); ?>
|
||||
</td><td class="valeur"><input id="printable" type="checkbox" name="printable"<?php echo GETPOST('printable', 'alpha')?' checked':''; ?>></td></tr>
|
||||
</td><td class="valeur"><input id="printable" class="minwidth100" type="text" name="printable" value="<?php echo dol_escape_htmltag(GETPOST('printable', 'int')); ?>"></td></tr>
|
||||
<!-- Totalizable -->
|
||||
<tr class="extra_totalizable"><td><?php echo $langs->trans("Totalizable"); ?></td><td class="valeur"><input id="totalizable" type="checkbox" name="totalizable"<?php echo ((GETPOST('totalizable', 'alpha') || GETPOST('button', 'alpha'))?' checked':''); ?>></td></tr>
|
||||
<!-- Help tooltip -->
|
||||
|
||||
@ -267,7 +267,7 @@ else
|
||||
</td><td class="valeur"><input id="list" class="minwidth100" type="text" name="list" value="<?php echo ($list!=''?$list:'1'); ?>"></td></tr>
|
||||
<!-- Visibility for PDF-->
|
||||
<tr><td class="extra_pdf"><?php echo $form->textwithpicto($langs->trans("DisplayOnPdf"), $langs->trans("DisplayOnPdfDesc")); ?>
|
||||
</td><td class="valeur"><input id="printable" type="checkbox" name="printable"<?php echo !empty($printable)?' checked':''; ?>></td></tr>
|
||||
</td><td class="valeur"><input id="printable" class="minwidth100" type="text" name="printable" value="<?php echo dol_escape_htmltag($printable); ?>"></td></tr>
|
||||
<tr class="extra_totalizable"><td><?php echo $form->textwithpicto($langs->trans("Totalizable"), $langs->trans("TotalizableDesc")); ?></td><td class="valeur"><input id="totalizable" type="checkbox" name="totalizable"<?php echo ($totalizable?' checked':''); ?>></td></tr>
|
||||
<!-- Help tooltip -->
|
||||
<tr class="help"><td><?php echo $form->textwithpicto($langs->trans("HelpOnTooltip"), $langs->trans("HelpOnTooltipDesc")); ?></td><td class="valeur"><input id="help" class="quatrevingtpercent" type="text" name="help" value="<?php echo dol_escape_htmltag($help); ?>"></td></tr>
|
||||
|
||||
@ -93,7 +93,7 @@ if (is_array($extrafields->attributes[$elementtype]['type']) && count($extrafiel
|
||||
print '<td class="center">'.yn($extrafields->attributes[$elementtype]['required'][$key])."</td>\n";
|
||||
print '<td class="center">'.yn($extrafields->attributes[$elementtype]['alwayseditable'][$key])."</td>\n";
|
||||
print '<td class="center">'.$extrafields->attributes[$elementtype]['list'][$key]."</td>\n";
|
||||
print '<td class="center">'.yn($extrafields->attributes[$elementtype]['printable'][$key])."</td>\n";
|
||||
print '<td class="center">'.$extrafields->attributes[$elementtype]['printable'][$key]."</td>\n";
|
||||
print '<td class="center">'.yn($extrafields->attributes[$elementtype]['totalizable'][$key])."</td>\n";
|
||||
if (! empty($conf->multicompany->enabled)) {
|
||||
print '<td class="center">';
|
||||
|
||||
@ -84,7 +84,7 @@ ListOfPermissionsDefined=List of defined permissions
|
||||
SeeExamples=See examples here
|
||||
EnabledDesc=Condition to have this field active (Examples: 1 or $conf->global->MYMODULE_MYOPTION)
|
||||
VisibleDesc=Is the field visible ? (Examples: 0=Never visible, 1=Visible on list and create/update/view forms, 2=Visible on list only, 3=Visible on create/update/view form only (not list), 4=Visible on list and update/view form only (not create), 5=Visible on list end view form only (not create, not update). Using a negative value means field is not shown by default on list but can be selected for viewing). It can be an expression, for example:<br>preg_match('/public/', $_SERVER['PHP_SELF'])?0:1<br>($user->rights->holiday->define_holiday ? 1 : 0)
|
||||
DisplayOnPdfDesc=Display this field on compatible PDF documents, you can manage position with "Position" field.<br/>Currently, known compatibles PDF models are : eratostene (order), espadon (ship), sponge (invoices), cyan (propal/quotation), cornas (supplier order)
|
||||
DisplayOnPdfDesc=Display this field on compatible PDF documents, you can manage position with "Position" field.<br/>Currently, known compatibles PDF models are : eratostene (order), espadon (ship), sponge (invoices), cyan (propal/quotation), cornas (supplier order)<br/><br/><strong>For document :</strong><br/>0 = not displayed <br/>1 = display<br/>2 = display only if not empty<br/><br/><strong>For document lines :</strong><br/>0 = not displayed <br/>1 = displayed in a column<br/>3 = display in line description column after the description<br/>4 = display in description column after the description only if not empty
|
||||
DisplayOnPdf=Display on PDF
|
||||
IsAMeasureDesc=Can the value of field be cumulated to get a total into list? (Examples: 1 or 0)
|
||||
SearchAllDesc=Is the field used to make a search from the quick search tool? (Examples: 1 or 0)
|
||||
@ -138,4 +138,4 @@ NotEditable=Not editable
|
||||
ForeignKey=Foreign key
|
||||
TypeOfFieldsHelp=Type of fields:<br>varchar(99), double(24,8), real, text, html, datetime, timestamp, integer, integer:ClassName:relativepath/to/classfile.class.php[:1[:filter]] ('1' means we add a + button after the combo to create the record, 'filter' can be 'status=1 AND fk_user = __USER_ID AND entity IN (__SHARED_ENTITIES__)' for example)
|
||||
AsciiToHtmlConverter=Ascii to HTML converter
|
||||
AsciiToPdfConverter=Ascii to PDF converter
|
||||
AsciiToPdfConverter=Ascii to PDF converter
|
||||
|
||||
Loading…
Reference in New Issue
Block a user