[open-ils-commits] [GIT] Evergreen ILS branch master updated. fdeffc5798232581588789b0b666bca47aef61a3

Evergreen Git git at git.evergreen-ils.org
Wed Dec 14 18:58:32 EST 2016


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "Evergreen ILS".

The branch, master has been updated
       via  fdeffc5798232581588789b0b666bca47aef61a3 (commit)
      from  233e61f3c194974b1316886e49d94b65c90a46f1 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit fdeffc5798232581588789b0b666bca47aef61a3
Author: Dan Pearl <dpearl at cwmars.org>
Date:   Thu Jun 2 15:17:44 2016 -0400

    LP#1586509 Bug fix to LP#1352542 caused extraneous blank line to appear in
    spine label.  This affected LC call numbers that had only one cutter number
    plus additional text following.
    
    Signed-off-by: Dan Pearl <dpearl at cwmars.org>
    Signed-off-by: Kathy Lussier <klussier at masslnc.org>

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 7822c90..a4d4afb 100644
--- a/Open-ILS/xul/staff_client/server/cat/spine_labels.js
+++ b/Open-ILS/xul/staff_client/server/cat/spine_labels.js
@@ -170,36 +170,38 @@
                 callnum = String(volume.label());
             }
             /* handle spine labels 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];
-                }
+            var lab_class = volume.label_class();
+            if (lab_class.id() == 3) {
+                /* Establish a pattern where every return value should be isolated on its own line 
+                   on the spine label: subclass letters, subclass numbers, cutter numbers, trailing stuff (date) */
+                var patt1 = /^([A-Z]{1,3})\s*(\d+(?:\.\d+)?)\s*(\.[A-Z]\d*)\s*([A-Z]\d*)?\s*(\d\d\d\d(?:-\d\d\d\d)?)?\s*(.*)$/i;
+                var result = callnum.match(patt1);
+                if (result) { 
+                    callnum = result.slice(1).join('\t');  
+                } else {
+                    callnum = callnum.split(/\s+/).join('\t');
+                } 
 
-                /* 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] + ' ';
-                    }
-                }
+                /* If result is null, leave callnum alone. Can't parse this malformed call num */
+            } else {
+                callnum = callnum.split(/\s+/).join('\t');
             }
 
             /* Only add the prefixes and suffixes once */
             if (!override || volume.id() != override.acn) {
                 if (volume.prefix()) {
-                    callnum = volume.prefix() + ' ' + callnum;
+                    callnum = volume.prefix() + '\t' + callnum;
                 }
                 if (volume.suffix()) {
-                    callnum += ' ' + volume.suffix();
+                    callnum += '\t' + volume.suffix();
                 }
             }
 
-            names = callnum.split(/\s+/);
+            /* At this point, the call number pieces are separated by tab characters.  This allows
+            *  some space-containing constructs like "v. 1" to appear on one line
+            */
+            callnum = callnum.replace(/\t\t/g,'\t');  /* Squeeze out empties */ 
+            names = callnum.split('\t');
             var j = 0;
             while (j < label_cfg.spine_length || j < label_cfg.pocket_length) {
                 var hb2 = document.createElement('hbox'); label_node.appendChild(hb2);

-----------------------------------------------------------------------

Summary of changes:
 .../xul/staff_client/server/cat/spine_labels.js    |   40 ++++++++++---------
 1 files changed, 21 insertions(+), 19 deletions(-)


hooks/post-receive
-- 
Evergreen ILS


More information about the open-ils-commits mailing list