From 33519911fdf61a2ffc551fc06fed98fc83a6010b Mon Sep 17 00:00:00 2001 From: miker Date: Wed, 7 Apr 2010 14:08:43 +0000 Subject: [PATCH] improve metarecord constituent type/form matching git-svn-id: svn://svn.open-ils.org/ILS/trunk@16152 dcc99617-32d9-48b4-a31d-7c20da2025e4 --- Open-ILS/web/opac/skin/default/js/holds.js | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 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 9c68c0781..d2d153df8 100644 --- a/Open-ILS/web/opac/skin/default/js/holds.js +++ b/Open-ILS/web/opac/skin/default/js/holds.js @@ -576,14 +576,29 @@ function holdsSetFormatSelector() { var selector = $('hold_alt_form_selector'); + for( var i = 0; i < selector.options.length; i++ ) { + if (selector.options[i].className.indexOf('hide_me') == -1) + hideMe(selector.options[i]); + } + for( var i = 0; i < avail_formats.length; i++ ) { var form = avail_formats[i]; - var opt = findSelectorOptByValue(selector,form); + var opt = findFormatSelectorOptByParts(selector,form); if(type=='M') opt.selected=true; unHideMe(opt); } } +function findFormatSelectorOptByParts( sel, val ) { + var parts = val.split('-'); + for( var i = 0; i < sel.options.length; i++ ) { + var opt = sel.options[i]; + var oval = opt.value; + var oparts = oval.split('-'); + if( oparts[0].indexOf(parts[0]) > -1 && ((!oparts[1] && !parts[1]) || (oparts[1].indexOf(parts[1]) > -1)) ) return opt; + } + return null; +} function holdsGetFormats() { -- 2.11.0