summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xprocess_bug.cgi21
-rw-r--r--template/en/default/bug/process/verify-new-product.html.tmpl8
2 files changed, 25 insertions, 4 deletions
diff --git a/process_bug.cgi b/process_bug.cgi
index db19916a3..103085457 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 84e5dd95a..21c5664b8 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 @@
<tr>
<td>
<b>Version:</b><br>
- [% PROCESS "global/select-menu.html.tmpl" name="version" options=versions %]
+ [% PROCESS "global/select-menu.html.tmpl" name="version" options=versions default=defaults.version %]
</td>
<td>
<b>Component:</b><br>
- [% PROCESS "global/select-menu.html.tmpl" name="component" options=components %]
+ [% PROCESS "global/select-menu.html.tmpl" name="component" options=components default=defaults.component %]
</td>
[% IF use_target_milestone %]
<td>
<b>Target Milestone:</b><br>
- [% PROCESS "global/select-menu.html.tmpl" name="target_milestone" options=milestones %]
+ [% PROCESS "global/select-menu.html.tmpl" name="target_milestone" options=milestones default=defaults.target_milestone %]
</td>
[% END %]
</tr>