From 3e8b78ccc5f63b487349e1098f5483721fd892a1 Mon Sep 17 00:00:00 2001 From: Jason Etheridge Date: Thu, 24 Mar 2011 16:42:56 -0400 Subject: [PATCH] handle both acn prefixes/suffixes and acpl prefixes/suffixes in the label interface --- .../xul/staff_client/server/cat/spine_labels.js | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 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..2db3a6ed23 100644 --- a/Open-ILS/xul/staff_client/server/cat/spine_labels.js +++ b/Open-ILS/xul/staff_client/server/cat/spine_labels.js @@ -44,9 +44,16 @@ 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; + /* The volume object has native prefix and suffixes now, so affix the ones coming from copy locations */ + var temp_prefix = label_prefix + ' ' + (typeof volume.prefix() == 'object' ? volume.prefix().label() : volume.prefix()); + var temp_suffix = (typeof volume.suffix() == 'object' ? volume.suffix().label() : volume.suffix()) + ' ' + label_suffix; + + /* And assume that leading and trailing spaces can be trimmed */ + temp_prefix = temp_prefix.replace(/\s+$/,'').replace(/^\s+/,''); + temp_suffix = temp_suffix.replace(/\s+$/,'').replace(/^\s+/,''); + + volume.prefix( temp_prefix ); + volume.suffix( temp_suffix ); g.volumes[ volume.id() ] = volume; } @@ -183,11 +190,11 @@ /* Only add the prefixes and suffixes once */ if (!override || volume.id() != override.acn) { - if (volume.prefix) { - callnum = volume.prefix + ' ' + callnum; + if (volume.prefix()) { + callnum = volume.prefix() + ' ' + callnum; } - if (volume.suffix) { - callnum += ' ' + volume.suffix; + if (volume.suffix()) { + callnum += ' ' + volume.suffix(); } } -- 2.11.0