From b3b7f82fef0736f481a703dae47bf7b9f062ef26 Mon Sep 17 00:00:00 2001 From: Matt Blenkinsop Date: Fri, 14 Jun 2024 14:45:18 +0000 Subject: [PATCH] Bug 28924: (QA follow-up) Use $self instead of $patron Sponsored-by: Cuyahoga County Public Library Signed-off-by: Nick Clemens Signed-off-by: Katrin Fischer --- C4/Circulation.pm | 4 ++-- C4/Members.pm | 2 +- C4/SIP/ILS/Patron.pm | 18 ++++++++++-------- Koha/Patron.pm | 9 ++++----- circ/circulation.pl | 2 +- members/moremember.pl | 2 +- 6 files changed, 19 insertions(+), 18 deletions(-) diff --git a/C4/Circulation.pm b/C4/Circulation.pm index d1bd350c03..cddd35fd79 100644 --- a/C4/Circulation.pm +++ b/C4/Circulation.pm @@ -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'}, diff --git a/C4/Members.pm b/C4/Members.pm index f7f6c383a6..1d93b49fa1 100644 --- a/C4/Members.pm +++ b/C4/Members.pm @@ -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; diff --git a/C4/SIP/ILS/Patron.pm b/C4/SIP/ILS/Patron.pm index bff5564fa7..b14a7e96c2 100644 --- a/C4/SIP/ILS/Patron.pm +++ b/C4/SIP/ILS/Patron.pm @@ -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; diff --git a/Koha/Patron.pm b/Koha/Patron.pm index 35fad91346..bb450d56f1 100644 --- a/Koha/Patron.pm +++ b/Koha/Patron.pm @@ -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} diff --git a/circ/circulation.pl b/circ/circulation.pl index 9cc67e8faa..74d21beaca 100755 --- a/circ/circulation.pl +++ b/circ/circulation.pl @@ -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} ); diff --git a/members/moremember.pl b/members/moremember.pl index ba24fbfa2e..773bc4190d 100755 --- a/members/moremember.pl +++ b/members/moremember.pl @@ -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, -- 2.39.5