From 8706c53af676f6ed946f23efb7f98676809aa99b Mon Sep 17 00:00:00 2001 From: Eileen McNaughton Date: Wed, 24 Nov 2021 11:02:30 +1300 Subject: [PATCH] Fix message templates screen to work with escape enabled by default --- CRM/Admin/Page/MessageTemplates.php | 2 +- CRM/Core/Smarty.php | 4 ++++ .../templates/CRM/Contact/Form/Search/Custom/FullText.tpl | 2 +- templates/CRM/Admin/Page/MessageTemplates.tpl | 2 +- tests/phpunit/CRM/Core/FormTest.php | 5 ++++- 5 files changed, 11 insertions(+), 4 deletions(-) diff --git a/CRM/Admin/Page/MessageTemplates.php b/CRM/Admin/Page/MessageTemplates.php index 544a39770e..58f154abda 100644 --- a/CRM/Admin/Page/MessageTemplates.php +++ b/CRM/Admin/Page/MessageTemplates.php @@ -252,7 +252,7 @@ class CRM_Admin_Page_MessageTemplates extends CRM_Core_Page_Basic { // find all objects $messageTemplate->find(); while ($messageTemplate->fetch()) { - $values[$messageTemplate->id] = []; + $values[$messageTemplate->id] = ['class' => '']; CRM_Core_DAO::storeValues($messageTemplate, $values[$messageTemplate->id]); // populate action links $this->action($messageTemplate, $action, $values[$messageTemplate->id], $links, CRM_Core_Permission::EDIT); diff --git a/CRM/Core/Smarty.php b/CRM/Core/Smarty.php index 3f4bd2a93a..32d21372d4 100644 --- a/CRM/Core/Smarty.php +++ b/CRM/Core/Smarty.php @@ -410,9 +410,13 @@ class CRM_Core_Smarty extends Smarty { // The ones below this point are hopefully here short term. || strpos($string, 'Tournament Fees is a required field. diff --git a/ext/legacycustomsearches/templates/CRM/Contact/Form/Search/Custom/FullText.tpl b/ext/legacycustomsearches/templates/CRM/Contact/Form/Search/Custom/FullText.tpl index 7c12f721cc..d720d1843c 100644 --- a/ext/legacycustomsearches/templates/CRM/Contact/Form/Search/Custom/FullText.tpl +++ b/ext/legacycustomsearches/templates/CRM/Contact/Form/Search/Custom/FullText.tpl @@ -35,7 +35,7 @@ {/if} {* @TODO: This is confusing - the variable `table` is already set and used above, and now we set it again to something that is technically different but has the same value, except on a blank form where it doesn't exist, but effectively then is the same value that it already has which is ''. So do we need this line even? *} -{if (isset($form.table.value.0))}{assign var=table value=$form.table.value.0}{/if} +{if $form.table.value && (array_key_exists(0, $form.table.value))}{assign var=table value=$form.table.value.0}{/if} {assign var=text value=$form.text.value} {if !empty($summary.Contact) }
diff --git a/templates/CRM/Admin/Page/MessageTemplates.tpl b/templates/CRM/Admin/Page/MessageTemplates.tpl index 74047b366f..96d38de5b1 100644 --- a/templates/CRM/Admin/Page/MessageTemplates.tpl +++ b/templates/CRM/Admin/Page/MessageTemplates.tpl @@ -125,7 +125,7 @@ {foreach from=$template_row item=row} - + {$row.msg_title} {if $type eq 'userTemplates'} {$row.msg_subject} diff --git a/tests/phpunit/CRM/Core/FormTest.php b/tests/phpunit/CRM/Core/FormTest.php index 8a89938ba7..958efb1b1c 100644 --- a/tests/phpunit/CRM/Core/FormTest.php +++ b/tests/phpunit/CRM/Core/FormTest.php @@ -15,7 +15,7 @@ class CRM_Core_FormTest extends CiviUnitTestCase { * * @dataProvider formList */ - public function testOpeningForms(string $url) { + public function testOpeningForms(string $url): void { $this->createLoggedInUser(); $_SERVER['REQUEST_URI'] = $url; @@ -62,6 +62,9 @@ class CRM_Core_FormTest extends CiviUnitTestCase { 'New Email' => [ 'civicrm/activity/email/add?atype=3&action=add&reset=1&context=standalone', ], + 'Message Templates' => [ + 'civicrm/admin/messageTemplates?reset=1', + ], ]; } -- 2.25.1