Bug 28924: (QA follow-up) Terminology fixes

Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
This commit is contained in:
Matt Blenkinsop 2024-07-15 14:09:10 +00:00 committed by Katrin Fischer
parent e147f7b60c
commit f070a48040
Signed by: kfischer
GPG key ID: 0EF6E2C03357A834
5 changed files with 44 additions and 40 deletions

View file

@ -819,7 +819,7 @@ sub CanBookBeIssued {
# #
# BORROWER STATUS # 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 )) { if ( $patron->category->category_type eq 'X' && ( $item_object->barcode )) {
# stats only borrower -- add entry to statistics table, and return issuingimpossible{STATS} = 1 . # stats only borrower -- add entry to statistics table, and return issuingimpossible{STATS} = 1 .
C4::Stats::UpdateStats( C4::Stats::UpdateStats(

View file

@ -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. my $patron_borrowing_status = $patron->can_checkout( { patron => $patron } );
- Debarrments
This method determines whether a patron is able to borrow based on various parameters.
- Restrictions
- Expiry - Expiry
- Charges - Charges
@ -2915,19 +2916,19 @@ If any blockers are found, these are returned in a hash
=cut =cut
sub can_borrow { sub can_checkout {
my ($self) = @_; my ($self) = @_;
my $status = { can_borrow => 1 }; my $status = { can_checkout => 1 };
$status->{debarred} = 1 if $self->debarred; $status->{debarred} = 1 if $self->debarred;
$status->{expired} = 1 if $self->is_expired; $status->{expired} = 1 if $self->is_expired;
$status->{can_borrow} = 0 if $status->{debarred} || $status->{expired}; $status->{can_checkout} = 0 if $status->{debarred} || $status->{expired};
# Patron charges # Patron charges
my $patron_charge_limits = $self->is_patron_inside_charge_limits(); my $patron_charge_limits = $self->is_patron_inside_charge_limits();
%$status = ( %$status, %$patron_charge_limits ); %$status = ( %$status, %$patron_charge_limits );
$status->{can_borrow} = 0 $status->{can_checkout} = 0
if $patron_charge_limits->{noissuescharge}->{overlimit} if $patron_charge_limits->{noissuescharge}->{overlimit}
|| $patron_charge_limits->{NoIssuesChargeGuarantees}->{overlimit} || $patron_charge_limits->{NoIssuesChargeGuarantees}->{overlimit}
|| $patron_charge_limits->{NoIssuesChargeGuarantorsWithGuarantees}->{overlimit}; || $patron_charge_limits->{NoIssuesChargeGuarantorsWithGuarantees}->{overlimit};

View file

@ -1806,9 +1806,9 @@ CREATE TABLE `categories` (
`min_password_length` smallint(6) DEFAULT NULL COMMENT 'set minimum password length for patrons in this category', `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', `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', `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', `noissuescharge` int(11) DEFAULT NULL COMMENT 'define maximum amount outstanding before checkouts are blocked',
`noissueschargeguarantees` int(11) DEFAULT NULL COMMENT 'define maximum amount withstanding 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 withstanding 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`), PRIMARY KEY (`categorycode`),
UNIQUE KEY `categorycode` (`categorycode`) UNIQUE KEY `categorycode` (`categorycode`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

View file

@ -446,16 +446,19 @@
<div class="hint">If <i>Yes</i>, holds placed by patrons of this category will not be given priority</div> <div class="hint">If <i>Yes</i>, holds placed by patrons of this category will not be given priority</div>
</li> </li>
<li> <li>
<label for="noissuescharge">No issues charge: </label> <label for="noissuescharge">Checkout charge limit: </label>
<input type="text" name="noissuescharge" id="noissuescharge" value="[% category.noissuescharge | html %]" size="3" maxlength="3" /> <input type="text" name="noissuescharge" id="noissuescharge" value="[% category.noissuescharge | $Price on_editing => 1 %]" class="decimal" size="3" maxlength="3" />
<div class="hint">If set, this will override the global value set in the <a href="/cgi-bin/koha/admin/preferences.pl?op=search&searchfield=noissuescharge&ok=Search">noissuescharge</a> preference</div>
</li> </li>
<li> <li>
<label for="noissueschargeguarantees">No issues charge guarantees: </label> <label for="noissueschargeguarantees">Guarantees checkout charge limit: </label>
<input type="text" name="noissueschargeguarantees" id="noissueschargeguarantees" value="[% category.noissueschargeguarantees | html %]" size="3" maxlength="3" /> <input type="text" name="noissueschargeguarantees" id="noissueschargeguarantees" value="[% category.noissueschargeguarantees | $Price on_editing => 1 %]" class="decimal" size="3" maxlength="3" />
<div class="hint">If set, this will override the global value set in the <a href="/cgi-bin/koha/admin/preferences.pl?op=search&searchfield=noissuescharge&ok=Search">NoIssuesChargeGuarantees</a> preference</div>
</li> </li>
<li> <li>
<label for="noissueschargeguarantorswithguarantees">No issues charge guarantors with guarantees: </label> <label for="noissueschargeguarantorswithguarantees">Guarantors with guarantees checkout charge limit: </label>
<input type="text" name="noissueschargeguarantorswithguarantees" id="noissueschargeguarantorswithguarantees" value="[% category.noissueschargeguarantorswithguarantees | html %]" size="3" maxlength="3" /> <input type="text" name="noissueschargeguarantorswithguarantees" id="noissueschargeguarantorswithguarantees" value="[% category.noissueschargeguarantorswithguarantees | $Price on_editing => 1 %]" class="decimal" size="3" maxlength="3" />
<div class="hint">If set, this will override the global value set in the <a href="/cgi-bin/koha/admin/preferences.pl?op=search&searchfield=noissuescharge&ok=Search">NoIssuesChargeGuarantorsWithGuarantees</a> preference</div>
</li> </li>
</ol> </ol>
</fieldset> </fieldset>
@ -602,9 +605,9 @@
<th scope="col">Can be guarantee</th> <th scope="col">Can be guarantee</th>
<th scope="col">Default privacy</th> <th scope="col">Default privacy</th>
<th scope="col">Exclude from local holds priority</th> <th scope="col">Exclude from local holds priority</th>
<th scope="col">No issues charge</th> <th scope="col">Checkout charge limit</th>
<th scope="col">No issues charge guarantees</th> <th scope="col">Guarantees checkout charge limit</th>
<th scope="col">No issues charge guarantors with guarantees</th> <th scope="col">Guarantors with guarantees checkout charge limit</th>
<th scope="col">Actions</th> <th scope="col">Actions</th>
</tr> </tr>
</thead> </thead>
@ -743,19 +746,19 @@
[% END %] [% END %]
</td> </td>
[% IF (category.noissuescharge) %] [% IF (category.noissuescharge) %]
<td>[% category.noissuescharge | html %]</td> <td>[% category.noissuescharge | $Price %]</td>
[% ELSE %] [% ELSE %]
<td>0.00</td> <td>[% 0.00 | $Price %]</td>
[% END %] [% END %]
[% IF (category.noissueschargeguarantees) %] [% IF (category.noissueschargeguarantees) %]
<td>[% category.noissueschargeguarantees | html %]</td> <td>[% category.noissueschargeguarantees | $Price %]</td>
[% ELSE %] [% ELSE %]
<td>0.00</td> <td>[% 0.00 | $Price %]</td>
[% END %] [% END %]
[% IF (category.noissueschargeguarantorswithguarantees) %] [% IF (category.noissueschargeguarantorswithguarantees) %]
<td>[% category.noissueschargeguarantorswithguarantees | html %]</td> <td>[% category.noissueschargeguarantorswithguarantees | $Price %]</td>
[% ELSE %] [% ELSE %]
<td>0.00</td> <td>[% 0.00 | $Price %]</td>
[% END %] [% END %]
<td class="actions"> <td class="actions">
<a class="btn btn-default btn-xs" href="/cgi-bin/koha/admin/categories.pl?op=add_form&amp;categorycode=[% category.categorycode |uri %]"><i class="fa-solid fa-pencil" aria-hidden="true"></i> Edit</a> <a class="btn btn-default btn-xs" href="/cgi-bin/koha/admin/categories.pl?op=add_form&amp;categorycode=[% category.categorycode |uri %]"><i class="fa-solid fa-pencil" aria-hidden="true"></i> Edit</a>

View file

@ -2250,7 +2250,7 @@ subtest 'guarantor requirements tests' => sub {
$schema->storage->txn_rollback; $schema->storage->txn_rollback;
}; };
subtest 'can_borrow() tests' => sub { subtest 'can_checkout() tests' => sub {
plan tests => 11; plan tests => 11;
$schema->storage->txn_begin; $schema->storage->txn_begin;
@ -2277,15 +2277,15 @@ subtest 'can_borrow() tests' => sub {
my $patron_borrowing_status; my $patron_borrowing_status;
$patron->debarred(1); $patron->debarred(1);
$patron_borrowing_status = $patron->can_borrow( { patron => $patron } ); $patron_borrowing_status = $patron->can_checkout( { patron => $patron } );
is( $patron_borrowing_status->{can_borrow}, 0, 'Debarred patron blocked from borrowing' ); is( $patron_borrowing_status->{can_checkout}, 0, 'Debarred patron blocked from borrowing' );
is( $patron_borrowing_status->{debarred}, 1, 'Blocker correctly identified and returned' ); is( $patron_borrowing_status->{debarred}, 1, 'Blocker correctly identified and returned' );
$patron->debarred(0); $patron->debarred(0);
$patron->dateexpiry( dt_from_string->subtract( days => 1 ) ); $patron->dateexpiry( dt_from_string->subtract( days => 1 ) );
$patron_borrowing_status = $patron->can_borrow( { patron => $patron } ); $patron_borrowing_status = $patron->can_checkout( { patron => $patron } );
is( $patron_borrowing_status->{can_borrow}, 0, 'Expired patron blocked from borrowing' ); is( $patron_borrowing_status->{can_checkout}, 0, 'Expired patron blocked from borrowing' );
is( $patron_borrowing_status->{expired}, 1, 'Blocker correctly identified and returned' ); is( $patron_borrowing_status->{expired}, 1, 'Blocker correctly identified and returned' );
$patron->dateexpiry(undef); $patron->dateexpiry(undef);
my $child = $builder->build_object( { class => 'Koha::Patrons' } ); my $child = $builder->build_object( { class => 'Koha::Patrons' } );
@ -2328,18 +2328,18 @@ subtest 'can_borrow() tests' => sub {
} }
)->store; )->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}->{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}->{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->{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->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}->{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->{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; $schema->storage->txn_rollback;
}; };