From 64a20bcc2e1062957a1b301eae13955e28fb62a1 Mon Sep 17 00:00:00 2001 From: "jocuri%softhome.net" <> Date: Thu, 9 Dec 2004 18:49:27 +0000 Subject: [PATCH] =?utf8?q?Patch=20for=20bug=20271797:=20avoid=20making=20t?= =?utf8?q?arget=5Fmilestone=20empty=20if=20usetargetmilestone=3D1;=20patch?= =?utf8?q?=20by=20Fr=C3=A9d=C3=A9ric=20Buclin=20,=20?= =?utf8?q?r=3Djustdave,=20a=3Djustdave.?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- process_bug.cgi | 47 +++++++++++++++++++++-------------------------- 1 file changed, 21 insertions(+), 26 deletions(-) diff --git a/process_bug.cgi b/process_bug.cgi index d0cc398f93..0854ac8441 100755 --- a/process_bug.cgi +++ b/process_bug.cgi @@ -203,12 +203,7 @@ CheckFormFieldDefined(\%::FORM, 'product'); CheckFormFieldDefined(\%::FORM, 'version'); CheckFormFieldDefined(\%::FORM, 'component'); -# check if target milestone is defined - matthew@zeroknowledge.com -if ( Param("usetargetmilestone") ) { - CheckFormFieldDefined(\%::FORM, 'target_milestone'); -} -# # This function checks if there is a comment required for a specific # function and tests, if the comment was given. # If comments are required for functions is defined by params. @@ -276,6 +271,7 @@ if ((($::FORM{'id'} && $::FORM{'product'} ne $::oldproduct) my $mok = 1; # so it won't affect the 'if' statement if milestones aren't used if ( Param("usetargetmilestone") ) { + CheckFormFieldDefined(\%::FORM, 'target_milestone'); $mok = lsearch($::target_milestone{$prod}, $::FORM{'target_milestone'}) >= 0; } @@ -293,23 +289,21 @@ if ((($::FORM{'id'} && $::FORM{'product'} ne $::oldproduct) # if its a valid option, otherwise we use the default where # thats appropriate $vars->{'versions'} = $::versions{$prod}; - if (lsearch($::versions{$prod}, $::FORM{'version'}) != -1) { + if ($vok) { $defaults{'version'} = $::FORM{'version'}; } $vars->{'components'} = $::components{$prod}; - if (lsearch($::components{$prod}, $::FORM{'component'}) != -1) { + if ($cok) { $defaults{'component'} = $::FORM{'component'}; } - if (Param("usetargetmilestone")) { $vars->{'use_target_milestone'} = 1; $vars->{'milestones'} = $::target_milestone{$prod}; - if (lsearch($::target_milestone{$prod}, - $::FORM{'target_milestone'}) != -1) { + if ($mok) { $defaults{'target_milestone'} = $::FORM{'target_milestone'}; } else { - SendSQL("SELECT defaultmilestone FROM products WHERE " . - "name = " . SqlQuote($prod)); + SendSQL("SELECT defaultmilestone FROM products " . + "WHERE name = " . SqlQuote($prod)); $defaults{'target_milestone'} = FetchOneColumn(); } } @@ -319,7 +313,7 @@ if ((($::FORM{'id'} && $::FORM{'product'} ne $::oldproduct) $vars->{'defaults'} = \%defaults; } else { - $vars->{"verify_fields"} = 0; + $vars->{'verify_fields'} = 0; } $vars->{'verify_bug_group'} = (AnyDefaultGroups() @@ -536,19 +530,23 @@ if (defined $::FORM{'id'}) { # (XXX those error checks need to happen too, but implementing them # is more work in the current architecture of this script...) # - CheckFormField(\%::FORM, 'rep_platform', \@::legal_platform); - CheckFormField(\%::FORM, 'priority', \@::legal_priority); - CheckFormField(\%::FORM, 'bug_severity', \@::legal_severity); + CheckFormField(\%::FORM, 'product', \@::legal_product); CheckFormField(\%::FORM, 'component', \@{$::components{$::FORM{'product'}}}); - CheckFormFieldDefined(\%::FORM, 'bug_file_loc'); - CheckFormFieldDefined(\%::FORM, 'short_desc'); - CheckFormField(\%::FORM, 'product', \@::legal_product); CheckFormField(\%::FORM, 'version', \@{$::versions{$::FORM{'product'}}}); + if ( Param("usetargetmilestone") ) { + CheckFormField(\%::FORM, 'target_milestone', + \@{$::target_milestone{$::FORM{'product'}}}); + } + CheckFormField(\%::FORM, 'rep_platform', \@::legal_platform); CheckFormField(\%::FORM, 'op_sys', \@::legal_opsys); + CheckFormField(\%::FORM, 'priority', \@::legal_priority); + CheckFormField(\%::FORM, 'bug_severity', \@::legal_severity); + CheckFormFieldDefined(\%::FORM, 'bug_file_loc'); + CheckFormFieldDefined(\%::FORM, 'short_desc'); CheckFormFieldDefined(\%::FORM, 'longdesclength'); - + if (trim($::FORM{'short_desc'}) eq "") { ThrowUserError("require_summary"); } @@ -676,9 +674,8 @@ while (my ($b, $isactive) = FetchSQLData()) { } } -foreach my $field ("rep_platform", "priority", "bug_severity", - "summary", "bug_file_loc", "short_desc", - "version", "op_sys", +foreach my $field ("rep_platform", "priority", "bug_severity", + "bug_file_loc", "short_desc", "version", "op_sys", "target_milestone", "status_whiteboard") { if (defined $::FORM{$field}) { if (!$::FORM{'dontchange'} @@ -1215,9 +1212,7 @@ foreach my $id (@idlist) { SendSQL("SELECT defaultmilestone FROM products WHERE name = " . SqlQuote($oldhash{'product'})); if ($value eq FetchOneColumn()) { - ThrowUserError("milestone_required", - { bug_id => $id }, - "abort"); + ThrowUserError("milestone_required", { bug_id => $id }, "abort"); } } if (defined $::FORM{'delta_ts'} && $::FORM{'delta_ts'} ne $delta_ts) { -- 2.47.2