Bug 15253: Add Koha::Logger based logging for SIP2
[koha-equinox.git] / C4 / SIP / ILS / Patron.pm
index 3d9de0d..17c9081 100644 (file)
@@ -12,7 +12,7 @@ use warnings;
 use Exporter;
 use Carp;
 
-use Sys::Syslog qw(syslog);
+use C4::SIP::Sip qw(syslog);
 use Data::Dumper;
 
 use C4::SIP::Sip qw(add_field);
@@ -22,7 +22,6 @@ use C4::Context;
 use C4::Koha;
 use C4::Members;
 use C4::Reserves;
-use C4::Items qw( GetItemnumbersForBiblio);
 use C4::Auth qw(checkpw);
 
 use Koha::Items;
@@ -131,7 +130,14 @@ sub new {
 
     # FIXME: populate fine_items recall_items
     $ilspatron{unavail_holds} = _get_outstanding_holds($kp->{borrowernumber});
-    $ilspatron{items} = $patron->pending_checkouts->unblessed;
+
+    my $pending_checkouts = $patron->pending_checkouts;
+    my @barcodes;
+    while ( my $c = $pending_checkouts->next ) {
+        push @barcodes, { barcode => $c->item->barcode };
+    }
+    $ilspatron{items} = \@barcodes;
+
     $self = \%ilspatron;
     $debug and warn Dumper($self);
     syslog("LOG_DEBUG", "new ILS::Patron(%s): found patron '%s'", $patron_id,$self->{id});
@@ -491,7 +497,7 @@ sub _get_outstanding_holds {
             # We need to return a barcode for the biblio so the client
             # can request the biblio info
             my $items = $hold->biblio->items;
-            $item = $items->count ? $item->next : undef;
+            $item = $items->count ? $items->next : undef;
         }
         my $unblessed_hold = $hold->unblessed;