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 = ?',
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 ($@) {
=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.
=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
=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,
# 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.
# 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 =
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) }
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);
}
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();
# 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
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 ($@) {
# 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
}
# Set and update flags.
- Bugzilla::Flag->process($bug, undef, $timestamp, $cgi, $vars);
+ Bugzilla::Flag->process($bug, undef, $timestamp, $vars);
$dbh->bz_commit_transaction();