From 14b6173d872ea7960c1ef514be862a91f85a5a10 Mon Sep 17 00:00:00 2001
From: Regis Houssin <regis@dolibarr.fr>
Date: Tue, 3 Apr 2012 17:56:54 +0200
Subject: [PATCH] Fix: add width and minimum height of cells parameters

---
 htdocs/core/lib/pdf.lib.php                               | 8 +++++---
 htdocs/core/modules/commande/doc/pdf_edison.modules.php   | 2 +-
 htdocs/core/modules/commande/doc/pdf_einstein.modules.php | 2 +-
 htdocs/core/modules/facture/doc/pdf_crabe.modules.php     | 2 +-
 htdocs/core/modules/facture/doc/pdf_oursin.modules.php    | 2 +-
 htdocs/core/modules/propale/doc/pdf_azur.modules.php      | 2 +-
 6 files changed, 10 insertions(+), 8 deletions(-)

diff --git a/htdocs/core/lib/pdf.lib.php b/htdocs/core/lib/pdf.lib.php
index 2914d5feaa9..4e4c717d208 100644
--- a/htdocs/core/lib/pdf.lib.php
+++ b/htdocs/core/lib/pdf.lib.php
@@ -694,12 +694,14 @@ function pdf_pagefoot(&$pdf,$outputlangs,$paramfreetext,$fromcompany,$marge_bass
  *	@param  Translate	$outputlangs		Object lang
  *	@param  int			$posx				X
  *	@param  int			$posy				Y
+ *	@param	float		$w					Width of cells. If 0, they extend up to the right margin of the page.
+ *	@param	float		$h					Cell minimum height. The cell extends automatically if needed.
  *	@param	int			$align				Align
  *	@param	string		$default_font_size	Font size
  *	@param	HookManager	$hookmanager		Hook manager object
  *	@return	void
  */
-function pdf_writeLinkedObjects(&$pdf,$object,$outputlangs,$posx,$posy,$align,$default_font_size,$hookmanager=false)
+function pdf_writeLinkedObjects(&$pdf,$object,$outputlangs,$posx,$posy,$w,$h,$align,$default_font_size,$hookmanager=false)
 {
 	$linkedobjects = pdf_getLinkedObjects($object,$outputlangs,$hookmanager);
 	if (! empty($linkedobjects))
@@ -709,13 +711,13 @@ function pdf_writeLinkedObjects(&$pdf,$object,$outputlangs,$posx,$posy,$align,$d
 			$posy+=3;
 			$pdf->SetXY($posx,$posy);
 			$pdf->SetFont('','', $default_font_size - 2);
-			$pdf->MultiCell(100, 3, $linkedobject["ref_title"].' : '.$linkedobject["ref_value"], '', $align);
+			$pdf->MultiCell($w, $h, $linkedobject["ref_title"].' : '.$linkedobject["ref_value"], '', $align);
 
 			if (! empty($linkedobject["date_title"]) && ! empty($linkedobject["date_value"]))
 			{
 				$posy+=3;
 				$pdf->SetXY($posx,$posy);
-				$pdf->MultiCell(100, 3, $linkedobject["date_title"].' : '.$linkedobject["date_value"], '', $align);
+				$pdf->MultiCell($w, $h, $linkedobject["date_title"].' : '.$linkedobject["date_value"], '', $align);
 			}
 		}
 	}
diff --git a/htdocs/core/modules/commande/doc/pdf_edison.modules.php b/htdocs/core/modules/commande/doc/pdf_edison.modules.php
index 4dd0ba21ab5..fbe8770dc6e 100644
--- a/htdocs/core/modules/commande/doc/pdf_edison.modules.php
+++ b/htdocs/core/modules/commande/doc/pdf_edison.modules.php
@@ -653,7 +653,7 @@ class pdf_edison extends ModelePDFCommandes
 		$posy+=1;
 
 		// Show list of linked objects
-		$posy = pdf_writeLinkedObjects($pdf, $object, $outputlangs, $posx, $posy, 'L', $default_font_size, $hookmanager);
+		$posy = pdf_writeLinkedObjects($pdf, $object, $outputlangs, $posx, $posy, 100, 3, 'L', $default_font_size, $hookmanager);
 	}
 
 	/**
diff --git a/htdocs/core/modules/commande/doc/pdf_einstein.modules.php b/htdocs/core/modules/commande/doc/pdf_einstein.modules.php
index 809f2d7f4ac..0e0c7f1474f 100644
--- a/htdocs/core/modules/commande/doc/pdf_einstein.modules.php
+++ b/htdocs/core/modules/commande/doc/pdf_einstein.modules.php
@@ -930,7 +930,7 @@ class pdf_einstein extends ModelePDFCommandes
 		$posy+=2;
 
 		// Show list of linked objects
-		$posy = pdf_writeLinkedObjects($pdf, $object, $outputlangs, $posx, $posy, 'R', $default_font_size, $hookmanager);
+		$posy = pdf_writeLinkedObjects($pdf, $object, $outputlangs, $posx, $posy, 100, 3, 'R', $default_font_size, $hookmanager);
 
 		if ($showaddress)
 		{
diff --git a/htdocs/core/modules/facture/doc/pdf_crabe.modules.php b/htdocs/core/modules/facture/doc/pdf_crabe.modules.php
index 29438a05af7..e7b7f33b037 100755
--- a/htdocs/core/modules/facture/doc/pdf_crabe.modules.php
+++ b/htdocs/core/modules/facture/doc/pdf_crabe.modules.php
@@ -1125,7 +1125,7 @@ class pdf_crabe extends ModelePDFFactures
 		$posy+=2;
 
 		// Show list of linked objects
-		$posy = pdf_writeLinkedObjects($pdf, $object, $outputlangs, $posx, $posy, 'R', $default_font_size, $hookmanager);
+		$posy = pdf_writeLinkedObjects($pdf, $object, $outputlangs, $posx, $posy, 100, 3, 'R', $default_font_size, $hookmanager);
 
 		if ($showaddress)
 		{
diff --git a/htdocs/core/modules/facture/doc/pdf_oursin.modules.php b/htdocs/core/modules/facture/doc/pdf_oursin.modules.php
index 7b6719be03a..274b11a4baf 100755
--- a/htdocs/core/modules/facture/doc/pdf_oursin.modules.php
+++ b/htdocs/core/modules/facture/doc/pdf_oursin.modules.php
@@ -1003,7 +1003,7 @@ class pdf_oursin extends ModelePDFFactures
 		$posy+=1;
 
 		// Show list of linked objects
-		$posy = pdf_writeLinkedObjects($pdf, $object, $outputlangs, $posx, $posy, 'L', $default_font_size, $hookmanager);
+		$posy = pdf_writeLinkedObjects($pdf, $object, $outputlangs, $posx, $posy, 100, 3, 'L', $default_font_size, $hookmanager);
 
 		// Amount in (at tab_top - 1)
 		$pdf->SetTextColor(0,0,0);
diff --git a/htdocs/core/modules/propale/doc/pdf_azur.modules.php b/htdocs/core/modules/propale/doc/pdf_azur.modules.php
index 13a68888d54..b17312c6b3b 100644
--- a/htdocs/core/modules/propale/doc/pdf_azur.modules.php
+++ b/htdocs/core/modules/propale/doc/pdf_azur.modules.php
@@ -985,7 +985,7 @@ class pdf_azur extends ModelePDFPropales
 		$posy+=2;
 
 		// Show list of linked objects
-		$posy = pdf_writeLinkedObjects($pdf, $object, $outputlangs, $posx, $posy, 'R', $default_font_size, $hookmanager);
+		$posy = pdf_writeLinkedObjects($pdf, $object, $outputlangs, $posx, $posy, 100, 3, 'R', $default_font_size, $hookmanager);
 
 		if ($showaddress)
 		{
-- 
GitLab