2
0
forked from Wavyzz/dolibarr

Fix show payment URL in massaction context when not one email per recipient

This commit is contained in:
Mathieu Moulin
2024-11-15 23:21:33 +01:00
parent ab6c74ae88
commit 0986d487f1
2 changed files with 12 additions and 6 deletions

View File

@@ -464,7 +464,12 @@ if (!$error && $massaction == 'confirm_presend') {
$substitutionarray['__REF__'] = ($oneemailperrecipient ? join(', ', $listofqualifiedref) : $objecttmp->ref);
$substitutionarray['__EMAIL__'] = $thirdparty->email;
$substitutionarray['__CHECK_READ__'] = '<img src="'.DOL_MAIN_URL_ROOT.'/public/emailing/mailing-read.php?tag='.urlencode($thirdparty->tag).'&securitykey='.urlencode($conf->global->MAILING_EMAIL_UNSUBSCRIBE_KEY).'" width="1" height="1" style="width:1px;height:1px" border="0"/>';
if ($oneemailperrecipient) {
$substitutionarray['__ONLINE_PAYMENT_URL__'] = '';
$substitutionarray['__ONLINE_PAYMENT_TEXT_AND_URL__'] = '';
}
$parameters = array('mode'=>'formemail');
if (!empty($listofobjectthirdparties)) {

View File

@@ -863,12 +863,12 @@ class FormMail extends Form
// Complete substitution array with the url to make online payment
$paymenturl = '';
$validpaymentmethod = array();
// Set the online payment url link into __ONLINE_PAYMENT_URL__ key
require_once DOL_DOCUMENT_ROOT.'/core/lib/payments.lib.php';
$validpaymentmethod = getValidOnlinePaymentMethods('');
if (empty($this->substit['__REF__'])) {
$paymenturl = '';
} else {
// Set the online payment url link into __ONLINE_PAYMENT_URL__ key
require_once DOL_DOCUMENT_ROOT.'/core/lib/payments.lib.php';
$langs->loadLangs(array('paypal', 'other'));
$typeforonlinepayment = 'free';
if ($this->param["models"] == 'order' || $this->param["models"] == 'order_send') {
@@ -882,14 +882,15 @@ class FormMail extends Form
}
$url = getOnlinePaymentUrl(0, $typeforonlinepayment, $this->substit['__REF__']);
$paymenturl = $url;
$validpaymentmethod = getValidOnlinePaymentMethods('');
}
if (count($validpaymentmethod) > 0 && $paymenturl) {
$langs->load('other');
$this->substit['__ONLINE_PAYMENT_TEXT_AND_URL__'] = str_replace('\n', "\n", $langs->transnoentities("PredefinedMailContentLink", $paymenturl));
$this->substit['__ONLINE_PAYMENT_URL__'] = $paymenturl;
} elseif (count($validpaymentmethod) > 0) {
$this->substit['__ONLINE_PAYMENT_TEXT_AND_URL__'] = '__ONLINE_PAYMENT_TEXT_AND_URL__';
$this->substit['__ONLINE_PAYMENT_URL__'] = '__ONLINE_PAYMENT_URL__';
} else {
$this->substit['__ONLINE_PAYMENT_TEXT_AND_URL__'] = '';
$this->substit['__ONLINE_PAYMENT_URL__'] = '';