From 966a0b7ec729f3baf2ea8437e80e1a02274729cc Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 20 Nov 2018 20:13:16 +0100 Subject: [PATCH] Fix message content and language --- htdocs/public/payment/paymentko.php | 24 +++++++++++++++++------- htdocs/public/payment/paymentok.php | 4 ++-- 2 files changed, 19 insertions(+), 9 deletions(-) diff --git a/htdocs/public/payment/paymentko.php b/htdocs/public/payment/paymentko.php index cd220a5764f..783493f375c 100644 --- a/htdocs/public/payment/paymentko.php +++ b/htdocs/public/payment/paymentko.php @@ -141,8 +141,13 @@ if (! empty($_SESSION['ipaddress'])) // To avoid to make action twice $sendemail = $conf->global->ONLINE_PAYMENT_SENDEMAIL; } + // Send warning of error to administrator if ($sendemail) { + $companylangs = new Translate('', $conf); + $companylangs->setDefaultLang($mysoc->default_lang); + $companylangs->loadLangs(array('main','members','bills','paypal','paybox')); + $from=$conf->global->MAILING_EMAIL_FROM; $sendto=$sendemail; @@ -160,16 +165,21 @@ if (! empty($_SESSION['ipaddress'])) // To avoid to make action twice else $appli.=" ".DOL_VERSION; $urlback=$_SERVER["REQUEST_URI"]; - $topic='['.$appli.'] '.$langs->transnoentitiesnoconv("NewOnlinePaymentFailed"); + $topic='['.$appli.'] '.$companylangs->transnoentitiesnoconv("NewOnlinePaymentFailed"); $content=""; - $content.=$langs->transnoentitiesnoconv("ValidationOfOnlinePaymentFailed")."\n"; - $content.="\n"; - $content.=$langs->transnoentitiesnoconv("TechnicalInformation").":\n"; - $content.=$langs->transnoentitiesnoconv("OnlinePaymentSystem").': '.$paymentmethod."
\n"; - $content.=$langs->transnoentitiesnoconv("ReturnURLAfterPayment").': '.$urlback."\n"; + $content.=''.$companylangs->transnoentitiesnoconv("ValidationOfOnlinePaymentFailed")."\n"; + + $content.="

\n"; + $content.=''.$companylangs->transnoentitiesnoconv("TechnicalInformation").":
\n"; + $content.=$companylangs->transnoentitiesnoconv("OnlinePaymentSystem").': '.$paymentmethod."
\n"; + $content.=$companylangs->transnoentitiesnoconv("ReturnURLAfterPayment").': '.$urlback."
\n"; + $content.="
\n"; $content.="tag=".$fulltag."\ntoken=".$onlinetoken." paymentType=".$paymentType." currencycodeType=".$currencyCodeType." payerId=".$payerID." ipaddress=".$ipaddress." FinalPaymentAmt=".$FinalPaymentAmt; + + $ishtml=dol_textishtml($content); // May contain urls + require_once DOL_DOCUMENT_ROOT.'/core/class/CMailFile.class.php'; - $mailfile = new CMailFile($topic, $sendto, $from, $content); + $mailfile = new CMailFile($topic, $sendto, $from, $content, array(), array(), array(), '', '', 0, $ishtml); $result=$mailfile->sendfile(); if ($result) diff --git a/htdocs/public/payment/paymentok.php b/htdocs/public/payment/paymentok.php index 3ad71487dfc..e48fc014749 100644 --- a/htdocs/public/payment/paymentok.php +++ b/htdocs/public/payment/paymentok.php @@ -876,7 +876,7 @@ else elseif ($paymentmethod == 'paybox' && ! empty($conf->global->PAYBOX_PAYONLINE_SENDEMAIL)) $sendemail=$conf->global->PAYBOX_PAYONLINE_SENDEMAIL; elseif ($paymentmethod == 'stripe' && ! empty($conf->global->STRIPE_PAYONLINE_SENDEMAIL)) $sendemail=$conf->global->STRIPE_PAYONLINE_SENDEMAIL; - // Send an email + // Send warning of error to administrator if ($sendemail) { $companylangs = new Translate('', $conf); @@ -908,7 +908,7 @@ else $content=""; $content.=''.$companylangs->transnoentitiesnoconv("PaymentSystemConfirmPaymentPageWasCalledButFailed")."\n"; - $content.="
\n"; + $content.="

\n"; $content.=''.$companylangs->transnoentitiesnoconv("TechnicalInformation").":
\n"; $content.=$companylangs->transnoentitiesnoconv("OnlinePaymentSystem").': '.$paymentmethod."
\n"; $content.=$companylangs->transnoentitiesnoconv("ReturnURLAfterPayment").': '.$urlback."
\n";