From: Remington Steed Date: Wed, 16 Dec 2015 20:46:17 +0000 (-0500) Subject: LP#1526546 Sort copies by part label in holdings maint. X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=7066a3200f96c0863445cf196e933f71df04f94e;p=Evergreen.git 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 --- 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(