From 89990436fdd6429440b267fdb37ad803d40bd4ad Mon Sep 17 00:00:00 2001 From: aydreeihn <adriane@enhancesoft.com> Date: Thu, 5 Apr 2018 16:37:46 -0500 Subject: [PATCH] do not set dept or ht error if agent is deleting an invalid filter action --- include/class.filter.php | 18 +++++++++++------- include/staff/filter.inc.php | 1 - 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/include/class.filter.php b/include/class.filter.php index 7178aece5..3889c770e 100644 --- a/include/class.filter.php +++ b/include/class.filter.php @@ -473,18 +473,22 @@ class Filter { function save($id,$vars,&$errors) { if ($this) { foreach ($this->getActions() as $A) { - if ($A->type == 'dept') - $dept = Dept::lookup($A->parseConfiguration($vars)['dept_id']); - - if ($A->type == 'topic') - $topic = Topic::lookup($A->parseConfiguration($vars)['topic_id']); + if ($A->type == 'dept') { + $dept = Dept::lookup($A->parseConfiguration($vars)['dept_id']); + $dept_action = $A->getId(); + } + + if ($A->type == 'topic') { + $topic = Topic::lookup($A->parseConfiguration($vars)['topic_id']); + $topic_action = $A->getId(); + } } } - if($dept && !$dept->isActive()) + if($dept && !$dept->isActive() && !in_array('D' . $dept_action,$vars['actions'])) $errors['err'] = sprintf(__('%s selected for %s must be active'), __('Department'), __('Filter Action')); - if($topic && !$topic->isActive()) + if($topic && !$topic->isActive() && !in_array('D' . $topic_action,$vars['actions'])) $errors['err'] = sprintf(__('%s selected for %s must be active'), __('Help Topic'), __('Filter Action')); if(!$vars['execorder']) diff --git a/include/staff/filter.inc.php b/include/staff/filter.inc.php index ba0c06ce5..100e1273c 100644 --- a/include/staff/filter.inc.php +++ b/include/staff/filter.inc.php @@ -242,7 +242,6 @@ $info=Format::htmlchars(($errors && $_POST)?$_POST:$info); $existing[] = $A->type; if($A->type == 'dept') { $errors['topic_id'] = ''; - // $info=Format::htmlchars(($errors && $_POST)?$_POST:$info); $dept_config = $A->parseConfiguration($_POST); $dept = Dept::lookup($dept_config['dept_id']); if($dept && !$dept->isActive()) -- GitLab