[open-ils-commits] [GIT] Evergreen ILS branch rel_3_1 updated. 48a915d6a1dd36e22813723a8e004381feeb2bf4

Evergreen Git git at git.evergreen-ils.org
Tue May 1 14:30:45 EDT 2018


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, rel_3_1 has been updated
       via  48a915d6a1dd36e22813723a8e004381feeb2bf4 (commit)
       via  d9e235906870e9990e69a3c58262783b622ae47a (commit)
      from  43865ff4e96ee4c8132005b400b4e96ac8cd1e28 (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 48a915d6a1dd36e22813723a8e004381feeb2bf4
Author: Galen Charlton <gmc at equinoxinitiative.org>
Date:   Tue May 1 14:29:50 2018 -0400

    LP#1576727: (follow-up) add unit test
    
    Signed-off-by: Galen Charlton <gmc at equinoxinitiative.org>

diff --git a/Open-ILS/src/perlmods/live_t/28-marc_cn.t b/Open-ILS/src/perlmods/live_t/28-marc_cn.t
new file mode 100644
index 0000000..0142867
--- /dev/null
+++ b/Open-ILS/src/perlmods/live_t/28-marc_cn.t
@@ -0,0 +1,22 @@
+#!perl
+
+use Test::More tests => 1;
+
+diag("Test retrieving call numbers from bibliographic records.");
+
+use strict; use warnings;
+
+use OpenILS::Utils::TestUtils;
+my $script = OpenILS::Utils::TestUtils->new();
+$script->bootstrap;
+
+our $apputils   = "OpenILS::Application::AppUtils";
+
+my $resp = $apputils->simplereq(
+    'open-ils.cat',
+    'open-ils.cat.biblio.record.marc_cn.retrieve',
+    46,
+    1
+);
+
+is_deeply($resp, [{ '050' => 'ML60 .C22' }], 'LP#1576727: extracted LC call number includes space');

commit d9e235906870e9990e69a3c58262783b622ae47a
Author: Mike Rylander <mrylander at gmail.com>
Date:   Fri Apr 29 15:30:17 2016 -0400

    LP#1576727: Delimit bib CN subfields with a space
    
    When suggested call numbers are pulled from a bib record, space delimiters are
    dropped.  This is bad for noralization routines.  Now we will forcibly inject
    a space between subfield values.
    
    Also included are two small optimizations: exit early if no nodes are found
    for a particular bib CN definition; use map+join instead of a for loop and
    blind substring trim to stitch together an xpath expression.
    
    Signed-off-by: Mike Rylander <mrylander at gmail.com>
    Signed-off-by: Cesar Velez <cesar.velez at equinoxinitiative.org>
    Signed-off-by: Galen Charlton <gmc at equinoxinitiative.org>

diff --git a/Open-ILS/src/perlmods/lib/OpenILS/Application/Cat.pm b/Open-ILS/src/perlmods/lib/OpenILS/Application/Cat.pm
index f88cc45..95a748a 100644
--- a/Open-ILS/src/perlmods/lib/OpenILS/Application/Cat.pm
+++ b/Open-ILS/src/perlmods/lib/OpenILS/Application/Cat.pm
@@ -528,6 +528,7 @@ sub biblio_record_marc_cn {
         my $tag = substr($field, 0, 3);
         $logger->debug("Tag = $tag");
         my @node = $doc->findnodes("//marc:datafield[\@tag='$tag']");
+        next unless (@node);
 
         # Now parse the subfields and build up the subfield XPath
         my @subfields = split(//, substr($field, 3));
@@ -536,16 +537,17 @@ sub biblio_record_marc_cn {
         if (!@subfields) {
             @subfields = ('a');
         }
-        my $subxpath;
-        foreach my $sf (@subfields) {
-            $subxpath .= "\@code='$sf' or ";
-        }
-        $subxpath = substr($subxpath, 0, -4);
-        $logger->debug("subxpath = $subxpath");
+        my $xpath = 'marc:subfield[' . join(' or ', map { "\@code='$_'" } @subfields) . ']';
+        $logger->debug("xpath = $xpath");
 
         # Find the contents of the specified subfields
         foreach my $x (@node) {
-            my $cn = $x->findvalue("marc:subfield[$subxpath]");
+            # We can't use find($xpath)->to_literal_delimited here because older 2.x
+            # versions of the XML::LibXML module don't have to_literal_delimited().
+            my $cn = join(
+                ' ',
+                map { $_->textContent } $x->findnodes($xpath)
+            );
             push @res, {$tag => $cn} if ($cn);
         }
     }

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

Summary of changes:
 .../src/perlmods/lib/OpenILS/Application/Cat.pm    |   16 ++++++++------
 Open-ILS/src/perlmods/live_t/28-marc_cn.t          |   22 ++++++++++++++++++++
 2 files changed, 31 insertions(+), 7 deletions(-)
 create mode 100644 Open-ILS/src/perlmods/live_t/28-marc_cn.t


hooks/post-receive
-- 
Evergreen ILS


More information about the open-ils-commits mailing list