Commit df48c469 authored by jocuri%softhome.net's avatar jocuri%softhome.net

Patch for bug 269398: request.cgi should not fail with error in SQL when no…

Patch for bug 269398: request.cgi should not fail with error in SQL when no products are available for the user; patch by Frédéric Buclin <LpSolit@netscape.net>, r=vladd, a=justdave.
parent c1db00cc
......@@ -634,21 +634,23 @@ sub GetSelectableProductHash {
PushGlobalSQLState();
foreach my $table (@tables) {
# Why oh why can't we standardize on these names?!?
my $fld = ($table eq "components" ? "name" : "value");
my $query = "SELECT $fld, product_id FROM $table WHERE product_id IN " .
"(" . join(",", keys %products) . ") ORDER BY $fld";
SendSQL($query);
my %values;
my %values_by_product;
while (MoreSQLData()) {
my ($name, $product_id) = FetchSQLData();
next unless $name;
$values{$name} = 1;
push @{$values_by_product{$products{$product_id}}}, $name;
if (scalar(keys %products)) {
# Why oh why can't we standardize on these names?!?
my $fld = ($table eq "components" ? "name" : "value");
my $query = "SELECT $fld, product_id FROM $table WHERE product_id " .
"IN (" . join(",", keys %products) . ") ORDER BY $fld";
SendSQL($query);
while (MoreSQLData()) {
my ($name, $product_id) = FetchSQLData();
next unless $name;
$values{$name} = 1;
push @{$values_by_product{$products{$product_id}}}, $name;
}
}
$selectables->{"legal_$table"} = [sort keys %values];
......
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