Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
bugzilla
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Ivan Ivlev
bugzilla
Commits
db2a5492
Commit
db2a5492
authored
Jun 18, 2010
by
Max Kanat-Alexander
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Bug 556422: Move the existing bug-moving functionality into an extension
called OldBugMove. r=dkl, a=mkanat
parent
7ae63b1e
Hide whitespace changes
Inline
Side-by-side
Showing
24 changed files
with
426 additions
and
265 deletions
+426
-265
Bug.pm
Bugzilla/Bug.pm
+1
-11
Comment.pm
Bugzilla/Comment.pm
+0
-3
Constants.pm
Bugzilla/Constants.pm
+1
-2
DB.pm
Bugzilla/DB.pm
+1
-2
ChoiceInterface.pm
Bugzilla/Field/ChoiceInterface.pm
+1
-1
User.pm
Bugzilla/User.pm
+0
-11
Config.pm
extensions/OldBugMove/Config.pm
+25
-0
Extension.pm
extensions/OldBugMove/Extension.pm
+214
-0
disabled
extensions/OldBugMove/disabled
+0
-0
Params.pm
extensions/OldBugMove/lib/Params.pm
+3
-36
oldbugmove.html.tmpl
...ove/template/en/default/admin/params/oldbugmove.html.tmpl
+10
-19
edit-after_comment_textarea.html.tmpl
...en/default/hook/bug/edit-after_comment_textarea.html.tmpl
+27
-0
format_comment-type.txt.tmpl
...template/en/default/hook/bug/format_comment-type.txt.tmpl
+29
-0
user-error-auth_failure_action.html.tmpl
...ault/hook/global/user-error-auth_failure_action.html.tmpl
+23
-0
user-error-errors.html.tmpl
...mplate/en/default/hook/global/user-error-errors.html.tmpl
+29
-0
importxml.pl
importxml.pl
+58
-74
process_bug.cgi
process_bug.cgi
+0
-66
edit.html.tmpl
template/en/default/bug/edit.html.tmpl
+0
-3
format_comment.txt.tmpl
template/en/default/bug/format_comment.txt.tmpl
+0
-8
code-error.html.tmpl
template/en/default/global/code-error.html.tmpl
+0
-4
field-descs.none.tmpl
template/en/default/global/field-descs.none.tmpl
+2
-2
user-error.html.tmpl
template/en/default/global/user-error.html.tmpl
+2
-7
edit-multiple.html.tmpl
template/en/default/list/edit-multiple.html.tmpl
+0
-4
fields.html.tmpl
template/en/default/pages/fields.html.tmpl
+0
-12
No files found.
Bugzilla/Bug.pm
View file @
db2a5492
...
...
@@ -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
;
...
...
Bugzilla/Comment.pm
View file @
db2a5492
...
...
@@ -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
)
{
...
...
Bugzilla/Constants.pm
View file @
db2a5492
...
...
@@ -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
;
...
...
Bugzilla/DB.pm
View file @
db2a5492
...
...
@@ -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"
],
};
#####################################################################
...
...
Bugzilla/Field/ChoiceInterface.pm
View file @
db2a5492
...
...
@@ -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
)
{
...
...
Bugzilla/User.pm
View file @
db2a5492
...
...
@@ -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
;
...
...
extensions/OldBugMove/Config.pm
0 → 100644
View file @
db2a5492
# -*- 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
;
extensions/OldBugMove/Extension.pm
0 → 100644
View file @
db2a5492
# -*- 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
;
extensions/OldBugMove/disabled
0 → 100644
View file @
db2a5492
Bugzilla/Config/BugMove
.pm
→
extensions/OldBugMove/lib/Params
.pm
View file @
db2a5492
...
...
@@ -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
;
template/en/default/admin/params/
bugmove.html.tmpl
→
extensions/OldBugMove/template/en/default/admin/params/old
bugmove.html.tmpl
View file @
db2a5492
...
...
@@ -24,26 +24,17 @@
%]
[% 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-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}.",
"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}.
",
movers =>
"A list of people with permission to move $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." }
%]
} %]
extensions/OldBugMove/template/en/default/hook/bug/edit-after_comment_textarea.html.tmpl
0 → 100644
View file @
db2a5492
[%# 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 %]
extensions/OldBugMove/template/en/default/hook/bug/format_comment-type.txt.tmpl
0 → 100644
View file @
db2a5492
[%# 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 %]
extensions/OldBugMove/template/en/default/hook/global/user-error-auth_failure_action.html.tmpl
0 → 100644
View file @
db2a5492
[%# 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 %]
extensions/OldBugMove/template/en/default/hook/global/user-error-errors.html.tmpl
0 → 100644
View file @
db2a5492
[%# 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 %]
importxml.pl
View file @
db2a5492
...
...
@@ -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
->
{
"m
oved-from-address
"
};
my
$from
=
$params
->
{
"m
ailfrom
"
};
$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
=
"
MOVE
D"
;
$resolution
=
"
INVALI
D"
;
$err
.=
"This bug was marked DUPLICATE in the database "
;
$err
.=
"it was moved from.\n Changing resolution to \"
MOVE
D\"\n"
;
$err
.=
"it was moved from.\n Changing resolution to \"
INVALI
D\"\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
MOVE
D\n"
;
$resolution
=
"
MOVE
D"
;
$err
.=
" Setting resolution to
INVALI
D\n"
;
$resolution
=
"
INVALI
D"
;
}
}
}
...
...
@@ -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
...
...
process_bug.cgi
View file @
db2a5492
...
...
@@ -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 #
##############################
...
...
template/en/default/bug/edit.html.tmpl
View file @
db2a5492
...
...
@@ -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 %]
template/en/default/bug/format_comment.txt.tmpl
View file @
db2a5492
...
...
@@ -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 %]
...
...
template/en/default/global/code-error.html.tmpl
View file @
db2a5492
...
...
@@ -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:
...
...
template/en/default/global/field-descs.none.tmpl
View file @
db2a5492
...
...
@@ -73,8 +73,8 @@
"resolution" => {
"" => "---",
# "FIXED" => "NO LONGER AN ISSUE",
# "
MOVED" => "BYE-BYE
",
# "FIXED"
=> "NO LONGER AN ISSUE",
# "
WORKSFORME" => "NOTMYPROBLEM!
",
},
} %]
...
...
template/en/default/global/user-error.html.tmpl
View file @
db2a5492
...
...
@@ -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.
...
...
template/en/default/list/edit-multiple.html.tmpl
View file @
db2a5492
...
...
@@ -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 #%]
[%############################################################################%]
...
...
template/en/default/pages/fields.html.tmpl
View file @
db2a5492
...
...
@@ -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>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment