From 0402a1661ca20e2f08e260082300788958381649 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 19 Jul 2015 14:40:18 +0200 Subject: [PATCH] Fix: Sending email must be done after payment ok is shown and trigger has been ran. --- htdocs/public/paybox/paymentok.php | 18 ++++++++++++++---- htdocs/public/paypal/paymentok.php | 3 ++- 2 files changed, 16 insertions(+), 5 deletions(-) diff --git a/htdocs/public/paybox/paymentok.php b/htdocs/public/paybox/paymentok.php index 65f4545a4ba..9c3030a86ba 100644 --- a/htdocs/public/paybox/paymentok.php +++ b/htdocs/public/paybox/paymentok.php @@ -99,6 +99,19 @@ $ipaddress = $_SESSION['ipaddress']; dol_syslog("Call newpaymentok with token=".$token." paymentType=".$paymentType." currencyCodeType=".$currencyCodeType." payerID=".$payerID." ipaddress=".$ipaddress." FinalPaymentAmt=".$FinalPaymentAmt." fulltag=".$fulltag); */ + +print $langs->trans("YourPaymentHasBeenRecorded")."

\n"; + +if (! empty($conf->global->PAYBOX_MESSAGE_OK)) print $conf->global->PAYBOX_MESSAGE_OK; + +// Appel des triggers +include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php'; +$interface=new Interfaces($db); +$result=$interface->run_triggers('PAYBOX_PAYMENT_OK',$object,$user,$langs,$conf); +if ($result < 0) { $error++; $errors=$interface->errors; } +// Fin appel triggers + + // Send an email if (! empty($conf->global->PAYBOX_PAYONLINE_SENDEMAIL)) { @@ -135,6 +148,7 @@ if (! empty($conf->global->PAYBOX_PAYONLINE_SENDEMAIL)) require_once DOL_DOCUMENT_ROOT.'/core/class/CMailFile.class.php'; $mailfile = new CMailFile($topic, $sendto, $from, $content, array(), array(), array(), '', '', 0, $ishtml); + // Send an email $result=$mailfile->sendfile(); if ($result) { @@ -147,13 +161,9 @@ if (! empty($conf->global->PAYBOX_PAYONLINE_SENDEMAIL)) } -print $langs->trans("YourPaymentHasBeenRecorded")."

\n"; - -if (! empty($conf->global->PAYBOX_MESSAGE_OK)) print $conf->global->PAYBOX_MESSAGE_OK; print "\n\n"; - html_print_paybox_footer($mysoc,$langs); diff --git a/htdocs/public/paypal/paymentok.php b/htdocs/public/paypal/paymentok.php index 499952c1b85..f59bab46bd1 100644 --- a/htdocs/public/paypal/paymentok.php +++ b/htdocs/public/paypal/paymentok.php @@ -110,6 +110,7 @@ dol_syslog("POST=".$tracepost, LOG_DEBUG, 0, '_paypal'); llxHeaderPaypal($langs->trans("PaymentForm")); +// Show message print ''."\n"; print '
'."\n"; @@ -216,7 +217,7 @@ if ($PAYPALTOKEN) } } else - { + { //Display a user friendly Error on the page using any of the following error information returned by PayPal $ErrorCode = urldecode($resArray["L_ERRORCODE0"]); $ErrorShortMsg = urldecode($resArray["L_SHORTMESSAGE0"]);