From 1cbdbd839cd8cfe74ff820cf02582a17daf8bb95 Mon Sep 17 00:00:00 2001 From: Ben Klang Date: Sun, 14 Mar 2010 23:28:30 -0400 Subject: [PATCH] Shout: Fix small errors in writing dialplan changes --- shout/lib/Ajax/Application.php | 6 +++--- shout/lib/Driver/Sql.php | 1 + shout/templates/dialplan/edit.inc | 1 + 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/shout/lib/Ajax/Application.php b/shout/lib/Ajax/Application.php index 3ba94eb7d..8a05290f1 100644 --- a/shout/lib/Ajax/Application.php +++ b/shout/lib/Ajax/Application.php @@ -176,7 +176,7 @@ class Shout_Ajax_Application extends Horde_Ajax_Application_Base public function saveAction() { try { - $shout = $_GLOBALS['shout'] = Horde_Registry::appInit('shout'); + $shout = $GLOBALS['shout'] = Horde_Registry::appInit('shout'); $vars = $this->_vars; if (!($action = $vars->get('action'))) { throw new Shout_Exception("Invalid action requested."); @@ -190,10 +190,10 @@ class Shout_Ajax_Application extends Horde_Ajax_Application_Base throw new Shout_Exception('Invalid action requested.'); } $args = array(); - foreach ($action[$action]['args'] as $name => $info) { + foreach ($actions[$action]['args'] as $name => $info) { $args[$name] = $vars->get($name); } - $shout->dialplan->saveMenuAction($account, $menu, $action, $args); + $shout->dialplan->saveMenuAction($account, $menu, $digit, $action, $args); } catch (Exception $e) { //FIXME: Create a way to notify the user of the failure. Horde::logMessage($e->getMessage(), __FILE__, __LINE__, PEAR_LOG_ERR); diff --git a/shout/lib/Driver/Sql.php b/shout/lib/Driver/Sql.php index 7a40b0558..d44a984e9 100644 --- a/shout/lib/Driver/Sql.php +++ b/shout/lib/Driver/Sql.php @@ -200,6 +200,7 @@ class Shout_Driver_Sql extends Shout_Driver '(SELECT id FROM actions WHERE name = ?), ?)'; $yamlargs = Horde_Yaml::dump($args); $values = array($account, $menu, $digit, $action, $yamlargs); + Horde::logMessage("Data: ".print_r($values, true), __FILE__, __LINE__, PEAR_LOG_ERR); $msg = 'SQL query in Shout_Driver_Sql#saveMenuAction(): ' . $sql; Horde::logMessage($msg, __FILE__, __LINE__, PEAR_LOG_DEBUG); $result = $this->_write_db->query($sql, $values); diff --git a/shout/templates/dialplan/edit.inc b/shout/templates/dialplan/edit.inc index 3914d4455..da962bcee 100644 --- a/shout/templates/dialplan/edit.inc +++ b/shout/templates/dialplan/edit.inc @@ -111,6 +111,7 @@ function saveAction(digit) { var params = $('editActionForm').serialize(true); params.menu = menuInfo.get('meta').name; + params.action = $('selectActionForm').getElements().first().getValue(); new Ajax.Request(ajax_url + 'saveAction', { method: 'post', -- 2.11.0