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

Evergreen Git git at git.evergreen-ils.org
Tue Dec 6 09:22:10 EST 2011


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  d71b923ea0f7d16b19bb7e98176609726867b98a (commit)
      from  c4e56c4c40c6a69887834a2fd5d7d099c9987097 (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 d71b923ea0f7d16b19bb7e98176609726867b98a
Author: Dan Scott <dscott at laurentian.ca>
Date:   Fri Nov 25 12:30:24 2011 -0500

    TPAC: Protect against missing 901c in legacy MARCXML
    
    Bad MARCXML to which Evergreen has been unable to add a 901c happens -
    particularly with legacy MARCXML. Currently, TPAC crashes hard with an
    ugly error if a 901c is not found when attempting to display the record
    in search results. In comparison, the JSPAC displays the record without
    a problem.
    
    This commit logs a warning and enables the TPAC to continue somewhat
    gracefully (the problem record is simply skipped in the search results).
    A more robust solution may be to teach unapi.bre to add the record ID to
    the results and to have the TPAC pull from that, rather than relying on
    the MARCXML itself to contain the record ID.
    
    Signed-off-by: Dan Scott <dscott at laurentian.ca>
    Signed-off-by: Bill Erickson <berick at esilibrary.com>

diff --git a/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader/Util.pm b/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader/Util.pm
index af027e3..1199d9a 100644
--- a/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader/Util.pm
+++ b/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader/Util.pm
@@ -180,7 +180,15 @@ sub get_records_and_facets {
             my($self, $req) = @_;
             my $data = $req->{response}->[0]->content;
             my $xml = XML::LibXML->new->parse_string($data->{'unapi.bre'})->documentElement;
-            my $bre_id =  $xml->find('*[@tag="901"]/*[@code="c"]')->[0]->textContent;
+
+            # Protect against legacy invalid MARCXML that might not have a 901c
+            my $bre_id;
+            my $bre_id_nodes =  $xml->find('*[@tag="901"]/*[@code="c"]');
+            if ($bre_id_nodes) {
+                $bre_id =  $bre_id_nodes->[0]->textContent;
+            } else {
+                $logger->warn("Missing 901 subfield 'c' in " . $xml->toString());
+            }
             push(@data, {id => $bre_id, marc_xml => $xml});
         }
     );

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

Summary of changes:
 .../perlmods/lib/OpenILS/WWW/EGCatLoader/Util.pm   |   10 +++++++++-
 1 files changed, 9 insertions(+), 1 deletions(-)


hooks/post-receive
-- 
Evergreen ILS


More information about the open-ils-commits mailing list