Bug 1542, fixing filter by area in reports dictionary

Signed-off-by: Galen Charlton <galen.charlton@liblime.com>
This commit is contained in:
Chris Cormack 2009-05-14 18:46:56 +12:00 committed by Galen Charlton
parent 890f673d64
commit a89c3085cf
2 changed files with 11 additions and 6 deletions

View file

@ -21,16 +21,17 @@
<!-- TMPL_IF NAME="start_dictionary" --> <!-- TMPL_IF NAME="start_dictionary" -->
<p>Use the dictionary to define custom criteria for reporting.</p> <p>Use the dictionary to define custom criteria for reporting.</p>
<!-- TMPL_IF NAME="definitions" -->
<h2>Current Terms</h2> <h2>Current Terms</h2>
<form action="/cgi-bin/koha/reports/dictionary.pl" method="post"> <form action="/cgi-bin/koha/reports/dictionary.pl" method="post">
<input type="hidden" name="phase" value="View Dictionary" />
Filter by area <select name="areas"> Filter by area <select name="areas">
<option value="All">All</option> <option value="">All</option>
<!-- TMPL_LOOP NAME="areas" --> <!-- TMPL_LOOP NAME="areas" -->
<option value="<!-- TMPL_VAR NAME="id" -->"><!-- TMPL_VAR NAME="name"--></option> <option value="<!-- TMPL_VAR NAME="id" -->"><!-- TMPL_VAR NAME="name"--></option>
<!-- /TMPL_LOOP --> <!-- /TMPL_LOOP -->
</select> </select>
<input name="phase" value="Go" type="submit" /> <input name="submit" value="Go" type="submit" />
</form> </form>
<br /> <br />
<table border="1" cellspacing="0" cellpadding="5"> <table border="1" cellspacing="0" cellpadding="5">
@ -41,6 +42,7 @@ Filter by area <select name="areas">
<th>Definition</th> <th>Definition</th>
<th>&nbsp;</th> <th>&nbsp;</th>
</tr> </tr>
<!-- TMPL_IF NAME="definitions" -->
<!-- TMPL_LOOP NAME="definitions" --> <!-- TMPL_LOOP NAME="definitions" -->
<tr valign="top"> <tr valign="top">
<td><!-- TMPL_VAR NAME="name" --></td> <td><!-- TMPL_VAR NAME="name" --></td>
@ -54,7 +56,8 @@ Filter by area <select name="areas">
</form></td> </form></td>
</tr> </tr>
<!-- /TMPL_LOOP --> <!-- /TMPL_LOOP -->
</table><!-- TMPL_ELSE -->&nbsp;<!-- /TMPL_IF --> <!-- TMPL_ELSE -->&nbsp;<!-- /TMPL_IF -->
</table>
<!-- /TMPL_IF --> <!-- /TMPL_IF -->

View file

@ -18,6 +18,7 @@
# Suite 330, Boston, MA 02111-1307 USA # Suite 330, Boston, MA 02111-1307 USA
use CGI::Carp qw(fatalsToBrowser warningsToBrowser); use CGI::Carp qw(fatalsToBrowser warningsToBrowser);
use strict; use strict;
use warnings;
use C4::Auth; use C4::Auth;
use CGI; use CGI;
use C4::Output; use C4::Output;
@ -38,7 +39,8 @@ Script to control the guided report creation
my $input = new CGI; my $input = new CGI;
my $referer = $input->referer(); my $referer = $input->referer();
my $phase = $input->param('phase'); my $phase = $input->param('phase') || 'View Dictionary';
my $area = $input->param('areas') || '';
my $no_html = 0; # this will be set if we dont want to print out an html::template my $no_html = 0; # this will be set if we dont want to print out an html::template
my ( $template, $borrowernumber, $cookie ) = get_template_and_user( my ( $template, $borrowernumber, $cookie ) = get_template_and_user(
{ {
@ -54,7 +56,7 @@ my ( $template, $borrowernumber, $cookie ) = get_template_and_user(
if ($phase eq 'View Dictionary'){ if ($phase eq 'View Dictionary'){
# view the dictionary we use to set up abstract variables such as all borrowers over fifty who live in a certain town # view the dictionary we use to set up abstract variables such as all borrowers over fifty who live in a certain town
my $areas = get_report_areas(); my $areas = get_report_areas();
my $definitions = get_from_dictionary(); my $definitions = get_from_dictionary($area);
$template->param( 'areas' => $areas , $template->param( 'areas' => $areas ,
'start_dictionary' => 1, 'start_dictionary' => 1,
'definitions' => $definitions, 'definitions' => $definitions,