summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBharat Mediratta <bharat@menalto.com>2010-01-18 13:09:58 -0800
committerBharat Mediratta <bharat@menalto.com>2010-01-18 13:09:58 -0800
commit1cfee16e38b483d97dddc723b383f5c8cef0f229 (patch)
treeaab22fe526cd8bd43995d296eb86e1671ebf9547
parentf492436317a61aa8387d1fb2232f8e5255ed5d3c (diff)
In valid_name, don't query on the id if it's null.
-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 fcd9b8e6..e04b1314 100644
--- a/modules/gallery/models/item.php
+++ b/modules/gallery/models/item.php
@@ -839,8 +839,8 @@ class Item_Model extends ORM_MPTT {
if (db::build()
->from("items")
->where("parent_id", "=", $this->parent_id)
- ->where("id", "<>", $this->id)
->where("name", "=", $this->name)
+ ->merge_where($this->id ? array(array("id", "<>", $this->id)) : null)
->count_records()) {
$v->add_error("name", "conflict");
}