From 10f88107630ecdcb35f8034525baa9c032bbb8fc Mon Sep 17 00:00:00 2001 From: Martin Renvoize Date: Tue, 12 Sep 2023 16:24:19 +0100 Subject: [PATCH] Bug 34767: Pass fee_ack into ::Transaction::Renew(All) Content-Type: text/plain; charset=utf-8 This patch copies the $fee_ack field into the generated ::Transaction::Renew|All objects such that the fee acknowldegement flag is respected for renewals. Test plan To test: 1) Add a rental charge to an itemtype 2) Checkout an item of that itemtype to a user 3) Attempt a renewal of that item via SIP2 and note that it fails sip_cli_emulator.pl -a localhost -p 6001 -su term1 -sp term1 -l CPL --patron 23529000035676 --item 39999000007756 -m renew 4) Pass the fee_acknowledgement bit in renewal and note the renewal still fails. sip_cli_emulator.pl -a localhost -p 6001 -su term1 -sp term1 -l CPL --fee-acknowledged Y --patron 23529000035676 --item 39999000007756 -m renew 5) Apply patch and note the above now succeeds sip_cli_emulator.pl -a localhost -p 6001 -su term1 -sp term1 -l CPL --fee-acknowledged Y --patron 23529000035676 --item 39999000007756 -m renew Signed-off-by: David Nind Signed-off-by: Marcel de Rooy --- C4/SIP/ILS.pm | 7 ++++++- C4/SIP/ILS/Transaction/Renew.pm | 2 ++ C4/SIP/ILS/Transaction/RenewAll.pm | 1 + 3 files changed, 9 insertions(+), 1 deletion(-) diff --git a/C4/SIP/ILS.pm b/C4/SIP/ILS.pm index 0c58b07f15..9bba3c80f5 100644 --- a/C4/SIP/ILS.pm +++ b/C4/SIP/ILS.pm @@ -469,7 +469,6 @@ sub renew { $trans = C4::SIP::ILS::Transaction::Renew->new(); $trans->patron($patron = C4::SIP::ILS::Patron->new( $patron_id )); - if (!$patron) { $trans->screen_msg("Invalid patron barcode."); return $trans; @@ -505,6 +504,9 @@ sub renew { # } $trans->item($item); + if ($fee_ack) { + $trans->fee_ack($fee_ack); + } if (!defined($item)) { $trans->screen_msg("Item not checked out to " . $patron->name); # not checked out to $patron_id @@ -526,6 +528,9 @@ sub renew_all { my $trans; $trans = C4::SIP::ILS::Transaction::RenewAll->new(); + if ($fee_ack) { + $trans->fee_ack($fee_ack); + } $trans->patron($patron = C4::SIP::ILS::Patron->new( $patron_id )); if (defined $patron) { diff --git a/C4/SIP/ILS/Transaction/Renew.pm b/C4/SIP/ILS/Transaction/Renew.pm index b3e3889655..0d66326543 100644 --- a/C4/SIP/ILS/Transaction/Renew.pm +++ b/C4/SIP/ILS/Transaction/Renew.pm @@ -6,6 +6,7 @@ package C4::SIP::ILS::Transaction::Renew; use warnings; use strict; +use C4::SIP::Sip qw( siplog ); use C4::Circulation qw( CanBookBeRenewed GetIssuingCharges AddIssue ); use Koha::Patrons; @@ -64,6 +65,7 @@ sub do_renew_for { sub do_renew { my $self = shift; + siplog('LOG_DEBUG', "ILS::Transaction::Renew performing renewal..."); my $patron = Koha::Patrons->find( $self->{patron}->borrowernumber ); $patron or return; # FIXME we should log that return $self->do_renew_for($patron); diff --git a/C4/SIP/ILS/Transaction/RenewAll.pm b/C4/SIP/ILS/Transaction/RenewAll.pm index 12cefea25c..ef75ae11ef 100644 --- a/C4/SIP/ILS/Transaction/RenewAll.pm +++ b/C4/SIP/ILS/Transaction/RenewAll.pm @@ -33,6 +33,7 @@ sub new { sub do_renew_all { my $self = shift; + siplog('LOG_DEBUG', "ILS::Transaction::RenewAll performing renewals..."); my $patron = Koha::Patrons->find( $self->{patron}->{borrowernumber} ); my $all_ok = 1; $self->{renewed} = []; -- 2.30.2