From 31340b59dc3d754f6f91c4e84fe31f079e769f1f Mon Sep 17 00:00:00 2001 From: Eileen McNaughton Date: Thu, 30 Sep 2021 12:09:06 +1300 Subject: [PATCH] Remove workflow_id reference --- CRM/Admin/Form/MessageTemplates.php | 2 +- CRM/Admin/Page/MessageTemplates.php | 6 +++--- CRM/Mailing/Info.php | 6 +++--- api/v3/examples/MessageTemplate/Get.ex.php | 2 +- templates/CRM/Admin/Form/MessageTemplates.tpl | 2 +- 5 files changed, 9 insertions(+), 9 deletions(-) diff --git a/CRM/Admin/Form/MessageTemplates.php b/CRM/Admin/Form/MessageTemplates.php index dcf97bba3c..076fcf3742 100644 --- a/CRM/Admin/Form/MessageTemplates.php +++ b/CRM/Admin/Form/MessageTemplates.php @@ -110,7 +110,7 @@ class CRM_Admin_Form_MessageTemplates extends CRM_Core_Form { else { $this->_workflow_id = $this->_values['workflow_id'] ?? NULL; $this->checkUserPermission($this->_workflow_id); - $this->assign('workflow_id', $this->_workflow_id); + $this->assign('isWorkflow', (bool) ($this->_values['workflow_id'] ?? NULL)); if ($this->_workflow_id) { $selectedChild = 'workflow'; diff --git a/CRM/Admin/Page/MessageTemplates.php b/CRM/Admin/Page/MessageTemplates.php index 325b06528d..544a39770e 100644 --- a/CRM/Admin/Page/MessageTemplates.php +++ b/CRM/Admin/Page/MessageTemplates.php @@ -51,7 +51,7 @@ class CRM_Admin_Page_MessageTemplates extends CRM_Core_Page_Basic { $sql = ' SELECT diverted.id, orig.id orig_id FROM civicrm_msg_template diverted JOIN civicrm_msg_template orig ON ( - diverted.workflow_id = orig.workflow_id AND + diverted.workflow_name = orig.workflow_name AND orig.is_reserved = 1 AND ( diverted.msg_subject != orig.msg_subject OR diverted.msg_text != orig.msg_text OR @@ -134,7 +134,7 @@ class CRM_Admin_Page_MessageTemplates extends CRM_Core_Page_Basic { * @param bool $forceAction */ public function action(&$object, $action, &$values, &$links, $permission, $forceAction = FALSE) { - if ($object->workflow_id) { + if ($object->workflow_name) { // do not expose action link for reverting to default if the template did not diverge or we just reverted it now if (!array_key_exists($object->id, $this->_revertible) or ($this->_action & CRM_Core_Action::REVERT and $object->id == $this->_revertedId) @@ -145,7 +145,7 @@ class CRM_Admin_Page_MessageTemplates extends CRM_Core_Page_Basic { // default workflow templates shouldn’t be deletable // workflow templates shouldn’t have disable/enable actions (at least for CiviCRM 3.1) - if ($object->workflow_id) { + if ($object->workflow_name) { $action &= ~CRM_Core_Action::DISABLE; $action &= ~CRM_Core_Action::DELETE; } diff --git a/CRM/Mailing/Info.php b/CRM/Mailing/Info.php index d26c57dc99..c670df0d96 100644 --- a/CRM/Mailing/Info.php +++ b/CRM/Mailing/Info.php @@ -68,15 +68,15 @@ class CRM_Mailing_Info extends CRM_Core_Component_Info { $emailAdd = civicrm_api3('Email', 'get', [ 'sequential' => 1, - 'return' => "email", + 'return' => 'email', 'contact_id' => $contactID, ]); $mesTemplate = civicrm_api3('MessageTemplate', 'get', $params + [ 'sequential' => 1, 'is_active' => 1, - 'return' => ["id", "msg_title"], - 'workflow_id' => ['IS NULL' => ""], + 'return' => ['id', 'msg_title'], + 'workflow_name' => ['IS NULL' => ''], ]); $mailTokens = civicrm_api3('Mailing', 'gettokens', [ 'entity' => ['contact', 'mailing'], diff --git a/api/v3/examples/MessageTemplate/Get.ex.php b/api/v3/examples/MessageTemplate/Get.ex.php index 985ecbba48..9874c57f2e 100644 --- a/api/v3/examples/MessageTemplate/Get.ex.php +++ b/api/v3/examples/MessageTemplate/Get.ex.php @@ -11,7 +11,7 @@ function message_template_get_example() { 'msg_subject' => 'msg_subject_472', 'msg_text' => 'msg_text_472', 'msg_html' => 'msg_html_472', - 'workflow_id' => 472, + 'workflow_name' => 'contribution_online_invoice', 'is_default' => '1', 'is_reserved' => 1, ]; diff --git a/templates/CRM/Admin/Form/MessageTemplates.tpl b/templates/CRM/Admin/Form/MessageTemplates.tpl index ddff12a700..d00fb30478 100644 --- a/templates/CRM/Admin/Form/MessageTemplates.tpl +++ b/templates/CRM/Admin/Form/MessageTemplates.tpl @@ -118,7 +118,7 @@ - {if !$workflow_id} + {if !$isWorkflow} -- 2.25.1
{$form.is_active.label}