From d700649fb9d559600c39a7fb4c1877295d341f6d Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 6 Sep 2020 19:25:25 +0200 Subject: [PATCH] The deprecated subsitution key __SIGNATURE__ has been removed. Replace with __USER_SIGNATURE__ if you still use old syntax in your email templates. --- ChangeLog | 3 ++- htdocs/comm/mailing/card.php | 1 - htdocs/core/class/html.formticket.class.php | 6 +++--- htdocs/core/lib/functions.lib.php | 8 +------- htdocs/ticket/card.php | 2 +- 5 files changed, 7 insertions(+), 13 deletions(-) diff --git a/ChangeLog b/ChangeLog index e534e9e3d6d..aa82859a5b8 100644 --- a/ChangeLog +++ b/ChangeLog @@ -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 returns NaN because body is not loaded yet diff --git a/htdocs/comm/mailing/card.php b/htdocs/comm/mailing/card.php index ea81c4e35b9..ccccc93da4f 100644 --- a/htdocs/comm/mailing/card.php +++ b/htdocs/comm/mailing/card.php @@ -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__'] = ''; $substitutionarray['__UNSUBSCRIBE__'] = ''.$langs->trans("MailUnsubcribe").''; diff --git a/htdocs/core/class/html.formticket.class.php b/htdocs/core/class/html.formticket.class.php index ce1b89bf416..9f64797c646 100644 --- a/htdocs/core/class/html.formticket.class.php +++ b/htdocs/core/class/html.formticket.class.php @@ -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']) { diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index a5497474c9f..563a30dbbeb 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -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 diff --git a/htdocs/ticket/card.php b/htdocs/ticket/card.php index 8ac7d7cad1f..a078fe78fc4 100644 --- a/htdocs/ticket/card.php +++ b/htdocs/ticket/card.php @@ -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;