Skip to content

Commit

Permalink
add payment link for donation
Browse files Browse the repository at this point in the history
  • Loading branch information
ptibogxiv committed Sep 5, 2018
1 parent 639f24a commit 6e209b5
Showing 1 changed file with 23 additions and 3 deletions.
26 changes: 23 additions & 3 deletions htdocs/core/lib/payments.lib.php
Expand Up @@ -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;

Expand Down Expand Up @@ -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;

Expand Down Expand Up @@ -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='')
Expand Down Expand Up @@ -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?'<font color="#666666">':'');
if ($mode == 1) $out.='donation_ref';
if ($mode == 0) $out.=urlencode($ref);
$out.=($mode?'</font>':'');
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?'<font color="#666666">':'');
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?'</font>':'');
}
}
}

// 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
Expand Down

0 comments on commit 6e209b5

Please sign in to comment.