summaryrefslogtreecommitdiff
path: root/modules/tag
diff options
context:
space:
mode:
authorChad Parry <github@chad.parry.org>2011-04-27 20:35:58 -0600
committerChad Parry <github@chad.parry.org>2011-04-27 20:35:58 -0600
commit6d564f185e5279d6cca9a7385066514ff18a2455 (patch)
tree40d7ebab63894412b57aeb4a7ce660b0c255ac00 /modules/tag
parent7ff485fa48c392bbbb0370f67cb1bd6fcc00c2a4 (diff)
parent406064087662184ec7f85297b9cdf83a77976616 (diff)
Merge branch 'master' of https://github.com/gallery/gallery3 into rawphoto
Diffstat (limited to 'modules/tag')
-rw-r--r--modules/tag/controllers/admin_tags.php1
-rw-r--r--modules/tag/models/tag.php9
2 files changed, 6 insertions, 4 deletions
diff --git a/modules/tag/controllers/admin_tags.php b/modules/tag/controllers/admin_tags.php
index 7a64f7ab..77b5f20a 100644
--- a/modules/tag/controllers/admin_tags.php
+++ b/modules/tag/controllers/admin_tags.php
@@ -87,7 +87,6 @@ class Admin_Tags_Controller extends Admin_Controller {
$old_name = $tag->name;
$new_name_or_list = $in_place_edit->value();
$tag_list = explode(",", $new_name_or_list);
- $tag_count = count($tag_list);
$tag->name = array_shift($tag_list);
$tag->save();
diff --git a/modules/tag/models/tag.php b/modules/tag/models/tag.php
index 13e253ba..bb79e707 100644
--- a/modules/tag/models/tag.php
+++ b/modules/tag/models/tag.php
@@ -75,8 +75,12 @@ class Tag_Model_Core extends ORM {
->where("id", "!=", $this->id)
->find();
if ($duplicate_tag->loaded()) {
- // If so, tag its items with this tag so as to merge it.
- foreach ($duplicate_tag->items() as $item) {
+ // If so, tag its items with this tag so as to merge it
+ $duplicate_tag_items = ORM::factory("item")
+ ->join("items_tags", "items.id", "items_tags.item_id")
+ ->where("items_tags.tag_id", "=", $duplicate_tag->id)
+ ->find_all();
+ foreach ($duplicate_tag_items as $item) {
$this->add($item);
}
@@ -84,7 +88,6 @@ class Tag_Model_Core extends ORM {
$duplicate_tag->delete();
}
- // Figure out what items have changed in this tag for our item_related_update event below
if (isset($this->object_relations["items"])) {
$added = array_diff($this->changed_relations["items"], $this->object_relations["items"]);
$removed = array_diff($this->object_relations["items"], $this->changed_relations["items"]);