LP#1879790: Give carousels their own context org user/miker/lp-1879790-separate-carousel-scope
authorMike Rylander <mrylander@gmail.com>
Tue, 28 Jul 2020 14:42:24 +0000 (10:42 -0400)
committerMike Rylander <mrylander@gmail.com>
Tue, 28 Jul 2020 14:56:44 +0000 (10:56 -0400)
Before this commit, the context org unit for carousels was the same as
the physical_loc environment variable, or the client-passed physcial
location, or the search location, whichever was set in that order.  This
commit provides the ability to specify a carousel_loc environment
variable in the apache vhost configuration, as an override to
physical_loc.  This, in turn, allows hostname-segregated branches of the
org hierarchy in a resource sharing group to specify their own carousels
even when they want the top of the group to be the default search
location.

Signed-off-by: Mike Rylander <mrylander@gmail.com>
Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader.pm

index 7388d79..2f04308 100644 (file)
@@ -297,6 +297,8 @@ sub load_common {
     $ctx->{original_tz} = $ENV{TZ};
     $ENV{TZ} = $ctx->{client_tz};
 
+    $ctx->{carousel_loc} = $ENV{carousel_loc}; # let templates see it
+
     my $xul_wrapper = 
         ($self->apache->headers_in->get('OILS-Wrapper') || '') =~ /true/;
 
@@ -361,7 +363,7 @@ sub load_common {
 
     # FIXME - move carousel helpers to a separate file
     $ctx->{get_visible_carousels} = sub {
-        my $org_unit = $self->ctx->{physical_loc} || $self->cgi->param('loc') || $self->ctx->{aou_tree}->()->id;
+        my $org_unit = $self->ctx->{carousel_loc} || $self->ctx->{physical_loc} || $self->cgi->param('loc') || $self->ctx->{aou_tree}->()->id;
         return $U->simplereq(
             'open-ils.actor',
             'open-ils.actor.carousel.retrieve_by_org',