From c4dd5c0774de0bd025658215cc4d8ad7dcbf8a59 Mon Sep 17 00:00:00 2001 From: dbs Date: Fri, 27 Aug 2010 21:58:24 +0000 Subject: [PATCH] Teach the spine label editor to use the label prefixes and suffixes If label_prefix or label_suffix are defined in asset.copy_location, the spine label editor will now prefix or suffix them to the call number label respectively. git-svn-id: svn://svn.open-ils.org/ILS/trunk@17365 dcc99617-32d9-48b4-a31d-7c20da2025e4 --- Open-ILS/xul/staff_client/server/cat/spine_labels.js | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) 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 720348b962..f742a38e67 100644 --- a/Open-ILS/xul/staff_client/server/cat/spine_labels.js +++ b/Open-ILS/xul/staff_client/server/cat/spine_labels.js @@ -33,11 +33,18 @@ for (var i = 0; i < g.barcodes.length; i++) { var copy = g.network.simple_request( 'FM_ACP_RETRIEVE_VIA_BARCODE.authoritative', [ g.barcodes[i] ] ); if (typeof copy.ilsevent != 'undefined') throw(copy); + var label_prefix = copy.location().label_prefix() || ''; + var label_suffix = copy.location().label_suffix() || ''; if (!g.volumes[ copy.call_number() ]) { var volume = g.network.simple_request( 'FM_ACN_RETRIEVE.authoritative', [ copy.call_number() ] ); if (typeof volume.ilsevent != 'undefined') throw(volume); var record = g.network.simple_request('MODS_SLIM_RECORD_RETRIEVE.authoritative', [ volume.record() ]); volume.record( record ); + + /* Jam the prefixes and suffixes into the volume object */ + volume.prefix = label_prefix; + volume.suffix = label_suffix; + g.volumes[ volume.id() ] = volume; } if (g.volumes[ copy.call_number() ].copies()) { @@ -162,7 +169,7 @@ } /* for LC, split between Cutter numbers */ - var lc_cutter_re = /^(.*?)(\.[A-Z]{1}[0-9]+.*?)$/ig; + 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 = ''; @@ -171,6 +178,16 @@ } } + /* Only add the prefixes and suffixes once */ + if (!override || volume.id() != override.acn) { + if (volume.prefix) { + callnum = volume.prefix + ' ' + callnum; + } + if (volume.suffix) { + callnum += ' ' + volume.suffix; + } + } + names = callnum.split(/\s+/); var j = 0; while (j < label_cfg.spine_length || j < label_cfg.pocket_length) { -- 2.11.0