From: Bill Erickson Date: Mon, 23 Jan 2012 22:04:01 +0000 (-0500) Subject: TPac: avoid SMS org setting check for non-SMS pages X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=d165b4ed70d06b4170f4e24cd75a2b31c6fdcc05;p=contrib%2FConifer.git TPac: avoid SMS org setting check for non-SMS pages Avoid an unnecessary org unit setting lookup on a large swath of (mostly myopac) pages. Instead, check to see if the current page is the SMS page in question and the lookup is necessary before making the lookup. This change also inserts the physical location as the first org unit to use in the org setting test. Signed-off-by: Bill Erickson 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 b19b8bc200..0a1fd65a4d 100644 --- a/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader.pm +++ b/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader.pm @@ -128,10 +128,10 @@ sub load { ); } - my $org_unit = $self->cgi->param('loc') || $self->ctx->{aou_tree}->()->id; - my $skip_sms_auth = $self->ctx->{get_org_setting}->($org_unit, 'sms.disable_authentication_requirement.callnumbers'); - if ($skip_sms_auth) { - return $self->load_sms_cn if $path =~ m|opac/sms_cn|; + if ($path =~ m|opac/sms_cn| and !$self->editor->requestor) { + my $org_unit = $self->ctx->{physical_loc} || $self->cgi->param('loc') || $self->ctx->{aou_tree}->()->id; + my $skip_sms_auth = $self->ctx->{get_org_setting}->($org_unit, 'sms.disable_authentication_requirement.callnumbers'); + return $self->load_sms_cn if $skip_sms_auth; } # ----------------------------------------------------------------