Bug 28924: (QA follow-up) Use $self instead of $patron

Sponsored-by: Cuyahoga County Public Library <https://cuyahogalibrary.org/>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
This commit is contained in:
Matt Blenkinsop 2024-06-14 14:45:18 +00:00 committed by Katrin Fischer
parent c76dc7fb08
commit b3b7f82fef
Signed by: kfischer
GPG key ID: 0EF6E2C03357A834
6 changed files with 19 additions and 18 deletions

View file

@ -819,9 +819,9 @@ sub CanBookBeIssued {
#
# BORROWER STATUS
#
my $patron_borrowing_status = $patron->can_borrow({ patron => $patron });
my $patron_borrowing_status = $patron->can_borrow();
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(
{
branch => C4::Context->userenv->{'branch'},

View file

@ -135,7 +135,7 @@ sub patronflags {
my $dbh=C4::Context->dbh;
my $patron = Koha::Patrons->find( $patroninformation->{borrowernumber} );
my $account = $patron->account;
my $patron_charge_limits = $patron->is_patron_inside_charge_limits( { patron => $patron } );
my $patron_charge_limits = $patron->is_patron_inside_charge_limits();
if ( $patron_charge_limits->{noissuescharge}->{charge} > 0 ) {
my %flaginfo;
my $noissuescharge = $patron_charge_limits->{noissuescharge}->{limit} || 5;

View file

@ -99,23 +99,25 @@ sub new {
$dexpiry and $dexpiry =~ s/-//g; # YYYYMMDD
# Get fines and add fines for guarantees (depends on preference NoIssuesChargeGuarantees)
my $patron_charge_limits = $patron->is_patron_inside_charge_limits( { patron => $patron } );
my $fines_amount = $patron_charge_limits->{noissuescharge}->{charge};
my $patron_charge_limits = $patron->is_patron_inside_charge_limits();
my $fines_amount = $patron_charge_limits->{noissuescharge}->{charge};
my $personal_fines_amount = $fines_amount;
my $fee_limit = $patron_charge_limits->{noissuescharge}->{limit} || 5;
my $noissueschargeguarantorswithguarantees = $patron_charge_limits->{NoIssuesChargeGuarantorsWithGuarantees}->{limit};
my $fee_limit = $patron_charge_limits->{noissuescharge}->{limit} || 5;
my $noissueschargeguarantorswithguarantees =
$patron_charge_limits->{NoIssuesChargeGuarantorsWithGuarantees}->{limit};
my $noissueschargeguarantees = $patron_charge_limits->{NoIssuesChargeGuarantees}->{limit};
my $fines_msg = "";
my $fine_blocked = 0;
if( $patron_charge_limits->{noissuescharge}->{overlimit} ){
if ( $patron_charge_limits->{noissuescharge}->{overlimit} ) {
$fine_blocked = 1;
$fines_msg .= " -- " . "Patron blocked by fines" if $fine_blocked;
} elsif ( $noissueschargeguarantorswithguarantees ) {
} elsif ($noissueschargeguarantorswithguarantees) {
$fines_amount = $patron_charge_limits->{NoIssuesChargeGuarantorsWithGuarantees}->{charge};
$fine_blocked = $patron_charge_limits->{NoIssuesChargeGuarantorsWithGuarantees}->{overlimit};
$fines_msg .= " -- " . "Patron blocked by fines ($fines_amount) on related accounts" if $fine_blocked;
} elsif ( $noissueschargeguarantees ) {
if( $patron->guarantee_relationships->count ){
} elsif ($noissueschargeguarantees) {
if ( $patron->guarantee_relationships->count ) {
$fines_amount += $patron_charge_limits->{NoIssuesChargeGuarantees}->{charge};
$fine_blocked = $patron_charge_limits->{NoIssuesChargeGuarantees}->{overlimit};
$fines_msg .= " -- " . "Patron blocked by fines ($fines_amount) on guaranteed accounts" if $fine_blocked;

View file

@ -2916,17 +2916,16 @@ If any blockers are found, these are returned in a hash
=cut
sub can_borrow {
my ( $self, $args ) = @_;
my ( $self ) = @_;
my $patron = $args->{patron};
my $status = { can_borrow => 1 };
$status->{debarred} = 1 if $patron->debarred;
$status->{expired} = 1 if $patron->is_expired;
$status->{debarred} = 1 if $self->debarred;
$status->{expired} = 1 if $self->is_expired;
$status->{can_borrow} = 0 if $status->{debarred} || $status->{expired};
# Patron charges
my $patron_charge_limits = $patron->is_patron_inside_charge_limits( { patron => $patron } );
my $patron_charge_limits = $self->is_patron_inside_charge_limits();
%$status = ( %$status, %$patron_charge_limits );
$status->{can_borrow} = 0
if $patron_charge_limits->{noissuescharge}->{overlimit}

View file

@ -594,7 +594,7 @@ if ( $patron ) {
$template->param( is_anonymous => 1 );
$noissues = 1;
}
my $patron_charge_limits = $patron->is_patron_inside_charge_limits( { patron => $patron } );
my $patron_charge_limits = $patron->is_patron_inside_charge_limits();
if( $patron_charge_limits->{noissuescharge}->{charge} > 0 ) {
my $noissuescharge = $patron_charge_limits->{noissuescharge}->{limit} || 5; # FIXME If noissuescharge == 0 then 5, why??
$noissues ||= ( not C4::Context->preference("AllowFineOverride") and $patron_charge_limits->{noissuescharge}->{overlimit} );

View file

@ -242,7 +242,7 @@ my $issues = $patron->checkouts;
my $balance = 0;
$balance = $patron->account->balance;
my $patron_charge_limits = $patron->is_patron_inside_charge_limits( { patron => $patron } );
my $patron_charge_limits = $patron->is_patron_inside_charge_limits();
if ( $patron_charge_limits->{noissuescharge}->{charge} > 0 ) {
$template->param(
charges => 1,