From bd8cdd337a5f896623e4a85936d11bb5a665be74 Mon Sep 17 00:00:00 2001
From: Laurent Destailleur <eldy@destailleur.fr>
Date: Sat, 26 Apr 2014 22:17:11 +0200
Subject: [PATCH] Fix: Option MAIN_INVERT_SENDER_RECIPIENT broken with typhon
 template.

---
 ChangeLog                                                | 1 +
 htdocs/core/modules/livraison/pdf/pdf_typhon.modules.php | 6 ++++--
 2 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 5d1af46d54f..455ba63c7ee 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -6,6 +6,7 @@ English Dolibarr ChangeLog
 Fix: Error on field accountancy code for export profile of invoices.
 Fix: [ bug #1351 ] VIES verification link broken.
 Fix: [ bug #1352 ] Removing a shipping does not remove the delivery.
+Fix: Option MAIN_INVERT_SENDER_RECIPIENT broken with typhon template.
 
 
 ***** ChangeLog for 3.5.2 compared to 3.5.1 *****
diff --git a/htdocs/core/modules/livraison/pdf/pdf_typhon.modules.php b/htdocs/core/modules/livraison/pdf/pdf_typhon.modules.php
index b9d61ec1049..295139e4619 100644
--- a/htdocs/core/modules/livraison/pdf/pdf_typhon.modules.php
+++ b/htdocs/core/modules/livraison/pdf/pdf_typhon.modules.php
@@ -780,9 +780,11 @@ class pdf_typhon extends ModelePDFDeliveryOrder
 
 			// Client destinataire
 			$posy=42;
+			$posx=102;
+			if (! empty($conf->global->MAIN_INVERT_SENDER_RECIPIENT)) $posx=$this->marge_gauche;
 			$pdf->SetTextColor(0,0,0);
 			$pdf->SetFont('','', $default_font_size - 2);
-			$pdf->SetXY(102,$posy-5);
+			$pdf->SetXY($posx,$posy-5);
 			$pdf->MultiCell(80,5, $outputlangs->transnoentities("DeliveryAddress").":", 0, 'L');
 
 			// If SHIPPING contact defined on order, we use it
@@ -814,7 +816,7 @@ class pdf_typhon extends ModelePDFDeliveryOrder
 			if ($this->page_largeur < 210) $widthrecbox=84;	// To work with US executive format
 			$posy=42;
 			$posx=$this->page_largeur-$this->marge_droite-$widthrecbox;
-			//if (! empty($conf->global->MAIN_INVERT_SENDER_RECIPIENT)) $posx=$this->marge_gauche;
+			if (! empty($conf->global->MAIN_INVERT_SENDER_RECIPIENT)) $posx=$this->marge_gauche;
 
 			// Show recipient frame
 			$pdf->SetTextColor(0,0,0);
-- 
GitLab