
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "Evergreen ILS". The branch, main has been updated via d438e83692c58e04b50010451b88b121547f6c2c (commit) from 8e995fa82b234f4561d770e7d1cf001fda6ae0cb (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit d438e83692c58e04b50010451b88b121547f6c2c Author: Dan Briem <dbriem@harrisonpl.org> Date: Mon Jun 9 04:21:13 2025 +0000 LP#2113754 Precat checkouts are no longer possible for blocked patrons Removes the automatic override designation on precats and instead trims the asset.copy.status failure result from action.item_user_circ_test for precat requests, similar to how noncat requests trim no_item failure results. This permits consecutive precact checkouts on the same barcode without intermediary processing, while allowing other events to be returned to the client and optionally overriden. Signed-off-by: Dan Briem <dbriem@harrisonpl.org> Signed-off-by: Jane Sandberg <js7389@princeton.edu> diff --git a/Open-ILS/src/perlmods/lib/OpenILS/Application/Circ/Circulate.pm b/Open-ILS/src/perlmods/lib/OpenILS/Application/Circ/Circulate.pm index 9755d03868..e20473162a 100644 --- a/Open-ILS/src/perlmods/lib/OpenILS/Application/Circ/Circulate.pm +++ b/Open-ILS/src/perlmods/lib/OpenILS/Application/Circ/Circulate.pm @@ -161,7 +161,7 @@ __PACKAGE__->register_method( sub run_method { my( $self, $conn, $auth, $args ) = @_; translate_legacy_args($args); - $args->{override_args} = { all => 1, events => [] } unless defined $args->{override_args}; + $args->{override_args} = { all => 1 } unless defined $args->{override_args}; $args->{new_copy_alerts} ||= $self->api_level > 1 ? 1 : 0; my $api = $self->api_name; @@ -248,11 +248,6 @@ sub run_method { } elsif( $api =~ /checkout.full/ ) { $circulator->skip_permit_key(1); - if ( $circulator->request_precat && $circulator->editor->allowed('CREATE_PRECAT') ) { - $circulator->override(1); - $circulator->override_args->{all} = 0; # precat checkout should only override COPY_NOT_AVAILABLE, and whatever else the client requested - push @{$circulator->override_args->{events}}, 'COPY_NOT_AVAILABLE'; - } $circulator->do_permit(); $circulator->is_checkout(1); unless( $circulator->bail_out ) { @@ -1249,6 +1244,11 @@ sub run_patron_permit_scripts { # no_item result is OK during noncat checkout @trimmed_results = grep { ($_->{fail_part} || '') ne 'no_item' } @$results; + } elsif ($self->is_precat && $self->request_precat) { + # consecutive precat checkouts on the same barcode may + # result in an asset.copy.status failure - ignore it + @trimmed_results = grep { ($_->{fail_part} || '') ne 'asset.copy.status' } @$results; + } else { if ($self->checkout_is_for_hold) { diff --git a/Open-ILS/src/perlmods/live_t/lp2113754_precat_override_for_blocked_patrons.t b/Open-ILS/src/perlmods/live_t/lp2113754_precat_override_for_blocked_patrons.t new file mode 100644 index 0000000000..14070cf05d --- /dev/null +++ b/Open-ILS/src/perlmods/live_t/lp2113754_precat_override_for_blocked_patrons.t @@ -0,0 +1,120 @@ +#!perl +use strict; use warnings; +use Test::More tests => 5; +use OpenILS::Utils::TestUtils; +use OpenILS::Const qw/:const/; + +diag('LP2113754: Override precat checkouts for blocked patrons'); + +use constant { + AUTH_USERNAME => 'admin', + AUTH_PASSWORD => 'demo123', + AUTH_TYPE => 'staff', + WS_NAME => 'BR1-test-lp2113754.t', + WS_OU => 4, + PATRON_ID => 71, + COPY_BARCODE => 'you got a fast car' +}; + +my $U = 'OpenILS::Application::AppUtils'; +my $script = OpenILS::Utils::TestUtils->new; +$script->bootstrap; + + +subtest('Login in', sub { + plan tests => 4; + + # Log in + my $credentials = { + username => AUTH_USERNAME, + password => AUTH_PASSWORD, + type => AUTH_TYPE + }; + $script->authenticate($credentials); + ok($script->authtoken, 'Logged in'); + + + # Find or register workstation + my $ws = $script->find_or_register_workstation(WS_NAME, WS_OU); + ok(!ref($ws), 'Found or registered workstation'); + + + # Logout so we can use the workstation. + $script->logout(); + ok(!$script->authtoken, 'Logged out'); + + + # Log in with workstation + $credentials->{workstation} = WS_NAME; + $credentials->{password} = AUTH_PASSWORD; + $script->authenticate($credentials); + ok($script->authtoken, 'Logged in with workstation'); +}); + + +# Add PATRON_EXCEEDS_FINES penalty to patron +my $ausp = Fieldmapper::actor::user_standing_penalty->new(); +$ausp->org_unit(WS_OU); +$ausp->set_date('now'); +$ausp->staff(1); +$ausp->standing_penalty(OILS_PENALTY_PATRON_EXCEEDS_FINES); +$ausp->usr(PATRON_ID); + +my $response = $U->simplereq( + 'open-ils.actor', + 'open-ils.actor.user.note.apply', + $script->authtoken, $ausp +); +ok( + !ref($response), + 'Added PATRON_EXCEEDS_FINES penalty to patron' +); +$ausp->id($response); + + +# Attempt a checkout with an uncataloged barcode +my $checkout_args = { + copy_barcode => COPY_BARCODE, + patron_id => PATRON_ID +}; + +$response = $script->do_checkout($checkout_args); +is( + $response->{textcode}, 'ITEM_NOT_CATALOGED', + 'Checkout attempt returned ITEM_NOT_CATALOGED' +); + + +# Attempt a precat checkout (simulate precat dialog submission) +$checkout_args->{dummy_title} = 'Title'; +$checkout_args->{precat} = 1; + +$response = $script->do_checkout($checkout_args); +is( + $response->{textcode}, 'PATRON_EXCEEDS_FINES', + 'Precat checkout attempt returned PATRON_EXCEEDS_FINES' +); + + +# Attempt a precat checkout override +$response = $U->simplereq( + 'open-ils.circ', + 'open-ils.circ.checkout.full.override', + $script->authtoken, $checkout_args +); +ok( + !$U->event_code($response), + 'Precat checkout override was successful' +); + + +# Clean up +$script->do_checkin({ copy_barcode => COPY_BARCODE }); + +$U->simplereq( + 'open-ils.actor', + 'open-ils.actor.user.note.remove', + $script->authtoken, $ausp +); + +$script->logout(); ----------------------------------------------------------------------- Summary of changes: .../lib/OpenILS/Application/Circ/Circulate.pm | 12 +-- ...lp2113754_precat_override_for_blocked_patrons.t | 120 +++++++++++++++++++++ 2 files changed, 126 insertions(+), 6 deletions(-) create mode 100644 Open-ILS/src/perlmods/live_t/lp2113754_precat_override_for_blocked_patrons.t hooks/post-receive -- Evergreen ILS