Permalink
Browse files

Fix a bug introduced recently in

f84c4a6 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.
  • Loading branch information...
bharat committed Sep 24, 2010
1 parent d2bf5c9 commit 85637a08265cbfef3cc615724b22195439f5afa5
Showing with 1 addition and 1 deletion.
  1. +1 −1 modules/gallery/models/item.php
@@ -498,7 +498,7 @@ private function _randomize_name_or_slug_on_conflict() {
$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)

0 comments on commit 85637a0

Please sign in to comment.