From a2a6225fdc1d0e389c7b39aeeca9229d71e5bbf8 Mon Sep 17 00:00:00 2001 From: Jason Stephenson Date: Thu, 8 Nov 2012 15:09:09 -0500 Subject: [PATCH] Fix lp1076379: Can't edit holds beyond first page. When a hold was being edited on page 2+ of a patron's list of holds, the offset was > 0. Since the input hold_ids array ref has only 1 member, using the offset as a starting point in searching began the search beyond the end of the array and thus returned nothing. The code in this commit moves the handling of the offset and limit to cases where the input hold_ids is undefined, as this is, I think the intended behavior. Typically when hold_ids is passed to the fetch_user_holds function in EGCatLoader::Account, you want to retrieve those holds regardless of the offset and limit values. Signed-off-by: Jason Stephenson Signed-off-by: Ben Shum --- .../perlmods/lib/OpenILS/WWW/EGCatLoader/Account.pm | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader/Account.pm b/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader/Account.pm index 33fec7fd7d..337ee52f31 100644 --- a/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader/Account.pm +++ b/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader/Account.pm @@ -447,6 +447,7 @@ sub fetch_user_holds { my $offset = shift; my $e = $self->editor; + my $all_ids; # to be used below. if(!$hold_ids) { my $circ = OpenSRF::AppSession->create('open-ils.circ'); @@ -458,10 +459,13 @@ sub fetch_user_holds { $available )->gather(1); $circ->kill_me; - } - my $all_ids = $hold_ids; - $hold_ids = [ grep { defined $_ } @$hold_ids[$offset..($offset + $limit - 1)] ] if $limit or $offset; + $all_ids = $hold_ids; + $hold_ids = [ grep { defined $_ } @$hold_ids[$offset..($offset + $limit - 1)] ] if $limit or $offset; + + } else { + $all_ids = $hold_ids; + } return { ids => $hold_ids, all_ids => $all_ids } if $ids_only or @$hold_ids == 0; -- 2.43.2