Existing Message Templates Throws Error on Notifications

XMLWordPrintable

      Message Templates that existed prior to 4.0.0 do not have a format set. When trying to send a Notification, CoPetition throws an error:

      Call to a member function to() on string

      Error: An Internal Error Has Occurred.

      Stack Trace

      APP/Model/CoNotification.php line 759 → CoNotification->sendEmail(string, string, string, string, string, string, string, string, string, boolean, string, string, null)

      This is because CoMessageTemplate::getMessageTemplateFields() sets $format to $tmpl['format'], regardless of whether or not there is a value there (and overriding the default value set two lines above). $format should only be overwritten if $tmpl['format'] is not empty.

      Additionally, there should probably be some code added to UpgradeVersionShell::post400() that populates cm_co_message_templates:format to MessageFormatEnum::Plaintext for all existing message templates.

            Assignee:
            Ioannis Eythymios Igoumenos (Inactive)
            Reporter:
            Benn Oshrin
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: