[open-ils-commits] r17365 - trunk/Open-ILS/xul/staff_client/server/cat (dbs)

svn at svn.open-ils.org svn at svn.open-ils.org
Fri Aug 27 17:58:30 EDT 2010


Author: dbs
Date: 2010-08-27 17:58:24 -0400 (Fri, 27 Aug 2010)
New Revision: 17365

Modified:
   trunk/Open-ILS/xul/staff_client/server/cat/spine_labels.js
Log:
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.


Modified: trunk/Open-ILS/xul/staff_client/server/cat/spine_labels.js
===================================================================
--- trunk/Open-ILS/xul/staff_client/server/cat/spine_labels.js	2010-08-27 21:50:28 UTC (rev 17364)
+++ trunk/Open-ILS/xul/staff_client/server/cat/spine_labels.js	2010-08-27 21:58:24 UTC (rev 17365)
@@ -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) {



More information about the open-ils-commits mailing list