Bugzilla – Attachment 176857 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: Use redirect_if_opac_suppressed() in opac-*detail.pl pages
Bug-38936-Use-redirectifopacsuppressed-in-opac-det.patch (text/plain), 5.45 KB, created by
Tomás Cohen Arazi (tcohen)
on 2025-01-21 12:43:43 UTC
(
hide
)
Description:
Bug 38936: Use redirect_if_opac_suppressed() in opac-*detail.pl pages
Filename:
MIME Type:
Creator:
Tomás Cohen Arazi (tcohen)
Created:
2025-01-21 12:43:43 UTC
Size:
5.45 KB
patch
obsolete
>From 8ebc3e74e344feac4731156f3d63aee8869d28c9 Mon Sep 17 00:00:00 2001 >From: Tomas Cohen Arazi <tomascohen@theke.io> >Date: Tue, 21 Jan 2025 08:33:06 -0300 >Subject: [PATCH] Bug 38936: Use redirect_if_opac_suppressed() in > opac-*detail.pl pages > >Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> >--- > opac/opac-ISBDdetail.pl | 29 +++-------------------------- > opac/opac-MARCdetail.pl | 29 +++-------------------------- > opac/opac-detail.pl | 29 +++-------------------------- > 3 files changed, 9 insertions(+), 78 deletions(-) > >diff --git a/opac/opac-ISBDdetail.pl b/opac/opac-ISBDdetail.pl >index 3bc55cb0f77..efe9458d9a6 100755 >--- a/opac/opac-ISBDdetail.pl >+++ b/opac/opac-ISBDdetail.pl >@@ -43,7 +43,7 @@ use Modern::Perl; > > use C4::Auth qw( get_template_and_user ); > use C4::Context; >-use C4::Output qw( parametrized_url output_html_with_http_headers ); >+use C4::Output qw( parametrized_url output_html_with_http_headers redirect_if_opac_suppressed ); > use CGI qw ( -utf8 ); > use C4::Biblio qw( > CountItemsIssued >@@ -77,31 +77,8 @@ if( !$biblio ) { > } > > # If record should be suppressed, handle it early >-if ( C4::Context->preference('OpacSuppression') ) { >- >- # 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); >- exit; >- } >- } else { >- print $query->redirect($redirect_url); >- exit; >- } >- } >-} >+redirect_if_opac_suppressed( $query, $biblio ) >+ if C4::Context->preference('OpacSuppression'); > > #open template > my ( $template, $loggedinuser, $cookie ) = get_template_and_user( >diff --git a/opac/opac-MARCdetail.pl b/opac/opac-MARCdetail.pl >index 8b3cb6ec085..89bdaa3fa63 100755 >--- a/opac/opac-MARCdetail.pl >+++ b/opac/opac-MARCdetail.pl >@@ -47,7 +47,7 @@ use Modern::Perl; > > use C4::Auth qw( get_template_and_user ); > use C4::Context; >-use C4::Output qw( parametrized_url output_html_with_http_headers ); >+use C4::Output qw( parametrized_url output_html_with_http_headers redirect_if_opac_suppressed ); > use CGI qw ( -utf8 ); > use C4::Biblio qw( > CountItemsIssued >@@ -98,31 +98,8 @@ if ( !$biblio ) { > } > > # If record should be suppressed, handle it early >-if ( C4::Context->preference('OpacSuppression') ) { >- >- # 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); >- exit; >- } >- } else { >- print $query->redirect($redirect_url); >- exit; >- } >- } >-} >+redirect_if_opac_suppressed( $query, $biblio ) >+ if C4::Context->preference('OpacSuppression'); > > unless ( $patron and $patron->category->override_hidden_items ) { > # only skip this check if there's a logged in user >diff --git a/opac/opac-detail.pl b/opac/opac-detail.pl >index ba5238b1c10..72bd477dfeb 100755 >--- a/opac/opac-detail.pl >+++ b/opac/opac-detail.pl >@@ -34,7 +34,7 @@ use C4::Koha qw( > ); > use C4::Search qw( new_record_from_zebra searchResults getRecords ); > use C4::Serials qw( CountSubscriptionFromBiblionumber SearchSubscriptions GetLatestSerials ); >-use C4::Output qw( parametrized_url output_html_with_http_headers ); >+use C4::Output qw( parametrized_url output_html_with_http_headers redirect_if_opac_suppressed ); > use C4::Biblio qw( > CountItemsIssued > GetBiblioData >@@ -113,31 +113,8 @@ unless ( $biblio && $record ) { > } > > # If record should be suppressed, handle it early >-if ( C4::Context->preference('OpacSuppression') ) { >- >- # 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); >- exit; >- } >- } else { >- print $query->redirect($redirect_url); >- exit; >- } >- } >-} >+redirect_if_opac_suppressed( $query, $biblio ) >+ if C4::Context->preference('OpacSuppression'); > > my $metadata_extractor = $biblio->metadata_extractor; > >-- >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