From 43d2f31b7c5ccd46af2a6ce07bba70909563758a Mon Sep 17 00:00:00 2001 From: Ben Klang Date: Fri, 26 Mar 2010 14:17:30 -0400 Subject: [PATCH] Shout: Fix bug that deleted other menu actions inadvertently --- shout/lib/Driver/Sql.php | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/shout/lib/Driver/Sql.php b/shout/lib/Driver/Sql.php index 11748a237..93e55ae4c 100644 --- a/shout/lib/Driver/Sql.php +++ b/shout/lib/Driver/Sql.php @@ -211,8 +211,11 @@ class Shout_Driver_Sql extends Shout_Driver public function saveMenuAction($account, $menu, $digit, $action, $args) { // Remove any existing action - $sql = 'DELETE FROM menu_entries WHERE digit = ?'; - $values = array($digit); + $sql = 'DELETE FROM menu_entries WHERE menu_id = ' . + '(SELECT id FROM menus WHERE account_id = ' . + '(SELECT id FROM accounts WHERE code = ?) AND name = ?) ' . + 'AND digit = ?'; + $values = array($account, $menu, $digit); $msg = 'SQL query in Shout_Driver_Sql#saveMenuAction(): ' . $sql; Horde::logMessage($msg, 'DEBUG'); $result = $this->_write_db->query($sql, $values); -- 2.11.0