From ba4585ae8a1c63a49e40461d2e2efc12bc75c58a Mon Sep 17 00:00:00 2001 From: Max Kanat-Alexander Date: Mon, 5 Jul 2010 17:42:57 -0700 Subject: Bug 486292: Change the default workflow to UNCONFIRMED, CONFIRMED, IN_PROGRESS, RESOLVED, VERIFIED. r=LpSolit, a=mkanat --- Bugzilla/Bug.pm | 5 ++++- Bugzilla/Chart.pm | 2 +- Bugzilla/Config/Query.pm | 4 ++-- Bugzilla/DB.pm | 4 ++-- Bugzilla/DB/Schema.pm | 2 +- Bugzilla/Install.pm | 36 ++++++++++++++++++++++++++++++++++++ Bugzilla/Install/DB.pm | 12 +++++++++--- Bugzilla/Migrate.pm | 2 +- Bugzilla/Migrate/Gnats.pm | 4 ++-- Bugzilla/Search/Quicksearch.pm | 4 ++-- Bugzilla/Status.pm | 2 +- 11 files changed, 61 insertions(+), 16 deletions(-) (limited to 'Bugzilla') diff --git a/Bugzilla/Bug.pm b/Bugzilla/Bug.pm index 23a92b080..a0c15bafa 100644 --- a/Bugzilla/Bug.pm +++ b/Bugzilla/Bug.pm @@ -1323,7 +1323,10 @@ sub _check_bug_status { } - if (ref $invocant && $new_status->name eq 'ASSIGNED' + if (ref $invocant + && ($new_status->name eq 'IN_PROGRESS' + # Backwards-compat for the old default workflow. + or $new_status->name eq 'ASSIGNED') && Bugzilla->params->{"usetargetmilestone"} && Bugzilla->params->{"musthavemilestoneonaccept"} # musthavemilestoneonaccept applies only if at least two diff --git a/Bugzilla/Chart.pm b/Bugzilla/Chart.pm index 58089d29e..760db135d 100644 --- a/Bugzilla/Chart.pm +++ b/Bugzilla/Chart.pm @@ -67,7 +67,7 @@ sub init { # # The URL encoding is: # line0=67&line0=73&line1=81&line2=67... - # &label0=B+/+R+/+NEW&label1=... + # &label0=B+/+R+/+CONFIRMED&label1=... # &select0=1&select3=1... # &cumulate=1&datefrom=2002-02-03&dateto=2002-04-04&ctype=html... # >=1&labelgt=Grand+Total diff --git a/Bugzilla/Config/Query.pm b/Bugzilla/Config/Query.pm index 6d570e01a..821f09fc6 100644 --- a/Bugzilla/Config/Query.pm +++ b/Bugzilla/Config/Query.pm @@ -58,13 +58,13 @@ sub get_param_list { { name => 'mybugstemplate', type => 't', - default => 'buglist.cgi?bug_status=UNCONFIRMED&bug_status=NEW&bug_status=ASSIGNED&bug_status=REOPENED&emailassigned_to1=1&emailreporter1=1&emailtype1=exact&email1=%userid%&field0-0-0=bug_status&type0-0-0=notequals&value0-0-0=UNCONFIRMED&field0-0-1=reporter&type0-0-1=equals&value0-0-1=%userid%' + default => 'buglist.cgi?resolution=---&emailassigned_to1=1&emailreporter1=1&emailtype1=exact&email1=%userid%' }, { name => 'defaultquery', type => 't', - default => 'bug_status=NEW&bug_status=ASSIGNED&bug_status=REOPENED&emailassigned_to1=1&emailassigned_to2=1&emailreporter2=1&emailcc2=1&emailqa_contact2=1&emaillongdesc3=1&order=Importance&long_desc_type=substring' + default => 'resolution=---&emailassigned_to1=1&emailassigned_to2=1&emailreporter2=1&emailcc2=1&emailqa_contact2=1&emaillongdesc3=1&order=Importance&long_desc_type=substring' }, { diff --git a/Bugzilla/DB.pm b/Bugzilla/DB.pm index 8c1aba8dd..7173ff896 100644 --- a/Bugzilla/DB.pm +++ b/Bugzilla/DB.pm @@ -68,8 +68,8 @@ use constant ENUM_DEFAULTS => { priority => ["Highest", "High", "Normal", "Low", "Lowest", "---"], op_sys => ["All","Windows","Mac OS","Linux","Other"], rep_platform => ["All","PC","Macintosh","Other"], - bug_status => ["UNCONFIRMED","NEW","ASSIGNED","REOPENED","RESOLVED", - "VERIFIED","CLOSED"], + bug_status => ["UNCONFIRMED","CONFIRMED","IN_PROGRESS","RESOLVED", + "VERIFIED"], resolution => ["","FIXED","INVALID","WONTFIX", "DUPLICATE","WORKSFORME"], }; diff --git a/Bugzilla/DB/Schema.pm b/Bugzilla/DB/Schema.pm index 0791cad98..4837ccc5f 100644 --- a/Bugzilla/DB/Schema.pm +++ b/Bugzilla/DB/Schema.pm @@ -1223,7 +1223,7 @@ use constant ABSTRACT_SCHEMA => { defaultmilestone => {TYPE => 'varchar(20)', NOTNULL => 1, DEFAULT => "'---'"}, allows_unconfirmed => {TYPE => 'BOOLEAN', NOTNULL => 1, - DEFAULT => 'FALSE'}, + DEFAULT => 'TRUE'}, ], INDEXES => [ products_name_idx => {FIELDS => ['name'], diff --git a/Bugzilla/Install.pm b/Bugzilla/Install.pm index e90fe41db..3754c0787 100644 --- a/Bugzilla/Install.pm +++ b/Bugzilla/Install.pm @@ -37,6 +37,24 @@ use Bugzilla::User::Setting; use Bugzilla::Util qw(get_text); use Bugzilla::Version; +use constant STATUS_WORKFLOW => ( + [undef, 'UNCONFIRMED'], + [undef, 'CONFIRMED'], + [undef, 'IN_PROGRESS'], + ['UNCONFIRMED', 'CONFIRMED'], + ['UNCONFIRMED', 'IN_PROGRESS'], + ['UNCONFIRMED', 'RESOLVED'], + ['CONFIRMED', 'IN_PROGRESS'], + ['CONFIRMED', 'RESOLVED'], + ['IN_PROGRESS', 'CONFIRMED'], + ['IN_PROGRESS', 'RESOLVED'], + ['RESOLVED', 'CONFIRMED'], + ['RESOLVED', 'VERIFIED'], + ['VERIFIED', 'CONFIRMED'], + # The RESOLVED/VERIFIED to UNCONFIRMED transition is enabled specially + # in the code for bugs that haven't been confirmed. +); + sub SETTINGS { return { # 2005-03-03 travis@sedsystems.ca -- Bug 41972 @@ -232,6 +250,24 @@ sub create_default_product { } +sub init_workflow { + my $dbh = Bugzilla->dbh; + my $has_workflow = $dbh->selectrow_array('SELECT 1 FROM status_workflow'); + return if $has_workflow; + + print get_text('install_workflow_init'), "\n"; + + my %status_ids = @{ $dbh->selectcol_arrayref( + 'SELECT value, id FROM bug_status', {Columns=>[1,2]}) }; + + foreach my $pair (STATUS_WORKFLOW) { + my $old_id = $pair->[0] ? $status_ids{$pair->[0]} : undef; + my $new_id = $status_ids{$pair->[1]}; + $dbh->do('INSERT INTO status_workflow (old_status, new_status) + VALUES (?,?)', undef, $old_id, $new_id); + } +} + sub create_admin { my ($params) = @_; my $dbh = Bugzilla->dbh; diff --git a/Bugzilla/Install/DB.pm b/Bugzilla/Install/DB.pm index 069096800..47e881e8f 100644 --- a/Bugzilla/Install/DB.pm +++ b/Bugzilla/Install/DB.pm @@ -530,7 +530,7 @@ sub update_table_definitions { _fix_uppercase_index_names(); # 2007-05-17 LpSolit@gmail.com - Bug 344965 - _initialize_workflow($old_params); + _initialize_workflow_for_upgrade($old_params); # 2007-08-08 LpSolit@gmail.com - Bug 332149 $dbh->bz_add_column('groups', 'icon_url', {TYPE => 'TINYTEXT'}); @@ -2919,10 +2919,12 @@ sub _fix_uppercase_index_names { } } -sub _initialize_workflow { +sub _initialize_workflow_for_upgrade { my $old_params = shift; my $dbh = Bugzilla->dbh; + my $had_is_open = $dbh->bz_column_info('bug_status', 'is_open'); + $dbh->bz_add_column('bug_status', 'is_open', {TYPE => 'BOOLEAN', NOTNULL => 1, DEFAULT => 'TRUE'}); @@ -2955,6 +2957,10 @@ sub _initialize_workflow { join(', ', @closed_statuses) . ')'); } + # We only populate the workflow here if we're upgrading from a version + # before 3.2. + return if $had_is_open; + # Populate the status_workflow table. We do nothing if the table already # has entries. If all bug status transitions have been deleted, the # workflow will be restored to its default schema. @@ -2974,7 +2980,7 @@ sub _initialize_workflow { # confirmed bugs, so we use this parameter here. my $reassign = $old_params->{'commentonreassign'} || 0; - # This is the default workflow. + # This is the default workflow for upgrading installations. my @workflow = ([undef, 'UNCONFIRMED', $create], [undef, 'NEW', $create], [undef, 'ASSIGNED', $create], diff --git a/Bugzilla/Migrate.pm b/Bugzilla/Migrate.pm index 2ae638e4f..e72c5c52e 100644 --- a/Bugzilla/Migrate.pm +++ b/Bugzilla/Migrate.pm @@ -90,7 +90,7 @@ END # bug_status => { # # Translate "Handled" into "RESOLVED". # "Handled" => "RESOLVED", -# "In Progress" => "ASSIGNED", +# "In Progress" => "IN_PROGRESS", # }, # # priority => { diff --git a/Bugzilla/Migrate/Gnats.pm b/Bugzilla/Migrate/Gnats.pm index ff24f73b5..db628b7d5 100644 --- a/Bugzilla/Migrate/Gnats.pm +++ b/Bugzilla/Migrate/Gnats.pm @@ -67,8 +67,8 @@ use constant VALUE_MAP => { 'non-critical' => 'normal', }, bug_status => { - 'open' => 'NEW', - 'analyzed' => 'ASSIGNED', + 'open' => 'CONFIRMED', + 'analyzed' => 'IN_PROGRESS', 'suspended' => 'RESOLVED', 'feedback' => 'RESOLVED', 'released' => 'VERIFIED', diff --git a/Bugzilla/Search/Quicksearch.pm b/Bugzilla/Search/Quicksearch.pm index 7839c4fd5..1a2877674 100644 --- a/Bugzilla/Search/Quicksearch.pm +++ b/Bugzilla/Search/Quicksearch.pm @@ -273,8 +273,8 @@ sub _handle_status_and_resolution { elsif ($words->[0] eq 'OPEN') { shift @$words; } - elsif ($words->[0] =~ /^[A-Z]+(,[A-Z]+)*$/) { - # e.g. NEW,ASSI,REOP,FIX + elsif ($words->[0] =~ /^[A-Z_]+(,[_A-Z]+)*$/) { + # e.g. CON,IN_PR,FIX undef %states; if (matchPrefixes(\%states, \%resolutions, diff --git a/Bugzilla/Status.pm b/Bugzilla/Status.pm index 0dd17ae39..ffef600de 100644 --- a/Bugzilla/Status.pm +++ b/Bugzilla/Status.pm @@ -241,7 +241,7 @@ Bugzilla::Status - Bug status class. use Bugzilla::Status; - my $bug_status = new Bugzilla::Status({name => 'ASSIGNED'}); + my $bug_status = new Bugzilla::Status({ name => 'IN_PROGRESS' }); my $bug_status = new Bugzilla::Status(4); my @closed_bug_statuses = closed_bug_statuses(); -- cgit v1.2.3-24-g4f1b