[Koha-patches] [PATCH] Bug 7454 Initialize return arrays in ILS/Transaction/RenewAll

Colin Campbell colin.campbell at ptfs-europe.com
Fri Jan 20 16:21:50 CET 2012


Explicitly clear these arrays and update them directly.
In practice item numbers were already in them when called
so that more items were being returned than were actually
renewed (or failed)
---
 C4/SIP/ILS/Transaction/RenewAll.pm |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/C4/SIP/ILS/Transaction/RenewAll.pm b/C4/SIP/ILS/Transaction/RenewAll.pm
index a712806..2e49bf7 100644
--- a/C4/SIP/ILS/Transaction/RenewAll.pm
+++ b/C4/SIP/ILS/Transaction/RenewAll.pm
@@ -38,6 +38,8 @@ sub do_renew_all {
 	my $patron = $self->{patron};							# SIP's  patron
 	my $borrower = GetMember('cardnumber'=>$patron->id);	# Koha's patron
 	my $all_ok = 1;
+    $self->{renewed} = [];
+    $self->{unrenewed} = [];
 	foreach my $itemx (@{$patron->{items}}) {
 		my $item_id = $itemx->{barcode};
 		my $item = new ILS::Item $item_id;
@@ -52,9 +54,9 @@ sub do_renew_all {
 		$self->do_renew_for($borrower);
 		if ($self->ok) {
 			$item->{due_date} = $self->{due};
-			push @{$self->renewed  }, $item_id;
+            push @{$self->{renewed}  }, $item_id;
 		} else {
-			push @{$self->unrenewed}, $item_id;
+            push @{$self->{unrenewed}}, $item_id;
 		}
 	}
 	$self->ok($all_ok);
-- 
1.7.5.1



More information about the Koha-patches mailing list