summaryrefslogtreecommitdiff
path: root/modules/gallery/models/item.php
diff options
context:
space:
mode:
authorBharat Mediratta <bharat@menalto.com>2010-09-23 20:45:27 -0700
committerBharat Mediratta <bharat@menalto.com>2010-09-23 20:45:27 -0700
commit85637a08265cbfef3cc615724b22195439f5afa5 (patch)
tree393a7b8bcac6ce982df0e09aa39ea82fa87b32a9 /modules/gallery/models/item.php
parentd2bf5c9d1f28e90223b484addd6969c46f3160b5 (diff)
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.
Diffstat (limited to 'modules/gallery/models/item.php')
-rw-r--r--modules/gallery/models/item.php2
1 files changed, 1 insertions, 1 deletions
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)