[open-ils-commits] ***SPAM*** [GIT] Evergreen ILS branch master updated. a457813d632916c0d79ec38ffe4ddf2662f91002

Evergreen Git git at git.evergreen-ils.org
Mon Sep 16 13:04:00 EDT 2013


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  a457813d632916c0d79ec38ffe4ddf2662f91002 (commit)
      from  823c90a959026b2e5f1ba4b4593305547ab8321c (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 a457813d632916c0d79ec38ffe4ddf2662f91002
Author: Dan Wells <dbw2 at calvin.edu>
Date:   Fri Sep 6 16:36:47 2013 -0400

    'Opportunistic' Acq In-process Copy Overlay
    
    It is both normal and common to overlay brief acquisitions bib
    records with more complete records, and it is simple to create
    copies as part of the overlay process, but there is no *simple* way
    to have the imported copies overlay the acq copies.
    
    This code builds off the existing copy overlay code (which matches
    and overlays using specified IDs), but uses broader matching criteria.
    By selecting the new option, "Auto Overlay In-process Acquisitions
    Copies", the system will potentially overlay copies which:
      * have associated lineitem details (that is, they were created
        by the acquisitions process), and
      * that lineitem detail has the same owning_lib as the incoming
        copy's owning_lib
      * the current copy associated with that lineitem detail is "In
        process"
    
    Also, fix two small bugs, one which prevented overlay using the
    'Available' status (change 'if $val' to 'if defined $val', since
    'Available' is '0'), and another which prevented item overlay when
    selecting the match record manually (as_imported was null in the DB).
    
    Signed-off-by: Dan Wells <dbw2 at calvin.edu>
    Signed-off-by: Mike Rylander <mrylander at gmail.com>

diff --git a/Open-ILS/src/perlmods/lib/OpenILS/Application/Vandelay.pm b/Open-ILS/src/perlmods/lib/OpenILS/Application/Vandelay.pm
index e7dbde7..5766231 100644
--- a/Open-ILS/src/perlmods/lib/OpenILS/Application/Vandelay.pm
+++ b/Open-ILS/src/perlmods/lib/OpenILS/Application/Vandelay.pm
@@ -1015,6 +1015,7 @@ sub import_record_list_impl {
                     $logger->info("vl: $type direct overlay succeeded for queued rec ".
                         "$rec_id and overlay target $overlay_target");
                     $imported = 1;
+                    $rec->imported_as($overlay_target);
                 }
 
             } else {
@@ -1207,7 +1208,7 @@ sub import_record_list_impl {
     }
 
     # import the copies
-    import_record_asset_list_impl($conn, \@success_rec_ids, $requestor) if @success_rec_ids;
+    import_record_asset_list_impl($conn, \@success_rec_ids, $requestor, $args) if @success_rec_ids;
 
     $conn->respond({total => $$report_args{total}, progress => $$report_args{progress}});
     return undef;
@@ -1577,7 +1578,7 @@ sub retrieve_queue_summary {
 # Given a list of queued record IDs, imports all items attached to those records
 # --------------------------------------------------------------------------------
 sub import_record_asset_list_impl {
-    my($conn, $rec_ids, $requestor) = @_;
+    my($conn, $rec_ids, $requestor, $args) = @_;
 
     my $roe = new_editor(xact=> 1, requestor => $requestor);
 
@@ -1614,6 +1615,8 @@ sub import_record_asset_list_impl {
         # call number label for every copy per org per record.
         my $auto_callnumber = {};
 
+        my $opp_acq_copy_overlay = $args->{opp_acq_copy_overlay};
+        my @overlaid_copy_ids;
         for my $item_id (@$item_ids) {
             my $e = new_editor(requestor => $requestor, xact => 1);
             my $item = $e->retrieve_vandelay_import_item($item_id);
@@ -1673,6 +1676,38 @@ sub import_record_asset_list_impl {
                     respond_with_status($report_args);
                     next;
                 }
+            } elsif ($opp_acq_copy_overlay) { # we are going to "opportunistically" overlay received, in-process acq copies
+                # recv_time should never be null if the copy status is
+                # "In Process", so that is just a double-check
+                my $query = [
+                    {
+                        "recv_time" => {"!=" => undef},
+                        "owning_lib" => $item->owning_lib,
+                        "+acn" => {"record" => $rec->imported_as},
+                        "+acp" => {"status" => OILS_COPY_STATUS_IN_PROCESS}
+                    },
+                    {
+                        "join" => {
+                            "acp" => {
+                                "join" => "acn"
+                            }
+                        },
+                        "flesh" => 2,
+                        "flesh_fields" => {
+                            "acqlid" => ["eg_copy_id"],
+                            "acp" => ["call_number"]
+                        }
+                    }
+                ];
+                # don't overlay the same copy twice
+                $query->[0]{"+acp"}{"id"} = {"not in" => \@overlaid_copy_ids} if @overlaid_copy_ids;
+                if (my $acqlid = $e->search_acq_lineitem_detail($query)->[0]) {
+                    $copy = $acqlid->eg_copy_id;
+                    push(@overlaid_copy_ids, $copy->id);
+                }
+            }
+
+            if ($copy) { # we found a copy to overlay
 
                 # overlaying copies requires an extra permission
                 if (!$e->allowed("IMPORT_OVERLAY_COPY", $copy->call_number->owning_lib)) {
@@ -1743,7 +1778,7 @@ sub import_record_asset_list_impl {
                     price circ_as_type alert_message opac_visible circ_modifier/) {
 
                     my $val = $item->$_();
-                    $copy->$_($val) if $val and $val ne '';
+                    $copy->$_($val) if defined $val and $val ne '';
                 }
 
                 # de-flesh for update
diff --git a/Open-ILS/src/templates/vandelay/inc/queue.tt2 b/Open-ILS/src/templates/vandelay/inc/queue.tt2
index 0d8be97..d9118dc 100644
--- a/Open-ILS/src/templates/vandelay/inc/queue.tt2
+++ b/Open-ILS/src/templates/vandelay/inc/queue.tt2
@@ -249,6 +249,13 @@
                         </select>
                     </td>
                 </tr>
+                <tr><td colspan='2' style='margin-top:10px;border-bottom:1px solid #888;border-top:2px solid #888'>
+                    <b>[% l('Copy Import Actions') %]</b>
+                </td></tr>
+                <tr>
+                    <td>[% l('Auto-overlay In-process Acquisition Copies') %]</td>
+                    <td colspan='4'><input jsId='vlUploadQueueAutoOverlayInprocessAcqCopies2' dojoType='dijit.form.CheckBox'/></td>
+                </tr>
 
                 <tr>
                     <td>
diff --git a/Open-ILS/src/templates/vandelay/inc/upload.tt2 b/Open-ILS/src/templates/vandelay/inc/upload.tt2
index bca673e..4db970d 100644
--- a/Open-ILS/src/templates/vandelay/inc/upload.tt2
+++ b/Open-ILS/src/templates/vandelay/inc/upload.tt2
@@ -103,6 +103,13 @@
                 </select>
             </td>
         </tr>
+        <tr><td colspan='2' style='margin-top:10px;border-bottom:1px solid #888;border-top:2px solid #888'>
+            <b>[% l('Copy Import Actions') %]</b>
+        </td></tr>
+        <tr>
+            <td>[% l('Auto-overlay In-process Acquisitions Copies') %]</td>
+            <td colspan='4'><input jsId='vlUploadQueueAutoOverlayInprocessAcqCopies' dojoType='dijit.form.CheckBox'/></td>
+        </tr>
 
         <tr><td colspan='2' style='border-bottom:2px solid #888;'></td></tr>
         <tr><td colspan='2' style='padding-bottom: 10px;'></td></tr>
diff --git a/Open-ILS/web/js/ui/default/vandelay/vandelay.js b/Open-ILS/web/js/ui/default/vandelay/vandelay.js
index 00f78e1..41b9a99 100644
--- a/Open-ILS/web/js/ui/default/vandelay/vandelay.js
+++ b/Open-ILS/web/js/ui/default/vandelay/vandelay.js
@@ -1241,6 +1241,7 @@ function vlHandleQueueItemsAction(action) {
             vlUploadFtMergeProfile.attr('value',  vlUploadFtMergeProfile2.attr('value'));
             vlUploadQueueAutoOverlayBestMatch.attr('value',  vlUploadQueueAutoOverlayBestMatch2.attr('value'));
             vlUploadQueueAutoOverlayBestMatchRatio.attr('value',  vlUploadQueueAutoOverlayBestMatchRatio2.attr('value'));
+            vlUploadQueueAutoOverlayInprocessAcqCopies.attr('value',  vlUploadQueueAutoOverlayInprocessAcqCopies2.attr('value'));
 
             // attr('value') and various other incantations won't let me set 
             // the value on the checkedmultiselect, so we temporarily swap 
@@ -1271,6 +1272,8 @@ function vlHandleQueueItemsAction(action) {
             vlUploadQueueAutoOverlayBestMatch2.attr('value', false);
             vlUploadQueueAutoOverlayBestMatchRatio.attr('value', '0.0');
             vlUploadQueueAutoOverlayBestMatchRatio2.attr('value', '0.0');
+            vlUploadQueueAutoOverlayInprocessAcqCopies.attr('value', false);
+            vlUploadQueueAutoOverlayInprocessAcqCopies2.attr('value', false);
 
             // and... swap them back
             vlUploadTrashGroups2 = vlUploadTrashGroups;
@@ -1351,6 +1354,11 @@ function vlImportRecordQueue(type, queueId, recList, onload) {
         options.match_quality_ratio = vlUploadQueueAutoOverlayBestMatchRatio.attr('value');
     }
 
+    if(vlUploadQueueAutoOverlayInprocessAcqCopies.checked) {
+        options.opp_acq_copy_overlay = true; //"opp" for opportunistic
+        vlUploadQueueAutoOverlayInprocessAcqCopies.checked = false;
+    }
+
     var profile = vlUploadMergeProfile.attr('value');
     if(profile != null && profile != '') {
         options.merge_profile = profile;

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

Summary of changes:
 .../perlmods/lib/OpenILS/Application/Vandelay.pm   |   41 ++++++++++++++++++-
 Open-ILS/src/templates/vandelay/inc/queue.tt2      |    7 +++
 Open-ILS/src/templates/vandelay/inc/upload.tt2     |    7 +++
 Open-ILS/web/js/ui/default/vandelay/vandelay.js    |    8 ++++
 4 files changed, 60 insertions(+), 3 deletions(-)


hooks/post-receive
-- 
Evergreen ILS


More information about the open-ils-commits mailing list