Merge pull request #22255 from MegaphoneJon/membership-14-2021
[civicrm-core.git] / CRM / Admin / Page / MessageTemplates.php
index 325b06528d1fa9e182749c814bbc728caff33c91..a2af7ea9ab13df2320e8038b39ef77ea0dfa1b2d 100644 (file)
@@ -40,8 +40,8 @@ class CRM_Admin_Page_MessageTemplates extends CRM_Core_Page_Basic {
   protected $_revertedId;
 
   /**
-   * @param null $title
-   * @param null $mode
+   * @param string $title
+   * @param int $mode
    */
   public function __construct($title = NULL, $mode = NULL) {
     parent::__construct($title, $mode);
@@ -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;
       }
@@ -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);