From 8c03d88b8b691f1f7bb950b384f1ea78245272d8 Mon Sep 17 00:00:00 2001 From: Mark Crane Date: Tue, 5 Jun 2012 07:48:41 +0000 Subject: [PATCH] Fix the order the IVR Menus are listed in. --- includes/classes/database.php | 12 ++++-------- includes/classes/switch_ivr_menu.php | 4 +--- 2 files changed, 5 insertions(+), 11 deletions(-) diff --git a/includes/classes/database.php b/includes/classes/database.php index 078ab4788d..2a15e2f21c 100644 --- a/includes/classes/database.php +++ b/includes/classes/database.php @@ -209,8 +209,7 @@ include "root.php"; $this->connect(); } //get data from the database - $sql = ""; - $sql .= " select * from ".$this->table." "; + $sql = " select * from ".$this->table." "; if ($this->where) { $i = 0; foreach($this->where as $row) { @@ -223,21 +222,18 @@ include "root.php"; $i++; } } - if ($this->order_by) { + if (count($this->order_by) > 0) { $sql .= "order by "; $i = 1; foreach($this->order_by as $row) { if (count($this->order_by) == $i) { - $sql .= $row['name']." "; + $sql .= $row['name']." ".$row['order']." "; } else { - $sql .= $row['name'].", "; + $sql .= $row['name']." ".$row['order'].", "; } $i++; } - if ($this->order_type) { - $sql .= $this->order_type." "; - } } if ($this->limit) { $sql .= " limit ".$this->limit." offset ".$this->offset." "; diff --git a/includes/classes/switch_ivr_menu.php b/includes/classes/switch_ivr_menu.php index adddbad415..a4f062d6a3 100644 --- a/includes/classes/switch_ivr_menu.php +++ b/includes/classes/switch_ivr_menu.php @@ -59,6 +59,7 @@ include "root.php"; public $ivr_menu_option_param; public $ivr_menu_option_order; public $ivr_menu_option_description; + public $order_by; //array public function __construct() { require_once "includes/classes/database.php"; @@ -151,9 +152,6 @@ include "root.php"; if (isset($this->order_by)) { $database->order_by = $this->order_by; } - if (isset($this->order_type)) { - $database->order_type = $this->order_type; - } return $database->find(); }