From 1a97ab1ef9296e6e2bddcb43a8a3e2326b74cde8 Mon Sep 17 00:00:00 2001
From: Jared Hancock <jared@osticket.com>
Date: Sun, 11 Aug 2013 04:04:25 +0000
Subject: [PATCH] Show correct auto-response email in department view

Fixes #575
---
 include/staff/department.inc.php | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/include/staff/department.inc.php b/include/staff/department.inc.php
index 707aa69dd..ab22f94ec 100644
--- a/include/staff/department.inc.php
+++ b/include/staff/department.inc.php
@@ -192,7 +192,9 @@ $info=Format::htmlchars(($errors && $_POST)?$_POST:$info);
                     $sql='SELECT email_id,email,name FROM '.EMAIL_TABLE.' email ORDER by name';
                     if(($res=db_query($sql)) && db_num_rows($res)){
                         while(list($id,$email,$name)=db_fetch_row($res)){
-                            $selected=($info['email_id'] && $id==$info['email_id'])?'selected="selected"':'';
+                            $selected = (isset($info['autoresp_email_id'])
+                                    && $id == $info['autoresp_email_id'])
+                                ? 'selected="selected"' : '';
                             if($name)
                                 $email=Format::htmlchars("$name <$email>");
                             echo sprintf('<option value="%d" %s>%s</option>',$id,$selected,$email);
-- 
GitLab