From: Ian Jackson Date: Wed, 19 Aug 2009 23:30:23 +0000 (+0100) Subject: Make including islands with no offers optional X-Git-Tag: 3.4~163 X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~yarrgweb/git?p=ypp-sc-tools.web-live.git;a=commitdiff_plain;h=00ba9271fd8409f29fcae6ee2af15824810bc939 Make including islands with no offers optional --- 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"