From c7a7e4581200ae8472aed66d38250b7cf28e1755 Mon Sep 17 00:00:00 2001 From: Nick Clemens Date: Fri, 24 Sep 2021 00:05:30 +0000 Subject: [PATCH] Bug 15812: Use patron search in place of circ search The 'Checkout' search hijacks some of the DataTables searching code used for 'Search patrons' Rather than try to implement the search again on another page, we can simply send the user to the patron search if the cardnumber is not found Additionally, this patch adds a 'Check out' button to the patron search results to allow going to checkotus directly To test: 1 - Apply patch 2 - Perform a 'Checkout' search from the header 3 - Note that: For a cardnumber, you are redirected directly to checkouts page for the borrower For a search with one result, you are redirected directly to the checkout page for the borrower For a search with many results, you are redirected to the patron search results and there is a 'Checkout' button under the cardnumber 4 - Confirm circulation page works as expected (i.e. checkout to a patron) Signed-off-by: Kyle M Hall Signed-off-by: George Williams Signed-off-by: Martin Renvoize Signed-off-by: Jonathan Druart --- circ/circulation.pl | 21 +- .../prog/en/modules/circ/circulation.tt | 613 +++++++++--------- .../modules/members/tables/members_results.tt | 2 +- members/member.pl | 6 +- 4 files changed, 305 insertions(+), 337 deletions(-) diff --git a/circ/circulation.pl b/circ/circulation.pl index 4f6607b9e2..0ec0156612 100755 --- a/circ/circulation.pl +++ b/circ/circulation.pl @@ -226,25 +226,8 @@ if ($findborrower) { if ( $patron ) { $borrowernumber = $patron->borrowernumber; } else { - my $dt_params = { iDisplayLength => -1 }; - my $results = C4::Utils::DataTables::Members::search( - { - searchmember => $findborrower, - searchtype => $searchtype, - dt_params => $dt_params, - } - ); - my $borrowers = $results->{patrons}; - if ( scalar @$borrowers == 1 ) { - $borrowernumber = $borrowers->[0]->{borrowernumber}; - $query->param( 'borrowernumber', $borrowernumber ); - $query->param( 'barcode', '' ); - } elsif ( @$borrowers ) { - $template->param( borrowers => $borrowers ); - } else { - $query->param( 'findborrower', '' ); - $message = "'$findborrower'"; - } + print $query->redirect( "/cgi-bin/koha/members/member.pl?quicksearch=1&circsearch=1&searchmember=" . $findborrower ); + exit; } } diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tt index d5e83f673a..bc8a32e631 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tt @@ -562,387 +562,371 @@

No patron matched [% message | html %]

