summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Bugzilla/Search/Saved.pm7
-rw-r--r--Bugzilla/Series.pm5
-rwxr-xr-xcontrib/convert-workflow.pl2
3 files changed, 12 insertions, 2 deletions
diff --git a/Bugzilla/Search/Saved.pm b/Bugzilla/Search/Saved.pm
index 32a24eae1..4b46fc75c 100644
--- a/Bugzilla/Search/Saved.pm
+++ b/Bugzilla/Search/Saved.pm
@@ -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);
}
diff --git a/Bugzilla/Series.pm b/Bugzilla/Series.pm
index 82735a34b..7168bcb7e 100644
--- a/Bugzilla/Series.pm
+++ b/Bugzilla/Series.pm
@@ -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;
diff --git a/contrib/convert-workflow.pl b/contrib/convert-workflow.pl
index 8a740fcb2..322857f5b 100755
--- a/contrib/convert-workflow.pl
+++ b/contrib/convert-workflow.pl
@@ -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();