]> git.ipfire.org Git - thirdparty/bugzilla.git/commitdiff
Bug 577089: Make convert-workflow fix the query values for series
authorMax Kanat-Alexander <mkanat@bugzilla.org>
Thu, 8 Jul 2010 00:17:26 +0000 (17:17 -0700)
committerMax Kanat-Alexander <mkanat@bugzilla.org>
Thu, 8 Jul 2010 00:17:26 +0000 (17:17 -0700)
r=LpSolit, a=LpSolit

Bugzilla/Search/Saved.pm
Bugzilla/Series.pm
contrib/convert-workflow.pl

index 32a24eae1dc8b154060f610bff989735ecebdfd6..4b46fc75ca1dd5ee7970b2bd839f08af98ba9799 100644 (file)
@@ -182,11 +182,14 @@ sub rename_field_value {
     my $old_sql = $old;
     $old_sql =~ s/([_\%])/\\$1/g;
 
+    my $table = $class->DB_TABLE;
+    my $id_field = $class->ID_FIELD;
+
     my $dbh = Bugzilla->dbh;
     $dbh->bz_start_transaction();
 
     my %queries = @{ $dbh->selectcol_arrayref(
-        "SELECT id, query FROM namedqueries WHERE query LIKE ?",
+        "SELECT $id_field, query FROM $table WHERE query LIKE ?",
         {Columns=>[1,2]}, "\%$old_sql\%") };
     foreach my $id (keys %queries) {
         my $query = $queries{$id};
@@ -198,7 +201,7 @@ sub rename_field_value {
             # boolean charts. Users will have to fix those themselves.
             $query =~ s/\bvalue\Q$chart_id\E=\Q$old\E\b/value$chart_id=$new/i;
         }
-        $dbh->do("UPDATE namedqueries SET query = ? WHERE id = ?",
+        $dbh->do("UPDATE $table SET query = ? WHERE $id_field = ?",
                  undef, $query, $id);
     }
 
index 82735a34bc5a853a2d91da0275eb341b0ef99815..7168bcb7e3610f4bd79076c181589f6445c404ba 100644 (file)
@@ -34,6 +34,11 @@ package Bugzilla::Series;
 use Bugzilla::Error;
 use Bugzilla::Util;
 
+# This is a hack so that we can re-use the rename_field_value
+# code from Bugzilla::Search::Saved.
+use constant DB_TABLE => 'series';
+use constant ID_FIELD => 'series_id';
+
 sub new {
     my $invocant = shift;
     my $class = ref($invocant) || $invocant;
index 8a740fcb256754561a32568dc5de0d9ddfd01e33..322857f5b023d041c71dea03fc2002c78711a6c4 100755 (executable)
@@ -102,6 +102,8 @@ foreach my $pair (@translation) {
     }
 
     Bugzilla::Search::Saved->rename_field_value('bug_status', $from, $to);
+    Bugzilla::Series->Bugzilla::Search::Saved::rename_field_value('bug_status',
+        $from, $to);
 }
 
 $dbh->bz_commit_transaction();