From 572c1ca89bbedbf8e1126c98ae0e4a64591a1df0 Mon Sep 17 00:00:00 2001 From: Banana Date: Wed, 15 Jun 2011 10:10:21 +0200 Subject: [PATCH] tag rename from web to Web was not working --- BUGS | 1 - ChangeLog | 1 + lib/Insipid/Tags.pm | 15 ++++++++------- 3 files changed, 9 insertions(+), 8 deletions(-) diff --git a/BUGS b/BUGS index 4cd1f6c..c64d471 100644 --- a/BUGS +++ b/BUGS @@ -1,7 +1,6 @@ === Open Bugs === * Add form shown although not logged in -* Tag Rename case sensitiv * Case-sensitivity in SELECT statements with Postgres really do a number on the tag algorithms * Tag operations (op=tags) or not working yet. diff --git a/ChangeLog b/ChangeLog index c0dbc24..8184762 100755 --- a/ChangeLog +++ b/ChangeLog @@ -1,6 +1,7 @@ 06.2011 CEST jumpin.banana * tag suggest was not working correctly. * tag rename feature implemented + * tag rename case sensitiv problem Tue Jul 14 21:38 EST 2009 Luke Reeve diff --git a/lib/Insipid/Tags.pm b/lib/Insipid/Tags.pm index 418a992..995b880 100755 --- a/lib/Insipid/Tags.pm +++ b/lib/Insipid/Tags.pm @@ -56,18 +56,19 @@ sub tag_operations { my $newTag = param('newName'); my $oldTagName = param('rename'); my $oldTagId = get_tag_id_by_name($oldTagName); + print Dumper "oldtagid: ".$oldTagId; # is the new name already a tag ? # if check then check is the new tagId my $check = get_tag_id_by_name($newTag); - if($check) { + print Dumper "newtagid: ".$check; + if($check && ($check != $oldTagId)) { my $sql = "SELECT bookmark_id, tag_id FROM `$tbl_bookmark_tags` WHERE tag_id = ?"; my $sth = $dbh->prepare($sql); $sth->execute($oldTagId); while(my ($bid, $tid) = $sth->fetchrow_array) { - #print Dumper $bid; my $sql1 = "DELETE FROM `$tbl_bookmark_tags` WHERE bookmark_id = ? AND tag_id = ?"; @@ -89,9 +90,9 @@ sub tag_operations { } else { # just rename the tag - my $sql = "UPDATE $tbl_tags SET name = ? WHERE name = ?"; + my $sql = "UPDATE $tbl_tags SET name = ? WHERE id = ?"; my $sth = $dbh->prepare($sql); - $sth->execute($oldTagId); + $sth->execute($newTag,$oldTagId); } print 'Done !'; @@ -278,9 +279,9 @@ sub set_tags { # or create a new tag if ($tagcount < 1) { - my $sql = "insert into $tbl_tags (name) values(?)"; - my $sth = $dbh->prepare($sql); - $sth->execute($cur); + my $sql = "insert into $tbl_tags (name) values(?)"; + my $sth = $dbh->prepare($sql); + $sth->execute($cur); } # and fetch the tag ID -- 2.39.5