From df28605801ee39e55235d346a1a10868fec7cb47 Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Mon, 27 Jun 2022 14:51:45 +0200 Subject: [PATCH] Bug 30965: Add patron autocomplete search to curbside pickups Prior to this patch librarians had to know the cardnumber to search for patron. Now it's possible to search using the default patron autocomplete search (name, cardnumber, etc.) Test plan: Confirm that you can search for a patron without their cardnumber, select it and create a curbside pickup Sponsored-by: Association KohaLa - https://koha-fr.org/ Signed-off-by: Koha Team University Lyon 3 --- circ/curbside_pickups.pl | 30 +++++------------- .../prog/en/modules/circ/curbside_pickups.tt | 31 ++++++++++--------- 2 files changed, 24 insertions(+), 37 deletions(-) diff --git a/circ/curbside_pickups.pl b/circ/curbside_pickups.pl index fb1c17475bb..14e835c6535 100755 --- a/circ/curbside_pickups.pl +++ b/circ/curbside_pickups.pl @@ -45,31 +45,17 @@ my ( $template, $loggedinuser, $cookie ) = get_template_and_user( my $branchcode = C4::Context->userenv()->{'branch'}; my $libraries = Koha::Libraries->search( {}, { order_by => ['branchname'] } ); if ( $op eq 'find-patron' ) { - my $cardnumber = $input->param('cardnumber'); my $borrowernumber = $input->param('borrowernumber'); - my $patron = - $cardnumber - ? Koha::Patrons->find( { cardnumber => $cardnumber } ) - : Koha::Patrons->find($borrowernumber); + my $patron = Koha::Patrons->find($borrowernumber); - my $existing_curbside_pickups; - - if ( $patron ){ - $existing_curbside_pickups = Koha::CurbsidePickups->search( - { - branchcode => $branchcode, - borrowernumber => $patron->id, - delivered_datetime => undef, - } - )->filter_by_scheduled_today; - } else { - push @messages, { - type => 'error', - code => 'no_patron_found', - cardnumber => $cardnumber - }; - } + my $existing_curbside_pickups = Koha::CurbsidePickups->search( + { + branchcode => $branchcode, + borrowernumber => $patron->id, + delivered_datetime => undef, + } + )->filter_by_scheduled_today; $tab = 'schedule-pickup'; $template->param( diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/curbside_pickups.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/curbside_pickups.tt index f6e18084515..1ebb53bc686 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/curbside_pickups.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/curbside_pickups.tt @@ -107,8 +107,6 @@ There are no more pickups available for this slot. Please choose another one. [% CASE 'cannot_checkout' %] Unable to check the items out to [% INCLUDE 'patron-title.inc' patron=m.patron %] - [% CASE 'no_patron_found' %] - No patron found with cardnumber [% m.cardnumber | html %]. [% CASE %] [% m.code | html %] [% END %] @@ -427,20 +425,13 @@ [% patron.firstname | html %] [% patron.surname | html %] ([% patron.cardnumber | html %]) already has a scheduled pickup for this library. [% END %] -
- - - -
- -
-
Card number
- -
+
+ +
+
Search a patron
+
- - - +
[% ELSE %] [% SET waiting_holds = patron.holds.search( found => 'W', branchcode => Branches.GetLoggedInBranchcode ) %] [% IF !policy.enable_waiting_holds_only || waiting_holds.count > 0 %] @@ -505,6 +496,7 @@ [% INCLUDE 'calendar.inc' %] + [% INCLUDE 'js-patron-format.inc' %] [% END %] -- 2.25.1