Debug v15

This commit is contained in:
Laurent Destailleur
2022-01-04 12:56:08 +01:00
parent a887e41600
commit 1d80b8394a
16 changed files with 559 additions and 342 deletions

View File

@@ -213,14 +213,14 @@ function getHtmlOnlinePaymentLink($type, $ref, $label = '')
* Return string with full Url
*
* @param int $mode 0=True url, 1=Url formated with colors
* @param string $type Type of URL ('free', 'order', 'invoice', 'contractline', 'member' ...)
* @param string $type Type of URL ('free', 'order', 'invoice', 'contractline', 'member', 'boothlocation', ...)
* @param string $ref Ref of object
* @param int $amount Amount (required for $type='free' only)
* @param string $freetag Free tag
* @param int $amount Amount (required and used for $type='free' only)
* @param string $freetag Free tag (required and used for $type='free' only)
* @param string $localorexternal 0=Url for browser, 1=Url for external access
* @return string Url string
*/
function getOnlinePaymentUrl($mode, $type, $ref = '', $amount = '9.99', $freetag = 'your_tag', $localorexternal = 0)
function getOnlinePaymentUrl($mode, $type, $ref = '', $amount = '9.99', $freetag = 'your_tag', $localorexternal = 1)
{
global $conf, $dolibarr_main_url_root;
@@ -248,7 +248,7 @@ function getOnlinePaymentUrl($mode, $type, $ref = '', $amount = '9.99', $freetag
}
//if ($mode) $out.='&noidempotency=1';
} elseif ($type == 'order') {
$out = $urltouse.'/public/payment/newpayment.php?source=order&ref='.($mode ? '<span style="color: #666666">' : '');
$out = $urltouse.'/public/payment/newpayment.php?source='.$type.'&ref='.($mode ? '<span style="color: #666666">' : '');
if ($mode == 1) {
$out .= 'order_ref';
}
@@ -271,7 +271,7 @@ function getOnlinePaymentUrl($mode, $type, $ref = '', $amount = '9.99', $freetag
}
}
} elseif ($type == 'invoice') {
$out = $urltouse.'/public/payment/newpayment.php?source=invoice&ref='.($mode ? '<span style="color: #666666">' : '');
$out = $urltouse.'/public/payment/newpayment.php?source='.$type.'&ref='.($mode ? '<span style="color: #666666">' : '');
if ($mode == 1) {
$out .= 'invoice_ref';
}
@@ -294,7 +294,7 @@ function getOnlinePaymentUrl($mode, $type, $ref = '', $amount = '9.99', $freetag
}
}
} elseif ($type == 'contractline') {
$out = $urltouse.'/public/payment/newpayment.php?source=contractline&ref='.($mode ? '<span style="color: #666666">' : '');
$out = $urltouse.'/public/payment/newpayment.php?source='.$type.'&ref='.($mode ? '<span style="color: #666666">' : '');
if ($mode == 1) {
$out .= 'contractline_ref';
}
@@ -340,9 +340,8 @@ function getOnlinePaymentUrl($mode, $type, $ref = '', $amount = '9.99', $freetag
$out .= ($mode ? '</span>' : '');
}
}
}
if ($type == 'donation') {
$out = $urltouse.'/public/payment/newpayment.php?source=donation&ref='.($mode ? '<span style="color: #666666">' : '');
} elseif ($type == 'donation') {
$out = $urltouse.'/public/payment/newpayment.php?source='.$type.'&ref='.($mode ? '<span style="color: #666666">' : '');
if ($mode == 1) {
$out .= 'donation_ref';
}
@@ -364,6 +363,29 @@ function getOnlinePaymentUrl($mode, $type, $ref = '', $amount = '9.99', $freetag
$out .= ($mode ? '</span>' : '');
}
}
} elseif ($type == 'boothlocation') {
$out = $urltouse.'/public/payment/newpayment.php?source='.$type.'&ref='.($mode ? '<span style="color: #666666">' : '');
if ($mode == 1) {
$out .= 'invoice_ref';
}
if ($mode == 0) {
$out .= urlencode($ref);
}
$out .= ($mode ? '</span>' : '');
if (!empty($conf->global->PAYMENT_SECURITY_TOKEN)) {
if (empty($conf->global->PAYMENT_SECURITY_TOKEN_UNIQUE)) {
$out .= '&securekey='.urlencode($conf->global->PAYMENT_SECURITY_TOKEN);
} else {
$out .= '&securekey='.($mode ? '<span style="color: #666666">' : '');
if ($mode == 1) {
$out .= "hash('".$conf->global->PAYMENT_SECURITY_TOKEN."' + '".$type."' + invoice_ref)";
}
if ($mode == 0) {
$out .= dol_hash($conf->global->PAYMENT_SECURITY_TOKEN.$type.$ref, 2);
}
$out .= ($mode ? '</span>' : '');
}
}
}
// For multicompany