summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Bugzilla/Bug.pm12
-rw-r--r--Bugzilla/Comment.pm3
-rw-r--r--Bugzilla/Constants.pm3
-rw-r--r--Bugzilla/DB.pm3
-rw-r--r--Bugzilla/Field/ChoiceInterface.pm2
-rw-r--r--Bugzilla/User.pm11
-rw-r--r--extensions/OldBugMove/Config.pm25
-rw-r--r--extensions/OldBugMove/Extension.pm214
-rw-r--r--extensions/OldBugMove/disabled0
-rw-r--r--extensions/OldBugMove/lib/Params.pm (renamed from Bugzilla/Config/BugMove.pm)39
-rw-r--r--extensions/OldBugMove/template/en/default/admin/params/oldbugmove.html.tmpl40
-rw-r--r--extensions/OldBugMove/template/en/default/hook/bug/edit-after_comment_textarea.html.tmpl27
-rw-r--r--extensions/OldBugMove/template/en/default/hook/bug/format_comment-type.txt.tmpl29
-rw-r--r--extensions/OldBugMove/template/en/default/hook/global/user-error-auth_failure_action.html.tmpl23
-rw-r--r--extensions/OldBugMove/template/en/default/hook/global/user-error-errors.html.tmpl29
-rwxr-xr-ximportxml.pl132
-rwxr-xr-xprocess_bug.cgi66
-rw-r--r--template/en/default/admin/params/bugmove.html.tmpl49
-rw-r--r--template/en/default/bug/edit.html.tmpl3
-rw-r--r--template/en/default/bug/format_comment.txt.tmpl8
-rw-r--r--template/en/default/global/code-error.html.tmpl4
-rw-r--r--template/en/default/global/field-descs.none.tmpl4
-rw-r--r--template/en/default/global/user-error.html.tmpl9
-rw-r--r--template/en/default/list/edit-multiple.html.tmpl4
-rw-r--r--template/en/default/pages/fields.html.tmpl12
25 files changed, 456 insertions, 295 deletions
diff --git a/Bugzilla/Bug.pm b/Bugzilla/Bug.pm
index 3fb1dcf98..6df7363d5 100644
--- a/Bugzilla/Bug.pm
+++ b/Bugzilla/Bug.pm
@@ -2410,10 +2410,6 @@ sub set_resolution {
my $new_res = $self->resolution;
if ($new_res ne $old_res) {
- # MOVED has a special meaning and can only be used when
- # really moving bugs to another installation.
- ThrowCodeError('no_manual_moved') if ($new_res eq 'MOVED' && !$params->{moving});
-
# Clear the dup_id if we're leaving the dup resolution.
if ($old_res eq 'DUPLICATE') {
$self->_clear_dup_id();
@@ -3278,7 +3274,6 @@ sub user {
return {} if $self->{'error'};
my $user = Bugzilla->user;
- my $canmove = Bugzilla->params->{'move-enabled'} && $user->is_mover;
my $prod_id = $self->{'product_id'};
@@ -3293,8 +3288,7 @@ sub user {
my $isreporter = $user->id
&& $user->id == $self->{reporter_id};
- $self->{'user'} = {canmove => $canmove,
- canconfirm => $canconfirm,
+ $self->{'user'} = {canconfirm => $canconfirm,
canedit => $canedit,
isreporter => $isreporter};
return $self->{'user'};
@@ -3326,10 +3320,6 @@ sub choices {
my $resolution_field = new Bugzilla::Field({ name => 'resolution' });
# Don't include the empty resolution in drop-downs.
my @resolutions = grep($_->name, @{ $resolution_field->legal_values });
- # And don't include MOVED in the list unless the bug is already MOVED.
- if ($self->resolution ne 'MOVED') {
- @resolutions= grep { $_->name ne 'MOVED' } @resolutions;
- }
$choices{'resolution'} = \@resolutions;
$self->{'choices'} = \%choices;
diff --git a/Bugzilla/Comment.pm b/Bugzilla/Comment.pm
index be10329d9..074f28dd6 100644
--- a/Bugzilla/Comment.pm
+++ b/Bugzilla/Comment.pm
@@ -179,9 +179,6 @@ sub _check_extra_data {
if (!defined $extra_data) {
ThrowCodeError('comment_extra_data_required', { type => $type });
}
- if ($type == CMT_MOVED_TO) {
- $extra_data = Bugzilla::User->check($extra_data)->login;
- }
elsif ($type == CMT_ATTACHMENT_CREATED
or $type == CMT_ATTACHMENT_UPDATED)
{
diff --git a/Bugzilla/Constants.pm b/Bugzilla/Constants.pm
index d4e8782c6..55ef4a0e3 100644
--- a/Bugzilla/Constants.pm
+++ b/Bugzilla/Constants.pm
@@ -92,7 +92,6 @@ use File::Basename;
CMT_NORMAL
CMT_DUPE_OF
CMT_HAS_DUPE
- CMT_MOVED_TO
CMT_ATTACHMENT_CREATED
CMT_ATTACHMENT_UPDATED
@@ -299,7 +298,7 @@ use constant CMT_NORMAL => 0;
use constant CMT_DUPE_OF => 1;
use constant CMT_HAS_DUPE => 2;
# Type 3 was CMT_POPULAR_VOTES, which moved to the Voting extension.
-use constant CMT_MOVED_TO => 4;
+# Type 4 was CMT_MOVED_TO, which moved to the OldBugMove extension.
use constant CMT_ATTACHMENT_CREATED => 5;
use constant CMT_ATTACHMENT_UPDATED => 6;
diff --git a/Bugzilla/DB.pm b/Bugzilla/DB.pm
index 79a5639dd..8b8d74c90 100644
--- a/Bugzilla/DB.pm
+++ b/Bugzilla/DB.pm
@@ -70,8 +70,7 @@ use constant ENUM_DEFAULTS => {
rep_platform => ["All","PC","Macintosh","Other"],
bug_status => ["UNCONFIRMED","NEW","ASSIGNED","REOPENED","RESOLVED",
"VERIFIED","CLOSED"],
- resolution => ["","FIXED","INVALID","WONTFIX", "DUPLICATE","WORKSFORME",
- "MOVED"],
+ resolution => ["","FIXED","INVALID","WONTFIX", "DUPLICATE","WORKSFORME"],
};
#####################################################################
diff --git a/Bugzilla/Field/ChoiceInterface.pm b/Bugzilla/Field/ChoiceInterface.pm
index 5b796270b..a718377c2 100644
--- a/Bugzilla/Field/ChoiceInterface.pm
+++ b/Bugzilla/Field/ChoiceInterface.pm
@@ -99,7 +99,7 @@ sub is_static {
# If we need to special-case Resolution for *anything* else, it should
# get its own subclass.
if ($self->field->name eq 'resolution') {
- return grep($_ eq $self->name, ('', 'FIXED', 'MOVED', 'DUPLICATE'))
+ return grep($_ eq $self->name, ('', 'FIXED', 'DUPLICATE'))
? 1 : 0;
}
elsif ($self->field->custom) {
diff --git a/Bugzilla/User.pm b/Bugzilla/User.pm
index 815b435fd..aa01d93a5 100644
--- a/Bugzilla/User.pm
+++ b/Bugzilla/User.pm
@@ -1639,17 +1639,6 @@ sub mail_settings {
return $self->{'mail_settings'};
}
-sub is_mover {
- my $self = shift;
-
- if (!defined $self->{'is_mover'}) {
- my @movers = map { trim($_) } split(',', Bugzilla->params->{'movers'});
- $self->{'is_mover'} = ($self->id
- && grep { $_ eq $self->login } @movers);
- }
- return $self->{'is_mover'};
-}
-
sub is_insider {
my $self = shift;
diff --git a/extensions/OldBugMove/Config.pm b/extensions/OldBugMove/Config.pm
new file mode 100644
index 000000000..e40126046
--- /dev/null
+++ b/extensions/OldBugMove/Config.pm
@@ -0,0 +1,25 @@
+# -*- Mode: perl; indent-tabs-mode: nil -*-
+#
+# The contents of this file are subject to the Mozilla Public
+# License Version 1.1 (the "License"); you may not use this file
+# except in compliance with the License. You may obtain a copy of
+# the License at http://www.mozilla.org/MPL/
+#
+# Software distributed under the License is distributed on an "AS
+# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+# implied. See the License for the specific language governing
+# rights and limitations under the License.
+#
+# The Original Code is the OldBugMove Bugzilla Extension.
+#
+# The Initial Developer of the Original Code is Everything Solved, Inc.
+# Portions created by the Initial Developer is Copyright (C) 2010 the
+# Initial Developer. All Rights Reserved.
+#
+# Contributor(s):
+# Max Kanat-Alexander <mkanat@bugzilla.org>
+
+package Bugzilla::Extension::OldBugMove;
+use strict;
+use constant NAME => 'OldBugMove';
+__PACKAGE__->NAME;
diff --git a/extensions/OldBugMove/Extension.pm b/extensions/OldBugMove/Extension.pm
new file mode 100644
index 000000000..c6b5659b0
--- /dev/null
+++ b/extensions/OldBugMove/Extension.pm
@@ -0,0 +1,214 @@
+# -*- Mode: perl; indent-tabs-mode: nil -*-
+#
+# The contents of this file are subject to the Mozilla Public
+# License Version 1.1 (the "License"); you may not use this file
+# except in compliance with the License. You may obtain a copy of
+# the License at http://www.mozilla.org/MPL/
+#
+# Software distributed under the License is distributed on an "AS
+# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+# implied. See the License for the specific language governing
+# rights and limitations under the License.
+#
+# The Original Code is the OldBugMove Bugzilla Extension.
+#
+# The Initial Developer of the Original Code is Everything Solved, Inc.
+# Portions created by the Initial Developer are Copyright (C) 2010 the
+# Initial Developer. All Rights Reserved.
+#
+# Contributor(s):
+# Max Kanat-Alexander <mkanat@bugzilla.org>
+
+package Bugzilla::Extension::OldBugMove;
+use strict;
+use base qw(Bugzilla::Extension);
+use Bugzilla::Constants;
+use Bugzilla::Error;
+use Bugzilla::Field::Choice;
+use Bugzilla::Mailer;
+use Bugzilla::User;
+use Bugzilla::Util qw(trim);
+
+use Scalar::Util qw(blessed);
+use Storable qw(dclone);
+
+# This is 4 because that's what it originally was when this code was
+# a part of Bugzilla.
+use constant CMT_MOVED_TO => 4;
+
+our $VERSION = BUGZILLA_VERSION;
+
+sub install_update_db {
+ my $reso_type = Bugzilla::Field::Choice->type('resolution');
+ my $moved_reso = $reso_type->new({ name => 'MOVED' });
+ # We make the MOVED resolution inactive, so that it doesn't show up
+ # as a valid drop-down option.
+ if ($moved_reso) {
+ $moved_reso->set_is_active(0);
+ $moved_reso->update();
+ }
+ else {
+ print "Creating the MOVED resolution...\n";
+ $reso_type->create(
+ { value => 'MOVED', sortkey => '30000', isactive => 0 });
+ }
+}
+
+sub config_add_panels {
+ my ($self, $args) = @_;
+ my $modules = $args->{'panel_modules'};
+ $modules->{'OldBugMove'} = 'Bugzilla::Extension::OldBugMove::Params';
+}
+
+sub template_before_create {
+ my ($self, $args) = @_;
+ my $config = $args->{config};
+
+ my $constants = $config->{CONSTANTS};
+ $constants->{CMT_MOVED_TO} = CMT_MOVED_TO;
+
+ my $vars = $config->{VARIABLES};
+ $vars->{oldbugmove_user_is_mover} = \&_user_is_mover;
+}
+
+sub object_before_delete {
+ my ($self, $args) = @_;
+ my $object = $args->{'object'};
+ if ($object->isa('Bugzilla::Field::Choice::resolution')) {
+ if ($object->name eq 'MOVED') {
+ ThrowUserError('oldbugmove_no_delete_moved');
+ }
+ }
+}
+
+sub object_before_set {
+ my ($self, $args) = @_;
+ my ($object, $field) = @$args{qw(object field)};
+ if ($field eq 'resolution' and $object->isa('Bugzilla::Bug')) {
+ # Store the old value so that end_of_set can check it.
+ $object->{'_oldbugmove_old_resolution'} = $object->resolution;
+ }
+}
+
+sub object_end_of_set {
+ my ($self, $args) = @_;
+ my ($object, $field) = @$args{qw(object field)};
+ if ($field eq 'resolution' and $object->isa('Bugzilla::Bug')) {
+ my $old_value = delete $object->{'_oldbugmove_old_resolution'};
+ return if $old_value eq $object->resolution;
+ if ($object->resolution eq 'MOVED') {
+ $object->add_comment('', { type => CMT_MOVED_TO,
+ extra_data => Bugzilla->user->login });
+ }
+ }
+}
+
+sub object_end_of_set_all {
+ my ($self, $args) = @_;
+ my $object = $args->{'object'};
+
+ if ($object->isa('Bugzilla::Bug') and _bug_is_moving($object)) {
+ my $new_status = Bugzilla->params->{'duplicate_or_move_bug_status'};
+ $object->set_bug_status($new_status, { resolution => 'MOVED' });
+ }
+}
+
+sub object_validators {
+ my ($self, $args) = @_;
+ my ($class, $validators) = @$args{qw(class validators)};
+ if ($class->isa('Bugzilla::Comment')) {
+ my $extra_data_validator = $validators->{extra_data};
+ $validators->{extra_data} =
+ sub { _check_comment_extra_data($extra_data_validator, @_) };
+ }
+ elsif ($class->isa('Bugzilla::Bug')) {
+ my $reso_validator = $validators->{resolution};
+ $validators->{resolution} =
+ sub { _check_bug_resolution($reso_validator, @_) };
+ }
+}
+
+sub _check_bug_resolution {
+ my $original_validator = shift;
+ my ($invocant, $resolution) = @_;
+
+ if ($resolution eq 'MOVED' and !_bug_is_moving($invocant)) {
+ # MOVED has a special meaning and can only be used when
+ # really moving bugs to another installation.
+ ThrowUserError('oldbugmove_no_manual_move');
+ }
+
+ return $original_validator->(@_);
+}
+
+sub _check_comment_extra_data {
+ my $original_validator = shift;
+ my ($invocant, $extra_data, undef, $params) = @_;
+ my $type = blessed($invocant) ? $invocant->type : $params->{type};
+
+ if ($type == CMT_MOVED_TO) {
+ return Bugzilla::User->check($extra_data)->login;
+ }
+ return $original_validator->(@_);
+}
+
+sub bug_end_of_update {
+ my ($self, $args) = @_;
+ my ($bug, $old_bug, $changes) = @$args{qw(bug old_bug changes)};
+ if (defined $changes->{'resolution'}
+ and $changes->{'resolution'}->[1] eq 'MOVED')
+ {
+ $self->_move_bug($bug, $old_bug);
+ }
+}
+
+sub _move_bug {
+ my ($self, $bug, $old_bug) = @_;
+
+ my $dbh = Bugzilla->dbh;
+ my $template = Bugzilla->template;
+
+ _user_is_mover(Bugzilla->user)
+ or ThrowUserError("auth_failure", { action => 'move',
+ object => 'bugs' });
+
+ # Don't export the new status and resolution. We want the current
+ # ones.
+ local $Storable::forgive_me = 1;
+ my $export_me = dclone($bug);
+ $export_me->{bug_status} = $old_bug->bug_status;
+ delete $export_me->{status};
+ $export_me->{resolution} = $old_bug->resolution;
+
+ # Prepare and send all data about these bugs to the new database
+ my $to = Bugzilla->params->{'move-to-address'};
+ $to =~ s/@/\@/;
+ my $from = Bugzilla->params->{'mailfrom'};
+ $from =~ s/@/\@/;
+ my $msg = "To: $to\n";
+ $msg .= "From: Bugzilla <" . $from . ">\n";
+ $msg .= "Subject: Moving bug " . $bug->id . "\n\n";
+ my @fieldlist = (Bugzilla::Bug->fields, 'group', 'long_desc',
+ 'attachment', 'attachmentdata');
+ my %displayfields = map { $_ => 1 } @fieldlist;
+ my $vars = { bugs => [$export_me], displayfields => \%displayfields };
+ $template->process("bug/show.xml.tmpl", $vars, \$msg)
+ || ThrowTemplateError($template->error());
+ $msg .= "\n";
+ MessageToMTA($msg);
+}
+
+sub _bug_is_moving {
+ my $bug = shift;
+ my $oldbugmove = Bugzilla->input_params->{"oldbugmove_" . $bug->id};
+ return $oldbugmove ? 1 : 0;
+}
+
+sub _user_is_mover {
+ my $user = shift;
+
+ my @movers = map { trim($_) } split(',', Bugzilla->params->{'movers'});
+ return ($user->id and grep($_ eq $user->login, @movers)) ? 1 : 0;
+}
+
+__PACKAGE__->NAME;
diff --git a/extensions/OldBugMove/disabled b/extensions/OldBugMove/disabled
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/extensions/OldBugMove/disabled
diff --git a/Bugzilla/Config/BugMove.pm b/extensions/OldBugMove/lib/Params.pm
index 2d973d8ca..a8617e347 100644
--- a/Bugzilla/Config/BugMove.pm
+++ b/extensions/OldBugMove/lib/Params.pm
@@ -29,7 +29,7 @@
# Frédéric Buclin <LpSolit@gmail.com>
#
-package Bugzilla::Config::BugMove;
+package Bugzilla::Extension::OldBugMove::Params;
use strict;
@@ -37,21 +37,7 @@ use Bugzilla::Config::Common;
our $sortkey = 700;
-sub get_param_list {
- my $class = shift;
- my @param_list = (
- {
- name => 'move-enabled',
- type => 'b',
- default => 0
- },
-
- {
- name => 'move-button-text',
- type => 't',
- default => 'Move To Bugscape'
- },
-
+use constant get_param_list => (
{
name => 'move-to-url',
type => 't',
@@ -65,29 +51,10 @@ sub get_param_list {
},
{
- name => 'moved-from-address',
- type => 't',
- default => 'bugzilla-admin'
- },
-
- {
name => 'movers',
type => 't',
default => ''
},
-
- {
- name => 'moved-default-product',
- type => 't',
- default => ''
- },
-
- {
- name => 'moved-default-component',
- type => 't',
- default => ''
- } );
- return @param_list;
-}
+);
1;
diff --git a/extensions/OldBugMove/template/en/default/admin/params/oldbugmove.html.tmpl b/extensions/OldBugMove/template/en/default/admin/params/oldbugmove.html.tmpl
new file mode 100644
index 000000000..ce588b168
--- /dev/null
+++ b/extensions/OldBugMove/template/en/default/admin/params/oldbugmove.html.tmpl
@@ -0,0 +1,40 @@
+[%# The contents of this file are subject to the Mozilla Public
+ # License Version 1.1 (the "License"); you may not use this file
+ # except in compliance with the License. You may obtain a copy of
+ # the License at http://www.mozilla.org/MPL/
+ #
+ # Software distributed under the License is distributed on an "AS
+ # IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ # implied. See the License for the specific language governing
+ # rights and limitations under the License.
+ #
+ # The Original Code is the Bugzilla Bug Tracking System.
+ #
+ # The Initial Developer of the Original Code is Netscape Communications
+ # Corporation. Portions created by Netscape are
+ # Copyright (C) 1998 Netscape Communications Corporation. All
+ # Rights Reserved.
+ #
+ # Contributor(s): Dave Miller <justdave@bugzilla.org>
+ # Frédéric Buclin <LpSolit@gmail.com>
+ #%]
+[%
+ title = "$terms.Bug Moving"
+ desc = "Set up parameters to move $terms.bugs to/from another installation"
+%]
+
+[% param_descs = {
+
+ "move-to-url" =>
+ "The URL of the database we allow some of our $terms.bugs to"
+ _ " be moved to.",
+
+ "move-to-address" =>
+ "To move ${terms.bugs}, an email is sent to the target database."
+ _ " This is the email address that that database uses to listen"
+ _ " for incoming ${terms.bugs}.",
+
+ movers =>
+ "A list of people with permission to move $terms.bugs ",
+
+} %]
diff --git a/extensions/OldBugMove/template/en/default/hook/bug/edit-after_comment_textarea.html.tmpl b/extensions/OldBugMove/template/en/default/hook/bug/edit-after_comment_textarea.html.tmpl
new file mode 100644
index 000000000..71fe06590
--- /dev/null
+++ b/extensions/OldBugMove/template/en/default/hook/bug/edit-after_comment_textarea.html.tmpl
@@ -0,0 +1,27 @@
+[%# The contents of this file are subject to the Mozilla Public
+ # License Version 1.1 (the "License"); you may not use this file
+ # except in compliance with the License. You may obtain a copy of
+ # the License at http://www.mozilla.org/MPL/
+ #
+ # Software distributed under the License is distributed on an "AS
+ # IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ # implied. See the License for the specific language governing
+ # rights and limitations under the License.
+ #
+ # The Original Code is the Bugzilla Bug Tracking System.
+ #
+ # The Initial Developer of the Original Code is Everything Solved, Inc.
+ # Portions created by the Initial Developer are Copyright (C) 2010
+ # the Initial Developer. All Rights Reserved.
+ #
+ # Contributor(s):
+ # Max Kanat-Alexander <mkanat@bugzilla.org>
+ #%]
+
+[% IF oldbugmove_user_is_mover(user) AND bug.resolution != 'MOVED' %]
+ <br>
+ <input type="submit" name="oldbugmove_[% bug.id FILTER html %]"
+ id="oldbugmove"
+ value="Move [% terms.Bug FILTER html %] to
+ [%= Param('move-to-url') FILTER html %]">
+[% END %]
diff --git a/extensions/OldBugMove/template/en/default/hook/bug/format_comment-type.txt.tmpl b/extensions/OldBugMove/template/en/default/hook/bug/format_comment-type.txt.tmpl
new file mode 100644
index 000000000..1ce8e369d
--- /dev/null
+++ b/extensions/OldBugMove/template/en/default/hook/bug/format_comment-type.txt.tmpl
@@ -0,0 +1,29 @@
+[%# The contents of this file are subject to the Mozilla Public
+ # License Version 1.1 (the "License"); you may not use this file
+ # except in compliance with the License. You may obtain a copy of
+ # the License at http://www.mozilla.org/MPL/
+ #
+ # Software distributed under the License is distributed on an "AS
+ # IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ # implied. See the License for the specific language governing
+ # rights and limitations under the License.
+ #
+ # The Original Code is the Bugzilla Bug Tracking System.
+ #
+ # The Initial Developer of the Original Code is Everything Solved, Inc.
+ # Portions created by the Initial Developer are Copyright (C) 2010
+ # the Initial Developer. All Rights Reserved.
+ #
+ # Contributor(s):
+ # Max Kanat-Alexander <mkanat@bugzilla.org>
+ #%]
+
+[% IF comment.type == constants.CMT_MOVED_TO %]
+[% comment.body %]
+
+[%+ terms.Bug %] moved to [% Param("move-to-url") %].
+If the move succeeded, [% comment.extra_data FILTER email %] will receive a mail
+containing the number of the new [% terms.bug %] in the other database.
+If all went well, please paste in a link to the new [% terms.bug %].
+Otherwise, reopen this [% terms.bug %].
+[% END %]
diff --git a/extensions/OldBugMove/template/en/default/hook/global/user-error-auth_failure_action.html.tmpl b/extensions/OldBugMove/template/en/default/hook/global/user-error-auth_failure_action.html.tmpl
new file mode 100644
index 000000000..58500976b
--- /dev/null
+++ b/extensions/OldBugMove/template/en/default/hook/global/user-error-auth_failure_action.html.tmpl
@@ -0,0 +1,23 @@
+[%# The contents of this file are subject to the Mozilla Public
+ # License Version 1.1 (the "License"); you may not use this file
+ # except in compliance with the License. You may obtain a copy of
+ # the License at http://www.mozilla.org/MPL/
+ #
+ # Software distributed under the License is distributed on an "AS
+ # IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ # implied. See the License for the specific language governing
+ # rights and limitations under the License.
+ #
+ # The Original Code is the Bugzilla Bug Tracking System.
+ #
+ # The Initial Developer of the Original Code is Everything Solved, Inc.
+ # Portions created by the Initial Developer are Copyright (C) 2010
+ # the Initial Developer. All Rights Reserved.
+ #
+ # Contributor(s):
+ # Max Kanat-Alexander <mkanat@bugzilla.org>
+ #%]
+
+[% IF action == "move" %]
+ move
+[% END %]
diff --git a/extensions/OldBugMove/template/en/default/hook/global/user-error-errors.html.tmpl b/extensions/OldBugMove/template/en/default/hook/global/user-error-errors.html.tmpl
new file mode 100644
index 000000000..935117780
--- /dev/null
+++ b/extensions/OldBugMove/template/en/default/hook/global/user-error-errors.html.tmpl
@@ -0,0 +1,29 @@
+[%# The contents of this file are subject to the Mozilla Public
+ # License Version 1.1 (the "License"); you may not use this file
+ # except in compliance with the License. You may obtain a copy of
+ # the License at http://www.mozilla.org/MPL/
+ #
+ # Software distributed under the License is distributed on an "AS
+ # IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ # implied. See the License for the specific language governing
+ # rights and limitations under the License.
+ #
+ # The Original Code is the Bugzilla Bug Tracking System.
+ #
+ # The Initial Developer of the Original Code is Everything Solved, Inc.
+ # Portions created by the Initial Developer are Copyright (C) 2010
+ # the Initial Developer. All Rights Reserved.
+ #
+ # Contributor(s):
+ # Max Kanat-Alexander <mkanat@bugzilla.org>
+ #%]
+
+[% IF error == "oldbugmove_no_delete_moved" %]
+ As long as the OldBugMove extension is active, you cannot
+ delete the [%+ display_value("resolution", "MOVED") FILTER html %]
+ resolution.
+[% ELSIF error == "oldbugmove_no_manual_move" %]
+ You cannot set the resolution of [% terms.abug %] to
+ [%+ display_value("resolution", "MOVED") FILTER html %] without
+ moving the [% terms.bug %].
+[% END %]
diff --git a/importxml.pl b/importxml.pl
index 33d385791..142470906 100755
--- a/importxml.pl
+++ b/importxml.pl
@@ -95,12 +95,15 @@ my $debug = 0;
my $mail = '';
my $attach_path = '';
my $help = 0;
+my ($default_product_name, $default_component_name);
my $result = GetOptions(
"verbose|debug+" => \$debug,
"mail|sendmail!" => \$mail,
"attach_path=s" => \$attach_path,
- "help|?" => \$help
+ "help|?" => \$help,
+ "product=s" => \$default_product_name,
+ "component=s" => \$default_component_name,
);
pod2usage(0) if $help;
@@ -117,6 +120,9 @@ my $dbh = Bugzilla->dbh;
my $params = Bugzilla->params;
my ($timestamp) = $dbh->selectrow_array("SELECT NOW()");
+$default_product_name = '' if !defined $default_product_name;
+$default_component_name = '' if !defined $default_component_name;
+
###############################################################################
# Helper sub routines #
###############################################################################
@@ -126,7 +132,7 @@ sub MailMessage {
my $subject = shift;
my $message = shift;
my @recipients = @_;
- my $from = $params->{"moved-from-address"};
+ my $from = $params->{"mailfrom"};
$from =~ s/@/\@/g;
foreach my $to (@recipients){
@@ -316,22 +322,8 @@ sub init() {
}
Error( "no maintainer", "REOPEN", $exporter ) unless ($maintainer);
Error( "no exporter", "REOPEN", $exporter ) unless ($exporter);
- Error( "bug importing is disabled here", undef, $exporter ) unless ( $params->{"move-enabled"} );
Error( "invalid exporter: $exporter", "REOPEN", $exporter ) if ( !login_to_id($exporter) );
Error( "no urlbase set", "REOPEN", $exporter ) unless ($urlbase);
- my $def_product =
- new Bugzilla::Product( { name => $params->{"moved-default-product"} } )
- || Error("an invalid default product was defined for the target DB. " .
- $params->{"maintainer"} . " needs to fix the definitions of " .
- "moved-default-product. \n", "REOPEN", $exporter);
- my $def_component = new Bugzilla::Component(
- {
- product => $def_product,
- name => $params->{"moved-default-component"}
- })
- || Error("an invalid default component was defined for the target DB. " .
- $params->{"maintainer"} . " needs to fix the definitions of " .
- "moved-default-component.\n", "REOPEN", $exporter);
}
@@ -634,49 +626,34 @@ sub process_bug {
push( @query, "reporter_accessible" );
push( @values, $bug_fields{'reporter_accessible'} ? 1 : 0 );
- # Product and Component if there is no valid default product and
- # component defined in the parameters, we wouldn't be here
- my $def_product =
- new Bugzilla::Product( { name => $params->{"moved-default-product"} } );
- my $def_component = new Bugzilla::Component(
- {
- product => $def_product,
- name => $params->{"moved-default-component"}
- }
- );
- my $product;
- my $component;
-
- if ( defined $bug_fields{'product'} ) {
- $product = new Bugzilla::Product( { name => $bug_fields{'product'} } );
- unless ($product) {
- $product = $def_product;
- $err .= "Unknown Product " . $bug_fields{'product'} . "\n";
- $err .= " Using default product set in Parameters \n";
- }
- }
- else {
- $product = $def_product;
+ my $product = new Bugzilla::Product(
+ { name => $bug_fields{'product'} || '' });
+ if (!$product) {
+ $err .= "Unknown Product " . $bug_fields{'product'} . "\n";
+ $err .= " Using default product set at the command line.\n";
+ $product = new Bugzilla::Product({ name => $default_product_name })
+ or Error("an invalid default product was defined for the target"
+ . " DB. " . $params->{"maintainer"} . " needs to specify "
+ . "--product when calling importxml.pl", "REOPEN",
+ $exporter);
}
- if ( defined $bug_fields{'component'} ) {
- $component = new Bugzilla::Component(
- {
- product => $product,
- name => $bug_fields{'component'}
- }
- );
- unless ($component) {
- $component = $def_component;
- $product = $def_product;
- $err .= "Unknown Component " . $bug_fields{'component'} . "\n";
- $err .= " Using default product and component set ";
- $err .= "in Parameters \n";
+ my $component = new Bugzilla::Component({
+ product => $product, name => $bug_fields{'component'} || '' });
+ if (!$component) {
+ $err .= "Unknown Component " . $bug_fields{'component'} . "\n";
+ $err .= " Using default product and component set ";
+ $err .= "at the command line.\n";
+
+ $product = new Bugzilla::Product({ name => $default_product_name });
+ $component = new Bugzilla::Component({
+ name => $default_component_name, product => $product });
+ if (!$component) {
+ Error("an invalid default component was defined for the target"
+ . " DB. ". $params->{"maintainer"} . " needs to specify "
+ . "--component when calling importxml.pl", "REOPEN",
+ $exporter);
}
}
- else {
- $component = $def_component;
- $product = $def_product;
- }
my $prod_id = $product->id;
my $comp_id = $component->id;
@@ -927,9 +904,9 @@ sub process_bug {
# that might not yet be in the database we have no way of populating
# this table. Change the resolution instead.
if ( $valid_res && ( $bug_fields{'resolution'} eq "DUPLICATE" ) ) {
- $resolution = "MOVED";
+ $resolution = "INVALID";
$err .= "This bug was marked DUPLICATE in the database ";
- $err .= "it was moved from.\n Changing resolution to \"MOVED\"\n";
+ $err .= "it was moved from.\n Changing resolution to \"INVALID\"\n";
}
# If there is at least 1 initial bug status different from UNCO, use it,
@@ -1005,8 +982,8 @@ sub process_bug {
}
if(!$valid_res){
$err .= "Unknown resolution \"$resolution\".\n";
- $err .= " Setting resolution to MOVED\n";
- $resolution = "MOVED";
+ $err .= " Setting resolution to INVALID\n";
+ $resolution = "INVALID";
}
}
}
@@ -1346,31 +1323,38 @@ importxml - Import bugzilla bug data from xml.
=head1 SYNOPSIS
- importxml.pl [options] [file ...]
-
- Options:
- -? --help brief help message
- -v --verbose print error and debug information.
- Multiple -v increases verbosity
- -m --sendmail send mail to recipients with log of bugs imported
- --attach_path The path to the attachment files.
- (Required if encoding="filename" is used for attachments.)
+ importxml.pl [options] [file ...]
=head1 OPTIONS
-=over 8
+=over
=item B<-?>
- Print a brief help message and exits.
+Print a brief help message and exit.
=item B<-v>
- Print error and debug information. Mulltiple -v increases verbosity
+Print error and debug information. Mulltiple -v increases verbosity
+
+=item B<-m> B<--sendmail>
+
+Send mail to exporter with a log of bugs imported and any errors.
+
+=item B<--attach_path>
+
+The path to the attachment files. (Required if encoding="filename"
+is used for attachments.)
+
+=item B<--product=name>
+
+The product to put the bug in if the product specified in the
+XML doesn't exist.
-=item B<-m>
+=item B<--component=name>
- Send mail to exporter with a log of bugs imported and any errors.
+The component to put the bug in if the component specified in the
+XML doesn't exist.
=back
diff --git a/process_bug.cgi b/process_bug.cgi
index f915a0893..5e6657939 100755
--- a/process_bug.cgi
+++ b/process_bug.cgi
@@ -376,72 +376,6 @@ if (defined $cgi->param('id')) {
$first_bug->set_flags($flags, $new_flags);
}
-my $move_action = $cgi->param('action') || '';
-if ($move_action eq Bugzilla->params->{'move-button-text'}) {
- Bugzilla->params->{'move-enabled'} || ThrowUserError("move_bugs_disabled");
-
- $user->is_mover || ThrowUserError("auth_failure", {action => 'move',
- object => 'bugs'});
-
- $dbh->bz_start_transaction();
-
- # First update all moved bugs.
- foreach my $bug (@bug_objects) {
- $bug->add_comment('', { type => CMT_MOVED_TO, extra_data => $user->login });
- }
- # Don't export the new status and resolution. We want the current ones.
- local $Storable::forgive_me = 1;
- my $bugs = dclone(\@bug_objects);
-
- my $new_status = Bugzilla->params->{'duplicate_or_move_bug_status'};
- foreach my $bug (@bug_objects) {
- $bug->set_bug_status($new_status, {resolution => 'MOVED', moving => 1});
- }
- $_->update() foreach @bug_objects;
- $dbh->bz_commit_transaction();
-
- # Now send emails.
- foreach my $bug (@bug_objects) {
- $vars->{'mailrecipients'} = { 'changer' => $user };
- $vars->{'id'} = $bug->id;
- $vars->{'type'} = "move";
- send_results($bug->id, $vars);
- }
- # Prepare and send all data about these bugs to the new database
- my $to = Bugzilla->params->{'move-to-address'};
- $to =~ s/@/\@/;
- my $from = Bugzilla->params->{'moved-from-address'};
- $from =~ s/@/\@/;
- my $msg = "To: $to\n";
- $msg .= "From: Bugzilla <" . $from . ">\n";
- $msg .= "Subject: Moving bug(s) " . join(', ', map($_->id, @bug_objects))
- . "\n\n";
-
- my @fieldlist = (Bugzilla::Bug->fields, 'group', 'long_desc',
- 'attachment', 'attachmentdata');
- my %displayfields;
- foreach (@fieldlist) {
- $displayfields{$_} = 1;
- }
-
- $template->process("bug/show.xml.tmpl", { bugs => $bugs,
- displayfields => \%displayfields,
- }, \$msg)
- || ThrowTemplateError($template->error());
-
- $msg .= "\n";
- MessageToMTA($msg);
-
- # End the response page.
- unless (Bugzilla->usage_mode == USAGE_MODE_EMAIL) {
- $template->process("bug/navigate.html.tmpl", $vars)
- || ThrowTemplateError($template->error());
- $template->process("global/footer.html.tmpl", $vars)
- || ThrowTemplateError($template->error());
- }
- exit;
-}
-
##############################
# Do Actual Database Updates #
##############################
diff --git a/template/en/default/admin/params/bugmove.html.tmpl b/template/en/default/admin/params/bugmove.html.tmpl
deleted file mode 100644
index 911bc330a..000000000
--- a/template/en/default/admin/params/bugmove.html.tmpl
+++ /dev/null
@@ -1,49 +0,0 @@
-[%# The contents of this file are subject to the Mozilla Public
- # License Version 1.1 (the "License"); you may not use this file
- # except in compliance with the License. You may obtain a copy of
- # the License at http://www.mozilla.org/MPL/
- #
- # Software distributed under the License is distributed on an "AS
- # IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
- # implied. See the License for the specific language governing
- # rights and limitations under the License.
- #
- # The Original Code is the Bugzilla Bug Tracking System.
- #
- # The Initial Developer of the Original Code is Netscape Communications
- # Corporation. Portions created by Netscape are
- # Copyright (C) 1998 Netscape Communications Corporation. All
- # Rights Reserved.
- #
- # Contributor(s): Dave Miller <justdave@bugzilla.org>
- # Frédéric Buclin <LpSolit@gmail.com>
- #%]
-[%
- title = "$terms.Bug Moving"
- desc = "Set up parameters to move $terms.bugs to/from another installation"
-%]
-
-[% param_descs = {
- "move-enabled" => "If this is on, $terms.Bugzilla will allow certain people " _
- "to move $terms.bugs to the defined database.",
-
- "move-button-text" => "The text written on the Move button. Explain where the $terms.bug is " _
- "being moved to.",
-
- "move-to-url" => "The URL of the database we allow some of our $terms.bugs to be moved to.",
-
- "move-to-address" => "To move ${terms.bugs}, an email is sent to the target database. This is " _
- "the email address that database uses to listen for incoming ${terms.bugs}.",
-
- "moved-from-address" => "To move ${terms.bugs}, an email is sent to the target database. This is " _
- "the email address from which this mail, and error messages are sent.",
-
- movers => "A list of people with permission to move $terms.bugs and reopen moved " _
- "${terms.bugs} (in case the move operation fails).",
-
- "moved-default-product" => "$terms.Bugs moved from other databases to here are assigned " _
- "to this product.",
-
- "moved-default-component" => "$terms.Bugs moved from other databases to here are assigned " _
- "to this component." }
-%]
diff --git a/template/en/default/bug/edit.html.tmpl b/template/en/default/bug/edit.html.tmpl
index e3255ec1e..d9342a93c 100644
--- a/template/en/default/bug/edit.html.tmpl
+++ b/template/en/default/bug/edit.html.tmpl
@@ -1133,9 +1133,6 @@
<div class="knob-buttons">
<input type="submit" value="Save Changes"
id="commit[% id FILTER css_class_quote %]">
- [% IF bug.user.canmove %]
- <input type="submit" name="action" id="action[% id FILTER css_class_quote %]" value="[% Param("move-button-text") %]">
- [% END %]
</div>
[% END %]
[% END %]
diff --git a/template/en/default/bug/format_comment.txt.tmpl b/template/en/default/bug/format_comment.txt.tmpl
index 7a65aed24..ed89188a6 100644
--- a/template/en/default/bug/format_comment.txt.tmpl
+++ b/template/en/default/bug/format_comment.txt.tmpl
@@ -39,14 +39,6 @@ X[% comment_body %]
*** This [% terms.bug %] has been marked as a duplicate of [% terms.bug %] [%+ comment.extra_data %] ***
[% ELSIF comment.type == constants.CMT_HAS_DUPE %]
*** [% terms.Bug %] [%+ comment.extra_data %] has been marked as a duplicate of this [% terms.bug %]. ***
-[% ELSIF comment.type == constants.CMT_MOVED_TO %]
-X[% comment_body %]
-
-[%+ terms.Bug %] moved to [% Param("move-to-url") %].
-If the move succeeded, [% comment.extra_data %] will receive a mail containing
-the number of the new [% terms.bug %] in the other database.
-If all went well, please paste in a link to the new [% terms.bug %].
-Otherwise, reopen this [% terms.bug %].
[% ELSIF comment.type == constants.CMT_ATTACHMENT_CREATED %]
Created attachment [% comment.extra_data %]
[% IF is_bugmail %]
diff --git a/template/en/default/global/code-error.html.tmpl b/template/en/default/global/code-error.html.tmpl
index f36199bef..177d47621 100644
--- a/template/en/default/global/code-error.html.tmpl
+++ b/template/en/default/global/code-error.html.tmpl
@@ -349,10 +349,6 @@
[% ELSIF error == "need_quipid" %]
A valid quipid is needed.
- [% ELSIF error == "no_manual_moved" %]
- You cannot set the resolution of [% terms.abug %] to [% display_value("resolution", "MOVED") FILTER html %] without
- moving the [% terms.bug %].
-
[% ELSIF error == "object_dep_sort_loop" %]
There is a loop in VALIDATOR_DEPENDENCIES involving
'[%+ field FILTER html %]'. Here are the fields we considered:
diff --git a/template/en/default/global/field-descs.none.tmpl b/template/en/default/global/field-descs.none.tmpl
index bbe1aba7b..6b406431e 100644
--- a/template/en/default/global/field-descs.none.tmpl
+++ b/template/en/default/global/field-descs.none.tmpl
@@ -73,8 +73,8 @@
"resolution" => {
"" => "---",
- # "FIXED" => "NO LONGER AN ISSUE",
- # "MOVED" => "BYE-BYE",
+ # "FIXED" => "NO LONGER AN ISSUE",
+ # "WORKSFORME" => "NOTMYPROBLEM!",
},
} %]
diff --git a/template/en/default/global/user-error.html.tmpl b/template/en/default/global/user-error.html.tmpl
index 669d6adb3..0d053cb74 100644
--- a/template/en/default/global/user-error.html.tmpl
+++ b/template/en/default/global/user-error.html.tmpl
@@ -145,8 +145,6 @@
delete
[% ELSIF action == "edit" %]
add, modify or delete
- [% ELSIF action == "move" %]
- move
[% ELSIF action == "run" %]
run
[% ELSIF action == "schedule" %]
@@ -155,6 +153,8 @@
use
[% ELSIF action == "approve" %]
approve
+ [% ELSE %]
+ [% Hook.process('auth_failure_action') %]
[% END %]
[% IF object == "administrative_pages" %]
@@ -1164,11 +1164,6 @@
A valid resolution is required to mark [% terms.bugs %] as
[%+ status FILTER upper FILTER html %].
- [% ELSIF error == "move_bugs_disabled" %]
- [% title = BLOCK %][% terms.Bug %] Moving Disabled[% END %]
- Sorry, [% terms.bug %] moving has been disabled. If you need
- to move [% terms.abug %], please contact [% Param("maintainer") %].
-
[% ELSIF error == "missing_subcategory" %]
[% title = "Missing Subcategory" %]
You did not specify a subcategory for this series.
diff --git a/template/en/default/list/edit-multiple.html.tmpl b/template/en/default/list/edit-multiple.html.tmpl
index 5f16dae69..c6bfbd336 100644
--- a/template/en/default/list/edit-multiple.html.tmpl
+++ b/template/en/default/list/edit-multiple.html.tmpl
@@ -353,10 +353,6 @@
[% END %]
<input type="submit" id="commit" value="Commit">
-[% IF Param('move-enabled') && user.is_mover %]
- <input type="submit" name="action" id="action" value="[% Param('move-button-text') %]">
-[% END %]
-
[%############################################################################%]
[%# Select Menu Block #%]
[%############################################################################%]
diff --git a/template/en/default/pages/fields.html.tmpl b/template/en/default/pages/fields.html.tmpl
index b3583b568..de089ec11 100644
--- a/template/en/default/pages/fields.html.tmpl
+++ b/template/en/default/pages/fields.html.tmpl
@@ -203,18 +203,6 @@
behavior would occur. If more information appears later,
the [% terms.bug %] can be reopened.
</dd>
-
- [% IF Param('move-enabled') %]
- <dt>
- [% display_value("resolution", "MOVED") FILTER html %]
- </dt>
- <dd>
- The problem was specific to a related product
- whose [% terms.bugs %] are tracked in
- another [% terms.bug %] database.
- The [% terms.bug %] has been moved to that database.
- </dd>
- [% END %]
</dl>
</td>
</tr>