From: Jason Stephenson <jason@sigio.com>
Date: Wed, 16 Mar 2022 17:29:09 +0000 (-0400)
Subject: LP1965161: Sort Monograph Parts in Holds Metadata
X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=f61f1e147b1d4ed288554c88ff72d040c924a0f1;p=evergreen%2Fjoelewis.git

LP1965161: Sort Monograph Parts in Holds Metadata

When placing a hold in the Angular Staff Catalog, parts are not sorted
in the proper order.  This patch corrects the sort order.

To verify the bug:

 1. Find a record with parts in your catalog.
 2. Place a hold on a specific part using the Angular Staff Catalog.
 3. Notice that the entries int he parts drop down are likely not
    sorted in the correct order. (If they are you lucked out and
    should try again with a different record.)

To verify the fix after applying the patch and re-installing
Evergreen, repeat the above steps.  The parts should display in the
proper sort order by label.

Signed-off-by: Jason Stephenson <jason@sigio.com>
Signed-off-by: Bill Erickson <berickxx@gmail.com>
---

diff --git a/Open-ILS/src/perlmods/lib/OpenILS/Application/Circ/Holds.pm b/Open-ILS/src/perlmods/lib/OpenILS/Application/Circ/Holds.pm
index f5489369ed..a11d0abfe7 100644
--- a/Open-ILS/src/perlmods/lib/OpenILS/Application/Circ/Holds.pm
+++ b/Open-ILS/src/perlmods/lib/OpenILS/Application/Circ/Holds.pm
@@ -5145,7 +5145,11 @@ sub hold_metadata {
 
             # Also fetch the available parts for bib-level holds.
             $meta->{parts} = $e->search_biblio_monograph_part(
-                {record => $bre->id, deleted => 'f'});
+                [
+                    {record => $bre->id, deleted => 'f'},
+                    {order_by => {bmp => 'label_sortkey'}}
+                ]
+            );
         }
 
         if ($meta->{metarecord}) {