From 7ec3ea5ef54dd1c3651bc8f4ec2575f2308c4ae3 Mon Sep 17 00:00:00 2001 From: Jason Stephenson Date: Tue, 14 Apr 2015 10:43:49 -0400 Subject: [PATCH] LP 1444130: Add max_chunk_size guards to Holds.pm. Web staff client fixes introduced a bug in using the Clear Holds Shelf checkin modifier. Commit 4ccbf980 added calls to max_chunk_size on the client to use chunked responses for better feedback during long operations. Thise works just fine when a regular OpenSRF AppRequest is used, but leads to a network error when AppSubrequest is used, as apparently the xul client does with the Clear Holds Shelf checkin modifier. This commit adds code to check if the client object can do the max_chunk_size call when the max_chunk_size call is made. This will prevent the network errors in cases where the client is an AppSubrequest object and will still use chunked responses when the client is capable of doing it. Signed-off-by: Jason Stephenson Signed-off-by: Bill Erickson --- Open-ILS/src/perlmods/lib/OpenILS/Application/Circ/Holds.pm | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Open-ILS/src/perlmods/lib/OpenILS/Application/Circ/Holds.pm b/Open-ILS/src/perlmods/lib/OpenILS/Application/Circ/Holds.pm index 144098ede7..a859f114d9 100644 --- a/Open-ILS/src/perlmods/lib/OpenILS/Application/Circ/Holds.pm +++ b/Open-ILS/src/perlmods/lib/OpenILS/Application/Circ/Holds.pm @@ -1687,7 +1687,7 @@ sub print_hold_pull_list_stream { delete($$params{chunk_size}) unless (int($$params{chunk_size})); delete($$params{chunk_size}) if ($$params{chunk_size} && $$params{chunk_size} > 50); # keep the size reasonable $$params{chunk_size} ||= 10; - $client->max_chunk_size($$params{chunk_size}); + $client->max_chunk_size($$params{chunk_size}) if ($client->can('max_chunk_size')); $$params{org_id} = (defined $$params{org_id}) ? $$params{org_id}: $e->requestor->ws_ou; return $e->die_event unless $e->allowed('VIEW_HOLD', $$params{org_id }); @@ -3516,7 +3516,7 @@ sub clear_shelf_cache { return $e->die_event unless $e->checkauth and $e->allowed('VIEW_HOLD'); $chunk_size ||= 25; - $client->max_chunk_size($chunk_size); + $client->max_chunk_size($chunk_size) if ($client->can('max_chunk_size')); my $hold_data = OpenSRF::Utils::Cache->new('global')->get_cache($cache_key); @@ -3627,7 +3627,7 @@ sub clear_shelf_process { my @holds; my @canceled_holds; # newly canceled holds $chunk_size ||= 25; # chunked status updates - $client->max_chunk_size($chunk_size); + $client->max_chunk_size($chunk_size) if ($client->can('max_chunk_size')); my $counter = 0; for my $hold_id (@hold_ids) { -- 2.43.2