diff --git a/htdocs/comm/mailing/card.php b/htdocs/comm/mailing/card.php
index c7771476f35..b2b7e9cf5cf 100644
--- a/htdocs/comm/mailing/card.php
+++ b/htdocs/comm/mailing/card.php
@@ -189,8 +189,9 @@ if (empty($reshook))
while ($i < $num && $i < $conf->global->MAILING_LIMIT_SENDBYWEB)
{
-
+ // Here code is common with same loop ino mailing-send.php
$res=1;
+ $now=dol_now();
$obj = $db->fetch_object($resql);
@@ -222,6 +223,27 @@ if (empty($reshook))
'__CHECK_READ__' => ' ',
'__UNSUBSCRIBE__' => ''.$langs->trans("MailUnsubcribe").' '
);
+ $onlinepaymentenabled = 0;
+ if (! empty($conf->paypal->enabled)) $onlinepaymentenabled++;
+ if (! empty($conf->paybox->enabled)) $onlinepaymentenabled++;
+ if (! empty($conf->stripe->enabled)) $onlinepaymentenabled++;
+ if ($onlinepaymentenabled && ! empty($conf->global->PAYMENT_SECURITY_TOKEN))
+ {
+ $substitutionarray['__SECUREKEYPAYMENT__']=dol_hash($conf->global->PAYMENT_SECURITY_TOKEN, 2);
+
+ if (empty($conf->global->PAYMENT_SECURITY_TOKEN_UNIQUE)) $substitutionarray['__SECUREKEYPAYMENT_MEMBER__']=dol_hash($conf->global->PAYMENT_SECURITY_TOKEN, 2);
+ else $substitutionarray['__SECUREKEYPAYMENT_MEMBER__']=dol_hash($conf->global->PAYMENT_SECURITY_TOKEN . 'membersubscription' . $obj->source_id, 2);
+
+ if (empty($conf->global->PAYMENT_SECURITY_TOKEN_UNIQUE)) $substitutionarray['__SECUREKEYPAYMENT_ORDER__']=dol_hash($conf->global->PAYMENT_SECURITY_TOKEN, 2);
+ else $substitutionarray['__SECUREKEYPAYMENT_ORDER__']=dol_hash($conf->global->PAYMENT_SECURITY_TOKEN . 'order' . $obj->source_id, 2);
+
+ if (empty($conf->global->PAYMENT_SECURITY_TOKEN_UNIQUE)) $substitutionarray['__SECUREKEYPAYMENT_INVOICE__']=dol_hash($conf->global->PAYMENT_SECURITY_TOKEN, 2);
+ else $substitutionarray['__SECUREKEYPAYMENT_INVOICE__']=dol_hash($conf->global->PAYMENT_SECURITY_TOKEN . 'invoice' . $obj->source_id, 2);
+
+ if (empty($conf->global->PAYMENT_SECURITY_TOKEN_UNIQUE)) $substitutionarray['__SECUREKEYPAYMENT_CONTRACTLINE__']=dol_hash($conf->global->PAYMENT_SECURITY_TOKEN, 2);
+ else $substitutionarray['__SECUREKEYPAYMENT_CONTRACTLINE__']=dol_hash($conf->global->PAYMENT_SECURITY_TOKEN . 'contractline' . $obj->source_id, 2);
+ }
+ /* For backward compatibility */
if (! empty($conf->paypal->enabled) && ! empty($conf->global->PAYPAL_SECURITY_TOKEN))
{
$substitutionarray['__SECUREKEYPAYPAL__']=dol_hash($conf->global->PAYPAL_SECURITY_TOKEN, 2);
diff --git a/htdocs/core/class/html.formmail.class.php b/htdocs/core/class/html.formmail.class.php
index 26ad86fc845..932cc211d12 100644
--- a/htdocs/core/class/html.formmail.class.php
+++ b/htdocs/core/class/html.formmail.class.php
@@ -1131,6 +1131,35 @@ class FormMail extends Form
'__UNSUBSCRIBE__' => 'TagUnsubscribe'
//,'__PERSONALIZED__' => 'Personalized' // Hidden because not used yet in mass emailing
);
+
+ $onlinepaymentenabled = 0;
+ if (! empty($conf->paypal->enabled)) $onlinepaymentenabled++;
+ if (! empty($conf->paybox->enabled)) $onlinepaymentenabled++;
+ if (! empty($conf->stripe->enabled)) $onlinepaymentenabled++;
+ if ($onlinepaymentenabled && ! empty($conf->global->PAYMENT_SECURITY_TOKEN))
+ {
+ $vars['__SECUREKEYPAYMENT__']=$conf->global->PAYMENT_SECURITY_TOKEN;
+ if (! empty($conf->global->PAYMENT_SECURITY_TOKEN_UNIQUE))
+ {
+ if ($conf->adherent->enabled) $vars['__SECUREKEYPAYMENT_MEMBER__']='SecureKeyPAYMENTUniquePerMember';
+ if ($conf->facture->enabled) $vars['__SECUREKEYPAYMENT_INVOICE__']='SecureKeyPAYMENTUniquePerInvoice';
+ if ($conf->commande->enabled) $vars['__SECUREKEYPAYMENT_ORDER__']='SecureKeyPAYMENTUniquePerOrder';
+ if ($conf->contrat->enabled) $vars['__SECUREKEYPAYMENT_CONTRACTLINE__']='SecureKeyPAYMENTUniquePerContractLine';
+ }
+ }
+ else
+ {
+ /* No need to show into tooltip help, option is not enabled
+ $vars['__SECUREKEYPAYMENT__']='';
+ $vars['__SECUREKEYPAYMENT_MEMBER__']='';
+ $vars['__SECUREKEYPAYMENT_INVOICE__']='';
+ $vars['__SECUREKEYPAYMENT_ORDER__']='';
+ $vars['__SECUREKEYPAYMENT_CONTRACTLINE__']='';
+ */
+ }
+
+ // Old vars removed from doc
+ /*
if (! empty($conf->paypal->enabled) && ! empty($conf->global->PAYPAL_SECURITY_TOKEN))
{
$vars['__SECUREKEYPAYPAL__']='SecureKeyPaypal';
@@ -1146,7 +1175,7 @@ class FormMail extends Form
{
$vars['__SECUREKEYPAYPAL__']='';
$vars['__SECUREKEYPAYPAL_MEMBER__']='';
- }
+ }*/
}
$parameters=array('mode'=>$mode);
diff --git a/htdocs/core/tpl/onlinepaymentlinks.tpl.php b/htdocs/core/tpl/onlinepaymentlinks.tpl.php
new file mode 100644
index 00000000000..8650ab4110d
--- /dev/null
+++ b/htdocs/core/tpl/onlinepaymentlinks.tpl.php
@@ -0,0 +1,135 @@
+
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+
+require_once DOL_DOCUMENT_ROOT.'/core/lib/payments.lib.php';
+
+print '';
+
+// Url list
+print ''.$langs->trans("FollowingUrlAreAvailableToMakePayments").': ';
+print img_picto('','object_globe.png').' '.$langs->trans("ToOfferALinkForOnlinePaymentOnFreeAmount",$servicename).': ';
+print ''.getOnlinePaymentUrl(1,'free')." \n";
+if (! empty($conf->commande->enabled))
+{
+ print img_picto('','object_globe.png').' '.$langs->trans("ToOfferALinkForOnlinePaymentOnOrder",$servicename).': ';
+ print ''.getOnlinePaymentUrl(1,'order')." \n";
+ if (! empty($conf->global->PAYMENT_SECURITY_TOKEN) && ! empty($conf->global->PAYMENT_SECURITY_TOKEN_UNIQUE))
+ {
+ $langs->load("orders");
+ print '
';
+ }
+ print ' ';
+}
+if (! empty($conf->facture->enabled))
+{
+ print img_picto('','object_globe.png').' '.$langs->trans("ToOfferALinkForOnlinePaymentOnInvoice",$servicename).': ';
+ print ''.getOnlinePaymentUrl(1,'invoice')." \n";
+ if (! empty($conf->global->PAYMENT_SECURITY_TOKEN) && ! empty($conf->global->PAYMENT_SECURITY_TOKEN_UNIQUE))
+ {
+ $langs->load("bills");
+ print '';
+ }
+ print ' ';
+}
+if (! empty($conf->contrat->enabled))
+{
+ print img_picto('','object_globe.png').' '.$langs->trans("ToOfferALinkForOnlinePaymentOnContractLine",$servicename).': ';
+ print ''.getOnlinePaymentUrl(1,'contractline')." \n";
+ if (! empty($conf->global->PAYMENT_SECURITY_TOKEN) && ! empty($conf->global->PAYMENT_SECURITY_TOKEN_UNIQUE))
+ {
+ $langs->load("contract");
+ print '';
+ }
+ print ' ';
+}
+if (! empty($conf->adherent->enabled))
+{
+ print img_picto('','object_globe.png').' '.$langs->trans("ToOfferALinkForOnlinePaymentOnMemberSubscription",$servicename).': ';
+ print ''.getOnlinePaymentUrl(1,'membersubscription')." \n";
+ if (! empty($conf->global->PAYMENT_SECURITY_TOKEN) && ! empty($conf->global->PAYMENT_SECURITY_TOKEN_UNIQUE))
+ {
+ $langs->load("members");
+ print '';
+ }
+ print ' ';
+}
+
+if (! empty($conf->use_javascript_ajax))
+{
+ print "\n".'';
+}
+
+print info_admin($langs->trans("YouCanAddTagOnUrl"));
+
+print '';
+
diff --git a/htdocs/paybox/admin/paybox.php b/htdocs/paybox/admin/paybox.php
index 991c1511694..b5049becbdb 100644
--- a/htdocs/paybox/admin/paybox.php
+++ b/htdocs/paybox/admin/paybox.php
@@ -32,6 +32,7 @@ $servicename='PayBox';
$langs->load("admin");
$langs->load("other");
$langs->load("paybox");
+$langs->load("paypal");
if (!$user->admin)
accessforbidden();
@@ -65,6 +66,11 @@ if ($action == 'setvalue' && $user->admin)
if (! $result > 0) $error++;
$result=dolibarr_set_const($db, "ONLINE_PAYMENT_SENDEMAIL",GETPOST('ONLINE_PAYMENT_SENDEMAIL'),'chaine',0,'',$conf->entity);
if (! $result > 0) $error++;
+ // Payment token for URL
+ $result=dolibarr_set_const($db, "PAYMENT_SECURITY_TOKEN",GETPOST('PAYMENT_SECURITY_TOKEN','alpha'),'chaine',0,'',$conf->entity);
+ if (! $result > 0) $error++;
+ $result=dolibarr_set_const($db, "PAYMENT_SECURITY_TOKEN_UNIQUE",GETPOST('PAYMENT_SECURITY_TOKEN_UNIQUE','alpha'),'chaine',0,'',$conf->entity);
+ if (! $result > 0) $error++;
if (! $error)
{
@@ -210,6 +216,19 @@ print ' ';
+// Payment token for URL
+print '';
+print $langs->trans("SecurityToken").' ';
+print ' ';
+if (! empty($conf->use_javascript_ajax))
+ print ' '.img_picto($langs->trans('Generate'), 'refresh', 'id="generate_token" class="linkobject"');
+print ' ';
+
+print '';
+print $langs->trans("SecurityTokenIsUnique").' ';
+print $form->selectyesno("PAYMENT_SECURITY_TOKEN_UNIQUE",(empty($conf->global->PAYMENT_SECURITY_TOKEN)?0:$conf->global->PAYMENT_SECURITY_TOKEN_UNIQUE),1);
+print ' ';
+
print '';
dol_fiche_end();
@@ -220,33 +239,7 @@ print '';
print ' ';
-print ''.$langs->trans("FollowingUrlAreAvailableToMakePayments").': ';
-print img_picto('','object_globe.png').' '.$langs->trans("ToOfferALinkForOnlinePaymentOnFreeAmount",$servicename).': ';
-print ''.DOL_MAIN_URL_ROOT.'/public/paybox/newpayment.php?amount=9.99 &tag=your_free_tag '." \n";
-if (! empty($conf->commande->enabled))
-{
- print img_picto('','object_globe.png').' '.$langs->trans("ToOfferALinkForOnlinePaymentOnOrder",$servicename).': ';
- print ''.DOL_MAIN_URL_ROOT.'/public/paybox/newpayment.php?source=order&ref=order_ref '." \n";
-}
-if (! empty($conf->facture->enabled))
-{
- print img_picto('','object_globe.png').' '.$langs->trans("ToOfferALinkForOnlinePaymentOnInvoice",$servicename).': ';
- print ''.DOL_MAIN_URL_ROOT.'/public/paybox/newpayment.php?source=invoice&ref=invoice_ref '." \n";
-// print $langs->trans("SetupPayBoxToHavePaymentCreatedAutomatically",$langs->transnoentitiesnoconv("FeatureNotYetAvailable"))." \n";
-}
-if (! empty($conf->contrat->enabled))
-{
- print img_picto('','object_globe.png').' '.$langs->trans("ToOfferALinkForOnlinePaymentOnContractLine",$servicename).': ';
- print ''.DOL_MAIN_URL_ROOT.'/public/paybox/newpayment.php?source=contractline&ref=contractline_ref '." \n";
-}
-if (! empty($conf->adherent->enabled))
-{
- print img_picto('','object_globe.png').' '.$langs->trans("ToOfferALinkForOnlinePaymentOnMemberSubscription",$servicename).': ';
- print ''.DOL_MAIN_URL_ROOT.'/public/paybox/newpayment.php?source=membersubscription&ref=member_ref '." \n";
-}
-
-print info_admin($langs->trans("YouCanAddTagOnUrl"));
+include DOL_DOCUMENT_ROOT.'/core/tpl/onlinepaymentlinks.tpl.php';
llxFooter();
-
$db->close();
diff --git a/htdocs/paypal/admin/paypal.php b/htdocs/paypal/admin/paypal.php
index 0b11b34c872..3647ea7a4d5 100644
--- a/htdocs/paypal/admin/paypal.php
+++ b/htdocs/paypal/admin/paypal.php
@@ -26,6 +26,7 @@
require '../../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/paypal/lib/paypal.lib.php';
+require_once DOL_DOCUMENT_ROOT.'/core/lib/payments.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
@@ -58,10 +59,6 @@ if ($action == 'setvalue' && $user->admin)
if (! $result > 0) $error++;
$result=dolibarr_set_const($db, "ONLINE_PAYMENT_CSS_URL",GETPOST('ONLINE_PAYMENT_CSS_URL','alpha'),'chaine',0,'',$conf->entity);
if (! $result > 0) $error++;
- $result=dolibarr_set_const($db, "PAYPAL_SECURITY_TOKEN",GETPOST('PAYPAL_SECURITY_TOKEN','alpha'),'chaine',0,'',$conf->entity);
- if (! $result > 0) $error++;
- $result=dolibarr_set_const($db, "PAYPAL_SECURITY_TOKEN_UNIQUE",GETPOST('PAYPAL_SECURITY_TOKEN_UNIQUE','alpha'),'chaine',0,'',$conf->entity);
- if (! $result > 0) $error++;
$result=dolibarr_set_const($db, "PAYPAL_ADD_PAYMENT_URL",GETPOST('PAYPAL_ADD_PAYMENT_URL','alpha'),'chaine',0,'',$conf->entity);
if (! $result > 0) $error++;
$result=dolibarr_set_const($db, "ONLINE_PAYMENT_MESSAGE_FORM",GETPOST('ONLINE_PAYMENT_MESSAGE_FORM'),'chaine',0,'',$conf->entity);
@@ -72,6 +69,11 @@ if ($action == 'setvalue' && $user->admin)
if (! $result > 0) $error++;
$result=dolibarr_set_const($db, "ONLINE_PAYMENT_SENDEMAIL",GETPOST('ONLINE_PAYMENT_SENDEMAIL'),'chaine',0,'',$conf->entity);
if (! $result > 0) $error++;
+ // Payment token for URL
+ $result=dolibarr_set_const($db, "PAYMENT_SECURITY_TOKEN",GETPOST('PAYMENT_SECURITY_TOKEN','alpha'),'chaine',0,'',$conf->entity);
+ if (! $result > 0) $error++;
+ $result=dolibarr_set_const($db, "PAYMENT_SECURITY_TOKEN_UNIQUE",GETPOST('PAYMENT_SECURITY_TOKEN_UNIQUE','alpha'),'chaine',0,'',$conf->entity);
+ if (! $result > 0) $error++;
if (! $error)
{
@@ -254,19 +256,18 @@ print ''.$langs->trans("UrlGenerationParameters").' ';
print ''.$langs->trans("Value").' ';
print "\n";
-
+// Payment token for URL
print '';
print $langs->trans("SecurityToken").' ';
-print ' ';
+print ' ';
if (! empty($conf->use_javascript_ajax))
print ' '.img_picto($langs->trans('Generate'), 'refresh', 'id="generate_token" class="linkobject"');
-print ' ';
+ print '';
-
-print '';
-print $langs->trans("SecurityTokenIsUnique").' ';
-print $form->selectyesno("PAYPAL_SECURITY_TOKEN_UNIQUE",(empty($conf->global->PAYPAL_SECURITY_TOKEN)?0:$conf->global->PAYPAL_SECURITY_TOKEN_UNIQUE),1);
-print ' ';
+ print '';
+ print $langs->trans("SecurityTokenIsUnique").' ';
+ print $form->selectyesno("PAYMENT_SECURITY_TOKEN_UNIQUE",(empty($conf->global->PAYMENT_SECURITY_TOKEN)?0:$conf->global->PAYMENT_SECURITY_TOKEN_UNIQUE),1);
+ print ' ';
print '';
@@ -281,7 +282,7 @@ print ' ';
// Help doc
print ''.$langs->trans("InformationToFindParameters","Paypal").' : ';
if (! empty($conf->use_javascript_ajax))
- print ''.$langs->trans("ClickHere").'... ';
+ print ''.$langs->trans("ClickHere").'... ';
$realpaypalurl='www.paypal.com';
$sandboxpaypalurl='developer.paypal.com';
@@ -299,128 +300,24 @@ print 'Your API authentication information can be found with following steps. We
';
print '';
-print ' ';
-
-$token='';
-
-
-// Url list
-print ''.$langs->trans("FollowingUrlAreAvailableToMakePayments").': ';
-print img_picto('','object_globe.png').' '.$langs->trans("ToOfferALinkForOnlinePaymentOnFreeAmount",$servicename).': ';
-print ''.getPaypalPaymentUrl(1,'free')." \n";
-if (! empty($conf->commande->enabled))
-{
- print img_picto('','object_globe.png').' '.$langs->trans("ToOfferALinkForOnlinePaymentOnOrder",$servicename).': ';
- print ''.getPaypalPaymentUrl(1,'order')." \n";
- if (! empty($conf->global->PAYPAL_SECURITY_TOKEN) && ! empty($conf->global->PAYPAL_SECURITY_TOKEN_UNIQUE))
- {
- $langs->load("orders");
- print '';
- }
- print ' ';
-}
-if (! empty($conf->facture->enabled))
-{
- print img_picto('','object_globe.png').' '.$langs->trans("ToOfferALinkForOnlinePaymentOnInvoice",$servicename).': ';
- print ''.getPaypalPaymentUrl(1,'invoice')." \n";
- if (! empty($conf->global->PAYPAL_SECURITY_TOKEN) && ! empty($conf->global->PAYPAL_SECURITY_TOKEN_UNIQUE))
- {
- $langs->load("bills");
- print '';
- }
- print ' ';
-}
-if (! empty($conf->contrat->enabled))
-{
- print img_picto('','object_globe.png').' '.$langs->trans("ToOfferALinkForOnlinePaymentOnContractLine",$servicename).': ';
- print ''.getPaypalPaymentUrl(1,'contractline')." \n";
- if (! empty($conf->global->PAYPAL_SECURITY_TOKEN) && ! empty($conf->global->PAYPAL_SECURITY_TOKEN_UNIQUE))
- {
- $langs->load("contract");
- print '';
- }
- print ' ';
-}
-if (! empty($conf->adherent->enabled))
-{
- print img_picto('','object_globe.png').' '.$langs->trans("ToOfferALinkForOnlinePaymentOnMemberSubscription",$servicename).': ';
- print ''.getPaypalPaymentUrl(1,'membersubscription')." \n";
- if (! empty($conf->global->PAYPAL_SECURITY_TOKEN) && ! empty($conf->global->PAYPAL_SECURITY_TOKEN_UNIQUE))
- {
- $langs->load("members");
- print '';
- }
- print ' ';
-}
-
-print info_admin($langs->trans("YouCanAddTagOnUrl"));
-
if (! empty($conf->use_javascript_ajax))
{
print "\n".'';
}
+print ' ';
+
+$token='';
+
+include DOL_DOCUMENT_ROOT.'/core/tpl/onlinepaymentlinks.tpl.php';
+
llxFooter();
$db->close();
diff --git a/htdocs/stripe/admin/stripe.php b/htdocs/stripe/admin/stripe.php
index 4abf52fe0e0..de3c4db8987 100644
--- a/htdocs/stripe/admin/stripe.php
+++ b/htdocs/stripe/admin/stripe.php
@@ -67,6 +67,11 @@ if ($action == 'setvalue' && $user->admin)
if (! $result > 0) $error++;
$result=dolibarr_set_const($db, "ONLINE_PAYMENT_SENDEMAIL",GETPOST('ONLINE_PAYMENT_SENDEMAIL'),'chaine',0,'',$conf->entity);
if (! $result > 0) $error++;
+ // Payment token for URL
+ $result=dolibarr_set_const($db, "PAYMENT_SECURITY_TOKEN",GETPOST('PAYMENT_SECURITY_TOKEN','alpha'),'chaine',0,'',$conf->entity);
+ if (! $result > 0) $error++;
+ $result=dolibarr_set_const($db, "PAYMENT_SECURITY_TOKEN_UNIQUE",GETPOST('PAYMENT_SECURITY_TOKEN_UNIQUE','alpha'),'chaine',0,'',$conf->entity);
+ if (! $result > 0) $error++;
if (! $error)
{
@@ -220,6 +225,19 @@ print ' ';
+// Payment token for URL
+print '';
+print $langs->trans("SecurityToken").' ';
+print ' ';
+if (! empty($conf->use_javascript_ajax))
+ print ' '.img_picto($langs->trans('Generate'), 'refresh', 'id="generate_token" class="linkobject"');
+print ' ';
+
+print '';
+print $langs->trans("SecurityTokenIsUnique").' ';
+print $form->selectyesno("PAYMENT_SECURITY_TOKEN_UNIQUE",(empty($conf->global->PAYMENT_SECURITY_TOKEN)?0:$conf->global->PAYMENT_SECURITY_TOKEN_UNIQUE),1);
+print ' ';
+
print '';
dol_fiche_end();
@@ -233,121 +251,17 @@ print ' ';
$token='';
-
-// Url list
-print ''.$langs->trans("FollowingUrlAreAvailableToMakePayments").': ';
-print img_picto('','object_globe.png').' '.$langs->trans("ToOfferALinkForOnlinePaymentOnFreeAmount",$servicename).': ';
-print ''.getStripePaymentUrl(1,'free')." \n";
-if (! empty($conf->commande->enabled))
-{
- print img_picto('','object_globe.png').' '.$langs->trans("ToOfferALinkForOnlinePaymentOnOrder",$servicename).': ';
- print ''.getStripePaymentUrl(1,'order')." \n";
- if (! empty($conf->global->STRIPE_SECURITY_TOKEN) && ! empty($conf->global->STRIPE_SECURITY_TOKEN_UNIQUE))
- {
- $langs->load("orders");
- print '';
- }
- print ' ';
-}
-if (! empty($conf->facture->enabled))
-{
- print img_picto('','object_globe.png').' '.$langs->trans("ToOfferALinkForOnlinePaymentOnInvoice",$servicename).': ';
- print ''.getStripePaymentUrl(1,'invoice')." \n";
- if (! empty($conf->global->STRIPE_SECURITY_TOKEN) && ! empty($conf->global->STRIPE_SECURITY_TOKEN_UNIQUE))
- {
- $langs->load("bills");
- print '';
- }
- print ' ';
-}
-if (! empty($conf->contrat->enabled))
-{
- print img_picto('','object_globe.png').' '.$langs->trans("ToOfferALinkForOnlinePaymentOnContractLine",$servicename).': ';
- print ''.getStripePaymentUrl(1,'contractline')." \n";
- if (! empty($conf->global->STRIPE_SECURITY_TOKEN) && ! empty($conf->global->STRIPE_SECURITY_TOKEN_UNIQUE))
- {
- $langs->load("contract");
- print '';
- }
- print ' ';
-}
-if (! empty($conf->adherent->enabled))
-{
- print img_picto('','object_globe.png').' '.$langs->trans("ToOfferALinkForOnlinePaymentOnMemberSubscription",$servicename).': ';
- print ''.getStripePaymentUrl(1,'membersubscription')." \n";
- if (! empty($conf->global->STRIPE_SECURITY_TOKEN) && ! empty($conf->global->STRIPE_SECURITY_TOKEN_UNIQUE))
- {
- $langs->load("members");
- print '';
- }
- print ' ';
-}
-
-print info_admin($langs->trans("YouCanAddTagOnUrl"));
+include DOL_DOCUMENT_ROOT.'/core/tpl/onlinepaymentlinks.tpl.php';
if (! empty($conf->use_javascript_ajax))
{
print "\n".'';
}
diff --git a/scripts/emailings/mailing-send.php b/scripts/emailings/mailing-send.php
index 6465e765cfe..0de6ca4f5fd 100755
--- a/scripts/emailings/mailing-send.php
+++ b/scripts/emailings/mailing-send.php
@@ -64,7 +64,7 @@ print "***** ".$script_file." (".$version.") pid=".dol_getmypid()." *****\n";
if ($conf->global->MAILING_LIMIT_SENDBYCLI == '-1')
{
-
+
}
$user = new User($db);
@@ -98,7 +98,7 @@ if ($resql)
$emailing = new Mailing($db);
$emailing->fetch($obj->rowid);
-
+
$id = $emailing->id;
$subject = $emailing->sujet;
$message = $emailing->body;
@@ -120,7 +120,7 @@ if ($resql)
{
$sql2.= " LIMIT ".$conf->global->MAILING_LIMIT_SENDBYCLI;
}
-
+
$resql2=$db->query($sql2);
if ($resql2)
{
@@ -145,6 +145,7 @@ if ($resql)
$i = 0;
while ($i < $num2)
{
+ // Here code is common with same loop ino card.php
$res=1;
$now=dol_now();
@@ -178,13 +179,43 @@ if ($resql)
'__CHECK_READ__' => ' ',
'__UNSUBSCRIBE__' => ''.$langs->trans("MailUnsubcribe").' '
);
+ $onlinepaymentenabled = 0;
+ if (! empty($conf->paypal->enabled)) $onlinepaymentenabled++;
+ if (! empty($conf->paybox->enabled)) $onlinepaymentenabled++;
+ if (! empty($conf->stripe->enabled)) $onlinepaymentenabled++;
+ if ($onlinepaymentenabled && ! empty($conf->global->PAYMENT_SECURITY_TOKEN))
+ {
+ $substitutionarray['__SECUREKEYPAYMENT__']=dol_hash($conf->global->PAYMENT_SECURITY_TOKEN, 2);
+
+ if (empty($conf->global->PAYMENT_SECURITY_TOKEN_UNIQUE)) $substitutionarray['__SECUREKEYPAYMENT_MEMBER__']=dol_hash($conf->global->PAYMENT_SECURITY_TOKEN, 2);
+ else $substitutionarray['__SECUREKEYPAYMENT_MEMBER__']=dol_hash($conf->global->PAYMENT_SECURITY_TOKEN . 'membersubscription' . $obj->source_id, 2);
+
+ if (empty($conf->global->PAYMENT_SECURITY_TOKEN_UNIQUE)) $substitutionarray['__SECUREKEYPAYMENT_ORDER__']=dol_hash($conf->global->PAYMENT_SECURITY_TOKEN, 2);
+ else $substitutionarray['__SECUREKEYPAYMENT_ORDER__']=dol_hash($conf->global->PAYMENT_SECURITY_TOKEN . 'order' . $obj->source_id, 2);
+
+ if (empty($conf->global->PAYMENT_SECURITY_TOKEN_UNIQUE)) $substitutionarray['__SECUREKEYPAYMENT_INVOICE__']=dol_hash($conf->global->PAYMENT_SECURITY_TOKEN, 2);
+ else $substitutionarray['__SECUREKEYPAYMENT_INVOICE__']=dol_hash($conf->global->PAYMENT_SECURITY_TOKEN . 'invoice' . $obj->source_id, 2);
+
+ if (empty($conf->global->PAYMENT_SECURITY_TOKEN_UNIQUE)) $substitutionarray['__SECUREKEYPAYMENT_CONTRACTLINE__']=dol_hash($conf->global->PAYMENT_SECURITY_TOKEN, 2);
+ else $substitutionarray['__SECUREKEYPAYMENT_CONTRACTLINE__']=dol_hash($conf->global->PAYMENT_SECURITY_TOKEN . 'contractline' . $obj->source_id, 2);
+ }
+ /* For backward compatibility */
if (! empty($conf->paypal->enabled) && ! empty($conf->global->PAYPAL_SECURITY_TOKEN))
{
$substitutionarray['__SECUREKEYPAYPAL__']=dol_hash($conf->global->PAYPAL_SECURITY_TOKEN, 2);
+
if (empty($conf->global->PAYPAL_SECURITY_TOKEN_UNIQUE)) $substitutionarray['__SECUREKEYPAYPAL_MEMBER__']=dol_hash($conf->global->PAYPAL_SECURITY_TOKEN, 2);
else $substitutionarray['__SECUREKEYPAYPAL_MEMBER__']=dol_hash($conf->global->PAYPAL_SECURITY_TOKEN . 'membersubscription' . $obj->source_id, 2);
- }
+ if (empty($conf->global->PAYPAL_SECURITY_TOKEN_UNIQUE)) $substitutionarray['__SECUREKEYPAYPAL_ORDER__']=dol_hash($conf->global->PAYPAL_SECURITY_TOKEN, 2);
+ else $substitutionarray['__SECUREKEYPAYPAL_ORDER__']=dol_hash($conf->global->PAYPAL_SECURITY_TOKEN . 'order' . $obj->source_id, 2);
+
+ if (empty($conf->global->PAYPAL_SECURITY_TOKEN_UNIQUE)) $substitutionarray['__SECUREKEYPAYPAL_INVOICE__']=dol_hash($conf->global->PAYPAL_SECURITY_TOKEN, 2);
+ else $substitutionarray['__SECUREKEYPAYPAL_INVOICE__']=dol_hash($conf->global->PAYPAL_SECURITY_TOKEN . 'invoice' . $obj->source_id, 2);
+
+ if (empty($conf->global->PAYPAL_SECURITY_TOKEN_UNIQUE)) $substitutionarray['__SECUREKEYPAYPAL_CONTRACTLINE__']=dol_hash($conf->global->PAYPAL_SECURITY_TOKEN, 2);
+ else $substitutionarray['__SECUREKEYPAYPAL_CONTRACTLINE__']=dol_hash($conf->global->PAYPAL_SECURITY_TOKEN . 'contractline' . $obj->source_id, 2);
+ }
complete_substitutions_array($substitutionarray,$langs);
$newsubject=make_substitutions($subject,$substitutionarray);
$newmessage=make_substitutions($message,$substitutionarray);
@@ -252,7 +283,7 @@ if ($resql)
if ($result < 0) $error++;
// End call triggers
*/
-
+
$sqlok ="UPDATE ".MAIN_DB_PREFIX."mailing_cibles";
$sqlok.=" SET statut=1, date_envoi='".$db->idate($now)."' WHERE rowid=".$obj2->rowid;
$resqlok=$db->query($sqlok);