From a9e06563e694dc8ddc61ff4ab86552d0eb1ee416 Mon Sep 17 00:00:00 2001 From: Mike Rylander Date: Wed, 3 Mar 2021 16:23:25 -0500 Subject: [PATCH] LP#1815815: Library Groups - limit copy table This commit causes the record detail copy table to be restricted to lasso orgs of the user-selected lasso. The copy and hold summary information is still making use of the last context org selected, but it's unclear how to adjust those because they are (currently) strictly hierarchical via the org tree. Signed-off-by: Mike Rylander Signed-off-by: Terran McCanna Signed-off-by: Galen Charlton --- .../perlmods/lib/OpenILS/WWW/EGCatLoader/Record.pm | 8 ++++++-- .../perlmods/lib/OpenILS/WWW/EGCatLoader/Util.pm | 14 ++++++++++++++ 2 files changed, 20 insertions(+), 2 deletions(-) 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 f5fada4808..36f64ecc2d 100644 --- a/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader/Record.pm +++ b/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader/Record.pm @@ -315,8 +315,12 @@ sub mk_copy_query { $rec_id, undef, undef, $copy_limit, $copy_offset, $self->ctx->{is_staff} ); - if($org != $self->ctx->{aou_tree}->()->id) { + my $lasso_orgs = $self->search_lasso_orgs; + + if($lasso_orgs || $org != $self->ctx->{aou_tree}->()->id) { # no need to add the org join filter if we're not actually filtering + + my $filter_orgs = $lasso_orgs || $org; $query->{from}->{acp}->[1] = { aou => { fkey => 'circ_lib', field => 'id', @@ -330,7 +334,7 @@ sub mk_copy_query { params => [$depth] }]}, from => 'aou', - where => {id => $org} + where => {id => $filter_orgs} } } } diff --git a/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader/Util.pm b/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader/Util.pm index 33cf92d731..7f35d18835 100644 --- a/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader/Util.pm +++ b/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader/Util.pm @@ -676,6 +676,7 @@ sub extract_copy_location_group_info { if ($grp =~ /^lasso\(([^)]+)\)/) { $ctx->{search_lasso} = $1; $ctx->{search_scope} = $grp; + $self->search_lasso_orgs; } elsif ($grp) { $ctx->{copy_location_group} = $grp; $ctx->{search_scope} = "location_groups($grp)"; @@ -752,6 +753,19 @@ sub load_my_hold_subscriptions { ) : []; } +sub search_lasso_orgs { + my $self = shift; + my $ctx = $self->ctx; + return $ctx->{search_lasso_orgs} if defined $ctx->{search_lasso_orgs}; + return undef unless $ctx->{search_lasso}; + + # User can access global lassos and those at the current search lib + my $lasso_maps = $self->editor->search_actor_org_lasso_map( + { lasso => $ctx->{search_lasso} } + ); + $ctx->{search_lasso_orgs} = [ map { $_->org_unit } @$lasso_maps]; +} + sub load_lassos { my $self = shift; my $ctx = $self->ctx; -- 2.43.2