From: bbaetz%student.usyd.edu.au <> Date: Tue, 25 Jun 2002 17:08:53 +0000 (+0000) Subject: Bug 157085 - verify-new-product doesn't set defaults X-Git-Tag: bugzilla-2.16~29 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=16fd8326056036b134dcac97e13455ab17450ee4;p=thirdparty%2Fbugzilla.git Bug 157085 - verify-new-product doesn't set defaults r=jouni, gerv --- diff --git a/process_bug.cgi b/process_bug.cgi index db19916a35..103085457f 100755 --- a/process_bug.cgi +++ b/process_bug.cgi @@ -191,16 +191,35 @@ if ((($::FORM{'id'} && $::FORM{'product'} ne $::oldproduct) if (!$vok || !$cok || !$mok) { $vars->{'verify_fields'} = 1; + my %defaults; + # We set the defaults to these fields to the old value, + # if its a valid option, otherwise we use the default where + # thats appropriate $vars->{'versions'} = $::versions{$prod}; + if (lsearch($::versions{$prod}, $::FORM{'version'}) != -1) { + $defaults{'version'} = $::FORM{'version'}; + } $vars->{'components'} = $::components{$prod}; - + if (lsearch($::components{$prod}, $::FORM{'component'}) != -1) { + $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) { + $defaults{'target_milestone'} = $::FORM{'target_milestone'}; + } else { + SendSQL("SELECT defaultmilestone FROM products WHERE " . + "product = " . SqlQuote($prod)); + $defaults{'target_milestone'} = FetchOneColumn(); + } } else { $vars->{'use_target_milestone'} = 0; } + $vars->{'defaults'} = \%defaults; } else { $vars->{"verify_fields"} = 0; diff --git a/template/en/default/bug/process/verify-new-product.html.tmpl b/template/en/default/bug/process/verify-new-product.html.tmpl index 84e5dd95ad..21c5664b88 100644 --- a/template/en/default/bug/process/verify-new-product.html.tmpl +++ b/template/en/default/bug/process/verify-new-product.html.tmpl @@ -26,6 +26,8 @@ # versions: array; versions for the new product. # components: array; components for the new product. # milestones: array; milestones for the new product. + # defaults: hash; keys are names of fields, values are defaults for + # those fields # verify_bug_group: boolean; whether or not to ask the user # if they want to add the bug to its new product's group # use_target_milestone: boolean; whether or not to use @@ -57,16 +59,16 @@