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 <berick@esilibrary.com>
Signed-off-by: Lebbeous Fogle-Weekley <lebbeous@esilibrary.com>
);
}
- 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;
}
# ----------------------------------------------------------------