From accc73e1279b753c18bdf21be3cbeab174f8cec3 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 Signed-off-by: Katrin Fischer Signed-off-by: Tomas Cohen Arazi --- 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 1de97f9c84..6443e2c103 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 cc7ba2df2c..909708a44d 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 @@ -90,8 +90,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 %] @@ -435,20 +433,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 %] @@ -523,6 +514,7 @@ [% INCLUDE 'calendar.inc' %] + [% INCLUDE 'js-patron-format.inc' %] [% END %] -- 2.39.5