diff --git a/htdocs/core/lib/payments.lib.php b/htdocs/core/lib/payments.lib.php
index 0d46dc7eacc..0f0cfc267d3 100644
--- a/htdocs/core/lib/payments.lib.php
+++ b/htdocs/core/lib/payments.lib.php
@@ -236,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
diff --git a/htdocs/core/tpl/onlinepaymentlinks.tpl.php b/htdocs/core/tpl/onlinepaymentlinks.tpl.php
index a425055135f..a5c5ce7cf11 100644
--- a/htdocs/core/tpl/onlinepaymentlinks.tpl.php
+++ b/htdocs/core/tpl/onlinepaymentlinks.tpl.php
@@ -1,4 +1,4 @@
-
*
* This program is free software; you can redistribute it and/or modify
@@ -118,6 +118,28 @@ if (! empty($conf->adherent->enabled))
}
print '
';
}
+if (! empty($conf->don->enabled))
+{
+ print img_picto('','object_globe.png').' '.$langs->trans("ToOfferALinkForOnlinePaymentOnDonation",$servicename).':
';
+ print ''.getOnlinePaymentUrl(1,'donation')."
\n";
+ if (! empty($conf->global->PAYMENT_SECURITY_TOKEN) && ! empty($conf->global->PAYMENT_SECURITY_TOKEN_UNIQUE))
+ {
+ $langs->load("members");
+ print '
| '.$langs->trans("Date").' | '; - $form->select_date($donation_date?$donation_date:-1,'','','','',"add",1,1); - print ' | '; - - // Amount - print "|
| '.$langs->trans("Amount").' | '.$langs->trans("Currency".$conf->currency).' | |
| '.$langs->trans("PublicDonation")." | "; - print $form->selectyesno("public",isset($_POST["public"])?$_POST["public"]:1,1); - print " | |
| ' . $langs->trans('Ref') . ' | ' . $langs->trans('Draft') . ' | ' . $langs->trans('Customer') . ' | '; + if ($soc->id > 0 && ! GETPOST('fac_rec','alpha')) + { + print ''; + print $soc->getNomUrl(1); + print ''; + // Outstanding Bill + $outstandingBills = $soc->get_OutstandingBill(); + print ' (' . $langs->trans('CurrentOutstandingBill') . ': '; + print price($outstandingBills, '', $langs, 0, 0, -1, $conf->currency); + if ($soc->outstanding_limit != '') + { + if ($outstandingBills > $soc->outstanding_limit) print img_warning($langs->trans("OutstandingBillReached")); + print ' / ' . price($soc->outstanding_limit, '', $langs, 0, 0, -1, $conf->currency); + } + print ')'; + print ' | '; + } + else + { + print ''; + print $form->select_company($soc->id, 'socid', '(s.client = 1 OR s.client = 3) AND status=1', 'SelectThirdParty', 0, 0, null, 0, 'minwidth300'); + // Option to reload page to retrieve customer informations. Note, this clear other input + if (!empty($conf->global->RELOAD_PAGE_ON_CUSTOMER_CHANGE)) + { + print ''; + } + print ' '.$langs->trans("AddThirdParty").''; + print ' | '; + } + print '' . "\n"; + +} else { print "
| '.$langs->trans("Company").' | ||
| '.$langs->trans("Lastname").' | ||
| '.$langs->trans("Zip").' / '.$langs->trans("Town").' | '; - print $formcompany->select_ziptown((isset($_POST["zipcode"])?$_POST["zipcode"]:$object->zip),'zipcode',array('town','selectcountry_id','state_id'),6); + print $formcompany->select_ziptown((isset($_POST["zipcode"])?$_POST["zipcode"]:$object->zip),'zipcode',array('town','selectcountry_id','state_id'),6); print ' '; print $formcompany->select_ziptown((isset($_POST["town"])?$_POST["town"]:$object->town),'town',array('zipcode','selectcountry_id','state_id')); print ' | |
| '; print $form->select_country(GETPOST('country_id')!=''?GETPOST('country_id'):$object->country_id); if ($user->admin) print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"),1); print ' | ||
| '.$langs->trans("EMail").' | ||
| '.$langs->trans("EMail").' | ||
| '.$langs->trans("Date").' | '; + $form->select_date($donation_date?$donation_date:-1,'','','','',"add",1,1); + print ' | '; + + // Amount + print "|
| '.$langs->trans("Amount").' | '.$langs->trans("Currency".$conf->currency).' | |
| '.$langs->trans("PublicDonation")." | "; + print $form->selectyesno("public",isset($_POST["public"])?$_POST["public"]:1,1); + print " | |
| ".$langs->trans("PaymentMode")." | \n";
@@ -790,6 +841,16 @@ if (! empty($id) && $action != 'edit')
// Show links to link elements
$linktoelem = $form->showLinkToObjectBlock($object, null, array('don'));
$somethingshown = $form->showLinkedObjectBlock($object, $linktoelem);
+
+ // Show online payment link
+ $useonlinepayment = (! empty($conf->paypal->enabled) || ! empty($conf->stripe->enabled) || ! empty($conf->paybox->enabled));
+
+ if ($useonlinepayment) //$object->statut != Facture::STATUS_DRAFT &&
+ {
+ print ' '."\n"; + require_once DOL_DOCUMENT_ROOT.'/core/lib/payments.lib.php'; + print showOnlinePaymentUrl('donation', $object->ref).' '; + } print ' ';
| |