The deprecated subsitution key __SIGNATURE__ has been removed. Replace

with __USER_SIGNATURE__ if you still use old syntax in your email
templates.
This commit is contained in:
Laurent Destailleur 2020-09-06 19:25:25 +02:00
parent 84efd70dcb
commit d700649fb9
5 changed files with 7 additions and 13 deletions

View File

@ -13,7 +13,8 @@ WARNING:
Following changes may create regressions for some external modules, but were necessary to make Dolibarr better:
* Properties ->contactid has been renamed into ->contact_id
* Rename property $paiementid in API api_supplier_invoices into $payment_mode_id
* The deprecated subsitution key __SIGNATURE__ has been removed. Replace with __USER_SIGNATURE__ if you still use old syntax in
your email templates.
***** ChangeLog for 12.0.2 compared to 12.0.1 *****
FIX: computation of the bottom margin of <body> returns NaN because body is not loaded yet

View File

@ -211,7 +211,6 @@ if (empty($reshook))
$substitutionarray['__OTHER4__'] = $other4;
$substitutionarray['__OTHER5__'] = $other5;
$substitutionarray['__USER_SIGNATURE__'] = $signature; // Signature is empty when ran from command line or taken from user in parameter)
$substitutionarray['__SIGNATURE__'] = $signature; // For backward compatibility
$substitutionarray['__CHECK_READ__'] = '<img src="'.DOL_MAIN_URL_ROOT.'/public/emailing/mailing-read.php?tag='.$obj->tag.'&securitykey='.urlencode($conf->global->MAILING_EMAIL_UNSUBSCRIBE_KEY).'" width="1" height="1" style="width:1px;height:1px" border="0"/>';
$substitutionarray['__UNSUBSCRIBE__'] = '<a href="'.DOL_MAIN_URL_ROOT.'/public/emailing/mailing-unsubscribe.php?tag='.$obj->tag.'&unsuscrib=1&securitykey='.urlencode($conf->global->MAILING_EMAIL_UNSUBSCRIBE_KEY).'" target="_blank">'.$langs->trans("MailUnsubcribe").'</a>';

View File

@ -993,9 +993,9 @@ class FormTicket
$defaultmessage = str_replace('\n', "\n", $defaultmessage);
// Deal with format differences between message and signature (text / HTML)
if (dol_textishtml($defaultmessage) && !dol_textishtml($this->substit['__SIGNATURE__'])) {
$this->substit['__SIGNATURE__'] = dol_nl2br($this->substit['__SIGNATURE__']);
} elseif (!dol_textishtml($defaultmessage) && dol_textishtml($this->substit['__SIGNATURE__'])) {
if (dol_textishtml($defaultmessage) && !dol_textishtml($this->substit['__USER_SIGNATURE__'])) {
$this->substit['__USER_SIGNATURE__'] = dol_nl2br($this->substit['__USER_SIGNATURE__']);
} elseif (!dol_textishtml($defaultmessage) && dol_textishtml($this->substit['__USER_SIGNATURE__'])) {
$defaultmessage = dol_nl2br($defaultmessage);
}
if (isset($_POST["message"]) && !$_POST['modelselected']) {

View File

@ -5913,14 +5913,9 @@ function getCommonSubstitutionArray($outputlangs, $onlykey = 0, $exclude = null,
// this will include signature content first and then replace var found into content of signature
$signature = $user->signature;
$substitutionarray = array_merge($substitutionarray, array(
'__USER_SIGNATURE__' => (string) (($signature && empty($conf->global->MAIN_MAIL_DO_NOT_USE_SIGN)) ? ($onlykey == 2 ? dol_trunc(dol_string_nohtmltag($signature), 30) : $signature) : '')
'__USER_SIGNATURE__' => (string) (($signature && empty($conf->global->MAIN_MAIL_DO_NOT_USE_SIGN)) ? ($onlykey == 2 ? dol_trunc(dol_string_nohtmltag($signature), 30) : $signature) : '')
)
);
// For backward compatibility
if ($onlykey != 2)
{
$substitutionarray['__SIGNATURE__'] = (string) (($signature && empty($conf->global->MAIN_MAIL_DO_NOT_USE_SIGN)) ? ($onlykey == 2 ? dol_trunc(dol_string_nohtmltag($signature), 30) : $signature) : '');
}
$substitutionarray = array_merge($substitutionarray, array(
'__USER_ID__' => (string) $user->id,
@ -6383,7 +6378,6 @@ function make_substitutions($text, $substitutionarray, $outputlangs = null)
{
if (!isset($value)) continue; // If value is null, it same than not having substitution key at all into array, we do not replace.
if ($key == '__SIGNATURE__' && (!empty($conf->global->MAIN_MAIL_DO_NOT_USE_SIGN))) $value = ''; // Protection
if ($key == '__USER_SIGNATURE__' && (!empty($conf->global->MAIN_MAIL_DO_NOT_USE_SIGN))) $value = ''; // Protection
$text = str_replace("$key", "$value", $text); // We must keep the " to work when value is 123.5 for example

View File

@ -1234,7 +1234,7 @@ if (empty($action) || $action == 'view' || $action == 'addlink' || $action == 'd
$object->fetch_thirdparty();
$substitutionarray['__THIRDPARTY_NAME__'] = $object->thirdparty->name;
}
$substitutionarray['__SIGNATURE__'] = $user->signature;
$substitutionarray['__USER_SIGNATURE__'] = $user->signature;
$substitutionarray['__TICKET_TRACKID__'] = $object->track_id;
$substitutionarray['__TICKET_REF__'] = $object->ref;
$substitutionarray['__TICKET_SUBJECT__'] = $object->subject;