From 3b0bc03ad46e82d2d813227f46d6e7420bd6c189 Mon Sep 17 00:00:00 2001 From: Kyle M Hall Date: Wed, 13 Jul 2022 14:31:09 +0000 Subject: [PATCH] Bug 12225: Use ProcessOfflineIssue Signed-off-by: David Nind Signed-off-by: Martin Renvoize Signed-off-by: Tomas Cohen Arazi --- C4/Circulation.pm | 1 + C4/SIP/ILS/Transaction/Checkout.pm | 24 ++++++++++++++---------- 2 files changed, 15 insertions(+), 10 deletions(-) diff --git a/C4/Circulation.pm b/C4/Circulation.pm index 7b028bed0f..254f893a12 100644 --- a/C4/Circulation.pm +++ b/C4/Circulation.pm @@ -123,6 +123,7 @@ BEGIN { DeleteOfflineOperation ProcessOfflineOperation ProcessOfflinePayment + ProcessOfflineIssue ); push @EXPORT_OK, '_GetCircControlBranch'; # This is wrong! } diff --git a/C4/SIP/ILS/Transaction/Checkout.pm b/C4/SIP/ILS/Transaction/Checkout.pm index c1c1e18eeb..d9056f1c82 100644 --- a/C4/SIP/ILS/Transaction/Checkout.pm +++ b/C4/SIP/ILS/Transaction/Checkout.pm @@ -15,7 +15,7 @@ use CGI qw ( -utf8 ); use C4::SIP::ILS::Transaction; use C4::Context; -use C4::Circulation qw( AddIssue GetIssuingCharges CanBookBeIssued ); +use C4::Circulation qw( AddIssue GetIssuingCharges CanBookBeIssued ProcessOfflineIssue ); use C4::Members; use Koha::DateUtils qw( dt_from_string ); @@ -127,19 +127,23 @@ sub do_checkout { } } - if ( $no_block_due_date ) { - $overridden_duedate = $no_block_due_date; - $noerror = 1; - } - - unless ($noerror) { + if ( $noerror == 0 && !$no_block_due_date ) { $self->ok(0); return $self; } - # can issue - my $issue = AddIssue( $patron->unblessed, $barcode, $overridden_duedate, 0 ); - $self->{due} = $self->duedatefromissue($issue, $itemnumber); + if ( $no_block_due_date ) { + $overridden_duedate = $no_block_due_date; + ProcessOfflineIssue({ + cardnumber => $patron->cardnumber, + barcode => $barcode, + timestamp => $no_block_due_date, + }); + } else { + # can issue + my $issue = AddIssue( $patron->unblessed, $barcode, $overridden_duedate, 0 ); + $self->{due} = $self->duedatefromissue($issue, $itemnumber); + } $self->ok(1); return $self; -- 2.39.5