From e8e5209d51b999f0672e53b368da9046b0a219b9 Mon Sep 17 00:00:00 2001 From: ericdane Date: Fri, 8 Feb 2008 09:21:26 +0000 Subject: [PATCH] bug fix: bug when inserting a relation already into the base git-svn-id: https://semanticscuttle.svn.sourceforge.net/svnroot/semanticscuttle/trunk@35 b3834d28-1941-0410-a4f8-b48e95affb8f --- services/tag2tagservice.php | 3 ++- tests/tag2TagTest.php | 2 ++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/services/tag2tagservice.php b/services/tag2tagservice.php index 1c6392e..d3a4a77 100644 --- a/services/tag2tagservice.php +++ b/services/tag2tagservice.php @@ -17,7 +17,8 @@ class Tag2TagService { function addLinkedTags($tag1, $tag2, $relationType, $uId) { if($tag1 == $tag2 || strlen($tag1) == 0 || strlen($tag2) == 0 - || ($relationType != ">" && $relationType != "=")) { + || ($relationType != ">" && $relationType != "=") + || ($this->existsLinkedTags($tag1, $tag2, $relationType, $uId))) { return false; } $values = array('tag1' => $tag1, 'tag2' => $tag2, 'relationType'=> $relationType, 'uId'=> $uId); diff --git a/tests/tag2TagTest.php b/tests/tag2TagTest.php index f54537c..87dde52 100644 --- a/tests/tag2TagTest.php +++ b/tests/tag2TagTest.php @@ -264,6 +264,8 @@ class Tag2TagTest extends PHPUnit_Framework_TestCase $tts = $this->tts; $bs = $this->bs; + $tts->addLinkedTags('aa', 'bb', '>', 1); + $tags = array('aa>bb>cc', 'dd'); $bs->addBookmark("web1.com", "B1", "description", "status", $tags, null, false, false, 1); $tags = array('bb>gg', 'ee>ff');