summaryrefslogtreecommitdiffstats
path: root/lib/class/browse.class.php
diff options
context:
space:
mode:
authordipsol <dipsol@ampache>2009-01-28 13:09:51 +0000
committerdipsol <dipsol@ampache>2009-01-28 13:09:51 +0000
commit76f176159ee546614e8078f46382771f9ea4b358 (patch)
tree4b001467daa3dce38128d9182a3f98dfb62dd471 /lib/class/browse.class.php
parent8dc49610d636be1ec077de2bbdab23d8848763f2 (diff)
downloadampache-76f176159ee546614e8078f46382771f9ea4b358.tar.gz
ampache-76f176159ee546614e8078f46382771f9ea4b358.tar.bz2
ampache-76f176159ee546614e8078f46382771f9ea4b358.zip
Ticket #378, The where statement was inserted before the join. That resulted in an invalid sql statement. Fixed it.
Diffstat (limited to 'lib/class/browse.class.php')
-rw-r--r--lib/class/browse.class.php14
1 files changed, 10 insertions, 4 deletions
diff --git a/lib/class/browse.class.php b/lib/class/browse.class.php
index d88d9b4f..60eea3d1 100644
--- a/lib/class/browse.class.php
+++ b/lib/class/browse.class.php
@@ -1190,14 +1190,19 @@ class Browse {
// and the vollmer way, hopefully we don't have to
// do it the vollmer way
if (self::is_simple_browse()) {
+ debug_event('resort_objects','is_simple_browse','4');
$sql = self::get_sql();
}
else {
+ debug_event('resort_objects','not is_simple_browse','4');
// First pull the objects
$objects = self::get_saved();
// If there's nothing there don't do anything
- if (!count($objects)) { return false; }
+ if (!count($objects)) {
+ debug_event('resort_objects','no objects found','4');
+ return false;
+ }
$type = self::$type;
$where_sql = "WHERE `$type`.`id` IN (";
@@ -1210,7 +1215,6 @@ class Browse {
$where_sql .= ")";
$sql = self::get_base_sql();
- $sql .= $where_sql;
$order_sql = " ORDER BY ";
@@ -1220,9 +1224,11 @@ class Browse {
// Clean her up
$order_sql = rtrim($order_sql,"ORDER BY ");
$order_sql = rtrim($order_sql,",");
- $sql = $sql . self::get_join_sql() . $order_sql;
+
+ $sql = $sql . self::get_join_sql() . $where_sql . $order_sql;
} // if not simple
-
+
+ debug_event('resort_objects','final sql: ' . $sql,'4');
$db_results = Dba::query($sql);
while ($row = Dba::fetch_assoc($db_results)) {