From 56cf5c5312e11abe5f2c30395acc64e6a2c52002 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 Signed-off-by: Dan Wells --- 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 9c357d67f2..5267ddd6e2 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