From f070a48040ec2a44301794bdab460f5d1c41e5f7 Mon Sep 17 00:00:00 2001 From: Matt Blenkinsop Date: Mon, 15 Jul 2024 14:09:10 +0000 Subject: [PATCH] Bug 28924: (QA follow-up) Terminology fixes Signed-off-by: Katrin Fischer --- C4/Circulation.pm | 2 +- Koha/Patron.pm | 21 ++++++------ installer/data/mysql/kohastructure.sql | 6 ++-- .../prog/en/modules/admin/categories.tt | 33 ++++++++++--------- t/db_dependent/Koha/Patron.t | 22 ++++++------- 5 files changed, 44 insertions(+), 40 deletions(-) diff --git a/C4/Circulation.pm b/C4/Circulation.pm index 44f48b2e11..70ccd7fb54 100644 --- a/C4/Circulation.pm +++ b/C4/Circulation.pm @@ -819,7 +819,7 @@ sub CanBookBeIssued { # # BORROWER STATUS # - my $patron_borrowing_status = $patron->can_borrow(); + my $patron_borrowing_status = $patron->can_checkout(); if ( $patron->category->category_type eq 'X' && ( $item_object->barcode )) { # stats only borrower -- add entry to statistics table, and return issuingimpossible{STATS} = 1 . C4::Stats::UpdateStats( diff --git a/Koha/Patron.pm b/Koha/Patron.pm index 0dc98dc4c9..2034a6d137 100644 --- a/Koha/Patron.pm +++ b/Koha/Patron.pm @@ -2902,12 +2902,13 @@ sub consent { } -=head3 can_borrow -my $patron_borrowing_status = $patron->can_borrow( { patron => $patron } ); +=head3 can_checkout -This method determines whether a borrower is able to borrow based on various parameters. -- Debarrments +my $patron_borrowing_status = $patron->can_checkout( { patron => $patron } ); + +This method determines whether a patron is able to borrow based on various parameters. +- Restrictions - Expiry - Charges @@ -2915,19 +2916,19 @@ If any blockers are found, these are returned in a hash =cut -sub can_borrow { +sub can_checkout { my ($self) = @_; - my $status = { can_borrow => 1 }; + my $status = { can_checkout => 1 }; - $status->{debarred} = 1 if $self->debarred; - $status->{expired} = 1 if $self->is_expired; - $status->{can_borrow} = 0 if $status->{debarred} || $status->{expired}; + $status->{debarred} = 1 if $self->debarred; + $status->{expired} = 1 if $self->is_expired; + $status->{can_checkout} = 0 if $status->{debarred} || $status->{expired}; # Patron charges my $patron_charge_limits = $self->is_patron_inside_charge_limits(); %$status = ( %$status, %$patron_charge_limits ); - $status->{can_borrow} = 0 + $status->{can_checkout} = 0 if $patron_charge_limits->{noissuescharge}->{overlimit} || $patron_charge_limits->{NoIssuesChargeGuarantees}->{overlimit} || $patron_charge_limits->{NoIssuesChargeGuarantorsWithGuarantees}->{overlimit}; diff --git a/installer/data/mysql/kohastructure.sql b/installer/data/mysql/kohastructure.sql index 4715341cd1..8a6a1c2617 100644 --- a/installer/data/mysql/kohastructure.sql +++ b/installer/data/mysql/kohastructure.sql @@ -1806,9 +1806,9 @@ CREATE TABLE `categories` ( `min_password_length` smallint(6) DEFAULT NULL COMMENT 'set minimum password length for patrons in this category', `require_strong_password` tinyint(1) DEFAULT NULL COMMENT 'set required password strength for patrons in this category', `exclude_from_local_holds_priority` tinyint(1) DEFAULT NULL COMMENT 'Exclude patrons of this category from local holds priority', - `noissuescharge` int(11) DEFAULT NULL COMMENT 'define maximum amount withstanding before checkouts are blocked', - `noissueschargeguarantees` int(11) DEFAULT NULL COMMENT 'define maximum amount withstanding before checkouts are blocked', - `noissueschargeguarantorswithguarantees` int(11) DEFAULT NULL COMMENT 'define maximum amount withstanding before checkouts are blocked', + `noissuescharge` int(11) DEFAULT NULL COMMENT 'define maximum amount outstanding before checkouts are blocked', + `noissueschargeguarantees` int(11) DEFAULT NULL COMMENT 'define maximum amount that the guarantees of a patron in this category can have outstanding before checkouts are blocked', + `noissueschargeguarantorswithguarantees` int(11) DEFAULT NULL COMMENT 'define maximum amount that the guarantors with guarantees of a patron in this category can have outstanding before checkouts are blocked', PRIMARY KEY (`categorycode`), UNIQUE KEY `categorycode` (`categorycode`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/categories.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/categories.tt index 89fa8070ef..389533b39a 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/categories.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/categories.tt @@ -446,16 +446,19 @@
If Yes, holds placed by patrons of this category will not be given priority
  • - - + + +
    If set, this will override the global value set in the noissuescharge preference
  • - - + + +
    If set, this will override the global value set in the NoIssuesChargeGuarantees preference
  • - - + + +
    If set, this will override the global value set in the NoIssuesChargeGuarantorsWithGuarantees preference
  • @@ -602,9 +605,9 @@ Can be guarantee Default privacy Exclude from local holds priority - No issues charge - No issues charge guarantees - No issues charge guarantors with guarantees + Checkout charge limit + Guarantees checkout charge limit + Guarantors with guarantees checkout charge limit Actions @@ -743,19 +746,19 @@ [% END %] [% IF (category.noissuescharge) %] - [% category.noissuescharge | html %] + [% category.noissuescharge | $Price %] [% ELSE %] - 0.00 + [% 0.00 | $Price %] [% END %] [% IF (category.noissueschargeguarantees) %] - [% category.noissueschargeguarantees | html %] + [% category.noissueschargeguarantees | $Price %] [% ELSE %] - 0.00 + [% 0.00 | $Price %] [% END %] [% IF (category.noissueschargeguarantorswithguarantees) %] - [% category.noissueschargeguarantorswithguarantees | html %] + [% category.noissueschargeguarantorswithguarantees | $Price %] [% ELSE %] - 0.00 + [% 0.00 | $Price %] [% END %] Edit diff --git a/t/db_dependent/Koha/Patron.t b/t/db_dependent/Koha/Patron.t index 96f43fa4f8..bf4aeef097 100755 --- a/t/db_dependent/Koha/Patron.t +++ b/t/db_dependent/Koha/Patron.t @@ -2250,7 +2250,7 @@ subtest 'guarantor requirements tests' => sub { $schema->storage->txn_rollback; }; -subtest 'can_borrow() tests' => sub { +subtest 'can_checkout() tests' => sub { plan tests => 11; $schema->storage->txn_begin; @@ -2277,15 +2277,15 @@ subtest 'can_borrow() tests' => sub { my $patron_borrowing_status; $patron->debarred(1); - $patron_borrowing_status = $patron->can_borrow( { patron => $patron } ); - is( $patron_borrowing_status->{can_borrow}, 0, 'Debarred patron blocked from borrowing' ); - is( $patron_borrowing_status->{debarred}, 1, 'Blocker correctly identified and returned' ); + $patron_borrowing_status = $patron->can_checkout( { patron => $patron } ); + is( $patron_borrowing_status->{can_checkout}, 0, 'Debarred patron blocked from borrowing' ); + is( $patron_borrowing_status->{debarred}, 1, 'Blocker correctly identified and returned' ); $patron->debarred(0); $patron->dateexpiry( dt_from_string->subtract( days => 1 ) ); - $patron_borrowing_status = $patron->can_borrow( { patron => $patron } ); - is( $patron_borrowing_status->{can_borrow}, 0, 'Expired patron blocked from borrowing' ); - is( $patron_borrowing_status->{expired}, 1, 'Blocker correctly identified and returned' ); + $patron_borrowing_status = $patron->can_checkout( { patron => $patron } ); + is( $patron_borrowing_status->{can_checkout}, 0, 'Expired patron blocked from borrowing' ); + is( $patron_borrowing_status->{expired}, 1, 'Blocker correctly identified and returned' ); $patron->dateexpiry(undef); my $child = $builder->build_object( { class => 'Koha::Patrons' } ); @@ -2328,18 +2328,18 @@ subtest 'can_borrow() tests' => sub { } )->store; - $patron_borrowing_status = $patron->can_borrow( { patron => $patron } ); + $patron_borrowing_status = $patron->can_checkout( { patron => $patron } ); is( $patron_borrowing_status->{noissuescharge}->{charge}, 11, "Only patron's fines are reported in total" ); is( $patron_borrowing_status->{noissuescharge}->{limit}, 10, "Limit correctly identified at category level" ); is( $patron_borrowing_status->{noissuescharge}->{overlimit}, 1, "Patron is over the charge limit" ); - is( $patron_borrowing_status->{can_borrow}, 0, "Patron is over the charge limit and is blocked from borrowing" ); + is( $patron_borrowing_status->{can_checkout}, 0, "Patron is over the charge limit and is blocked from borrowing" ); $patron->category->noissuescharge(undef); - $patron_borrowing_status = $patron->can_borrow( { patron => $patron } ); + $patron_borrowing_status = $patron->can_checkout( { patron => $patron } ); is( $patron_borrowing_status->{noissuescharge}->{limit}, 50, "Limit correctly identified at global syspref level" ); is( $patron_borrowing_status->{noissuescharge}->{overlimit}, 0, "Patron is within the charge limit" ); - is( $patron_borrowing_status->{can_borrow}, 1, "Patron is within the charge limit and can borrow" ); + is( $patron_borrowing_status->{can_checkout}, 1, "Patron is within the charge limit and can borrow" ); $schema->storage->txn_rollback; }; -- 2.39.5