From 9cd6b97bdfb40a663d506164cbc803d3b37641d9 Mon Sep 17 00:00:00 2001 From: michaelpollak Date: Mon, 28 Jun 2021 13:10:21 +0200 Subject: [PATCH] Allow notification-limitation to checkbox for all event types #160 --- rule/eventnotification/rule_class.php | 4 ++-- rule/rule_form.php | 3 +-- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/rule/eventnotification/rule_class.php b/rule/eventnotification/rule_class.php index 208ecabb..94cd0e85 100644 --- a/rule/eventnotification/rule_class.php +++ b/rule/eventnotification/rule_class.php @@ -93,8 +93,8 @@ public function trigger(\core\event\base $event) { } } - // If event is "update_entry" check if we only trigger on specific checkbox. - if ($eventname == "entry_updated" && $this->rule->param5) { + // Check if we only trigger on specific checkbox. + if ($this->rule->param5) { // If so, test for conditions and stop sending if not met. $entryid = $entryid = $event->get_data()['objectid']; diff --git a/rule/rule_form.php b/rule/rule_form.php index cf784a14..78723b1a 100644 --- a/rule/rule_form.php +++ b/rule/rule_form.php @@ -101,8 +101,7 @@ public function definition() { // If we have selected entry updated, add a new UI when the instance includes a checkbox. if($checkboxes = $this->_df->get_fields_by_type('checkbox', true)) { $checkboxes = array('0' => get_string('noselection', 'datalynx')) + $checkboxes; - $mform->addElement('select', 'param5', get_string('triggerspecificevent', 'datalynxrule_eventnotification'), $checkboxes); - $mform->hideIf('param5', 'entry_updated'); + $mform->addElement('select', 'param5', get_string('triggerspecificevent', 'datalynxrule_eventnotification'), $checkboxes); } $this->rule_definition();