Skip to content

Commit

Permalink
Merge pull request #26754 from seamuslee001/revert_message_template_w…
Browse files Browse the repository at this point in the history
…rite_record

[REF] Use writeRecord in the revert function of MessageTemplate to en…
  • Loading branch information
seamuslee001 authored Jul 6, 2023
2 parents 8aff454 + 97079e7 commit 3c9d9f0
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions CRM/Core/BAO/MessageTemplate.php
Original file line number Diff line number Diff line change
Expand Up @@ -245,11 +245,14 @@ public static function revert($id) {
throw new CRM_Core_Exception(ts('Message template with id of %1 does not have a default to revert to.', [1 => $id]));
}

$diverted->msg_subject = $orig->msg_subject;
$diverted->msg_text = $orig->msg_text;
$diverted->msg_html = $orig->msg_html;
$diverted->pdf_format_id = is_null($orig->pdf_format_id) ? 'null' : $orig->pdf_format_id;
$diverted->save();
// Use write record to trigger hook invocations.
self::writeRecord([
'msg_subject' => $orig->msg_subject,
'msg_text' => $orig->msg_text,
'msg_html' => $orig->msg_html,
'pdf_format_id' => is_null($orig->pdf_format_id) ? 'null' : $orig->pdf_format_id,
'id' => $id,
]);
}

/**
Expand Down

0 comments on commit 3c9d9f0

Please sign in to comment.