[% END %] - [% IF ( borrowers ) %] + - [% INCLUDE 'patron-toolbar.inc' %] -
- Patron selection - [% INCLUDE 'circ-patron-search-results.inc' destination = "circ" %] -
- - [% ELSE %] - - + [% IF patron %] - [% IF patron %] + [% IF patron.privacy == 2 AND NOT Koha.Preference('AnonymousPatron') %] +
+ Error: This patron has requested their circulation history be anonymized on check-in, but the AnonymousPatron system preference is empty or incorrect. +
+ [% END %] - [% IF patron.privacy == 2 AND NOT Koha.Preference('AnonymousPatron') %] -
- Error: This patron has requested their circulation history be anonymized on check-in, but the AnonymousPatron system preference is empty or incorrect. -
- [% END %] +
+ [% IF ( !noissues ) || ( Koha.Preference('OnSiteCheckouts') && Koha.Preference('OnSiteCheckoutsForce') )%] +
+
+ + [% IF ( issue ) %] +
+ [% ELSE %] +
+ [% END %] -
- [% IF ( !noissues ) || ( Koha.Preference('OnSiteCheckouts') && Koha.Preference('OnSiteCheckoutsForce') )%] -
- - - [% IF ( issue ) %] -
- [% ELSE %] -
- [% END %] + [% IF ( DisplayClearScreenButton ) %] + x + + [% END %] - [% IF ( DisplayClearScreenButton ) %] - x - - [% END %] + [% IF (forceallow) %][% END %] - [% IF (forceallow) %][% END %] + - + [% IF Koha.Preference('itemBarcodeFallbackSearch') %] +
Enter item barcode or keyword:
+ [% ELSE %] +
Enter item barcode:
+ [% END %] - [% IF Koha.Preference('itemBarcodeFallbackSearch') %] -
Enter item barcode or keyword:
- [% ELSE %] -
Enter item barcode:
- [% END %] + [% IF NEEDSCONFIRMATION %] + + [% ELSE %] + + [% END %] - [% IF NEEDSCONFIRMATION %] - - [% ELSE %] - - [% END %] + - + - +
-
+ [% UNLESS ( noissues && Koha.Preference('OnSiteCheckoutsForce') ) %] + [% IF ( SpecifyDueDate ) %] +
+
Specify due date [% INCLUDE 'date-format.inc' %]:
+ [% IF ( duedatespec ) %] + + [% ELSE %] + + [% END %] + + [% IF ( stickyduedate ) %] + + [% ELSE %] + + [% END %] +
+ [% END %] + [% END %] - [% UNLESS ( noissues && Koha.Preference('OnSiteCheckoutsForce') ) %] - [% IF ( SpecifyDueDate ) %] -
-
Specify due date [% INCLUDE 'date-format.inc' %]:
- [% IF ( duedatespec ) %] - - [% ELSE %] - - [% END %] - - [% IF ( stickyduedate ) %] - + [% UNLESS ( noissues ) %] +
+ [% IF NEEDSCONFIRMATION %] + [% IF auto_renew %] + [% IF patron.autorenew_checkouts %] + [% ELSE %] - + [% END %] -
+ [% ELSE %] + + [% END %] + [% ELSE %] + [% IF ( auto_renew && patron.autorenew_checkouts ) %] + + [% ELSIF patron.autorenew_checkouts %] + + [% ELSE %] + + [% END %] [% END %] - [% END %] - [% UNLESS ( noissues ) %] -
+ +
+ [% IF Koha.Preference('decreaseLoanHighHolds') %] +
[% IF NEEDSCONFIRMATION %] - [% IF auto_renew %] - [% IF patron.autorenew_checkouts %] - - [% ELSE %] - - [% END %] + [% IF override_high_holds %] + [% ELSE %] - + [% END %] [% ELSE %] - [% IF ( auto_renew && patron.autorenew_checkouts ) %] - - [% ELSIF patron.autorenew_checkouts %] - + [% IF override_high_holds %] + [% ELSE %] - + [% END %] [% END %] - - +
- [% IF Koha.Preference('decreaseLoanHighHolds') %] -
- [% IF NEEDSCONFIRMATION %] - [% IF override_high_holds %] - - [% ELSE %] - - [% END %] - [% ELSE %] - [% IF override_high_holds %] - - [% ELSE %] - - [% END %] - [% END %] - -
- [% END %] [% END %] + [% END %] - [% IF Koha.Preference('OnSiteCheckouts') %] -
- [% IF noissues %] -
- - - -
+ [% IF Koha.Preference('OnSiteCheckouts') %] +
+ [% IF noissues %] +
+ + + +
+ [% ELSE %] + [% IF Koha.Preference('OnSiteCheckoutAutoCheck') && onsite_checkout == "on" %] + [% ELSE %] - [% IF Koha.Preference('OnSiteCheckoutAutoCheck') && onsite_checkout == "on" %] - - [% ELSE %] - - [% END %] + [% END %] -
- [% END %] - -
- - - - - [% IF ( CHARGES ) %] - + [% END %] +
[% END %] -
- - [% IF ( issue ) %] -
-

Checked out: [% issue.item.biblio.title | html %] ([% issue.item.barcode | html %]). Due on [% issue.date_due | $KohaDates as_due_date => 1 %]

