From a05001a49f341e7440672d7d15b8ff0a9590c42a Mon Sep 17 00:00:00 2001 From: Bill Erickson Date: Thu, 28 Jul 2011 14:31:31 -0400 Subject: [PATCH] Avoid server-error on barcode search when barcode not found Signed-off-by: Bill Erickson --- .../perlmods/lib/OpenILS/WWW/EGCatLoader/Search.pm | 22 ++++++++++++++-------- Open-ILS/web/templates/default/opac/results.tt2 | 2 +- 2 files changed, 15 insertions(+), 9 deletions(-) diff --git a/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader/Search.pm b/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader/Search.pm index f9594b3164..a1aa2e6301 100644 --- a/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader/Search.pm +++ b/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader/Search.pm @@ -237,16 +237,22 @@ sub item_barcode_shortcut { )->gather(1); if (ref $rec_ids ne 'ARRAY') { - if (defined $U->event_code($rec_ids)) { - $self->apache->log->warn( - "$method returned event: " . $U->event_code($rec_ids) - ); + + if($U->event_equals($rec_ids, 'ASSET_COPY_NOT_FOUND')) { + $rec_ids = []; + } else { - $self->apache->log->warn( - "$method returned something unexpected: $rec_ids" - ); + if (defined $U->event_code($rec_ids)) { + $self->apache->log->warn( + "$method returned event: " . $U->event_code($rec_ids) + ); + } else { + $self->apache->log->warn( + "$method returned something unexpected: $rec_ids" + ); + } + return Apache2::Const::HTTP_INTERNAL_SERVER_ERROR; } - return Apache2::Const::HTTP_INTERNAL_SERVER_ERROR; } my ($facets, @data) = $self->get_records_and_facets( diff --git a/Open-ILS/web/templates/default/opac/results.tt2 b/Open-ILS/web/templates/default/opac/results.tt2 index 139cf5f329..9b2d2427d1 100644 --- a/Open-ILS/web/templates/default/opac/results.tt2 +++ b/Open-ILS/web/templates/default/opac/results.tt2 @@ -11,7 +11,7 @@ END; page = CGI.param('page') || 0; - page_count = POSIX.ceil(ctx.hit_count / ctx.page_size); + page_count = ctx.page_size == 0 ? 1 : POSIX.ceil(ctx.hit_count / ctx.page_size); %]
-- 2.11.0