NEW Add option PDF_ADD_POSITION

This commit is contained in:
Laurent Destailleur 2024-05-02 16:41:48 +02:00
parent e054e4380c
commit 94c69c08ba
3 changed files with 72 additions and 5 deletions

View File

@ -557,6 +557,10 @@ class pdf_eratosthene extends ModelePDFCommandes
$posYAfterImage = 0;
$posYAfterDescription = 0;
if ($this->getColumnStatus('position')) {
$this->printStdColumnContent($pdf, $curY, 'position', $i + 1);
}
if ($this->getColumnStatus('photo')) {
// We start with Photo of product line
if (isset($imglinesize['width']) && isset($imglinesize['height']) && ($curY + $imglinesize['height']) > ($this->page_hauteur - ($heightforfooter + $heightforfreetext + $heightforinfotot))) { // If photo too high, we moved completely on new page
@ -1728,7 +1732,7 @@ class pdf_eratosthene extends ModelePDFCommandes
*/
public function defineColumnField($object, $outputlangs, $hidedetails = 0, $hidedesc = 0, $hideref = 0)
{
global $conf, $hookmanager;
global $hookmanager;
// Default field style for content
$this->defaultContentsFieldsStyle = array(
@ -1761,6 +1765,24 @@ class pdf_eratosthene extends ModelePDFCommandes
*/
$rank = 0; // do not use negative rank
$this->cols['position'] = array(
'rank' => $rank,
'width' => 10,
'status' => getDolGlobalInt('PDF_ERATOSHTENE_ADD_POSITION') ? true : (getDolGlobalInt('PDF_ADD_POSITION') ? true : false),
'title' => array(
'textkey' => '#', // use lang key is useful in somme case with module
'align' => 'C',
// '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
),
'content' => array(
'align' => 'C',
'padding' => array(1, 0.5, 1, 1.5), // Like css 0 => top , 1 => right, 2 => bottom, 3 => left
),
);
$rank = 5; // do not use negative rank
$this->cols['desc'] = array(
'rank' => $rank,
'width' => false, // only for desc

View File

@ -714,6 +714,10 @@ class pdf_sponge extends ModelePDFFactures
$posYAfterImage = 0;
$posYAfterDescription = 0;
if ($this->getColumnStatus('position')) {
$this->printStdColumnContent($pdf, $curY, 'position', $i + 1);
}
if ($this->getColumnStatus('photo')) {
// We start with Photo of product line
if (isset($imglinesize['width']) && isset($imglinesize['height']) && ($curY + $imglinesize['height']) > ($this->page_hauteur - $page_bottom_margin)) { // If photo too high, we moved completely on new page
@ -2509,7 +2513,7 @@ class pdf_sponge extends ModelePDFFactures
*/
public function defineColumnField($object, $outputlangs, $hidedetails = 0, $hidedesc = 0, $hideref = 0)
{
global $conf, $hookmanager;
global $hookmanager;
// Default field style for content
$this->defaultContentsFieldsStyle = array(
@ -2542,6 +2546,24 @@ class pdf_sponge extends ModelePDFFactures
*/
$rank = 0; // do not use negative rank
$this->cols['position'] = array(
'rank' => $rank,
'width' => 10,
'status' => getDolGlobalInt('PDF_SPONGE_ADD_POSITION') ? true : (getDolGlobalInt('PDF_ADD_POSITION') ? true : false),
'title' => array(
'textkey' => '#', // use lang key is useful in somme case with module
'align' => 'C',
// '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
),
'content' => array(
'align' => 'C',
'padding' => array(1, 0.5, 1, 1.5), // Like css 0 => top , 1 => right, 2 => bottom, 3 => left
),
);
$rank = 5; // do not use negative rank
$this->cols['desc'] = array(
'rank' => $rank,
'width' => false, // only for desc

View File

@ -568,6 +568,10 @@ class pdf_cyan extends ModelePDFPropales
$posYAfterImage = 0;
$posYAfterDescription = 0;
if ($this->getColumnStatus('position')) {
$this->printStdColumnContent($pdf, $curY, 'position', $i + 1);
}
if ($this->getColumnStatus('photo')) {
// We start with Photo of product line
if (isset($imglinesize['width']) && isset($imglinesize['height']) && ($curY + $imglinesize['height']) > ($this->page_hauteur - ($heightforfooter + $heightforfreetext + $heightforsignature + $heightforinfotot))) { // If photo too high, we moved completely on new page
@ -1602,11 +1606,12 @@ class pdf_cyan extends ModelePDFPropales
$posy += 3;
$pdf->SetFont('', '', $default_font_size - 2);
if ($object->ref_client) {
$ref_customer = $object->ref_customer ?? $object->ref_client;
if ($ref_customer) {
$posy += 4;
$pdf->SetXY($posx, $posy);
$pdf->SetTextColor(0, 0, 60);
$pdf->MultiCell($w, 3, $outputlangs->transnoentities("RefCustomer")." : ".dol_trunc($outputlangs->convToOutputCharset($object->ref_client), 65), '', 'R');
$pdf->MultiCell($w, 3, $outputlangs->transnoentities("RefCustomer")." : ".dol_trunc($outputlangs->convToOutputCharset($ref_customer), 65), '', 'R');
}
if (getDolGlobalString('PDF_SHOW_PROJECT_TITLE')) {
@ -1864,7 +1869,7 @@ class pdf_cyan extends ModelePDFPropales
*/
public function defineColumnField($object, $outputlangs, $hidedetails = 0, $hidedesc = 0, $hideref = 0)
{
global $conf, $hookmanager;
global $hookmanager;
// Default field style for content
$this->defaultContentsFieldsStyle = array(
@ -1897,6 +1902,24 @@ class pdf_cyan extends ModelePDFPropales
*/
$rank = 0; // do not use negative rank
$this->cols['position'] = array(
'rank' => $rank,
'width' => 10,
'status' => getDolGlobalInt('PDF_CYAN_ADD_POSITION') ? true : (getDolGlobalInt('PDF_ADD_POSITION') ? true : false),
'title' => array(
'textkey' => '#', // use lang key is useful in somme case with module
'align' => 'C',
// '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
),
'content' => array(
'align' => 'C',
'padding' => array(1, 0.5, 1, 1.5), // Like css 0 => top , 1 => right, 2 => bottom, 3 => left
),
);
$rank = 5; // do not use negative rank
$this->cols['desc'] = array(
'rank' => $rank,
'width' => false, // only for desc