Commit 24c32fe3 authored by lpsolit%gmail.com's avatar lpsolit%gmail.com

Bug 415155: Remove $cgi from the list of arguments when calling Bugzilla::Flag…

Bug 415155: Remove $cgi from the list of arguments when calling Bugzilla::Flag subroutines - Patch by Fré©ric Buclin <LpSolit@gmail.com> a=LpSolit
parent a9053d2b
......@@ -890,7 +890,7 @@ sub insert_attachment_for_bug {
foreach my $obsolete_attachment (@obsolete_attachments) {
# If the obsolete attachment has request flags, cancel them.
# This call must be done before updating the 'attachments' table.
Bugzilla::Flag::CancelRequests($bug, $obsolete_attachment, $timestamp);
Bugzilla::Flag->CancelRequests($bug, $obsolete_attachment, $timestamp);
$dbh->do('UPDATE attachments SET isobsolete = 1, modification_time = ?
WHERE attach_id = ?',
......@@ -917,8 +917,8 @@ sub insert_attachment_for_bug {
my $error_mode_cache = Bugzilla->error_mode;
Bugzilla->error_mode(ERROR_MODE_DIE);
eval {
Bugzilla::Flag::validate($cgi, $bug->bug_id, -1, SKIP_REQUESTEE_ON_ERROR);
Bugzilla::Flag->process($bug, $attachment, $timestamp, $cgi, $hr_vars);
Bugzilla::Flag::validate($bug->bug_id, -1, SKIP_REQUESTEE_ON_ERROR);
Bugzilla::Flag->process($bug, $attachment, $timestamp, $hr_vars);
};
Bugzilla->error_mode($error_mode_cache);
if ($@) {
......
......@@ -246,7 +246,7 @@ sub count {
=over
=item C<validate($cgi, $bug_id, $attach_id, $skip_requestee_on_error)>
=item C<validate($bug_id, $attach_id, $skip_requestee_on_error)>
Validates fields containing flag modifications.
......@@ -258,8 +258,8 @@ to -1 to force its check anyway.
=cut
sub validate {
my ($cgi, $bug_id, $attach_id, $skip_requestee_on_error) = @_;
my ($bug_id, $attach_id, $skip_requestee_on_error) = @_;
my $cgi = Bugzilla->cgi;
my $dbh = Bugzilla->dbh;
# Get a list of flags to validate. Uses the "map" function
......@@ -501,22 +501,22 @@ sub snapshot {
=over
=item C<process($bug, $attachment, $timestamp, $cgi, $hr_vars)>
=item C<process($bug, $attachment, $timestamp, $hr_vars)>
Processes changes to flags.
The bug and/or the attachment objects are the ones this flag is about,
the timestamp is the date/time the bug was last touched (so that changes
to the flag can be stamped with the same date/time), the cgi is the CGI
object used to obtain the flag fields that the user submitted.
to the flag can be stamped with the same date/time).
=back
=cut
sub process {
my ($class, $bug, $attachment, $timestamp, $cgi, $hr_vars) = @_;
my ($class, $bug, $attachment, $timestamp, $hr_vars) = @_;
my $dbh = Bugzilla->dbh;
my $cgi = Bugzilla->cgi;
# Make sure the bug (and attachment, if given) exists and is accessible
# to the current user. Moreover, if an attachment object is passed,
......@@ -535,7 +535,7 @@ sub process {
# Cancel pending requests if we are obsoleting an attachment.
if ($attachment && $cgi->param('isobsolete')) {
CancelRequests($bug, $attachment);
$class->CancelRequests($bug, $attachment);
}
# Create new flags and update existing flags.
......@@ -1094,7 +1094,7 @@ sub notify {
# Cancel all request flags from the attachment being obsoleted.
sub CancelRequests {
my ($bug, $attachment, $timestamp) = @_;
my ($class, $bug, $attachment, $timestamp) = @_;
my $dbh = Bugzilla->dbh;
my $request_ids =
......@@ -1109,7 +1109,7 @@ sub CancelRequests {
return if (!scalar(@$request_ids));
# Take a snapshot of flags before any changes.
my @old_summaries = __PACKAGE__->snapshot($bug->bug_id, $attachment->id)
my @old_summaries = $class->snapshot($bug->bug_id, $attachment->id)
if ($timestamp);
my $flags = Bugzilla::Flag->new_from_list($request_ids);
foreach my $flag (@$flags) { clear($flag, $bug, $attachment) }
......@@ -1118,7 +1118,7 @@ sub CancelRequests {
return unless ($timestamp);
# Take a snapshot of flags after any changes.
my @new_summaries = __PACKAGE__->snapshot($bug->bug_id, $attachment->id);
my @new_summaries = $class->snapshot($bug->bug_id, $attachment->id);
update_activity($bug->bug_id, $attachment->id, $timestamp,
\@old_summaries, \@new_summaries);
}
......
......@@ -508,7 +508,7 @@ sub update {
Bugzilla::User::match_field($cgi, {
'^requestee(_type)?-(\d+)$' => { 'type' => 'multi' }
});
Bugzilla::Flag::validate($cgi, $bug->id, $attachment->id);
Bugzilla::Flag::validate($bug->id, $attachment->id);
# Start a transaction in preparation for updating the attachment.
$dbh->bz_start_transaction();
......@@ -529,7 +529,7 @@ sub update {
# to attachments so that we can delete pending requests if the user
# is obsoleting this attachment without deleting any requests
# the user submits at the same time.
Bugzilla::Flag->process($bug, $attachment, $timestamp, $cgi, $vars);
Bugzilla::Flag->process($bug, $attachment, $timestamp, $vars);
# Update the attachment record in the database.
$dbh->do("UPDATE attachments
......
......@@ -229,8 +229,8 @@ if (defined($cgi->upload('data')) || $cgi->param('attachurl')) {
my $error_mode_cache = Bugzilla->error_mode;
Bugzilla->error_mode(ERROR_MODE_DIE);
eval {
Bugzilla::Flag::validate($cgi, $id, undef, SKIP_REQUESTEE_ON_ERROR);
Bugzilla::Flag->process($bug, undef, $timestamp, $cgi, $vars);
Bugzilla::Flag::validate($id, undef, SKIP_REQUESTEE_ON_ERROR);
Bugzilla::Flag->process($bug, undef, $timestamp, $vars);
};
Bugzilla->error_mode($error_mode_cache);
if ($@) {
......
......@@ -162,7 +162,7 @@ if (defined $cgi->param('dontchange')) {
# Validate flags in all cases. validate() should not detect any
# reference to flags if $cgi->param('id') is undefined.
Bugzilla::Flag::validate($cgi, $cgi->param('id'));
Bugzilla::Flag::validate($cgi->param('id'));
######################################################################
# End Data/Security Validation
......@@ -550,7 +550,7 @@ foreach my $bug (@bug_objects) {
}
# Set and update flags.
Bugzilla::Flag->process($bug, undef, $timestamp, $cgi, $vars);
Bugzilla::Flag->process($bug, undef, $timestamp, $vars);
$dbh->bz_commit_transaction();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment