From 4f0a3fefa035ec351bc881093f49f9bc81941f3d Mon Sep 17 00:00:00 2001 From: Bharat Mediratta Date: Thu, 4 Jun 2009 22:11:08 -0700 Subject: Fix a bug in Item_Model::get_position() where we incorrectly using the grandparent id. Oops. This caused navigation from photo back up to album to be broken. Also update Photos_Controller to use the active sort order.. it was still hardcoded to use the id. It's more efficient now, yay. Fixes ticket #340. --- modules/gallery/models/item.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'modules/gallery/models') diff --git a/modules/gallery/models/item.php b/modules/gallery/models/item.php index 10bad0b2..7dce9e51 100644 --- a/modules/gallery/models/item.php +++ b/modules/gallery/models/item.php @@ -380,7 +380,7 @@ class Item_Model extends ORM_MPTT { public function get_position($child_id) { $result = Database::instance()->query(" SELECT COUNT(*) AS position FROM {items} - WHERE parent_id = {$this->parent_id} + WHERE parent_id = {$this->id} AND {$this->sort_column} <= (SELECT {$this->sort_column} FROM {items} WHERE id = $child_id) ORDER BY {$this->sort_column} {$this->sort_order}"); -- cgit v1.2.3