From 84c84d44afd4a4335f09236fb7293d5a61962b14 Mon Sep 17 00:00:00 2001
From: Jared Hancock <jared@osticket.com>
Date: Mon, 10 Aug 2015 14:20:58 -0500
Subject: [PATCH] filter: Fix recursion crash updating filter with set-dept
 action

---
 include/class.filter_action.php | 18 ++++++++----------
 1 file changed, 8 insertions(+), 10 deletions(-)

diff --git a/include/class.filter_action.php b/include/class.filter_action.php
index b78a8de31..2e57ba530 100644
--- a/include/class.filter_action.php
+++ b/include/class.filter_action.php
@@ -288,10 +288,9 @@ class FA_RouteDepartment extends TriggerAction {
                 ),
                 'choices' =>
                     Dept::getDepartments() +
-                    array(':new:' => '— '.__('Add New').' —')
-                ,
-                'validators' => function($self) {
-                    if ($self->getClean() === ':new:')
+                    array(':new:' => '— '.__('Add New').' —'),
+                'validators' => function($self, $clean) {
+                    if ($clean === ':new:')
                         $self->addError(__('Select a department'));
                 }
             )),
@@ -368,12 +367,11 @@ class FA_AssignTeam extends TriggerAction {
                     'prompt' => __('Unchanged'),
                     'data' => array('quick-add' => 'team'),
                 ),
-                'choices' => array_merge(
-                    $choices,
-                    array(':new:' => '— '.__('Add New').' —')
-                ),
-                'validators' => function($self) {
-                    if ($self->getClean() === ':new:')
+                'choices' =>
+                    Team::getTeams() +
+                    array(':new:' => '— '.__('Add New').' —'),
+                'validators' => function($self, $clean) {
+                    if ($clean === ':new:')
                         $self->addError(__('Select a team'));
                 }
             )),
-- 
GitLab