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

Evergreen Git git at git.evergreen-ils.org
Wed Feb 28 17:28:59 EST 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, master has been updated
       via  88a86373120a024dc361c365ccbad303d601ed8e (commit)
       via  82c91c0e35c2e60a3f7315613612c87df68ffad2 (commit)
      from  af3545816d23502107d426a3e3d70e3cf4a96934 (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 88a86373120a024dc361c365ccbad303d601ed8e
Author: Jason Stephenson <jason at sigio.com>
Date:   Mon Nov 27 15:48:06 2017 -0500

    Lp 1350916: marc_export --uris option release notes.
    
    Add release notes for the new --uris option on marc_export.
    
    To test the new option, run marc_export to export records with
    holdings for a given library using the --library and --items options.
    If that library also has electronic resources, do another export with
    the same options but add the --uris option and direct this output to a
    different file.  Compare the file sizes.  The second file should be
    larger than the first.
    
    Signed-off-by: Jason Stephenson <jason at sigio.com>
    Signed-off-by: Dan Wells <dbw2 at calvin.edu>

diff --git a/docs/RELEASE_NOTES_NEXT/Administration/marc_export_uris_option.adoc b/docs/RELEASE_NOTES_NEXT/Administration/marc_export_uris_option.adoc
new file mode 100644
index 0000000..b9fd1f3
--- /dev/null
+++ b/docs/RELEASE_NOTES_NEXT/Administration/marc_export_uris_option.adoc
@@ -0,0 +1,12 @@
+marc_export --uris option
+^^^^^^^^^^^^^^^^^^^^^^^^^
+The marc_export support script now has a --uris option (short form:
+-u) to export records with located URIs.  When used by itself, it will
+export only records that have located URIs.  When used in conjunction
+with --items, it will add records with located URIs but no
+items/copies to the output.  If combined with a --library or
+--descendants option, this option will limit its output to those
+records with URIs at the designated libraries.  The best way to use
+this option is in combination with the --items and one of the
+--library or --descendants options to export *all* of a library's
+holdings both real and electronic.

commit 82c91c0e35c2e60a3f7315613612c87df68ffad2
Author: Jason Stephenson <jason at sigio.com>
Date:   Tue Nov 14 14:21:45 2017 -0500

    Lp 1350916: Add located URI option to marc_export.
    
    Add code to marc_export to support exporting records with located
    URIs.
    
    Signed-off-by: Jason Stephenson <jason at sigio.com>
    Signed-off-by: Dan Wells <dbw2 at calvin.edu>

diff --git a/Open-ILS/src/support-scripts/marc_export.in b/Open-ILS/src/support-scripts/marc_export.in
index d7c21d1..4031874 100755
--- a/Open-ILS/src/support-scripts/marc_export.in
+++ b/Open-ILS/src/support-scripts/marc_export.in
@@ -98,6 +98,7 @@ sub new {
                'descendants=s@',
                'since=s',
                'store=s',
+               'uris',
                'debug');
 
     if ($opts{help}) {
@@ -143,6 +144,7 @@ Usage: $0 [options]
                     exports records that have attached holdings for the
                     specified org. unit and all of its descendants in
                     the tree.
+ --uris or -u       Include records with located URIs in the output
 
 Examples:
 
@@ -329,6 +331,7 @@ sub new {
     $self->{sreClass} = Fieldmapper::class_for_hint('sre');
     $self->{acnpClass} = Fieldmapper::class_for_hint('acnp');
     $self->{acnsClass} = Fieldmapper::class_for_hint('acns');
+    $self->{auricnmClass} = Fieldmapper::class_for_hint('auricnm');
 
     # Make an arrayref of shortname ids if the library option was
     # specified:
@@ -365,6 +368,11 @@ sub new {
 sub build_query {
     my $self = shift;
 
+    # TODO: There is some unfortunate code repetition in this
+    # subroutine and it is now about 93 lines long with comments and
+    # whitespace.  It should probably be refactored into a series of
+    # smaller subroutines to avoid the repetition.
+
     # Get the field names and tables for our classes. We add the fully
     # qualified table names to the fields so that the joins will work.
     my $breTable = $self->{breClass}->Table();
@@ -373,6 +381,7 @@ sub build_query {
     my $acpTable = $self->{acpClass}->Table();
     my $acnpTable = $self->{acnpClass}->Table();
     my $acnsTable = $self->{acnsClass}->Table();
+    my $auricnmTable = $self->{auricnmClass}->Table();
 
     # Now we build the query in pieces:
 
@@ -423,7 +432,31 @@ ACN_JOIN
         $where .= "$breTable.deleted = 'f'";
     }
 
+    # Support the --uris option.  It is orthogonal to --items, so we
+    # may have to build a second query to use with a UNION DISTINCT.
+    my $uri_union = "";
+    if ($Marque::config->option_value('uris')) {
+        if ($Marque::config->option_value('items')) {
+            # Build UNION DISTINCT for main query.
+            $uri_union = "\nunion distinct\n";
+            $uri_union .= $select;
+            $uri_union .= "\nfrom $breTable";
+            $uri_union .= "\njoin $acnTable on $acnTable.record = $breTable.id";
+            $uri_union .= "\nand $acnTable.owning_lib in (" . join(',', @{$self->{libs}}) . ")" if (@{$self->{libs}});
+            $uri_union .= "\nand $acnTable.deleted = 'f'" unless ($Marque::config->option_value('since'));
+            $uri_union .= "\njoin $auricnmTable on $auricnmTable.call_number = $acnTable.id";
+            $uri_union .= "\n$where";
+        } else {
+            unless ($acn_joined) {
+                $from .= "\njoin $acnTable on $acnTable.record = $breTable.id";
+                $from .= "\nand $acnTable.deleted = 'f'" unless ($Marque::config->option_value('since'));
+            }
+            $from .= "\njoin $auricnmTable on $auricnmTable.call_number = $acnTable.id";
+        }
+    }
+
     $self->{query} = $select . "\n" . $from . "\n" . $where;
+    $self->{query} .= $uri_union if ($uri_union);
 }
 
 sub execute_query {

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

Summary of changes:
 Open-ILS/src/support-scripts/marc_export.in        |   33 ++++++++++++++++++++
 .../Administration/marc_export_uris_option.adoc    |   12 +++++++
 2 files changed, 45 insertions(+), 0 deletions(-)
 create mode 100644 docs/RELEASE_NOTES_NEXT/Administration/marc_export_uris_option.adoc


hooks/post-receive
-- 
Evergreen ILS


More information about the open-ils-commits mailing list