-
- [% END %] - -
- [% END #/IF !noissues %] +
- [% IF ( noissues ) %] - [% IF ( Koha.Preference('OnSiteCheckouts') && Koha.Preference('OnSiteCheckoutsForce') ) %] -
- [% ELSE %] -
- [% END %] - [% ELSE %] -
- [% END %] + + + + [% IF ( CHARGES ) %] + + [% END %] +
- [% IF ( noissues ) %] - [% IF ( Koha.Preference('OnSiteCheckouts') && Koha.Preference('OnSiteCheckoutsForce') ) %] -
- [% ELSE %] -

Checking out to [% INCLUDE 'patron-title.inc' %]

-
- [% END %] -

- Cannot check out! - [% IF ( Koha.Preference('OnSiteCheckouts') && Koha.Preference('OnSiteCheckoutsForce') ) %] - Only on-site checkouts are allowed + [% IF ( issue ) %] +
+

Checked out: [% issue.item.biblio.title | html %] ([% issue.item.barcode | html %]). Due on [% issue.date_due | $KohaDates as_due_date => 1 %]

+
[% END %] -

- [% ELSE %] -
- [% END %] - - [% INCLUDE 'patron_messages.inc' %] + +
-
-
-
+ [% END #/IF !noissues %] -
-
+ +
+ + - + [% IF Koha.Preference('ArticleRequests') %] + [% SET current_article_requests = Context.Scalar( Context.Scalar( patron, 'article_requests' ), 'filter_by_current' ) %] +
  • + [% current_article_requests.count | html %] Article requests +
  • + [% END %] - [% INCLUDE "checkouts-table.inc" %] + [% IF Koha.Preference('ClaimReturnedLostValue') %] +
  • + [% IF ( patron.return_claims.count ) %] + + Claim(s) + [% IF patron.return_claims.resolved.count == 0 %] + [% patron.return_claims.resolved.count | html %] + [% ELSE %] + [% patron.return_claims.resolved.count | html %] + [% END %] + [% IF patron.return_claims.unresolved.count == 0 %] + [% patron.return_claims.unresolved.count | html %] + [% ELSE %] + [% patron.return_claims.unresolved.count | html %] + [% END %] + + [% ELSE %] + + Claim(s) + 0 + 0 + + [% END %] +
  • + [% END %] - [% INCLUDE "relatives-issues-table.inc" %] +
  • [% debarments.count | html %] Restrictions
  • + [% SET enrollments = patron.get_club_enrollments(1) %] + [% SET enrollable = patron.get_enrollable_clubs(0,1) %] [% IF CAN_user_clubs && ( enrollable.count || enrollments.count ) %] -
    - Loading... -
    +
  • + + Clubs ([% enrollments.count | html %]/[% enrollable.count | html %]) + +
  • [% END %] + - [% INCLUDE borrower_debarments.inc %] + -
    - [% IF ( holds_count ) %] -
    - - - - - - - - - - - - - - - - -
    Hold dateTitleCall numberBarcodePickup atExpirationPriorityCancel?Suspend?Status
    - -
    - - - [% SET hold_cancellation = AuthorisedValues.GetAuthValueDropbox('HOLD_CANCELLATION') %] - [% IF hold_cancellation %] - - [% END %] -
    -
    + [% INCLUDE "checkouts-table.inc" %] - [% IF Koha.Preference('SuspendHoldsIntranet') %] -
    -
    - - - - - [% IF Koha.Preference('AutoResumeSuspendedHolds') %] - - - Specify date on which to resume [% INCLUDE 'date-format.inc' %]: - [% END %] -
    -
    - -
    -
    - - - - -
    -
    - [% END # /IF SuspendHoldsIntranet %] - - [% ELSE # IF holds_count %] -

    Patron has nothing on hold.

    - [% END # /IF holds_count %] -
    + [% INCLUDE "relatives-issues-table.inc" %] - [% IF Koha.Preference('ClaimReturnedLostValue') %] - [% INCLUDE 'patron-return-claims.inc' %] - [% END %] + [% IF CAN_user_clubs && ( enrollable.count || enrollments.count ) %] +
    + Loading... +
    + [% END %] - [% IF Koha.Preference('ArticleRequests') %] - [% INCLUDE 'patron-article-requests.inc' %] - [% END %] + [% INCLUDE borrower_debarments.inc %] + +
    + [% IF ( holds_count ) %] +
    + + + + + + + + + + + + + + + + +
    Hold dateTitleCall numberBarcodePickup atExpirationPriorityCancel?Suspend?Status
    + +
    + + + [% SET hold_cancellation = AuthorisedValues.GetAuthValueDropbox('HOLD_CANCELLATION') %] + [% IF hold_cancellation %] + + [% END %] +
    +
    + + [% IF Koha.Preference('SuspendHoldsIntranet') %] +
    +
    + + + + + [% IF Koha.Preference('AutoResumeSuspendedHolds') %] + + + Specify date on which to resume [% INCLUDE 'date-format.inc' %]: + [% END %] +
    +
    + +
    +
    + + + + +
    +
    + [% END # /IF SuspendHoldsIntranet %] + + [% ELSE # IF holds_count %] +

    Patron has nothing on hold.

    + [% END # /IF holds_count %] +
    + + [% IF Koha.Preference('ClaimReturnedLostValue') %] + [% INCLUDE 'patron-return-claims.inc' %] + [% END %] -
    - [% ELSIF borrowernumber # IF patron %] -
    Patron not found. Return to search
    - [% END # /IF patron %] + [% IF Koha.Preference('ArticleRequests') %] + [% INCLUDE 'patron-article-requests.inc' %] + [% END %] - [% END #/IF borrowers %] +
    + [% ELSIF borrowernumber # IF patron %] +
    Patron not found. Return to search
    + [% END # /IF patron %] [% IF Koha.Preference('CircSidebar') %] - [% UNLESS ( borrowers ) %] - [% IF not( borrowernumber and patron ) %] -
    - -
    - [% END %] + [% IF not( borrowernumber and patron ) %] +
    + +
    [% END %] [% END %] - [% UNLESS ( borrowers ) %] - [% IF borrowernumber and patron %] -
    - -
    - [% END %] + [% IF borrowernumber and patron %] +
    + +
    [% END %] @@ -995,7 +979,6 @@ [% Asset.js("js/pages/circulation.js") | $raw %] [% Asset.js("js/checkouts.js") | $raw %] [% Asset.js("js/holds.js") | $raw %] - [% Asset.js("js/circ-patron-search-results.js") | $raw %]