From 0318f1ea9c02c8e3df01f10cb1a7e5c7cb46f989 Mon Sep 17 00:00:00 2001 From: Colin Campbell Date: Thu, 30 May 2013 18:23:55 +0100 Subject: [PATCH] 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 Signed-off-by: Chris Cormack Signed-off-by: Galen Charlton (cherry picked from commit 7668e19c9593da570cffb5cd4640fe175d739328) Signed-off-by: Tomas Cohen Arazi (cherry picked from commit b88f16a4e99d533753e3d707239e94da019ce303) Signed-off-by: Bernardo Gonzalez Kriegel (cherry picked from commit b88f16a4e99d533753e3d707239e94da019ce303) Signed-off-by: Chris Hall (cherry picked from commit ccbc3226646c3c3b68b2ecffc84689a0f66a7ace) --- .../prog/en/modules/reserve/request.tt | 16 +++++-- reserve/request.pl | 46 +++++-------------- 2 files changed, 23 insertions(+), 39 deletions(-) diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/reserve/request.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/reserve/request.tt index 40b5ccdbf8..1e0939ee7c 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/reserve/request.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/reserve/request.tt @@ -177,7 +177,7 @@ function checkMultiHold() {

Patron Not Found

No patron with this name, please, try another

[% END %]
- [% UNLESS ( CGIselectborrower ) %] + [% UNLESS borrower_list %]
Enter patron card number or partial name:
@@ -186,9 +186,17 @@ function checkMultiHold() {
[% ELSE %] -
- [% CGIselectborrower %] -
+
+ +
[% END %] [% IF ( multi_hold ) %] diff --git a/reserve/request.pl b/reserve/request.pl index c34a614820..f29bfb9060 100755 --- a/reserve/request.pl +++ b/reserve/request.pl @@ -88,7 +88,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; @@ -125,7 +124,7 @@ if ($findborrower) { $borrowernumber_hold = $borrowers->[0]->{'borrowernumber'}; } else { - $borrowerslist = $borrowers; + $template->param( borrower_list => sort_borrowerlist($borrowers)); } } else { $messageborrower = "'$findborrower'"; @@ -191,38 +190,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 ); @@ -607,7 +574,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; +} -- 2.39.5