From ab880120e69b27bdcfed07d3b0729108326b335d Mon Sep 17 00:00:00 2001 From: Bharat Mediratta Date: Tue, 7 Sep 2010 21:04:38 -0700 Subject: [PATCH] The G2 import sets the sort_order to "asc"/"desc" but Item_Model::get_position() expects "DESC". This breaks navigation in any album imported from G2 that has a descending sort order. Two things: 1) Use "ASC"/"DESC" in G2 import for consistency 2) Make Item_Model::get_position() more robust against capitalization Fixes ticket #1334. --- modules/g2_import/helpers/g2_import.php | 6 +++--- modules/gallery/models/item.php | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/modules/g2_import/helpers/g2_import.php b/modules/g2_import/helpers/g2_import.php index c3737f8f95..515eb73d7d 100644 --- a/modules/g2_import/helpers/g2_import.php +++ b/modules/g2_import/helpers/g2_import.php @@ -452,9 +452,9 @@ static function import_album(&$queue) { "title" => "title", "viewCount" => "view_count"); $direction_map = array( - 1 => "asc", - ORDER_ASCENDING => "asc", - ORDER_DESCENDING => "desc"); + 1 => "ASC", + ORDER_ASCENDING => "ASC", + ORDER_DESCENDING => "DESC"); // Only consider G2's first sort order $g2_order = explode("|", $g2_album->getOrderBy() . ""); $g2_order = $g2_order[0]; diff --git a/modules/gallery/models/item.php b/modules/gallery/models/item.php index 34c2202134..485cd8cf9e 100644 --- a/modules/gallery/models/item.php +++ b/modules/gallery/models/item.php @@ -530,7 +530,7 @@ public function album_cover() { * the first child in the album is at position 1. */ public function get_position($child, $where=array()) { - if ($this->sort_order == "DESC") { + if (!strcasecmp($this->sort_order, "DESC")) { $comp = ">"; } else { $comp = "<";