diff options
author | Max Kanat-Alexander <mkanat@bugzilla.org> | 2010-05-17 00:25:53 +0200 |
---|---|---|
committer | Max Kanat-Alexander <mkanat@bugzilla.org> | 2010-05-17 00:25:53 +0200 |
commit | 2cdcaa08031424c393878bed91f81fc92e4328a4 (patch) | |
tree | e1605a493d08ee4e4fc965207343ef9d681ef1b8 /process_bug.cgi | |
parent | 003e49ae68c247448a5d9d18cb0110432668fdfd (diff) | |
download | bugzilla-2cdcaa08031424c393878bed91f81fc92e4328a4.tar.gz bugzilla-2cdcaa08031424c393878bed91f81fc92e4328a4.tar.xz |
Bug 556167: Move the setting of dependson/blocked from process_bug.cgi
into Bugzilla::Bug::set_all
r=dkl, a=mkanat
Diffstat (limited to 'process_bug.cgi')
-rwxr-xr-x | process_bug.cgi | 37 |
1 files changed, 11 insertions, 26 deletions
diff --git a/process_bug.cgi b/process_bug.cgi index 0753773df..bac09450f 100755 --- a/process_bug.cgi +++ b/process_bug.cgi @@ -280,32 +280,6 @@ if ($cgi->param('id')) { $first_bug->set_flags($flags, $new_flags); } -if ($cgi->param('id') && (defined $cgi->param('dependson') - || defined $cgi->param('blocked')) ) -{ - $first_bug->set_dependencies(scalar $cgi->param('dependson'), - scalar $cgi->param('blocked')); -} -elsif (should_set('dependson') || should_set('blocked')) { - foreach my $bug (@bug_objects) { - my %temp_deps; - foreach my $type (qw(dependson blocked)) { - $temp_deps{$type} = { map { $_ => 1 } @{$bug->$type} }; - if (should_set($type) && $cgi->param($type . '_action') =~ /^(add|remove)$/) { - foreach my $id (split(/[,\s]+/, $cgi->param($type))) { - if ($cgi->param($type . '_action') eq 'remove') { - delete $temp_deps{$type}{$id}; - } - else { - $temp_deps{$type}{$id} = 1; - } - } - } - } - $bug->set_dependencies([ keys %{$temp_deps{'dependson'}} ], [ keys %{$temp_deps{'blocked'}} ]); - } -} - # Component, target_milestone, and version are in here just in case # the 'product' field wasn't defined in the CGI. It doesn't hurt to set # them twice. @@ -348,6 +322,17 @@ if (should_set('see_also')) { if (should_set('remove_see_also')) { $set_all_fields{'see_also'}->{remove} = [$cgi->param('remove_see_also')]; } +foreach my $dep_field (qw(dependson blocked)) { + if (should_set($dep_field)) { + if (my $dep_action = $cgi->param("${dep_field}_action")) { + $set_all_fields{$dep_field}->{$dep_action} = + [split(/\s,/, $cgi->param($dep_field))]; + } + else { + $set_all_fields{$dep_field}->{set} = $cgi->param($dep_field); + } + } +} my @custom_fields = Bugzilla->active_custom_fields; foreach my $field (@custom_fields) { |