From 41bb3972fa866ae7f1fda69f0618153b60d36acc Mon Sep 17 00:00:00 2001 From: Martin Renvoize Date: Wed, 2 Sep 2020 12:00:07 +0100 Subject: [PATCH] Bug 25261: (QA follow-up) Capitalize return of needsconfirm This patch capitalizes the 'ADDITIONAL_MATERIALS' key in the needsconfirm hash return value for CanBookBeIssued to restore consistency with previous code and ensure SIP Checkout works as expected. Signed-off-by: Martin Renvoize --- C4/Circulation.pm | 2 +- C4/SIP/ILS/Transaction/Checkout.pm | 2 +- circ/circulation.pl | 2 +- .../intranet-tmpl/prog/en/modules/circ/circulation.tt | 10 +++++----- .../opac-tmpl/bootstrap/en/modules/sco/sco-main.tt | 2 +- opac/sco/sco-main.pl | 2 +- t/db_dependent/Circulation.t | 2 +- 7 files changed, 11 insertions(+), 11 deletions(-) diff --git a/C4/Circulation.pm b/C4/Circulation.pm index 14fa80c45d..ccf8bb3d8d 100644 --- a/C4/Circulation.pm +++ b/C4/Circulation.pm @@ -901,7 +901,7 @@ sub CanBookBeIssued { if ( C4::Context->preference("CircConfirmItemParts") && $item_object->materials ) { - $needsconfirmation{additional_materials} = $item_object->materials; + $needsconfirmation{ADDITIONAL_MATERIALS} = $item_object->materials; } # diff --git a/C4/SIP/ILS/Transaction/Checkout.pm b/C4/SIP/ILS/Transaction/Checkout.pm index 12e5813b23..84fa15f4be 100644 --- a/C4/SIP/ILS/Transaction/Checkout.pm +++ b/C4/SIP/ILS/Transaction/Checkout.pm @@ -96,7 +96,7 @@ sub do_checkout { } elsif ($confirmation eq 'PREVISSUE') { $self->screen_msg("This item was previously checked out by you"); last; - } elsif ( $confirmation eq 'additional_materials' ) { + } elsif ( $confirmation eq 'ADDITIONAL_MATERIALS' ) { $self->screen_msg('Item must be issued at a circulation desk'); $noerror = 0; last; diff --git a/circ/circulation.pl b/circ/circulation.pl index 5ec80c8f15..c9ffe4410f 100755 --- a/circ/circulation.pl +++ b/circ/circulation.pl @@ -396,7 +396,7 @@ if (@$barcodes) { my $materials = $item->materials; my $descriptions = Koha::AuthorisedValues->get_description_by_koha_field({ frameworkcode => $biblio->frameworkcode, kohafield => 'items.materials', authorised_value => $materials }); $materials = $descriptions->{lib} // $materials; - $template_params->{additional_materials} = $materials; + $template_params->{ADDITIONAL_MATERIALS} = $materials; $template_params->{itemhomebranch} = $item->homebranch; # pass needsconfirmation to template if issuing is possible and user hasn't yet confirmed. 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 a65aee394c..e466f3a491 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tt @@ -54,9 +54,9 @@
Patron was automatically switched by reading the patron card during checking out. Ensure you are working with the right patron.
[% END %] - [% IF additional_materials %] + [% IF ADDITIONAL_MATERIALS %]
Note about the accompanying materials:
- [% additional_materials | html %] + [% ADDITIONAL_MATERIALS | html %]
[% END %] @@ -82,7 +82,7 @@ [% IF ( NEEDSCONFIRMATION ) %]
- [% IF CAN_user_circulate_force_checkout or additional_materials %] + [% IF CAN_user_circulate_force_checkout or ADDITIONAL_MATERIALS %]

Please confirm checkout

[% ELSE %]

Cannot check out

@@ -198,9 +198,9 @@ [% END %] - [% IF additional_materials %] + [% IF ADDITIONAL_MATERIALS %]
  • - Please confirm that the accompanying materials are present: [% additional_materials | html %] + Please confirm that the accompanying materials are present: [% ADDITIONAL_MATERIALS | html %]
  • [% END %] diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/modules/sco/sco-main.tt b/koha-tmpl/opac-tmpl/bootstrap/en/modules/sco/sco-main.tt index 56922c8428..26917e081f 100644 --- a/koha-tmpl/opac-tmpl/bootstrap/en/modules/sco/sco-main.tt +++ b/koha-tmpl/opac-tmpl/bootstrap/en/modules/sco/sco-main.tt @@ -82,7 +82,7 @@ Your contact information seems to be incomplete. [% ELSIF ( circ_error_INVALID_DATE ) %] Due date is not valid. - [% ELSIF ( circ_error_additional_materials ) %] + [% ELSIF ( circ_error_ADDITIONAL_MATERIALS ) %] Item must be issued at a circulation desk. [% END %] Please see a member of the library staff. diff --git a/opac/sco/sco-main.pl b/opac/sco/sco-main.pl index a1a460f77c..2a78bc5a39 100755 --- a/opac/sco/sco-main.pl +++ b/opac/sco/sco-main.pl @@ -151,7 +151,7 @@ elsif ( $patron && ( $op eq 'checkout' || $op eq 'renew' ) ) { ); my $issue_error; if ( $confirm_required = scalar keys %$needconfirm ) { - for my $error ( qw( UNKNOWN_BARCODE max_loans_allowed ISSUED_TO_ANOTHER NO_MORE_RENEWALS NOT_FOR_LOAN DEBT WTHDRAWN RESTRICTED RESERVED ITEMNOTSAMEBRANCH EXPIRED DEBARRED CARD_LOST GNA INVALID_DATE UNKNOWN_BARCODE TOO_MANY DEBT_GUARANTEES USERBLOCKEDOVERDUE PATRON_CANT PREVISSUE NOT_FOR_LOAN_FORCING ITEM_LOST additional_materials) ) { + for my $error ( qw( UNKNOWN_BARCODE max_loans_allowed ISSUED_TO_ANOTHER NO_MORE_RENEWALS NOT_FOR_LOAN DEBT WTHDRAWN RESTRICTED RESERVED ITEMNOTSAMEBRANCH EXPIRED DEBARRED CARD_LOST GNA INVALID_DATE UNKNOWN_BARCODE TOO_MANY DEBT_GUARANTEES USERBLOCKEDOVERDUE PATRON_CANT PREVISSUE NOT_FOR_LOAN_FORCING ITEM_LOST ADDITIONAL_MATERIALS) ) { if ( $needconfirm->{$error} ) { $issue_error = $error; $confirmed = 0; diff --git a/t/db_dependent/Circulation.t b/t/db_dependent/Circulation.t index 66eae24082..626178c3d9 100755 --- a/t/db_dependent/Circulation.t +++ b/t/db_dependent/Circulation.t @@ -3559,7 +3559,7 @@ subtest 'CanBookBeIssued & CircConfirmItemParts' => sub { my $dt_due = dt_from_string->add( days => 3 ); my ( $issuingimpossible, $needsconfirmation ) = CanBookBeIssued( $patron, $item->barcode, $dt_due, undef, undef, undef ); - is_deeply( $needsconfirmation, { additional_materials => 'includes DVD' }, 'Item needs confirmation of additional parts' ); + is_deeply( $needsconfirmation, { ADDITIONAL_MATERIALS => 'includes DVD' }, 'Item needs confirmation of additional parts' ); }; subtest 'Do not return on renewal (LOST charge)' => sub { -- 2.20.1