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 <david@davidnind.com>

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
(cherry picked from commit 3a2dcf0733)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
(cherry picked from commit 11c73ed5b8)
Signed-off-by: Matt Blenkinsop <matt.blenkinsop@ptfs-europe.com>
This commit is contained in:
Martin Renvoize 2023-09-12 16:24:19 +01:00 committed by Matt Blenkinsop
parent e87d5dff12
commit 86699e47f8
3 changed files with 9 additions and 1 deletions

View file

@ -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) {

View file

@ -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);

View file

@ -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;