Browse Source

Add extrafields on PDF object lines desc for compatible pdf

ATM john 5 years ago
parent
commit
377b9a6b88

+ 14 - 1
htdocs/core/modules/commande/doc/pdf_eratosthene.modules.php

@@ -604,7 +604,20 @@ class pdf_eratosthene extends ModelePDFCommandes
 					{
     					$pdf->startTransaction();
     					pdf_writelinedesc($pdf, $object, $i, $outputlangs, $this->getColumnContentWidth('desc'), 3, $this->getColumnContentXStart('desc'), $curY, $hideref, $hidedesc);
-    					$pageposafter = $pdf->getPage();
+                        $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);
+                        }
+
+                        $pageposafter = $pdf->getPage();
     					if ($pageposafter > $pageposbefore)	// There is a pagebreak
     					{
     						$pdf->rollbackTransaction(true);

+ 26 - 1
htdocs/core/modules/expedition/doc/pdf_espadon.modules.php

@@ -474,7 +474,20 @@ class pdf_espadon extends ModelePdfExpedition
 					{
 					    $pdf->startTransaction();
 					    pdf_writelinedesc($pdf, $object, $i, $outputlangs, $this->getColumnContentWidth('desc'), 3, $this->getColumnContentXStart('desc'), $curY, $hideref, $hidedesc);
-					    $pageposafter = $pdf->getPage();
+                        $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);
+                        }
+
+                        $pageposafter = $pdf->getPage();
 					    if ($pageposafter > $pageposbefore)	// There is a pagebreak
 					    {
 					        $pdf->rollbackTransaction(true);
@@ -482,6 +495,18 @@ class pdf_espadon extends ModelePdfExpedition
 					        //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);
+                            }
 
 					        $pageposafter = $pdf->getPage();
 					        $posyafter = $pdf->GetY();

+ 7 - 4
htdocs/core/modules/facture/doc/pdf_sponge.modules.php

@@ -639,10 +639,13 @@ class pdf_sponge extends ModelePDFFactures
     	                $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',
-                            'documentpdfEnable' => array(3),
-                            'documentpdfEnableNotEmpty' => array(4)
+                            'printableEnable' => array(3),
+                            'printableEnableNotEmpty' => array(4)
                         );
                         $extrafieldDesc = $this->getExtrafieldsInHtml($object->lines[$i], $outputlangs, $params);
                         if(!empty($extrafieldDesc)){
@@ -658,8 +661,8 @@ class pdf_sponge extends ModelePDFFactures
                             $posYAfterDescription = $pdf->GetY();
                             $params = array(
                                 'display'         => 'list',
-                                'documentpdfEnable' => array(3),
-                                'documentpdfEnableNotEmpty' => array(4)
+                                'printableEnable' => array(3),
+                                'printableEnableNotEmpty' => array(4)
                             );
                             $extrafieldDesc = $this->getExtrafieldsInHtml($object->lines[$i], $outputlangs, $params);
                             if(!empty($extrafieldDesc)){

+ 25 - 0
htdocs/core/modules/propale/doc/pdf_cyan.modules.php

@@ -622,6 +622,19 @@ class pdf_cyan extends ModelePDFPropales
 					{
     					$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);
+                        }
+
     					$pageposafter = $pdf->getPage();
     					if ($pageposafter > $pageposbefore)	// There is a pagebreak
     					{
@@ -630,6 +643,18 @@ class pdf_cyan extends ModelePDFPropales
     						//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);
+                            }
 
     						$pageposafter = $pdf->getPage();
     						$posyafter = $pdf->GetY();

+ 26 - 0
htdocs/core/modules/supplier_order/doc/pdf_cornas.modules.php

@@ -556,6 +556,19 @@ class pdf_cornas extends ModelePDFSuppliersOrders
 					{
 					    $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);
+                        }
+
 					    $pageposafter = $pdf->getPage();
 					    if ($pageposafter > $pageposbefore)	// There is a pagebreak
 					    {
@@ -564,6 +577,19 @@ class pdf_cornas extends ModelePDFSuppliersOrders
 					        //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);
+                            }
+
 					        $pageposafter = $pdf->getPage();
 					        $posyafter = $pdf->GetY();
 					        if ($posyafter > ($this->page_hauteur - ($heightforfooter + $heightforfreetext + $heightforinfotot)))	// There is no space left for total+free text