add payment link for donation

This commit is contained in:
ptibogxiv 2018-09-05 17:40:26 +02:00 committed by GitHub
parent 639f24a95b
commit 6e209b550b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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?'<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