From 5cc9e797995a6544934247917f6b65d7bd275dc2 Mon Sep 17 00:00:00 2001 From: Remington Steed Date: Wed, 16 Dec 2015 15:46:17 -0500 Subject: [PATCH] LP#1526546 Sort copies by part label in holdings maint. This commit improves the sorting of copies on the Holdings Maintenance screen in the XUL-based staff client. The previous code sorted the copies by their barcodes after retrieval. This commit moves the sorting logic into the search call and adds logic to first sort by the part label sort key. Signed-off-by: Remington Steed --- Open-ILS/src/perlmods/lib/OpenILS/Application/Cat.pm | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/Open-ILS/src/perlmods/lib/OpenILS/Application/Cat.pm b/Open-ILS/src/perlmods/lib/OpenILS/Application/Cat.pm index 91566c2aed..6b7d3a68ca 100644 --- a/Open-ILS/src/perlmods/lib/OpenILS/Application/Cat.pm +++ b/Open-ILS/src/perlmods/lib/OpenILS/Application/Cat.pm @@ -680,11 +680,25 @@ sub _build_volume_list { my $copies = $e->search_asset_copy([ { call_number => $volume->id , deleted => 'f' }, - { flesh => 1, flesh_fields => { acp => ['stat_cat_entries','parts'] } } + { + join => { + acpm => { + type => 'left', + join => { + bmp => { type => 'left' } + } + } + }, + flesh => 1, + flesh_fields => { acp => ['stat_cat_entries','parts'] }, + order_by => [ + {'class' => 'bmp', 'field' => 'label_sortkey', 'transform' => 'oils_text_as_bytea'}, + {'class' => 'bmp', 'field' => 'label', 'transform' => 'oils_text_as_bytea'}, + {'class' => 'acp', 'field' => 'barcode'} + ] + } ]); - $copies = [ sort { $a->barcode cmp $b->barcode } @$copies ]; - for my $c (@$copies) { if( $c->status == OILS_COPY_STATUS_CHECKED_OUT ) { $c->circulations( -- 2.11.0