Bugzilla – Attachment 147969 Details for
Bug 32684
Implement SIP patron status field "too many items lost"
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 32684: (QA follow-up) Move too_many_lost to Patron
Bug-32684-QA-follow-up-Move-toomanylost-to-Patron.patch (text/plain), 4.52 KB, created by
Kyle M Hall (khall)
on 2023-03-08 17:38:37 UTC
(
hide
)
Description:
Bug 32684: (QA follow-up) Move too_many_lost to Patron
Filename:
MIME Type:
Creator:
Kyle M Hall (khall)
Created:
2023-03-08 17:38:37 UTC
Size:
4.52 KB
patch
obsolete
>From ea71f16c9d264e30558d35fade9fb1e8757cecad Mon Sep 17 00:00:00 2001 >From: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> >Date: Wed, 8 Mar 2023 12:45:53 +0000 >Subject: [PATCH] Bug 32684: (QA follow-up) Move too_many_lost to Patron > >Alternative implementation outside sub new. > >Test plan: >Run t/db_dependent/SIP/Message.t > >Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> > >Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com> >--- > C4/SIP/ILS/Patron.pm | 22 ++++++++++++++++++++-- > C4/SIP/ILS/Patron.pod | 4 ++-- > C4/SIP/Sip/MsgType.pm | 9 +-------- > 3 files changed, 23 insertions(+), 12 deletions(-) > >diff --git a/C4/SIP/ILS/Patron.pm b/C4/SIP/ILS/Patron.pm >index e5542bfb2b..0aea8ab63c 100644 >--- a/C4/SIP/ILS/Patron.pm >+++ b/C4/SIP/ILS/Patron.pm >@@ -26,10 +26,11 @@ use C4::Auth qw(checkpw); > use Koha::Items; > use Koha::Libraries; > use Koha::Patrons; >+use Koha::Checkouts; > > our $kp; # koha patron > >-=head1 Methods >+=head1 METHODS > > =cut > >@@ -209,7 +210,6 @@ my %fields = ( > too_many_overdue => 0, # for patron_status[6] > too_many_renewal => 0, # for patron_status[7] > too_many_claim_return => 0, # for patron_status[8] >- too_many_lost => 0, # for patron_status[9] > # excessive_fines => 0, # for patron_status[10] > # excessive_fees => 0, # for patron_status[11] > recall_overdue => 0, # for patron_status[12] >@@ -287,6 +287,24 @@ sub check_password { > } > > # A few special cases, not in AUTOLOADed %fields >+ >+=head2 too_many_lost >+ >+This method checks if number of checkouts of lost items exceeds a threshold (defined in server account). >+ >+=cut >+ >+sub too_many_lost { >+ my ( $self, $server ) = @_; >+ my $too_many_lost = 0; >+ if( $server && $server->{account} && ( my $lost_block_checkout = $server->{account}->{lost_block_checkout} )) { >+ my $lost_block_checkout_value = $server->{account}->{lost_block_checkout_value} // 1; >+ my $lost_checkouts = Koha::Checkouts->search({ borrowernumber => $self->borrowernumber, 'itemlost' => { '>=', $lost_block_checkout_value } }, { join => 'item'} )->count; >+ $too_many_lost = $lost_checkouts >= $lost_block_checkout; >+ } >+ return $too_many_lost; >+} >+ > sub fee_amount { > my $self = shift; > if ( $self->{fines} ) { >diff --git a/C4/SIP/ILS/Patron.pod b/C4/SIP/ILS/Patron.pod >index 71c167c0b9..80061b0172 100644 >--- a/C4/SIP/ILS/Patron.pod >+++ b/C4/SIP/ILS/Patron.pod >@@ -41,7 +41,7 @@ and to display information about the patron's borrowing activity. > $bool = $patron->too_many_overdue; > $bool = $patron->too_many_renewal; > $bool = $patron->too_many_claim_return; >- $bool = $patron->too_many_lost; >+ $bool = $patron->too_many_lost( $server ); > $bool = $patron->excessive_fines; > $bool = $patron->excessive_fees; > $bool = $patron->too_many_billed; >@@ -149,7 +149,7 @@ checking if they're authorized to perform various actions: > $bool = $patron-E<gt>too_many_overdue; > $bool = $patron-E<gt>too_many_renewal; > $bool = $patron-E<gt>too_many_claim_return; >- $bool = $patron-E<gt>too_many_lost; >+ $bool = $patron-E<gt>too_many_lost( $server ); > $bool = $patron-E<gt>excessive_fines; > $bool = $patron-E<gt>excessive_fees; > $bool = $patron-E<gt>too_many_billed; >diff --git a/C4/SIP/Sip/MsgType.pm b/C4/SIP/Sip/MsgType.pm >index 658eb5eb91..3510683d84 100644 >--- a/C4/SIP/Sip/MsgType.pm >+++ b/C4/SIP/Sip/MsgType.pm >@@ -1717,13 +1717,6 @@ sub patron_status_string { > > my $patron_status; > >- my $too_many_lost = 0; >- if ( my $lost_block_checkout = $server->{account}->{lost_block_checkout} ) { >- my $lost_block_checkout_value = $server->{account}->{lost_block_checkout_value} // 1; >- my $lost_checkouts = Koha::Checkouts->search({ borrowernumber => $patron->borrowernumber, 'itemlost' => { '>=', $lost_block_checkout_value } }, { join => 'item'} )->count; >- $too_many_lost = $lost_checkouts >= $lost_block_checkout; >- } >- > siplog( "LOG_DEBUG", "patron_status_string: %s charge_ok: %s", $patron->id, $patron->charge_ok ); > $patron_status = sprintf( > '%s%s%s%s%s%s%s%s%s%s%s%s%s%s', >@@ -1736,7 +1729,7 @@ sub patron_status_string { > $server->{account}->{overdues_block_checkout} ? boolspace( $patron->too_many_overdue ) : q{ }, > boolspace( $patron->too_many_renewal ), > boolspace( $patron->too_many_claim_return ), >- boolspace( $too_many_lost ), >+ boolspace( $patron->too_many_lost( $server ) ), > boolspace( $patron->excessive_fines ), > boolspace( $patron->excessive_fees ), > boolspace( $patron->recall_overdue ), >-- >2.39.1
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 32684
:
145491
|
145492
|
145493
|
145494
|
145786
|
147883
|
147884
|
147919
|
147920
|
147924
| 147969