From 566b43cac3abdb7f107078e9724acf790ab8ce1f Mon Sep 17 00:00:00 2001 From: James Fournie Date: Mon, 6 Jun 2011 10:00:22 -0700 Subject: [PATCH] Spine label editor assumes LC as reported in LP #780665. This patch encapsulates the LC-assuming code in an IF block which considers the asset.call_number.volume.label_class. If that is equal to 3, it will use the LC formatting. Signed-off-by: James Fournie Signed-off-by: Dan Scott --- .../xul/staff_client/server/cat/spine_labels.js | 30 ++++++++++++---------- 1 file changed, 16 insertions(+), 14 deletions(-) diff --git a/Open-ILS/xul/staff_client/server/cat/spine_labels.js b/Open-ILS/xul/staff_client/server/cat/spine_labels.js index 35d5d28cde..0f295b9a60 100644 --- a/Open-ILS/xul/staff_client/server/cat/spine_labels.js +++ b/Open-ILS/xul/staff_client/server/cat/spine_labels.js @@ -163,21 +163,23 @@ /* take the call number and split it on whitespace */ callnum = String(volume.label()); } + /* handle spine lables differently if using LC */ + if(volume.label_class() == 3){ + /* for LC, split between classification subclass letters and numbers */ + var lc_class_re = /^([A-Z]{1,3})([0-9]+.*?)$/i; + var lc_class_match = lc_class_re.exec(callnum); + if (lc_class_match && lc_class_match.length > 1) { + callnum = lc_class_match[1] + ' ' + lc_class_match[2]; + } - /* for LC, split between classification subclass letters and numbers */ - var lc_class_re = /^([A-Z]{1,3})([0-9]+.*?)$/i; - var lc_class_match = lc_class_re.exec(callnum); - if (lc_class_match && lc_class_match.length > 1) { - callnum = lc_class_match[1] + ' ' + lc_class_match[2]; - } - - /* for LC, split between Cutter numbers */ - var lc_cutter_re = /^(.*)(\.[A-Z]{1}[0-9]+.*?)$/ig; - var lc_cutter_match = lc_cutter_re.exec(callnum); - if (lc_cutter_match && lc_cutter_match.length > 1) { - callnum = ''; - for (var i = 1; i < lc_cutter_match.length; i++) { - callnum += lc_cutter_match[i] + ' '; + /* for LC, split between Cutter numbers */ + var lc_cutter_re = /^(.*)(\.[A-Z]{1}[0-9]+.*?)$/ig; + var lc_cutter_match = lc_cutter_re.exec(callnum); + if (lc_cutter_match && lc_cutter_match.length > 1) { + callnum = ''; + for (var i = 1; i < lc_cutter_match.length; i++) { + callnum += lc_cutter_match[i] + ' '; + } } } -- 2.11.0