]> git.ipfire.org Git - thirdparty/bugzilla.git/commitdiff
Bug 415155: Remove $cgi from the list of arguments when calling Bugzilla::Flag subrou...
authorlpsolit%gmail.com <>
Mon, 4 Feb 2008 19:29:26 +0000 (19:29 +0000)
committerlpsolit%gmail.com <>
Mon, 4 Feb 2008 19:29:26 +0000 (19:29 +0000)
Bugzilla/Attachment.pm
Bugzilla/Flag.pm
attachment.cgi
post_bug.cgi
process_bug.cgi

index b4ac9e6f0193b864942edee0ad69729cbb28d379..314227c873302950359f99a8adfacc567fd20828 100644 (file)
@@ -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 ($@) {
index dc298634d27e4942d38edb9cdbbb614dc032ea32..1fc2a6827f43844ab344e559f883aca2a3740ef4 100644 (file)
@@ -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);
 }
index 449abde654c5f89d15142354660f1068b9c8e7b8..bc5b2ac752be7feb2033778db72a6f0e60347a46 100755 (executable)
@@ -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 
index 89edca2f4a69b06cac2f6fce884f28d2fcf818b7..988a1dedf3692f6abf0a10beba194d5fca47ed4c 100755 (executable)
@@ -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 ($@) {
index 7c5902e730731f63c5a21ba9a17a2aaed875f8a7..0e081b407aa73e7909febef603b9b4e768d2e309 100755 (executable)
@@ -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();