From 00ba9271fd8409f29fcae6ee2af15824810bc939 Mon Sep 17 00:00:00 2001 From: Ian Jackson Date: Thu, 20 Aug 2009 00:30:23 +0100 Subject: [PATCH] Make including islands with no offers optional --- yarrg/web/lookup | 6 ++++++ yarrg/web/query_commod | 6 ++++-- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/yarrg/web/lookup b/yarrg/web/lookup index 0b6466e..a56adf7 100755 --- a/yarrg/web/lookup +++ b/yarrg/web/lookup @@ -66,6 +66,12 @@ my %styles; [ 'sell', 'Sell offers only' ], ], QuerySpecific => 1, + }, { Name => 'ShowBlank', + Before => '', + Values => [ [ 'omit', 'Omit islands with no offers' ], + [ 'show', 'Show all islands' ], + ], + QuerySpecific => 1, }); foreach my $var (@vars) { diff --git a/yarrg/web/query_commod b/yarrg/web/query_commod index 4869e5c..c9b17ae 100644 --- a/yarrg/web/query_commod +++ b/yarrg/web/query_commod @@ -52,6 +52,7 @@ my $qa= \%ARGS;

Commodity enquiry

% $prselector->('BuySell'); +% $prselector->('ShowBlank'); %#---------- textbox, user enters route as string ---------- % if (!$qa->{Dropdowns}) { @@ -94,11 +95,12 @@ foreach my $bs (split /_/, $ARGS{BuySell}) { my ($ascdesc) = ($bs eq 'buy') ? ('DESC') : ('ASC'); -#INNER JOIN + my $joinkind= $ARGS{ShowBlank} eq 'show' + ? 'LEFT OUTER JOIN' : 'INNER JOIN'; my $islands= $dbh->prepare( "SELECT islands.islandid AS islandid, archipelago, islandname, sum(qty) as tqty - FROM islands LEFT OUTER JOIN $bs offers + FROM islands $joinkind $bs offers ON islands.islandid == offers.islandid AND commodid == ? GROUP BY islands.islandid, ORDER BY archipelago, islandname" -- 2.30.2