Fix: Sending email must be done after payment ok is shown and trigger

has been ran.
This commit is contained in:
Laurent Destailleur 2015-07-19 14:40:18 +02:00
parent 2f2b0df6f8
commit 0402a1661c
2 changed files with 16 additions and 5 deletions

View File

@ -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); dol_syslog("Call newpaymentok with token=".$token." paymentType=".$paymentType." currencyCodeType=".$currencyCodeType." payerID=".$payerID." ipaddress=".$ipaddress." FinalPaymentAmt=".$FinalPaymentAmt." fulltag=".$fulltag);
*/ */
print $langs->trans("YourPaymentHasBeenRecorded")."<br><br>\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 // Send an email
if (! empty($conf->global->PAYBOX_PAYONLINE_SENDEMAIL)) 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'; require_once DOL_DOCUMENT_ROOT.'/core/class/CMailFile.class.php';
$mailfile = new CMailFile($topic, $sendto, $from, $content, array(), array(), array(), '', '', 0, $ishtml); $mailfile = new CMailFile($topic, $sendto, $from, $content, array(), array(), array(), '', '', 0, $ishtml);
// Send an email
$result=$mailfile->sendfile(); $result=$mailfile->sendfile();
if ($result) if ($result)
{ {
@ -147,13 +161,9 @@ if (! empty($conf->global->PAYBOX_PAYONLINE_SENDEMAIL))
} }
print $langs->trans("YourPaymentHasBeenRecorded")."<br><br>\n";
if (! empty($conf->global->PAYBOX_MESSAGE_OK)) print $conf->global->PAYBOX_MESSAGE_OK;
print "\n</div>\n"; print "\n</div>\n";
html_print_paybox_footer($mysoc,$langs); html_print_paybox_footer($mysoc,$langs);

View File

@ -110,6 +110,7 @@ dol_syslog("POST=".$tracepost, LOG_DEBUG, 0, '_paypal');
llxHeaderPaypal($langs->trans("PaymentForm")); llxHeaderPaypal($langs->trans("PaymentForm"));
// Show message
print '<span id="dolpaymentspan"></span>'."\n"; print '<span id="dolpaymentspan"></span>'."\n";
print '<div id="dolpaymentdiv" align="center">'."\n"; print '<div id="dolpaymentdiv" align="center">'."\n";
@ -216,7 +217,7 @@ if ($PAYPALTOKEN)
} }
} }
else else
{ {
//Display a user friendly Error on the page using any of the following error information returned by PayPal //Display a user friendly Error on the page using any of the following error information returned by PayPal
$ErrorCode = urldecode($resArray["L_ERRORCODE0"]); $ErrorCode = urldecode($resArray["L_ERRORCODE0"]);
$ErrorShortMsg = urldecode($resArray["L_SHORTMESSAGE0"]); $ErrorShortMsg = urldecode($resArray["L_SHORTMESSAGE0"]);