Repair SIP start/end list ranges user/berick/sip-repair-array-ranges
authorBill Erickson <berick@esilibrary.com>
Fri, 5 Apr 2013 17:28:08 +0000 (13:28 -0400)
committerBill Erickson <berick@esilibrary.com>
Fri, 5 Apr 2013 17:30:49 +0000 (13:30 -0400)
SIP supports paging of certain lists (holds, fines, etc.) by allowing
the SIP client to provide start and end points for lists.  This patch
repairs how Evgreen extracts the list ranges from arrays.

When using Perl array ranges, the array variable should be accessed via
'@' and not '$'.  Prior to this change, all ranged lists resulted in
returning the first item in the list instead of the full range.

This change affects lists of holds, overdues, fines, and charges.

Signed-off-by: Bill Erickson <berick@esilibrary.com>
Open-ILS/src/perlmods/lib/OpenILS/SIP/Patron.pm

index 5ce70e9..55d95b4 100644 (file)
@@ -467,7 +467,7 @@ sub hold_items {
     push( @holds, OpenILS::SIP::clean_text($self->__hold_to_title($_)) ) for @$holds;
 
     return (defined $start and defined $end) ? 
-        [ $holds[($start-1)..($end-1)] ] : 
+        [ @holds[($start-1)..($end-1)] ] :
         \@holds;
 }
 
@@ -574,7 +574,7 @@ sub overdue_items {
     @overdues = @o;
 
     return (defined $start and defined $end) ? 
-        [ $overdues[($start-1)..($end-1)] ] : \@overdues;
+        [ @overdues[($start-1)..($end-1)] ] : \@overdues;
 }
 
 sub __circ_to_barcode {
@@ -622,7 +622,7 @@ sub charged_items {
     @charges = @c;
 
     return (defined $start and defined $end) ? 
-        [ $charges[($start-1)..($end-1)] ] : 
+        [ @charges[($start-1)..($end-1)] ] :
         \@charges;
 }
 
@@ -645,7 +645,7 @@ sub fine_items {
     my $log_status = $@ ? 'ERROR: ' . $@ : 'OK';
     syslog('LOG_DEBUG', 'OILS: Patron->fine_items() ' . $log_status);
     return (defined $start and defined $end) ? 
-        [ $fines[($start-1)..($end-1)] ] : \@fines;
+        [ @fines[($start-1)..($end-1)] ] : \@fines;
 }
 
 # not currently supported