[open-ils-commits] ***SPAM*** [GIT] Evergreen ILS branch rel_2_4 updated. d7daf48b20186aa34aba7f6c3d68aa6f5fa8f940

Evergreen Git git at git.evergreen-ils.org
Fri Oct 11 12:14:53 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, rel_2_4 has been updated
       via  d7daf48b20186aa34aba7f6c3d68aa6f5fa8f940 (commit)
      from  8a190982e8b0f557e7f8f2f52e5abdf4cb95f7a0 (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 d7daf48b20186aa34aba7f6c3d68aa6f5fa8f940
Author: Bill Erickson <berick at esilibrary.com>
Date:   Wed Sep 4 14:55:57 2013 -0400

    Vandelay copy overlay call number merge
    
    When overlaying a copy, if the copy brings with it a new call number
    which collides with an existing call number AND said copy is the only
    copy linked to its (old) call number, merge the copy's (old) call
    number into the (new) existing call number, i.e. the one we collided
    with.
    
    Signed-off-by: Bill Erickson <berick at esilibrary.com>
    Signed-off-by: Dan Wells <dbw2 at calvin.edu>

diff --git a/Open-ILS/src/perlmods/lib/OpenILS/Application/Vandelay.pm b/Open-ILS/src/perlmods/lib/OpenILS/Application/Vandelay.pm
index 6796447..194a1e0 100644
--- a/Open-ILS/src/perlmods/lib/OpenILS/Application/Vandelay.pm
+++ b/Open-ILS/src/perlmods/lib/OpenILS/Application/Vandelay.pm
@@ -22,6 +22,7 @@ use OpenILS::Application::AppUtils;
 use OpenILS::Application::Cat::BibCommon;
 use OpenILS::Application::Cat::AuthCommon;
 use OpenILS::Application::Cat::AssetCommon;
+use OpenILS::Application::Cat::Merge;
 my $U = 'OpenILS::Application::AppUtils';
 
 # A list of LDR/06 values from http://loc.gov/marc
@@ -1671,16 +1672,54 @@ sub import_record_asset_list_impl {
                     })->[0]->{count};
 
                     if ($count == 1) {
-                        # if this is the only copy attached to this 
-                        # callnumber, just update the callnumber
 
-                        $logger->info("vl: updating callnumber label in copy overlay");
-
-                        $copy->call_number->label($item->call_number);
-                        if (!$e->update_asset_call_number($copy->call_number)) {
-                            $$report_args{evt} = $e->die_event;
-                            respond_with_status($report_args);
-                            next;
+                        my $evol = $e->search_asset_call_number({
+                            id => {'<>' => $copy->call_number->id},
+                            label => $item->call_number,
+                            owning_lib => $copy->call_number->owning_lib,
+                            record => $copy->call_number->record,
+                            prefix => $copy->call_number->prefix,
+                            suffix => $copy->call_number->suffix,
+                            deleted => 'f'
+                        })->[0];
+
+                        if ($evol) {
+                            # call number for overlayed copy changed to a
+                            # label already in use by another call number.
+                            # merge the old CN into the new CN
+                            
+                            $logger->info(
+                                "vl: moving copy to new call number ".
+                                $item->call_number);
+
+                            my ($mvol, $err) = 
+                                OpenILS::Application::Cat::Merge::merge_volumes(
+                                    $e, [$copy->call_number], $evol);
+
+                            if (!$mvol) {
+                                $$report_args{evt} = $err;
+                                respond_with_status($report_args);
+                                next;
+                            }
+
+                            # update our copy *cough* of the copy to pick up
+                            # any changes made my merge_volumes
+                            $copy = $e->retrieve_asset_copy([
+                                $copy->id,
+                                {flesh => 1, flesh_fields => {acp => ['call_number']}}
+                            ]);
+
+                        } else {
+                            $logger->info(
+                                "vl: updating copy call number label".
+                                $item->call_number);
+
+                            $copy->call_number->label($item->call_number);
+                            if (!$e->update_asset_call_number($copy->call_number)) {
+                                $$report_args{evt} = $e->die_event;
+                                respond_with_status($report_args);
+                                next;
+                            }
                         }
 
                     } else {

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

Summary of changes:
 .../perlmods/lib/OpenILS/Application/Vandelay.pm   |   57 ++++++++++++++++---
 1 files changed, 48 insertions(+), 9 deletions(-)


hooks/post-receive
-- 
Evergreen ILS


More information about the open-ils-commits mailing list