From 31a3a7ed9353958e3f684fffc62316caf21e3e77 Mon Sep 17 00:00:00 2001 From: Colin Campbell Date: Tue, 21 Jun 2011 12:11:05 +0100 Subject: [PATCH] Bug 5549 : Sip scripts should handle dt due dates --- C4/SIP/ILS/Patron.pm | 1 - C4/SIP/ILS/Transaction/Checkout.pm | 13 ++++++++----- C4/SIP/ILS/Transaction/Renew.pm | 3 +-- C4/SIP/ILS/Transaction/RenewAll.pm | 4 ++-- 4 files changed, 11 insertions(+), 10 deletions(-) diff --git a/C4/SIP/ILS/Patron.pm b/C4/SIP/ILS/Patron.pm index 95981fb227..99fd6e7edf 100644 --- a/C4/SIP/ILS/Patron.pm +++ b/C4/SIP/ILS/Patron.pm @@ -17,7 +17,6 @@ use Data::Dumper; use C4::Debug; use C4::Context; -# use C4::Dates; use C4::Koha; use C4::Members; use C4::Reserves; diff --git a/C4/SIP/ILS/Transaction/Checkout.pm b/C4/SIP/ILS/Transaction/Checkout.pm index 617a4ebc5f..d483e1625e 100644 --- a/C4/SIP/ILS/Transaction/Checkout.pm +++ b/C4/SIP/ILS/Transaction/Checkout.pm @@ -122,11 +122,14 @@ sub do_checkout { $debug and warn "do_checkout: calling AddIssue(\$borrower,$barcode, undef, 0)\n" # . "w/ \$borrower: " . Dumper($borrower) . "w/ C4::Context->userenv: " . Dumper(C4::Context->userenv); - my $c4due = AddIssue($borrower, $barcode, undef, 0); - my $due = $c4due->output('iso') || undef; - $debug and warn "Item due: $due"; - $self->{'due'} = $due; - $self->{item}->due_date($due); + my $due_dt = AddIssue($borrower, $barcode, undef, 0); + if ($due_dt) { + $self->{due} = $due_dt->clone(); + } else { + $self->{due} = undef; + } + + #$self->{item}->due_date($due); $self->ok(1); return $self; } diff --git a/C4/SIP/ILS/Transaction/Renew.pm b/C4/SIP/ILS/Transaction/Renew.pm index 73acaa3456..d7f949b091 100644 --- a/C4/SIP/ILS/Transaction/Renew.pm +++ b/C4/SIP/ILS/Transaction/Renew.pm @@ -37,8 +37,7 @@ sub do_renew_for ($$) { my $borrower = shift; my ($renewokay,$renewerror) = CanBookBeRenewed($borrower->{borrowernumber},$self->{item}->{itemnumber}); if ($renewokay){ - my $datedue = AddIssue( $borrower, $self->{item}->id, undef, 0 ); - $self->{due} = $datedue; + $self->{due} = AddIssue( $borrower, $self->{item}->id, undef, 0 ); $self->renewal_ok(1); } else { $self->screen_msg(($self->screen_msg || '') . " " . $renewerror); diff --git a/C4/SIP/ILS/Transaction/RenewAll.pm b/C4/SIP/ILS/Transaction/RenewAll.pm index 2e49bf7ed2..10fb27d7de 100644 --- a/C4/SIP/ILS/Transaction/RenewAll.pm +++ b/C4/SIP/ILS/Transaction/RenewAll.pm @@ -53,8 +53,8 @@ sub do_renew_all { $self->{item} = $item; $self->do_renew_for($borrower); if ($self->ok) { - $item->{due_date} = $self->{due}; - push @{$self->{renewed} }, $item_id; + $item->{due_date} = $self->{due}->clone(); + push @{$self->renewed }, $item_id; } else { push @{$self->{unrenewed}}, $item_id; } -- 2.39.5