Bug 766: remove CGI::scrolling_list from request.pl
Let the template take care of generating the display. Lets at least part of request.pl be more succinct. To test, place a hold and search for the patron using a partial name. You should get a dropdown select list of patrons and be able to select the patron to hold for from there. The functionality should remain unimpaired after this patch is applied. Signed-off-by: Owen Leonard <oleonard@myacpl.org> Signed-off-by: Chris Cormack <chris@bigballofwax.co.nz> Signed-off-by: Galen Charlton <gmc@esilibrary.com>
This commit is contained in:
parent
787a480626
commit
7668e19c95
2 changed files with 23 additions and 39 deletions
|
@ -177,7 +177,7 @@ function checkMultiHold() {
|
|||
<div class="dialog alert"><h3>Patron Not Found</h3><p>No patron with this name, please, try another</p> </div>
|
||||
[% END %]
|
||||
<form action="request.pl?biblionumber=[% biblionumber %]" method="post">
|
||||
[% UNLESS ( CGIselectborrower ) %]
|
||||
[% UNLESS borrower_list %]
|
||||
<fieldset class="brief">
|
||||
<label for="patron">Patron: </label>
|
||||
<div class="hint">Enter patron card number or partial name:</div>
|
||||
|
@ -186,9 +186,17 @@ function checkMultiHold() {
|
|||
<input type="submit" value="Search" />
|
||||
</fieldset>
|
||||
[% ELSE %]
|
||||
<fieldset>
|
||||
[% CGIselectborrower %]
|
||||
<input type="hidden" name="biblionumber" value="[% biblionumber %]" /><fieldset class="action"><input type="submit" value="Select" /></fieldset></fieldset>
|
||||
<fieldset>
|
||||
<select size="7" name="borrowernumber">
|
||||
[% FOREACH borrower IN borrower_list %]
|
||||
<option value="[% borrower.borrowernumber %]">
|
||||
[% borrower.surname -%], [% borrower.firstname -%]
|
||||
... ( [% borrower.cardnumber -%] - [% borrower.categorycode -%]
|
||||
) ... [% borrower.address %]
|
||||
</option>
|
||||
[% END %]
|
||||
</select>
|
||||
<input type="hidden" name="biblionumber" value="[% biblionumber %]" /><fieldset class="action"><input type="submit" value="Select" /></fieldset></fieldset>
|
||||
|
||||
[% END %]
|
||||
[% IF ( multi_hold ) %]
|
||||
|
|
|
@ -76,7 +76,6 @@ my $findborrower = $input->param('findborrower');
|
|||
$findborrower = '' unless defined $findborrower;
|
||||
$findborrower =~ s|,| |g;
|
||||
my $borrowernumber_hold = $input->param('borrowernumber') || '';
|
||||
my $borrowerslist;
|
||||
my $messageborrower;
|
||||
my $warnings;
|
||||
my $messages;
|
||||
|
@ -113,7 +112,7 @@ if ($findborrower) {
|
|||
$borrowernumber_hold = $borrowers->[0]->{'borrowernumber'};
|
||||
}
|
||||
else {
|
||||
$borrowerslist = $borrowers;
|
||||
$template->param( borrower_list => sort_borrowerlist($borrowers));
|
||||
}
|
||||
} else {
|
||||
$messageborrower = "'$findborrower'";
|
||||
|
@ -179,38 +178,6 @@ if ($borrowernumber_hold && !$action) {
|
|||
|
||||
$template->param( messageborrower => $messageborrower );
|
||||
|
||||
my $CGIselectborrower;
|
||||
if ($borrowerslist) {
|
||||
my @values;
|
||||
my %labels;
|
||||
|
||||
foreach my $borrower (
|
||||
sort {
|
||||
uc($a->{surname}
|
||||
. $a->{firstname}) cmp uc($b->{surname}
|
||||
. $b->{firstname})
|
||||
} @{$borrowerslist}
|
||||
)
|
||||
{
|
||||
push @values, $borrower->{borrowernumber};
|
||||
|
||||
$labels{ $borrower->{borrowernumber} } = sprintf(
|
||||
'%s, %s ... (%s - %s) ... %s',
|
||||
$borrower->{surname} ||'', $borrower->{firstname} || '',
|
||||
$borrower->{cardnumber} || '', $borrower->{categorycode} || '',
|
||||
$borrower->{address} || '',
|
||||
);
|
||||
}
|
||||
|
||||
$CGIselectborrower = CGI::scrolling_list(
|
||||
-name => 'borrowernumber',
|
||||
-values => \@values,
|
||||
-labels => \%labels,
|
||||
-size => 7,
|
||||
-multiple => 0,
|
||||
);
|
||||
}
|
||||
|
||||
# FIXME launch another time GetMember perhaps until
|
||||
my $borrowerinfo = GetMember( borrowernumber => $borrowernumber_hold );
|
||||
|
||||
|
@ -608,7 +575,6 @@ foreach my $biblionumber (@biblionumbers) {
|
|||
borrower_branchcode => $borrowerinfo->{'branchcode'},
|
||||
);
|
||||
}
|
||||
$template->param(CGIselectborrower => $CGIselectborrower) if defined $CGIselectborrower;
|
||||
|
||||
$biblioloopiter{biblionumber} = $biblionumber;
|
||||
$biblioloopiter{title} = $dat->{title};
|
||||
|
@ -640,3 +606,13 @@ $template->param(
|
|||
|
||||
# printout the page
|
||||
output_html_with_http_headers $input, $cookie, $template->output;
|
||||
|
||||
sub sort_borrowerlist {
|
||||
my $borrowerslist = shift;
|
||||
my $ref = [];
|
||||
push @{$ref}, sort {
|
||||
uc( $a->{surname} . $a->{firstname} ) cmp
|
||||
uc( $b->{surname} . $b->{firstname} )
|
||||
} @{$borrowerslist};
|
||||
return $ref;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue