Commit 2eec37a6 authored by lpsolit%gmail.com's avatar lpsolit%gmail.com

Bug 203951: Setting your default query to include boolean charts doesn't work -…

Bug 203951: Setting your default query to include boolean charts doesn't work - Patch by Todd Stansell <tjs@tellme.com> and GavinS <bugzilla@chimpychompy.org> r=joel a=LpSolit
parent 3dd93a04
...@@ -136,17 +136,22 @@ sub PrefillForm { ...@@ -136,17 +136,22 @@ sub PrefillForm {
$default{$name} = []; $default{$name} = [];
} }
# we won't prefill the boolean chart data from this query if
# there are any being submitted via params
my $prefillcharts = (grep(/^field-/, $cgi->param)) ? 0 : 1;
# Iterate over the URL parameters # Iterate over the URL parameters
foreach my $name ($buf->param()) { foreach my $name ($buf->param()) {
my @values = $buf->param($name); my @values = $buf->param($name);
# If the name begins with field, type, or value, then it is part of # If the name begins with the string 'field', 'type', 'value', or
# the boolean charts. Because these are built different than the rest # 'negate', then it is part of the boolean charts. Because
# of the form, we don't need to save a default value. We do, however, # these are built different than the rest of the form, we need
# need to indicate that we found something so the default query isn't # to store these as parameters. We also need to indicate that
# added in if all we have are boolean chart items. # we found something so the default query isn't added in if
if ($name =~ m/^(?:field|type|value)/) { # all we have are boolean chart items.
if ($name =~ m/^(?:field|type|value|negate)/) {
$cgi->param(-name => $name, -value => $values[0]) if ($prefillcharts);
$foundone = 1; $foundone = 1;
} }
# If the name ends in a number (which it does for the fields which # If the name ends in a number (which it does for the fields which
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment