LPXXX Angular Volcopy data api
authorBill Erickson <berickxx@gmail.com>
Mon, 29 Jun 2020 21:51:26 +0000 (17:51 -0400)
committerBill Erickson <berickxx@gmail.com>
Mon, 29 Jun 2020 21:51:26 +0000 (17:51 -0400)
Signed-off-by: Bill Erickson <berickxx@gmail.com>
Open-ILS/src/perlmods/lib/OpenILS/Application/Cat.pm

index 40527a5..b2ef7bd 100644 (file)
@@ -1948,6 +1948,14 @@ sub volcopy_data {
         ])
     });
 
+    # Provide a reasonable default copy location.  Typically "Stacks"
+    $client->respond({
+        acp_default_location => $e->search_asset_copy_location([
+            {deleted => 'f', owning_lib => $org_ids},
+            {order_by => {acpl => 'id'}, limit => 1}
+        ])->[0]
+    });
+
     $client->respond({
         acp_status => $e->search_config_copy_status([
             {id => {'!=' => undef}},
@@ -2018,14 +2026,10 @@ sub volcopy_data {
         sort {
             my $d1 = $a->owner->ou_type->depth;
             my $d2 = $b->owner->ou_type->depth;
+            return $a->name cmp $b->name if $d1 == $d2;
 
-            if ($d1 > $d2) {
-                return -1;
-            } elsif ($d1 < $d2) {
-                return 1;
-            } else {
-                return $a->name cmp $b->name;
-            }
+            # Sort cats closer to the workstation org unit to the front.
+            return $d1 > $d2 ? -1 : 1;
         }
         @$cats
     ];