diff --git a/htdocs/core/lib/payments.lib.php b/htdocs/core/lib/payments.lib.php
index 98d9035112f..0f0cfc267d3 100644
--- a/htdocs/core/lib/payments.lib.php
+++ b/htdocs/core/lib/payments.lib.php
@@ -24,7 +24,8 @@
* @param Paiement $object Current payment object
* @return array Tabs for the payment section
*/
-function payment_prepare_head(Paiement $object) {
+function payment_prepare_head(Paiement $object)
+{
global $langs, $conf;
@@ -59,7 +60,8 @@ function payment_prepare_head(Paiement $object) {
* @param Paiement $object Current payment object
* @return array Tabs for the payment section
*/
-function payment_supplier_prepare_head(Paiement $object) {
+function payment_supplier_prepare_head(Paiement $object)
+{
global $langs, $conf;
@@ -90,7 +92,7 @@ function payment_supplier_prepare_head(Paiement $object) {
/**
* Return array of valid payment mode
*
- * @param string $paymentmethod Filter on this payment method
+ * @param string $paymentmethod Filter on this payment method (''=none, 'paypal', ...)
* @return array Array of valid payment method
*/
function getValidOnlinePaymentMethods($paymentmethod='')
@@ -234,6 +236,24 @@ function getOnlinePaymentUrl($mode, $type, $ref='', $amount='9.99', $freetag='yo
}
}
}
+ if ($type == 'donation')
+ {
+ $out=DOL_MAIN_URL_ROOT.'/public/payment/newpayment.php?source=donation&ref='.($mode?'':'');
+ if ($mode == 1) $out.='donation_ref';
+ if ($mode == 0) $out.=urlencode($ref);
+ $out.=($mode?'':'');
+ if (! empty($conf->global->PAYMENT_SECURITY_TOKEN))
+ {
+ if (empty($conf->global->PAYMENT_SECURITY_TOKEN_UNIQUE)) $out.='&securekey='.$conf->global->PAYMENT_SECURITY_TOKEN;
+ else
+ {
+ $out.='&securekey='.($mode?'':'');
+ if ($mode == 1) $out.="hash('".$conf->global->PAYMENT_SECURITY_TOKEN."' + '".$type."' + donation_ref)";
+ if ($mode == 0) $out.= dol_hash($conf->global->PAYMENT_SECURITY_TOKEN . $type . $ref, 2);
+ $out.=($mode?'':'');
+ }
+ }
+ }
// For multicompany
if (! empty($out) && ! empty($conf->multicompany->enabled)) $out.="&entity=".$conf->entity; // Check the entity because we may have the same reference in several entities