From: Lebbeous Fogle-Weekley Date: Thu, 28 Jul 2011 20:37:19 +0000 (-0400) Subject: Sort copies on record detail page with copies belonging to "sort org unit" first X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=d919f613d89962f1b1ac457b16d3e1cc40e40c63;p=contrib%2FConifer.git Sort copies on record detail page with copies belonging to "sort org unit" first "sort org unit" needs to eventually be an abstract concept that could either refer to "orig_loc" or to "loc" or perhaps be skipped altogether, depending on some future configuration. Signed-off-by: Lebbeous Fogle-Weekley --- diff --git a/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader.pm b/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader.pm index e5743bca12..6097498561 100644 --- a/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader.pm +++ b/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader.pm @@ -259,7 +259,7 @@ sub get_orig_loc { return $orig_loc; } - return $self->cgi->cookie('orig_loc'); + return $self->cgi->cookie(COOKIE_ORIG_LOC); } diff --git a/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader/Record.pm b/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader/Record.pm index a1f6777e51..f3391ddfab 100644 --- a/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader/Record.pm +++ b/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader/Record.pm @@ -78,6 +78,12 @@ sub mk_copy_query { my $copy_limit = shift; my $copy_offset = shift; + # XXX In the future, $sort_org should be understood to be an abstration + # that refers to something configurable, not necessariyl orig_loc. + + my $sort_org = $self->ctx->{orig_loc} || $org || + $self->ctx->{aou_tree}->()->id; + my $query = { select => { acp => ['id', 'barcode', 'circ_lib', 'create_date', 'age_protect', 'holdable'], @@ -133,6 +139,8 @@ sub mk_copy_query { # Order is: copies with circ_lib=org, followed by circ_lib name, followed by call_number label order_by => [ + {class => 'acp', field => 'circ_lib', transform => 'numeric_eq', + params => [$sort_org], direction => 'desc'}, {class => 'aou', field => 'name'}, {class => 'acn', field => 'label'} ],