diff --git a/htdocs/adherents/card_subscriptions.php b/htdocs/adherents/card_subscriptions.php index 69caf4eeb5f..d5c3fe12fec 100644 --- a/htdocs/adherents/card_subscriptions.php +++ b/htdocs/adherents/card_subscriptions.php @@ -713,10 +713,17 @@ if ($rowid) { dol_print_error($db); } + + + // Link for paypal payment + if ($conf->paypal->enabled) + { + include_once(DOL_DOCUMENT_ROOT.'/paypal/lib/paypal.lib.php'); + print showPaypalPaymentUrl('membersubscription',$adh->ref); + } + } - - /* * Add new subscription form */ diff --git a/htdocs/compta/facture.php b/htdocs/compta/facture.php index c8c6f759114..17cce88c4bf 100644 --- a/htdocs/compta/facture.php +++ b/htdocs/compta/facture.php @@ -2938,15 +2938,8 @@ else // Link for paypal payment if ($conf->paypal->enabled) { - $langs->load("paypal"); - $langs->load("paybox"); - $servicename='PayPal'; include_once(DOL_DOCUMENT_ROOT.'/paypal/lib/paypal.lib.php'); - - print '
'; - print img_picto('','object_globe.png').' '.$langs->trans("ToOfferALinkForOnlinePayment",$servicename).'
'; - $url=getPaypalPaymentUrl(0,'invoice',$object->ref); - print '
'; + print showPaypalPaymentUrl('invoice',$object->ref); } print ''; diff --git a/htdocs/paypal/lib/paypal.lib.php b/htdocs/paypal/lib/paypal.lib.php index e1c55807141..fe7d05f877f 100755 --- a/htdocs/paypal/lib/paypal.lib.php +++ b/htdocs/paypal/lib/paypal.lib.php @@ -165,6 +165,29 @@ function paypaladmin_prepare_head() } + +/** + * Return string with full Url + * + * @param string $type Type of URL ('free', 'order', 'invoice', 'contractline', 'membersubscription' ...) + * @param string $ref Ref of object + * @return string Url string + */ +function showPaypalPaymentUrl($type,$ref) +{ + global $conf, $langs; + + $langs->load("paypal"); + $langs->load("paybox"); + $servicename='PayPal'; + $out='

'; + $out.=img_picto('','object_globe.png').' '.$langs->trans("ToOfferALinkForOnlinePayment",$servicename).'
'; + $url=getPaypalPaymentUrl(0,$type,$ref); + $out.='
'; + return $out; +} + + /** * Return string with full Url *