From 921c452c322fce564828794ad2f18e74d441f8ea Mon Sep 17 00:00:00 2001 From: Jared Hancock <gravydish@gmail.com> Date: Fri, 13 Jul 2012 16:03:15 -0500 Subject: [PATCH] Indicate which filters are using a canned reply --- include/staff/cannedreply.inc.php | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/include/staff/cannedreply.inc.php b/include/staff/cannedreply.inc.php index 55e29db7d..f776ef7f5 100644 --- a/include/staff/cannedreply.inc.php +++ b/include/staff/cannedreply.inc.php @@ -9,6 +9,11 @@ if($canned && $_REQUEST['a']!='add'){ $info=$canned->getInfo(); $info['id']=$canned->getId(); $qstr.='&id='.$canned->getId(); + $res = db_query( + 'SELECT GROUP_CONCAT(DISTINCT name ORDER BY name SEPARATOR ", ")' + .' FROM '.EMAIL_FILTER_TABLE + .' WHERE canned_response_id = '.db_input($canned->getId())); + $info['filter'] = ($res && ($row = db_fetch_row($res))) ? $row[0] : null; }else { $title='Add New Canned Reply'; $action='create'; @@ -107,6 +112,11 @@ $info=Format::htmlchars(($errors && $_POST)?$_POST:$info); </tr> </tbody> </table> + <?php if ($info['filter']) { ?> + <br/> + <div id="msg_warning">Canned reply is in use by email filter(s): <?php + echo $info['filter']; ?></div> + <?php } ?> <p style="padding-left:225px;"> <input type="submit" name="submit" value="<?php echo $submit_text; ?>"> <input type="reset" name="reset" value="Reset"> -- GitLab