Minor fix: normalize tags when renaming them
git-svn-id: https://semanticscuttle.svn.sourceforge.net/svnroot/semanticscuttle/trunk@185 b3834d28-1941-0410-a4f8-b48e95affb8f
This commit is contained in:
parent
17e2e700ad
commit
280d90cfef
3 changed files with 8 additions and 0 deletions
|
@ -369,6 +369,7 @@ class Bookmark2TagService {
|
||||||
|
|
||||||
function renameTag($userid, $old, $new, $fromApi = false) {
|
function renameTag($userid, $old, $new, $fromApi = false) {
|
||||||
$bookmarkservice =& ServiceFactory::getServiceInstance('BookmarkService');
|
$bookmarkservice =& ServiceFactory::getServiceInstance('BookmarkService');
|
||||||
|
$tagservice =& ServiceFactory::getServiceInstance('TagService');
|
||||||
|
|
||||||
if (is_null($userid) || is_null($old) || is_null($new))
|
if (is_null($userid) || is_null($old) || is_null($new))
|
||||||
return false;
|
return false;
|
||||||
|
@ -381,6 +382,8 @@ class Bookmark2TagService {
|
||||||
$this->deleteTag($userid, $old);
|
$this->deleteTag($userid, $old);
|
||||||
|
|
||||||
// Attach new tags
|
// Attach new tags
|
||||||
|
$new = $tagservice->normalize($new);
|
||||||
|
|
||||||
foreach(array_keys($bookmarks) as $key) {
|
foreach(array_keys($bookmarks) as $key) {
|
||||||
$row =& $bookmarks[$key];
|
$row =& $bookmarks[$key];
|
||||||
$this->attachTags($row['bId'], $new, $fromApi, NULL, false);
|
$this->attachTags($row['bId'], $new, $fromApi, NULL, false);
|
||||||
|
|
|
@ -270,6 +270,9 @@ class Tag2TagService {
|
||||||
}
|
}
|
||||||
|
|
||||||
function renameTag($uId, $oldName, $newName) {
|
function renameTag($uId, $oldName, $newName) {
|
||||||
|
$tagservice =& ServiceFactory::getServiceInstance('TagService');
|
||||||
|
$newName = $tagservice->normalize($newName);
|
||||||
|
|
||||||
$query = 'UPDATE `'. $this->getTableName() .'`';
|
$query = 'UPDATE `'. $this->getTableName() .'`';
|
||||||
$query.= ' SET tag1="'.$newName.'"';
|
$query.= ' SET tag1="'.$newName.'"';
|
||||||
$query.= ' WHERE tag1="'.$oldName.'"';
|
$query.= ' WHERE tag1="'.$oldName.'"';
|
||||||
|
|
|
@ -68,6 +68,8 @@ class TagService {
|
||||||
}
|
}
|
||||||
|
|
||||||
function renameTag($uId, $oldName, $newName) {
|
function renameTag($uId, $oldName, $newName) {
|
||||||
|
$newname = $this->normalize($newname);
|
||||||
|
|
||||||
$query = 'UPDATE `'. $this->getTableName() .'`';
|
$query = 'UPDATE `'. $this->getTableName() .'`';
|
||||||
$query.= ' SET tag="'.$newName.'"';
|
$query.= ' SET tag="'.$newName.'"';
|
||||||
$query.= ' WHERE tag="'.$oldName.'"';
|
$query.= ' WHERE tag="'.$oldName.'"';
|
||||||
|
|
Loading…
Reference in a new issue