diff --git a/htdocs/public/payment/paymentko.php b/htdocs/public/payment/paymentko.php index db16c74ab21..17e42d8f16b 100644 --- a/htdocs/public/payment/paymentko.php +++ b/htdocs/public/payment/paymentko.php @@ -132,6 +132,22 @@ if (empty($validpaymentmethod)) { $object = new stdClass(); // For triggers /** @var CommonObject $object */ +$error = 0; + +// Check if we have redirtodomain to do. +$ws_virtuelhost = null; +$doactionsthenredirect = 0; +if ($ws) { + $doactionsthenredirect = 1; + include_once DOL_DOCUMENT_ROOT.'/website/class/website.class.php'; + $website = new Website($db); + $result = $website->fetch(0, $ws); + if ($result > 0) { + $ws_virtuelhost = $website->virtualhost; + } +} + + /* * Actions */ @@ -144,13 +160,6 @@ $object = new stdClass(); // For triggers * View */ -// Check if we have redirtodomain to do. -$doactionsthenredirect = 0; -if ($ws) { - $doactionsthenredirect = 1; -} - - dol_syslog("Callback url when an online payment is refused or canceled. query_string=".(empty($_SERVER["QUERY_STRING"]) ? '' : $_SERVER["QUERY_STRING"])." script_uri=".(empty($_SERVER["SCRIPT_URI"]) ? '' : $_SERVER["SCRIPT_URI"]), LOG_DEBUG, 0, '_payment'); $tracepost = ""; @@ -333,6 +342,11 @@ $db->close(); if (!empty($doactionsthenredirect)) { // Redirect to an error page // Paymentko page must be created for the specific website - $ext_urlko = DOL_URL_ROOT.'/public/website/index.php?website='.urlencode($ws).'&pageref=paymentko&fulltag='.$FULLTAG; + if (!defined('USEDOLIBARRSERVER') && !empty($ws_virtuelhost)) { + $ext_urlok = $ws_virtuelhost . '/paymentok.php?fulltag='.$FULLTAG; + } else { + $ext_urlko = DOL_URL_ROOT.'/public/website/index.php?website='.urlencode($ws).'&pageref=paymentko&fulltag='.$FULLTAG; + } + print ""; } diff --git a/htdocs/public/payment/paymentok.php b/htdocs/public/payment/paymentok.php index aa46e7ccf0b..1c0d5a61aea 100644 --- a/htdocs/public/payment/paymentok.php +++ b/htdocs/public/payment/paymentok.php @@ -169,6 +169,7 @@ $ErrorCode = $ErrorShortMsg = $ErrorLongMsg = $ErrorSeverityCode = ''; $object = new stdClass(); // For triggers +/** @var CommonObject $object */ $error = 0;