[open-ils-commits] [GIT] Evergreen ILS branch rel_3_0 updated. 88be431b8457448539f1b09cb704768259de396c

Evergreen Git git at git.evergreen-ils.org
Tue Mar 13 11:42:16 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_0 has been updated
       via  88be431b8457448539f1b09cb704768259de396c (commit)
       via  56d076ef05b392185ded657048f8cfc836bfa543 (commit)
       via  d549cbd7abfc6330fa5353c7e2d31d95ce48bfec (commit)
       via  089c79a7a435c52b27a6040855d4b20c1074b723 (commit)
      from  e83d81737d387885fe404ffb805f3d82274ed92c (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 88be431b8457448539f1b09cb704768259de396c
Author: Jason Stephenson <jason at sigio.com>
Date:   Fri Mar 9 09:17:34 2018 -0500

    Lp 1411422: Fix & rename test file.
    
    The tests added for this branch had a bad plan.  It specified 7 tests were
    to be run when actually there are 8.
    
    I also renumbered the file to be 26, so that there would be only 1 test
    numbered 25.
    
    Signed-off-by: Jason Stephenson <jason at sigio.com>

diff --git a/Open-ILS/src/perlmods/live_t/25-lp1411422-transferring-items-volumes-with-parts.t b/Open-ILS/src/perlmods/live_t/26-lp1411422-transferring-items-volumes-with-parts.t
similarity index 98%
rename from Open-ILS/src/perlmods/live_t/25-lp1411422-transferring-items-volumes-with-parts.t
rename to Open-ILS/src/perlmods/live_t/26-lp1411422-transferring-items-volumes-with-parts.t
index 18fe58c..5bd7e1f 100755
--- a/Open-ILS/src/perlmods/live_t/25-lp1411422-transferring-items-volumes-with-parts.t
+++ b/Open-ILS/src/perlmods/live_t/26-lp1411422-transferring-items-volumes-with-parts.t
@@ -1,10 +1,10 @@
 #!perl
 
-use Test::More tests => 7;
+use Test::More tests => 8;
 
 diag("Test transferring holds with parts.");
 
-use constant WORKSTATION_NAME => 'BR1-test-25-lp1411422-transferring-items-volumes-with-parts.t';
+use constant WORKSTATION_NAME => 'BR1-test-26-lp1411422-transferring-items-volumes-with-parts.t';
 use constant WORKSTATION_LIB => 4;
 
 use strict; use warnings;

commit 56d076ef05b392185ded657048f8cfc836bfa543
Author: Jason Stephenson <jason at sigio.com>
Date:   Thu Mar 8 14:11:31 2018 -0500

    Lp#1411422: Clean up the code a little bit.
    
    We don't need to left join when we flesh fields.
    
    Signed-off-by: Jason Stephenson <jason at sigio.com>

diff --git a/Open-ILS/src/perlmods/lib/OpenILS/Application/Cat.pm b/Open-ILS/src/perlmods/lib/OpenILS/Application/Cat.pm
index 4bc9a43..f88cc45 100644
--- a/Open-ILS/src/perlmods/lib/OpenILS/Application/Cat.pm
+++ b/Open-ILS/src/perlmods/lib/OpenILS/Application/Cat.pm
@@ -855,14 +855,6 @@ sub transfer_copies_to_volume {
         $copy = $editor->search_asset_copy([
             { id => $copy_id , deleted => 'f' },
             {
-                join => {
-                    acpm => {
-                        type => 'left',
-                        join => {
-                            bmp => { type => 'left' }
-                        }
-                    }
-                },
                 flesh => 1,
                 flesh_fields => { acp => ['parts'] }
             }
@@ -1401,14 +1393,6 @@ sub batch_volume_transfer {
         my $copies = $e->search_asset_copy([
             { call_number => $vol->id , deleted => 'f' },
             {
-                join => {
-                    acpm => {
-                        type => 'left',
-                        join => {
-                            bmp => { type => 'left' }
-                        }
-                    }
-                },
                 flesh => 1,
                 flesh_fields => { acp => ['parts'] }
             }

commit d549cbd7abfc6330fa5353c7e2d31d95ce48bfec
Author: blake <blake at mobiusconsortium.org>
Date:   Fri Sep 1 20:54:39 2017 +0000

    LP1411422 Copy details repeated in search results when item/volume moved with parts attached
    
    Added regression test and tweaked the part lookup query to remove deleted parts.
    
    Signed-off-by: blake <blake at mobiusconsortium.org>
    Signed-off-by: Jason Stephenson <jason at sigio.com>

diff --git a/Open-ILS/src/perlmods/lib/OpenILS/Application/Cat.pm b/Open-ILS/src/perlmods/lib/OpenILS/Application/Cat.pm
index be3df96..4bc9a43 100644
--- a/Open-ILS/src/perlmods/lib/OpenILS/Application/Cat.pm
+++ b/Open-ILS/src/perlmods/lib/OpenILS/Application/Cat.pm
@@ -895,7 +895,8 @@ sub transfer_copies_to_volume {
             my $part_obj = $editor->search_biblio_monograph_part(
               {
                    label=>$part_label,
-                   record=>$cn->record
+                   record=>$cn->record,
+                   deleted=>'f'
               }
            )->[0];
            if (!$part_obj) {
@@ -1434,7 +1435,8 @@ sub batch_volume_transfer {
                     my $part_obj = $e->search_biblio_monograph_part(
                        {
                             label=>$part_label,
-                            record=>$rec
+                            record=>$rec,
+                            deleted=>'f'
                        }
                     )->[0];
 
diff --git a/Open-ILS/src/perlmods/live_t/25-lp1411422-transferring-items-volumes-with-parts.t b/Open-ILS/src/perlmods/live_t/25-lp1411422-transferring-items-volumes-with-parts.t
new file mode 100755
index 0000000..18fe58c
--- /dev/null
+++ b/Open-ILS/src/perlmods/live_t/25-lp1411422-transferring-items-volumes-with-parts.t
@@ -0,0 +1,183 @@
+#!perl
+
+use Test::More tests => 7;
+
+diag("Test transferring holds with parts.");
+
+use constant WORKSTATION_NAME => 'BR1-test-25-lp1411422-transferring-items-volumes-with-parts.t';
+use constant WORKSTATION_LIB => 4;
+
+use strict; use warnings;
+
+use OpenILS::Utils::TestUtils;
+use OpenILS::Utils::CStoreEditor qw/:funcs/;
+use OpenILS::Utils::Fieldmapper;
+
+our $script = OpenILS::Utils::TestUtils->new();
+$script->bootstrap;
+
+our $e = new_editor(xact => 1);
+$e->init;
+
+
+# setup workstation and login
+# -------------
+setupLogin();
+
+# Find a copy with at least one part
+# -------------
+
+my $copy = $e->search_asset_copy([
+{ deleted => 'f' },
+{
+    join => {
+        acpm => {
+            type => 'inner',
+            join => {
+                bmp => { type => 'left' },
+            }
+        }
+    },
+    flesh => 1,
+    flesh_fields => { acp => ['parts']},
+    limit => 1
+}
+])->[0];
+
+diag("Using copy ". $copy->id);
+my $parts = $copy->parts;
+my $oldcallnumber = $copy->call_number;
+my $part_objs = [];
+my $part;
+
+foreach my $spart (@$parts) {
+    $part = $spart;
+}
+diag("Copy part label -> ". $part->label);
+
+diag("Copy call number ". $oldcallnumber);
+
+$oldcallnumber = $e->search_asset_call_number({id => $oldcallnumber, deleted => 'f'})->[0];
+
+diag("Copy attached to bib ". $oldcallnumber->record);
+
+# Find a bib without parts
+# -------------
+my $sdestbib = $e->search_biblio_record_entry([
+{
+id =>
+    {
+        'not in' =>
+            { "from" => 'bmp',
+                'select' =>  { "bmp" => [ 'record' ] }
+            }
+    },
+deleted => 'f' },
+{ limit => 3 }
+
+]);
+
+my $destbib;
+foreach(@{$sdestbib}) {
+    if ($_->id > -1) {
+        $destbib = $_;
+        last;
+    }
+}
+
+
+diag("Using this non parted bib ". $destbib->id);
+
+# Create a new volume for the copy to transfer to
+# -------------
+my $newcall = Fieldmapper::asset::call_number->new;
+
+$newcall->owning_lib($oldcallnumber->owning_lib);
+$newcall->record($destbib->id);
+$newcall->creator($oldcallnumber->creator);
+$newcall->editor($oldcallnumber->editor);
+$newcall->label('Test copy transfer with parts');
+
+
+my $stat = $e->create_asset_call_number($newcall);
+ok($stat, 'Created temporary volume on bib '.$destbib->id);
+
+diag( "New call number id: " . $newcall->id );
+
+# freshen up the variable
+# get all the rest of the values from the DB
+$newcall = $e->search_asset_call_number({id => $newcall->id})->[0];
+
+# save changes so that the storage request has access
+$e->commit;
+
+# make the transfer
+# -------------
+my @copy_id_array = ($copy->id);
+my $storage = $script->session('open-ils.cat');
+my $req = $storage->request(
+    'open-ils.cat.transfer_copies_to_volume',  $script->authtoken, $newcall->id, \@copy_id_array )->gather(1);
+
+# Did the code create a new part on the destination bib?
+# -------------
+$e->xact_begin;
+
+my $destparts = $e->search_biblio_monograph_part({record => $newcall->record, label => $part->label, deleted => 'f'})->[0];
+ok($destparts, 'Copy transfer with parts success on bib '.$destbib->id);
+
+is($destparts->label, $part->label, 'Part labels match and everything!');
+
+# Now test transferring volumes,
+# might as well transfer it back to the old bib
+# -------------
+
+my @vols = ($newcall->id);
+my $docid = $oldcallnumber->record;
+my $args = {lib => $oldcallnumber->owning_lib, docid => $docid, volumes => \@vols };
+$storage = $script->session('open-ils.cat');
+$req = $storage->request(
+    'open-ils.cat.asset.volume.batch.transfer',
+    $script->authtoken,
+    $args
+    )->gather(1);
+# Make sure that the old bib received the part
+my $destparts2 = $e->search_biblio_monograph_part({record => $oldcallnumber->record, label => $part->label, deleted => 'f'})->[0];
+ok($destparts2, 'Volume transfer with parts success on bib '.$oldcallnumber->record);
+is($destparts->label, $part->label, 'Part labels match and everything!');
+
+
+# Reverse the data
+# -------------
+$storage = $script->session('open-ils.cat');
+$req = $storage->request(
+    'open-ils.cat.transfer_copies_to_volume',  $script->authtoken, $oldcallnumber->id, \@copy_id_array )->gather(1);
+
+$stat = $e->delete_asset_call_number($newcall);
+
+$e->xact_commit;
+
+
+sub setupLogin {
+
+    my $workstation = $e->search_actor_workstation([ {name => WORKSTATION_NAME, owning_lib => WORKSTATION_LIB } ])->[0];
+
+    if(!$workstation )
+    {
+        $script->authenticate({
+            username => 'admin',
+            password => 'demo123',
+            type => 'staff'});
+        ok( $script->authtoken, 'Have an authtoken');
+        my $ws = $script->register_workstation(WORKSTATION_NAME,WORKSTATION_LIB);
+        ok( ! ref $ws, 'Registered a new workstation');
+        $script->logout();
+    }
+
+    $script->authenticate({
+        username => 'admin',
+        password => 'demo123',
+        type => 'staff',
+        workstation => WORKSTATION_NAME});
+    ok( $script->authtoken, 'Have an authtoken associated with the workstation');
+}
+

commit 089c79a7a435c52b27a6040855d4b20c1074b723
Author: blake <blake at mobiusconsortium.org>
Date:   Mon Jun 13 15:58:13 2016 -0500

    LP1411422 Copy details repeated in search results when item/volume moved with parts attached
    
    Added the code in perl to respect the existence of parts. Both "transferring volume"
    and "transferring items". "Transferring items" was coded to use
    open-ils.cat.asset.copy.fleshed.batch.update which means most of the work was done in js.
    The web based staff client is coded to use open-ils.cat.transfer_copies_to_volume.
    Decided to use that method for xul as well. Making it more consistent with the "transferring
    volume" code. Considered coding it to move the part level holds to the destination part but
    it's possible that the source part still has items.
    
    Signed-off-by: blake <blake at mobiusconsortium.org>
    Signed-off-by: Jason Stephenson <jason at sigio.com>

diff --git a/Open-ILS/src/perlmods/lib/OpenILS/Application/Cat.pm b/Open-ILS/src/perlmods/lib/OpenILS/Application/Cat.pm
index 19c0b6a..be3df96 100644
--- a/Open-ILS/src/perlmods/lib/OpenILS/Application/Cat.pm
+++ b/Open-ILS/src/perlmods/lib/OpenILS/Application/Cat.pm
@@ -850,10 +850,24 @@ sub transfer_copies_to_volume {
 
     # flesh and munge the copies
     my $fleshed_copies = [];
-    my ($copy, $copy_evt);
+    my $copy;
     foreach my $copy_id ( @{ $copies } ) {
-        ($copy, $copy_evt) = $U->fetch_copy($copy_id);
-        return $copy_evt if $copy_evt;
+        $copy = $editor->search_asset_copy([
+            { id => $copy_id , deleted => 'f' },
+            {
+                join => {
+                    acpm => {
+                        type => 'left',
+                        join => {
+                            bmp => { type => 'left' }
+                        }
+                    }
+                },
+                flesh => 1,
+                flesh_fields => { acp => ['parts'] }
+            }
+        ])->[0];
+        return OpenILS::Event->new('ASSET_COPY_NOT_FOUND') if !$copy;
         $copy->call_number( $volume );
         $copy->circ_lib( $cn->owning_lib() );
         $copy->ischanged( 't' );
@@ -871,6 +885,35 @@ sub transfer_copies_to_volume {
         return $evt; 
     }
 
+    # take care of the parts
+    for my $copy (@$fleshed_copies) {
+        my $parts = $copy->parts;
+        next unless $parts;
+        my $part_objs = [];
+        foreach my $part (@$parts) {
+            my $part_label = $part->label;
+            my $part_obj = $editor->search_biblio_monograph_part(
+              {
+                   label=>$part_label,
+                   record=>$cn->record
+              }
+           )->[0];
+           if (!$part_obj) {
+               $part_obj = Fieldmapper::biblio::monograph_part->new();
+               $part_obj->label( $part_label );
+               $part_obj->record( $cn->record );
+               unless($editor->create_biblio_monograph_part($part_obj)) {
+                 return $editor->die_event if $editor->die_event;
+               }
+           }
+           push @$part_objs, $part_obj;
+        }
+        $copy->parts( $part_objs );
+        $copy->ischanged(1);
+        $evt = OpenILS::Application::Cat::AssetCommon->update_copy_parts($editor, $copy, 1); #delete_parts=1
+        return $evt if $evt;
+    }
+
     $editor->commit;
     $logger->info("copy to volume transfer successfully updated ".scalar(@$copies)." copies");
     reset_hold_list($auth, $retarget_holds);
@@ -1300,6 +1343,9 @@ sub batch_volume_transfer {
             }
         }
 
+        # record the difference between the destination bib and the present bib
+        my $same_bib = $vol->record == $rec;
+
         # see if there is a volume at the destination lib that 
         # already has the requested label
         my $existing_vol = $e->search_asset_call_number(
@@ -1351,7 +1397,21 @@ sub batch_volume_transfer {
 
         # regardless of what volume was used as the destination, 
         # update any copies that have moved over to the new lib
-        my $copies = $e->search_asset_copy({call_number=>$vol->id, deleted => 'f'});
+        my $copies = $e->search_asset_copy([
+            { call_number => $vol->id , deleted => 'f' },
+            {
+                join => {
+                    acpm => {
+                        type => 'left',
+                        join => {
+                            bmp => { type => 'left' }
+                        }
+                    }
+                },
+                flesh => 1,
+                flesh_fields => { acp => ['parts'] }
+            }
+        ]);
 
         # update circ lib on the copies - make this a method flag?
         for my $copy (@$copies) {
@@ -1363,6 +1423,39 @@ sub batch_volume_transfer {
             $e->update_asset_copy($copy) or return $e->event;
         }
 
+        # update parts if volume is moving bib records
+        if( !$same_bib ) {
+            for my $copy (@$copies) {
+                my $parts = $copy->parts;
+                next unless $parts;
+                my $part_objs = [];
+                foreach my $part (@$parts) {
+                    my $part_label = $part->label;
+                    my $part_obj = $e->search_biblio_monograph_part(
+                       {
+                            label=>$part_label,
+                            record=>$rec
+                       }
+                    )->[0];
+
+                    if (!$part_obj) {
+                        $part_obj = Fieldmapper::biblio::monograph_part->new();
+                        $part_obj->label( $part_label );
+                        $part_obj->record( $rec );
+                        unless($e->create_biblio_monograph_part($part_obj)) {
+                          return $e->die_event if $e->die_event;
+                        }
+                    }
+                    push @$part_objs, $part_obj;
+                }
+
+                $copy->parts( $part_objs );
+                $copy->ischanged(1);
+                $evt = OpenILS::Application::Cat::AssetCommon->update_copy_parts($e, $copy, 1); #delete_parts=1
+                return $evt if $evt;
+            }
+        }
+
         # Now see if any empty records need to be deleted after all of this
 
         for(@rec_ids) {
diff --git a/Open-ILS/xul/staff_client/chrome/content/main/constants.js b/Open-ILS/xul/staff_client/chrome/content/main/constants.js
index 8f2e313..96e31fa 100644
--- a/Open-ILS/xul/staff_client/chrome/content/main/constants.js
+++ b/Open-ILS/xul/staff_client/chrome/content/main/constants.js
@@ -107,6 +107,7 @@ var api = {
     'FM_ACP_UNFLESHED_BATCH_RETRIEVE' : { 'app' : 'open-ils.search', 'method' : 'open-ils.search.asset.copy.batch.retrieve', 'secure' : false },
     'FM_ACP_FLESHED_BATCH_RETRIEVE.authoritative' : { 'app' : 'open-ils.search', 'method' : 'open-ils.search.asset.copy.fleshed.batch.retrieve.authoritative', 'secure' : false },
     'FM_ACP_FLESHED_BATCH_UPDATE' : { 'app' : 'open-ils.cat', 'method' : 'open-ils.cat.asset.copy.fleshed.batch.update' },
+    'FM_ACP_TRANSFER_COPIES_BATCH' : { 'app' : 'open-ils.cat', 'method' : 'open-ils.cat.transfer_copies_to_volume' },
     'FM_ACP_COUNT' : { 'app' : 'open-ils.search', 'method' : 'open-ils.search.biblio.record.copy_count.staff', 'secure' : false },
     'FM_ACP_COUNT.authoritative' : { 'app' : 'open-ils.search', 'method' : 'open-ils.search.biblio.record.copy_count.staff.authoritative', 'secure' : false },
     'FM_ACPL_RETRIEVE' : { 'app' : 'open-ils.circ', 'method' : 'open-ils.circ.copy_location.retrieve.all', 'secure' : false },
diff --git a/Open-ILS/xul/staff_client/server/cat/util.js b/Open-ILS/xul/staff_client/server/cat/util.js
index f7da886..2f4e93a 100644
--- a/Open-ILS/xul/staff_client/server/cat/util.js
+++ b/Open-ILS/xul/staff_client/server/cat/util.js
@@ -184,17 +184,9 @@ cat.util.transfer_copies = function(params) {
 
         JSAN.use('util.functional');
 
-        var copies = network.simple_request('FM_ACP_FLESHED_BATCH_RETRIEVE.authoritative', [ params.copy_ids ]);
-
-        for (var i = 0; i < copies.length; i++) {
-            copies[i].call_number( data.marked_volume );
-            copies[i].circ_lib( params.owning_lib );
-            copies[i].ischanged( 1 );
-        }
-
         var robj = network.simple_request(
-            'FM_ACP_FLESHED_BATCH_UPDATE', 
-            [ ses(), copies, true ], 
+            'FM_ACP_TRANSFER_COPIES_BATCH',
+            [ ses(), data.marked_volume , params.copy_ids ],
             null,
             {
                 'title' : $("catStrings").getString('staff.cat.util.transfer_copies.override_transfer_failure'),

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

Summary of changes:
 .../src/perlmods/lib/OpenILS/Application/Cat.pm    |   87 +++++++++-
 ...1411422-transferring-items-volumes-with-parts.t |  183 ++++++++++++++++++++
 .../staff_client/chrome/content/main/constants.js  |    1 +
 Open-ILS/xul/staff_client/server/cat/util.js       |   12 +-
 4 files changed, 269 insertions(+), 14 deletions(-)
 create mode 100755 Open-ILS/src/perlmods/live_t/26-lp1411422-transferring-items-volumes-with-parts.t


hooks/post-receive
-- 
Evergreen ILS


More information about the open-ils-commits mailing list