Bugzilla – Attachment 176856 Details for
Bug 38936
Move suppressed record redirection into a sub
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 38936: Introduce C4::Output::redirect_if_opac_suppressed
Bug-38936-Introduce-C4Outputredirectifopacsuppress.patch (text/plain), 2.08 KB, created by
Tomás Cohen Arazi (tcohen)
on 2025-01-21 12:43:40 UTC
(
hide
)
Description:
Bug 38936: Introduce C4::Output::redirect_if_opac_suppressed
Filename:
MIME Type:
Creator:
Tomás Cohen Arazi (tcohen)
Created:
2025-01-21 12:43:40 UTC
Size:
2.08 KB
patch
obsolete
>From c383cab8a57da66645797ed6b400ddbdc7801377 Mon Sep 17 00:00:00 2001 >From: Tomas Cohen Arazi <tomascohen@theke.io> >Date: Tue, 21 Jan 2025 08:32:22 -0300 >Subject: [PATCH] Bug 38936: Introduce C4::Output::redirect_if_opac_suppressed > >Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> >--- > C4/Output.pm | 38 ++++++++++++++++++++++++++++++++++++++ > 1 file changed, 38 insertions(+) > >diff --git a/C4/Output.pm b/C4/Output.pm >index d8ea0bfb521..f1015ae9cc4 100644 >--- a/C4/Output.pm >+++ b/C4/Output.pm >@@ -47,6 +47,7 @@ BEGIN { > setlanguagecookie getlanguagecookie pagination_bar parametrized_url > output_html_with_http_headers output_ajax_with_http_headers output_with_http_headers > output_and_exit_if_error output_and_exit output_error >+ redirect_if_opac_suppressed > ); > } > >@@ -412,6 +413,43 @@ sub parametrized_url { > return $ret; > } > >+=item redirect_if_opac_suppressed >+ >+ redirect_if_opac_suppressed( $query, $biblio ) >+ if C4::Context->preference('OpacSuppression'); >+ >+For a given I<Koha::Biblio> object, it handles redirection if it is suppressed >+from the OPAC. >+ >+=cut >+ >+sub redirect_if_opac_suppressed { >+ my ( $query, $biblio ) = @_; >+ >+ # redirect to opac-blocked info page or 404? >+ my $redirect_url; >+ if ( C4::Context->preference("OpacSuppressionRedirect") ) { >+ $redirect_url = "/cgi-bin/koha/opac-blocked.pl"; >+ } else { >+ $redirect_url = "/cgi-bin/koha/errors/404.pl"; >+ } >+ if ( $biblio->opac_suppressed() ) { >+ >+ # if OPAC suppression by IP address >+ if ( C4::Context->preference('OpacSuppressionByIPRange') ) { >+ my $IPAddress = $ENV{'REMOTE_ADDR'}; >+ my $IPRange = C4::Context->preference('OpacSuppressionByIPRange'); >+ if ( $IPAddress !~ /^$IPRange/ ) { >+ print $query->redirect($redirect_url); >+ C4::Auth::safe_exit(); >+ } >+ } else { >+ print $query->redirect($redirect_url); >+ C4::Auth::safe_exit(); >+ } >+ } >+} >+ > END { } # module clean-up code here (global destructor) > > 1; >-- >2.48.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 38936
:
176855
| 176856 |
176857
|
178576
|
178577
|
178578