Shout: Fix display of devices and dialplan
authorBen Klang <ben@alkaloid.net>
Mon, 8 Mar 2010 22:53:40 +0000 (17:53 -0500)
committerBen Klang <ben@alkaloid.net>
Mon, 8 Mar 2010 23:24:18 +0000 (18:24 -0500)
shout/devices.php
shout/dialplan.php
shout/lib/Application.php
shout/lib/Driver/Sql.php

index fc6e0b5..e3562c8 100644 (file)
@@ -26,7 +26,7 @@ switch ($action) {
 case 'add':
 case 'edit':
     $vars = Horde_Variables::getDefaultVariables();
-    $vars->set('account', $curaccount['code']);
+    $vars->set('account', $curaccount);
     $Form = new DeviceDetailsForm($vars);
 
     // Show the list if the save was successful, otherwise back to edit.
@@ -51,7 +51,7 @@ case 'edit':
 
     // Create a new add/edit form
     $devid = Horde_Util::getFormData('devid');
-    $devices = $shout->devices->getDevices($curaccount['code']);
+    $devices = $shout->devices->getDevices($curaccount);
     $vars = new Horde_Variables($devices[$devid]);
 
     $vars->set('action', $action);
@@ -66,7 +66,7 @@ case 'delete':
     $devid = Horde_Util::getFormData('devid');
 
     $vars = Horde_Variables::getDefaultVariables();
-    $vars->set('account', $curaccount['code']);
+    $vars->set('account', $curaccount);
     $Form = new DeviceDeleteForm($vars);
 
     $FormValid = $Form->validate($vars, true);
@@ -84,7 +84,7 @@ case 'delete':
     }
 
     $vars = Horde_Variables::getDefaultVariables(array());
-    $vars->set('account', $curaccount['code']);
+    $vars->set('account', $curaccount);
     $Form = new DeviceDeleteForm($vars);
 
     break;
@@ -97,7 +97,7 @@ default:
 
 // Fetch the (possibly updated) list of extensions
 try {
-    $devices = $shout->devices->getDevices($curaccount['code']);
+    $devices = $shout->devices->getDevices($curaccount);
 } catch (Exception $e) {
     $notification->push($e);
     $devices = array();
index 086d2c9..f3af4c8 100644 (file)
@@ -16,9 +16,9 @@ require_once SHOUT_BASE . '/lib/Forms/ExtensionForm.php';
 
 $action = Horde_Util::getFormData('action');
 $menu = Horde_Util::getFormData('menu');
-$curaccount['code'] = $_SESSION['shout']['curaccount'];
+$curaccount = $_SESSION['shout']['curaccount'];
 
-$menus = $shout->storage->getMenus($curaccount['code']);
+$menus = $shout->storage->getMenus($curaccount);
 
 switch($action) {
 case 'edit':
index 0e20615..cdbaaa4 100644 (file)
@@ -88,8 +88,8 @@ class Shout_Application extends Horde_Registry_Application
         }
 
         $account = Horde_Util::getFormData('account');
-        if (empty($account) && !empty($_SESSION['shout']['account'])) {
-            $account = $_SESSION['shout']['account'];
+        if (empty($account) && !empty($_SESSION['shout']['curaccount'])) {
+            $account = $_SESSION['shout']['curaccount'];
         }
 
         if (!empty($account) && !in_array($account, array_keys($accounts))) {
index 7d2426d..839d21f 100644 (file)
@@ -85,7 +85,7 @@ class Shout_Driver_Sql extends Shout_Driver
         $sql = 'SELECT accounts.code AS account, menus.name AS name, ' .
                'menus.description AS description, menus.soundfile AS soundfile ' .
                'FROM menus INNER JOIN accounts ON menus.account_id = accounts.id ' .
-               'WHERE accounts.accountcode = ?';
+               'WHERE accounts.code = ?';
         $vars = array($account);
 
         $msg = 'SQL query in Shout_Driver_Sql#getMenus(): ' . $sql;