Bugzilla – Attachment 122573 Details for
Bug 28658
With SearchMyLibraryFirst: If library isn't set for the OPAC, try to guess it by checking branchip
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Proposed patch
0001-Bug-28658-With-SearchMyLibraryFirst-guess-the-opac-c.patch (text/plain), 1.54 KB, created by
Michael Hafen
on 2021-07-02 17:12:05 UTC
(
hide
)
Description:
Proposed patch
Filename:
MIME Type:
Creator:
Michael Hafen
Created:
2021-07-02 17:12:05 UTC
Size:
1.54 KB
patch
obsolete
>From 0822839ff2af7203ceeced027529f5e854ea7f1b Mon Sep 17 00:00:00 2001 >From: Michael Hafen <michael.hafen@washk12.org> >Date: Fri, 2 Jul 2021 11:10:37 -0600 >Subject: [PATCH] Bug 28658 - With SearchMyLibraryFirst guess the opac clients > library > >If the SearchMyLibraryFirst syspref is set, the OPAC uses the logged in >users branchcode to limit searches to their library. If it's an anonymous >session that doesn't happen. This tries to guess the client library by >checking for the client ip address in each libraries branchip setting. >--- > C4/Auth.pm | 12 ++++++++++++ > 1 file changed, 12 insertions(+) > >diff --git a/C4/Auth.pm b/C4/Auth.pm >index e8575e9472..641db1c90f 100644 >--- a/C4/Auth.pm >+++ b/C4/Auth.pm >@@ -635,6 +635,18 @@ sub get_template_and_user { > ); > > $template->param( OpacPublic => '1' ) if ( $user || C4::Context->preference("OpacPublic") ); >+ >+ # guess the branch by ip if it isn't set already >+ if ( C4::Context->preference("SearchMyLibraryFirst") && ! $template->param('mylibraryfirst') ) { >+ my $branches = { map { $_->branchcode => $_->unblessed } Koha::Libraries->search }; >+ my $ip = $ENV{'REMOTE_ADDR'}; >+ foreach my $br ( keys %$branches ) { >+ my $domain = $branches->{$br}->{'branchip'}; >+ if ( in_iprange($domain) ) { >+ $template->param( mylibraryfirst => $branches->{$br}->{'branchcode'} ); >+ } >+ } >+ } > } > > # Check if we were asked using parameters to force a specific language >-- >2.25.1 >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 28658
: 122573 |
149432