From 85637a08265cbfef3cc615724b22195439f5afa5 Mon Sep 17 00:00:00 2001 From: Bharat Mediratta Date: Thu, 23 Sep 2010 20:45:27 -0700 Subject: Fix a bug introduced recently in f84c4a6192ea0e47ca5b2006baa0bfd7e09a682c where we were generating bad SQL. If we're checking for a conflict on a new item, the id is null and we were doing a comparison that resulted in "id <> NULL" which won't work -- in that case we need "id IS NOT NULL". Fixes #1393. --- modules/gallery/models/item.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'modules') diff --git a/modules/gallery/models/item.php b/modules/gallery/models/item.php index 7bcf1f31..07f781d1 100644 --- a/modules/gallery/models/item.php +++ b/modules/gallery/models/item.php @@ -498,7 +498,7 @@ class Item_Model_Core extends ORM_MPTT { $base_slug = $this->slug; while (ORM::factory("item") ->where("parent_id", "=", $this->parent_id) - ->where("id", "<>", $this->id) + ->where("id", $this->id ? "<>" : "IS NOT", $this->id) ->and_open() ->where("name", "=", $this->name) ->or_where("slug", "=", $this->slug) -- cgit v1.2.3