Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove workflow_id reference #21671

Merged
merged 3 commits into from
Oct 1, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion CRM/Admin/Form/MessageTemplates.php
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ public function buildQuickForm() {
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';
Expand Down
6 changes: 3 additions & 3 deletions CRM/Admin/Page/MessageTemplates.php
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ public function __construct($title = NULL, $mode = NULL) {
$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
Expand Down Expand Up @@ -134,7 +134,7 @@ public function &links() {
* @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)
Expand All @@ -145,7 +145,7 @@ public function action(&$object, $action, &$values, &$links, $permission, $force

// 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;
}
Expand Down
2 changes: 1 addition & 1 deletion CRM/Core/BAO/MessageTemplate.php
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,7 @@ public static function revert($id) {
}

$orig = new CRM_Core_BAO_MessageTemplate();
$orig->workflow_id = $diverted->workflow_id;
$orig->workflow_name = $diverted->workflow_name;
$orig->is_reserved = 1;
$orig->find(1);

Expand Down
6 changes: 3 additions & 3 deletions CRM/Mailing/Info.php
Original file line number Diff line number Diff line change
Expand Up @@ -68,15 +68,15 @@ public static function createAngularSettings():array {

$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'],
Expand Down
4 changes: 2 additions & 2 deletions ang/crmMailing/Templates.js
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,8 @@
}

rcpAjaxState.page_i = page_num - rcpAjaxState.page_n;
var filterParams = { is_active: 1, workflow_id: { "IS NULL": 1 } };
var filterParams = { is_active: 1, workflow_name: { "IS NULL": 1 } };

var params = {
input: input,
page_num: rcpAjaxState.page_i,
Expand Down
2 changes: 1 addition & 1 deletion api/v3/examples/MessageTemplate/Get.ex.php
Original file line number Diff line number Diff line change
Expand Up @@ -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,
];
Expand Down
2 changes: 1 addition & 1 deletion templates/CRM/Admin/Form/MessageTemplates.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@
</div><!-- /.crm-accordion-body -->
</div><!-- /.crm-accordion-wrapper -->

{if !$workflow_id}
{if !$isWorkflow}
<table class="form-layout-compressed">
<tr>
<td class="label-left">{$form.is_active.label}</td>
Expand Down