]> 91.132.146.200 Git - insipid.git/commitdiff
tag rename from web to Web was not working
authorBanana <banana@starscream.de>
Wed, 15 Jun 2011 08:10:21 +0000 (10:10 +0200)
committerBanana <banana@starscream.de>
Wed, 15 Jun 2011 08:10:21 +0000 (10:10 +0200)
BUGS
ChangeLog
lib/Insipid/Tags.pm

diff --git a/BUGS b/BUGS
index 4cd1f6c6dcf1d25c2882788fe589004394d728d3..c64d47191b26376a109ea0b7bd89656fe6ea993d 100644 (file)
--- 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.
index c0dbc2411f36add0a29ca0b7219a2758efd95d68..8184762f4001555a508db2756b8325bf0fa279d1 100755 (executable)
--- 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   <luke@neuro-tech.net>
 
index 418a9924d2790585bfd9a517aa4ff3c0f166e9be..995b8807c4fd30ca089910bbc8adc01eb6b422b6 100755 (executable)
@@ -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 '<span style="color: green;">Done !</span>';
@@ -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