From c7835817977a4b38ea0c4478c17a515a573d1ec8 Mon Sep 17 00:00:00 2001 From: Lebbeous Fogle-Weekley Date: Fri, 24 Feb 2012 14:56:18 -0500 Subject: [PATCH] Avoid JSPAC hold placement interface problems when no holdable copies This addresses a bug brought to my attention by John Jones. When you're trying to place certain holds (at least title level holds) on records for which there are no holdable formats (no descriptors as returned by open-ils.search.metabib.record_to_descriptors), then holdArgs.recordDescriptors in holds.js can be an empty array. There is a line of code that assumes this will never happen. The end user-visible result of the javascript failing here is an alert() dialog about phone number format, but this is a red herring. That only happens because the problem code is in one big function that has too many responsibilites. Signed-off-by: Lebbeous Fogle-Weekley Signed-off-by: Michael Peters Signed-off-by: Mike Rylander --- Open-ILS/web/opac/skin/default/js/holds.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Open-ILS/web/opac/skin/default/js/holds.js b/Open-ILS/web/opac/skin/default/js/holds.js index 61dd8a4459..f9a975139e 100644 --- a/Open-ILS/web/opac/skin/default/js/holds.js +++ b/Open-ILS/web/opac/skin/default/js/holds.js @@ -535,7 +535,7 @@ function __holdsDrawWindow() { var mods_formats = rec.types_of_resource(); var formats; - if(holdArgs.recordDescriptors) + if (holdArgs.recordDescriptors && holdArgs.recordDescriptors.length) formats = holdArgs.recordDescriptors[0].item_type(); if( holdArgs.type == 'T' ) { -- 2.11.0