From e62e1be32375be9bcabf1cd3a2d444cab125f01d Mon Sep 17 00:00:00 2001 From: Kyle M Hall Date: Tue, 12 Dec 2023 06:57:42 -0500 Subject: [PATCH] Bug 18139: Tidy code Signed-off-by: Tomas Cohen Arazi Signed-off-by: Katrin Fischer --- C4/Circulation.pm | 18 +++++++++--------- t/db_dependent/Circulation/TooMany.t | 22 +++++++++++----------- 2 files changed, 20 insertions(+), 20 deletions(-) diff --git a/C4/Circulation.pm b/C4/Circulation.pm index 13ca90e9f2..562cad7267 100644 --- a/C4/Circulation.pm +++ b/C4/Circulation.pm @@ -1027,19 +1027,19 @@ sub CanBookBeIssued { # if TooMany max_allowed returns 0 the user doesn't have permission to check out this book if ( $toomany && not exists $needsconfirmation{RENEW_ISSUE} ) { if ( $toomany->{max_allowed} == 0 ) { - $needsconfirmation{PATRON_CANT} = 1; + $needsconfirmation{PATRON_CANT} = 1; $needsconfirmation{circulation_rule_PATRON_CANT} = $toomany->{circulation_rule}; } if ( C4::Context->preference("AllowTooManyOverride") ) { - $needsconfirmation{TOO_MANY} = $toomany->{reason}; - $needsconfirmation{current_loan_count} = $toomany->{count}; - $needsconfirmation{max_loans_allowed} = $toomany->{max_allowed}; - $needsconfirmation{circulation_rule_TOO_MANY} = $toomany->{circulation_rule}; + $needsconfirmation{TOO_MANY} = $toomany->{reason}; + $needsconfirmation{current_loan_count} = $toomany->{count}; + $needsconfirmation{max_loans_allowed} = $toomany->{max_allowed}; + $needsconfirmation{circulation_rule_TOO_MANY} = $toomany->{circulation_rule}; } else { - $issuingimpossible{TOO_MANY} = $toomany->{reason}; - $issuingimpossible{current_loan_count} = $toomany->{count}; - $issuingimpossible{max_loans_allowed} = $toomany->{max_allowed}; - $needsconfirmation{circulation_rule_TOO_MANY} = $toomany->{circulation_rule}; + $issuingimpossible{TOO_MANY} = $toomany->{reason}; + $issuingimpossible{current_loan_count} = $toomany->{count}; + $issuingimpossible{max_loans_allowed} = $toomany->{max_allowed}; + $needsconfirmation{circulation_rule_TOO_MANY} = $toomany->{circulation_rule}; } } diff --git a/t/db_dependent/Circulation/TooMany.t b/t/db_dependent/Circulation/TooMany.t index 44b0a9bffa..02e972a353 100755 --- a/t/db_dependent/Circulation/TooMany.t +++ b/t/db_dependent/Circulation/TooMany.t @@ -209,8 +209,8 @@ subtest '1 Issuingrule exist with onsiteissueqty=unlimited' => sub { is_deeply( $data, { - reason => 'TOO_MANY_CHECKOUTS', - count => 1, + reason => 'TOO_MANY_CHECKOUTS', + count => 1, max_allowed => 1, }, 'CO should not be allowed if ConsiderOnSiteCheckoutsAsNormalCheckouts == 1' @@ -289,15 +289,15 @@ subtest '1 Issuingrule exist: 1 CO allowed, 1 OSCO allowed. Do a CO' => sub { my $issue = C4::Circulation::AddIssue( $patron, $item->barcode, dt_from_string() ); like( $issue->issue_id, qr|^\d+$|, 'The issue should have been inserted' ); - t::lib::Mocks::mock_preference('ConsiderOnSiteCheckoutsAsNormalCheckouts', 0); + t::lib::Mocks::mock_preference( 'ConsiderOnSiteCheckoutsAsNormalCheckouts', 0 ); my $data = C4::Circulation::TooMany( $patron, $item ); my $rule = delete $data->{circulation_rule}; is( ref $rule, 'Koha::CirculationRule', 'Circulation rule was returned' ); is_deeply( $data, { - reason => 'TOO_MANY_CHECKOUTS', - count => 1, + reason => 'TOO_MANY_CHECKOUTS', + count => 1, max_allowed => 1, }, 'CO should not be allowed if ConsiderOnSiteCheckoutsAsNormalCheckouts == 0' @@ -357,7 +357,7 @@ subtest '1 Issuingrule exist: 1 CO allowed, 1 OSCO allowed, Do a OSCO' => sub { my $issue = C4::Circulation::AddIssue( $patron, $item->barcode, dt_from_string(), undef, undef, undef, { onsite_checkout => 1 } ); like( $issue->issue_id, qr|^\d+$|, 'The issue should have been inserted' ); - t::lib::Mocks::mock_preference('ConsiderOnSiteCheckoutsAsNormalCheckouts', 0); + t::lib::Mocks::mock_preference( 'ConsiderOnSiteCheckoutsAsNormalCheckouts', 0 ); is( C4::Circulation::TooMany( $patron, $item ), undef, @@ -369,22 +369,22 @@ subtest '1 Issuingrule exist: 1 CO allowed, 1 OSCO allowed, Do a OSCO' => sub { is_deeply( $data, { - reason => 'TOO_MANY_ONSITE_CHECKOUTS', - count => 1, + reason => 'TOO_MANY_ONSITE_CHECKOUTS', + count => 1, max_allowed => 1, }, 'OSCO should not be allowed if ConsiderOnSiteCheckoutsAsNormalCheckouts == 0' ); - t::lib::Mocks::mock_preference('ConsiderOnSiteCheckoutsAsNormalCheckouts', 1); + t::lib::Mocks::mock_preference( 'ConsiderOnSiteCheckoutsAsNormalCheckouts', 1 ); $data = C4::Circulation::TooMany( $patron, $item ); $rule = delete $data->{circulation_rule}; is( ref $rule, 'Koha::CirculationRule', 'Circulation rule was returned' ); is_deeply( $data, { - reason => 'TOO_MANY_CHECKOUTS', - count => 1, + reason => 'TOO_MANY_CHECKOUTS', + count => 1, max_allowed => 1, }, 'CO should not be allowed if ConsiderOnSiteCheckoutsAsNormalCheckouts == 1' -- 2.39.5