lp1678152 webstaff fix Add Copies & Volumes
authorJason Etheridge <jason@equinoxinitiative.org>
Mon, 26 Jun 2017 12:11:28 +0000 (08:11 -0400)
committerMike Rylander <mrylander@gmail.com>
Fri, 30 Jun 2017 14:38:12 +0000 (10:38 -0400)
Changes open-ils.cat.asset.volume.fleshed.batch.update,
AssetCommon::create_volume, and Cat::Merge::merge_volumes
to handle auto-volume merges during volume creation.

Signed-off-by: Jason Etheridge <jason@equinoxinitiative.org>
Signed-off-by: Mike Rylander <mrylander@gmail.com>

Open-ILS/src/perlmods/lib/OpenILS/Application/Cat.pm
Open-ILS/src/perlmods/lib/OpenILS/Application/Cat/AssetCommon.pm

index 211e7c8..0800b88 100644 (file)
@@ -1102,7 +1102,7 @@ sub fleshed_volume_update {
 
         } elsif( $vol->isnew ) {
             $logger->info("vol-update: creating volume");
-            $evt = $assetcom->create_volume( $oargs, $editor, $vol );
+            ($vol,$evt) = $assetcom->create_volume( $auto_merge_vols ? { all => 1} : $oargs, $editor, $vol );
             return $evt if $evt;
 
         } elsif( $vol->ischanged ) {
index 69e5b4b..4b81a46 100644 (file)
@@ -551,12 +551,10 @@ sub create_volume {
     if($label) {
         # now restore the label and merge into the existing record
         $vol->label($label);
-        (undef, $evt) = 
-            OpenILS::Application::Cat::Merge::merge_volumes($editor, [$vol], $$vols[0]);
-        return $evt if $evt;
+        return OpenILS::Application::Cat::Merge::merge_volumes($editor, [$vol], $$vols[0]);
     }
 
-    return undef;
+    return ($vol);
 }
 
 # returns the volume if it exists
@@ -598,10 +596,7 @@ sub find_or_create_volume {
     $vol->suffix($suffix);
     $vol->record($record_id);
 
-    my $evt = $class->create_volume(0, $e, $vol);
-    return (undef, $evt) if $evt;
-
-    return ($vol);
+    return $class->create_volume(0, $e, $vol);
 }