Skip to content

Commit

Permalink
Merge pull request civicrm#31037 from eileenmcnaughton/no_test
Browse files Browse the repository at this point in the history
Remove blank place holders for text versions of messages
  • Loading branch information
demeritcowboy authored Sep 4, 2024
2 parents 21a7248 + 0b610e8 commit 004fc0c
Show file tree
Hide file tree
Showing 34 changed files with 10 additions and 4 deletions.
1 change: 0 additions & 1 deletion CRM/Core/CodeGen/Util/MessageTemplates.php
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,6 @@ public static function assignSmartyVariables($smarty): void {
$directory = self::getDirectory($smarty);
foreach (array_keys($templates) as $name) {
$templates[$name]['msg_html'] = file_get_contents($directory . '/' . $name . '_html.tpl');
$templates[$name]['msg_text'] = file_get_contents($directory . '/' . $name . '_text.tpl') ?: '';
$templates[$name]['subject'] = file_get_contents($directory . '/' . $name . '_subject.tpl');
$templates[$name]['name'] = $name;
}
Expand Down
9 changes: 8 additions & 1 deletion CRM/Upgrade/Incremental/MessageTemplates.php
Original file line number Diff line number Diff line change
Expand Up @@ -542,7 +542,14 @@ public function updateTemplates(): void {
$workFlowID = CRM_Core_DAO::singleValueQuery('SELECT MAX(id) as id FROM civicrm_option_value WHERE name = %1', [
1 => [$template['name'], 'String'],
]);
$content = file_get_contents(\Civi::paths()->getPath('[civicrm.root]/xml/templates/message_templates/' . $template['name'] . '_' . $template['type'] . '.tpl'));
if ($template['type'] === 'text') {
// We no longer ship text templates.
$content = '';
}
else {
$content = file_get_contents(\Civi::paths()
->getPath('[civicrm.root]/xml/templates/message_templates/' . $template['name'] . '_' . $template['type'] . '.tpl'));
}
$templatesToUpdate = [];
if (!empty($workFlowID)) {
// This could be empty if the template was deleted. It should not happen,
Expand Down
4 changes: 2 additions & 2 deletions xml/templates/civicrm_msg_template.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,12 @@ INSERT INTO civicrm_option_group
INSERT INTO civicrm_msg_template
(msg_title, msg_subject, msg_text, msg_html, workflow_name, workflow_id, is_default, is_reserved)
VALUES
('{$template.title}', '{$template.subject|escape:"quotes"}', '{$template.msg_text|escape:"quotes"}', '{$template.msg_html|escape:"quotes"}', '{$template.name}', (SELECT id FROM civicrm_option_value WHERE name = '{$template.name}'), 1, 0);
('{$template.title}', '{$template.subject|escape:"quotes"}', '', '{$template.msg_html|escape:"quotes"}', '{$template.name}', (SELECT id FROM civicrm_option_value WHERE name = '{$template.name}'), 1, 0);

INSERT INTO civicrm_msg_template
(msg_title, msg_subject, msg_text, msg_html, workflow_name, workflow_id, is_default, is_reserved)
VALUES
('{$template.title}', '{$template.subject|escape:"quotes"}', '{$template.msg_text|escape:"quotes"}', '{$template.msg_html|escape:"quotes"}', '{$template.name}', (SELECT id FROM civicrm_option_value WHERE name = '{$template.name}'), 0, 1);
('{$template.title}', '{$template.subject|escape:"quotes"}', '', '{$template.msg_html|escape:"quotes"}', '{$template.name}', (SELECT id FROM civicrm_option_value WHERE name = '{$template.name}'), 0, 1);
{else}
INSERT INTO civicrm_msg_template
(msg_text, msg_title, msg_subject, msg_html)
Expand Down
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.

0 comments on commit 004fc0c

Please sign in to comment.