From 86699e47f848e92dc13d42abfa409d077c2bf678 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) 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 Signed-off-by: Tomas Cohen Arazi (cherry picked from commit 3a2dcf0733733a92ddbf46fb863434a46060e279) Signed-off-by: Fridolin Somers (cherry picked from commit 11c73ed5b83402495ece7ffe5601f291e5c4247b) Signed-off-by: Matt Blenkinsop --- 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 82e1a9cfc2..8e4da378fa 100644 --- a/C4/SIP/ILS.pm +++ b/C4/SIP/ILS.pm @@ -436,7 +436,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; @@ -472,6 +471,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 @@ -493,6 +495,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 9e5579ee87..cfa5a016a3 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; @@ -62,6 +63,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->unblessed); diff --git a/C4/SIP/ILS/Transaction/RenewAll.pm b/C4/SIP/ILS/Transaction/RenewAll.pm index 5acd53efb7..d12769e5a5 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 = $self->{patron}; # SIP's patron my $borrower = Koha::Patrons->find( { cardnumber => $patron->id } )->unblessed; # Koha's patron my $all_ok = 1; -- 2.39.5