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
This commit is contained in:
ericdane 2008-02-08 09:21:26 +00:00
parent 76ba36093f
commit e8e5209d51
2 changed files with 4 additions and 1 deletions

View File

@ -17,7 +17,8 @@ class Tag2TagService {
function addLinkedTags($tag1, $tag2, $relationType, $uId) { function addLinkedTags($tag1, $tag2, $relationType, $uId) {
if($tag1 == $tag2 || strlen($tag1) == 0 || strlen($tag2) == 0 if($tag1 == $tag2 || strlen($tag1) == 0 || strlen($tag2) == 0
|| ($relationType != ">" && $relationType != "=")) { || ($relationType != ">" && $relationType != "=")
|| ($this->existsLinkedTags($tag1, $tag2, $relationType, $uId))) {
return false; return false;
} }
$values = array('tag1' => $tag1, 'tag2' => $tag2, 'relationType'=> $relationType, 'uId'=> $uId); $values = array('tag1' => $tag1, 'tag2' => $tag2, 'relationType'=> $relationType, 'uId'=> $uId);

View File

@ -264,6 +264,8 @@ class Tag2TagTest extends PHPUnit_Framework_TestCase
$tts = $this->tts; $tts = $this->tts;
$bs = $this->bs; $bs = $this->bs;
$tts->addLinkedTags('aa', 'bb', '>', 1);
$tags = array('aa>bb>cc', 'dd'); $tags = array('aa>bb>cc', 'dd');
$bs->addBookmark("web1.com", "B1", "description", "status", $tags, null, false, false, 1); $bs->addBookmark("web1.com", "B1", "description", "status", $tags, null, false, false, 1);
$tags = array('bb>gg', 'ee>ff'); $tags = array('bb>gg', 'ee>ff');