From 9e06f185c52be3987a8275e867a33551891ac6af Mon Sep 17 00:00:00 2001
From: Laurent Destailleur <eldy@destailleur.fr>
Date: Thu, 6 Feb 2014 18:19:49 +0100
Subject: [PATCH] Fix: Fix problem of invalid paypal link with \n.

---
 htdocs/compta/facture.php                 | 5 ++++-
 htdocs/core/class/html.formmail.class.php | 4 ++--
 2 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/htdocs/compta/facture.php b/htdocs/compta/facture.php
index 044cc203cf8..69c24341f9c 100644
--- a/htdocs/compta/facture.php
+++ b/htdocs/compta/facture.php
@@ -3917,7 +3917,10 @@ else if ($id > 0 || ! empty($ref))
 		$formmail->frommail = $user->email;
 		$formmail->withfrom=1;
 		$liste=array();
-		foreach ($object->thirdparty->thirdparty_and_contact_email_array(1) as $key=>$value)	$liste[$key]=$value;
+		foreach ($object->thirdparty->thirdparty_and_contact_email_array(1) as $key=>$value)
+		{
+			$liste[$key]=$value;
+		}
 		$formmail->withto=GETPOST('sendto')?GETPOST('sendto'):$liste;
 		$formmail->withtocc=$liste;
 		$formmail->withtoccc=$conf->global->MAIN_EMAIL_USECCC;
diff --git a/htdocs/core/class/html.formmail.class.php b/htdocs/core/class/html.formmail.class.php
index e5dc008fc2e..66fd945c01d 100644
--- a/htdocs/core/class/html.formmail.class.php
+++ b/htdocs/core/class/html.formmail.class.php
@@ -566,12 +566,12 @@ class FormMail
         			if ($this->param["models"]=='order_send')
         			{
         				$url=getPaypalPaymentUrl(0,'order',$this->substit['__ORDERREF__']);
-        				$this->substit['__PERSONALIZED__']=$langs->transnoentitiesnoconv("PredefinedMailContentLink",$url);
+        				$this->substit['__PERSONALIZED__']=str_replace('\n',"\n",$langs->transnoentitiesnoconv("PredefinedMailContentLink",$url));
         			}
         			if ($this->param["models"]=='facture_send')
         			{
         				$url=getPaypalPaymentUrl(0,'invoice',$this->substit['__FACREF__']);
-        				$this->substit['__PERSONALIZED__']=$langs->transnoentitiesnoconv("PredefinedMailContentLink",$url);
+        				$this->substit['__PERSONALIZED__']=str_replace('\n',"\n",$langs->transnoentitiesnoconv("PredefinedMailContentLink",$url));
         			}
         		}
 
-- 
GitLab