Skip to content
Snippets Groups Projects
Commit 40860f6c authored by jaapjansma's avatar jaapjansma
Browse files

added are you sure to delete screen for deletions of rules

parent 8908e593
No related branches found
No related tags found
No related merge requests found
......@@ -70,13 +70,11 @@ class CRM_Civirules_Form_Rule extends CRM_Core_Form {
$ruleActionAddUrl = CRM_Utils_System::url('civicrm/civirule/form/rule_action', 'reset=1&action=add&rid='.$this->ruleId, TRUE);
$this->assign('ruleConditionAddUrl', $ruleConditionAddUrl);
$this->assign('ruleActionAddUrl', $ruleActionAddUrl);
$this->assign('action', $this->_action);
$this->assign('rule', $this->rule);
$session = CRM_Core_Session::singleton();
switch($this->_action) {
case CRM_Core_Action::DELETE:
CRM_Civirules_BAO_Rule::deleteWithId($this->ruleId);
$session->setStatus('CiviRule deleted', 'Delete', 'success');
CRM_Utils_System::redirect($session->readUserContext());
break;
case CRM_Core_Action::DISABLE:
CRM_Civirules_BAO_Rule::disable($this->ruleId);
$session->setStatus('CiviRule disabled', 'Disable', 'success');
......@@ -107,6 +105,10 @@ class CRM_Civirules_Form_Rule extends CRM_Core_Form {
if ($this->_action == CRM_Core_Action::ADD || $this->_action == CRM_Core_Action::UPDATE) {
$editUrl = CRM_Utils_System::url('civicrm/civirule/form/rule', 'action=update&id='.$this->ruleId, TRUE);
$session->pushUserContext($editUrl);
} elseif ($this->_action == CRM_Core_Action::DELETE) {
CRM_Civirules_BAO_Rule::deleteWithId($this->ruleId);
$session->setStatus('CiviRule deleted', 'Delete', 'success');
CRM_Utils_System::redirect($session->readUserContext());
}
if (isset($this->_submitValues['rule_event_select'])) {
......
......@@ -2,11 +2,19 @@
{include file="CRM/common/formButtons.tpl" location="top"}
</div>
{include file="CRM/Civirules/Form/RuleBlocks/RuleBlock.tpl"}
{include file="CRM/Civirules/Form/RuleBlocks/EventBlock.tpl"}
{if $action ne 1}
{include file="CRM/Civirules/Form/RuleBlocks/ConditionBlock.tpl"}
{include file="CRM/Civirules/Form/RuleBlocks/ActionBlock.tpl"}
{if $action eq 8}
{* Are you sure to delete form *}
<h3>{ts}Delete rule{/ts}</h3>
<div class="crm-block crm-form-block crm-civirule-rule_label-block">
<div class="crm-section">{ts 1=$rule->label}Are you sure to delete rule '%1'?{/ts}</div>
</div>
{else}
{include file="CRM/Civirules/Form/RuleBlocks/RuleBlock.tpl"}
{include file="CRM/Civirules/Form/RuleBlocks/EventBlock.tpl"}
{if $action ne 1}
{include file="CRM/Civirules/Form/RuleBlocks/ConditionBlock.tpl"}
{include file="CRM/Civirules/Form/RuleBlocks/ActionBlock.tpl"}
{/if}
{/if}
<div class="crm-submit-buttons">
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment