diff --git a/C4/Auth.pm b/C4/Auth.pm index fe79fe5..646d4fa 100755 --- a/C4/Auth.pm +++ b/C4/Auth.pm @@ -150,6 +150,8 @@ sub get_template_and_user { # user info $template->param( loggedinusername => $user ); $template->param( sessionID => $sessionID ); + $template->param( OpacNotPublic => C4::Context->preference("OpacNotPublic") ) + unless ( $template->param( 'loggedinusername' ) ); my ($total, $pubshelves, $barshelves) = C4::Context->get_shelves_userenv(); if (defined($pubshelves)) { @@ -917,6 +919,7 @@ sub checkauth { virtualshelves => C4::Context->preference("virtualshelves"), LibraryName => C4::Context->preference("LibraryName"), opacuserlogin => C4::Context->preference("opacuserlogin"), + OpacNotPublic => C4::Context->preference("OpacNotPublic"), OpacNav => C4::Context->preference("OpacNav"), opaccredits => C4::Context->preference("opaccredits"), opacreadinghistory => C4::Context->preference("opacreadinghistory"), diff --git a/installer/data/mysql/updatedatabase.pl b/installer/data/mysql/updatedatabase.pl index e6f3f9f..440b736 100755 --- a/installer/data/mysql/updatedatabase.pl +++ b/installer/data/mysql/updatedatabase.pl @@ -3520,6 +3520,13 @@ if (C4::Context->preference('Version') < TransformToNum($DBversion)){ SetVersion ($DBversion); } +$DBversion = '3.01.00.xxx'; +if (C4::Context->preference("Version") < TransformToNum($DBversion)) { + $dbh->do("INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES ('OpacNotPublic','0','OPAC search-bar and buttons, and non-authenticated OPAC access','','YesNo')"); + print "Upgrade to $DBversion done (added 'OpacNotPublic' syspref)\n"; + SetVersion ($DBversion); +} + =item DropAllForeignKeys($table) Drop all foreign keys of the table $table diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/opac.pref b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/opac.pref index 98d78a0..e811049 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/opac.pref +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/opac.pref @@ -294,6 +294,12 @@ OPAC: yes: Show no: "Don't show" - purchase suggestions from other patrons on the OPAC. + - + - pref: OPACNotPublic + choices: + yes: "Disable" + no: "Enable" + - OPAC search-bar field and Cart/Virtual-Shelves buttons, and non-authenticated OPAC access. Privacy: - - pref: EnableOpacSearchHistory diff --git a/koha-tmpl/opac-tmpl/prog/en/includes/masthead.inc b/koha-tmpl/opac-tmpl/prog/en/includes/masthead.inc index 63d92b0..dfc3800 100644 --- a/koha-tmpl/opac-tmpl/prog/en/includes/masthead.inc +++ b/koha-tmpl/opac-tmpl/prog/en/includes/masthead.inc @@ -25,6 +25,10 @@ Koha Online Catalog
+ + + +
+ + + +
+ + +

diff --git a/kohaversion.pl b/kohaversion.pl index c1edc2e..dfa8a32 100644 --- a/kohaversion.pl +++ b/kohaversion.pl @@ -10,7 +10,7 @@ use strict; sub kohaversion { - our $VERSION = '3.01.00.124'; + our $VERSION = '3.01.00.xxx'; # version needs to be set this way # so that it can be picked up by Makefile.PL # during install diff --git a/opac/ilsdi.pl b/opac/ilsdi.pl index 1a97abe..a61b04f 100755 --- a/opac/ilsdi.pl +++ b/opac/ilsdi.pl @@ -123,7 +123,7 @@ if ( not $cgi->param('service') ) { { template_name => "ilsdi.tmpl", query => $cgi, type => "opac", - authnotrequired => 1, + authnotrequired => (C4::Context->preference("OpacNotPublic") ? 0 : 1), debug => 1, } ); @@ -137,7 +137,7 @@ if ( $cgi->param('service') eq "Describe" and grep { $cgi->param('verb') eq $_ } { template_name => "ilsdi.tmpl", query => $cgi, type => "opac", - authnotrequired => 1, + authnotrequired => (C4::Context->preference("OpacNotPublic") ? 0 : 1), debug => 1, } ); diff --git a/opac/maintenance.pl b/opac/maintenance.pl index 3044c5d..c5ce538 100755 --- a/opac/maintenance.pl +++ b/opac/maintenance.pl @@ -31,7 +31,7 @@ my ( $template, $borrowernumber, $cookie ) = get_template_and_user( template_name => "maintenance.tmpl", type => "opac", query => $input, - authnotrequired => 1, + authnotrequired => (C4::Context->preference("OpacNotPublic") ? 0 : 1), flagsrequired => { borrow => 1 }, } ); diff --git a/opac/opac-ISBDdetail.pl b/opac/opac-ISBDdetail.pl index 24557d1..6c347b1 100755 --- a/opac/opac-ISBDdetail.pl +++ b/opac/opac-ISBDdetail.pl @@ -63,7 +63,7 @@ my ( $template, $loggedinuser, $cookie ) = get_template_and_user( template_name => "opac-ISBDdetail.tmpl", query => $query, type => "opac", - authnotrequired => 1, + authnotrequired => (C4::Context->preference("OpacNotPublic") ? 0 : 1), debug => 1, } ); diff --git a/opac/opac-MARCdetail.pl b/opac/opac-MARCdetail.pl index ff85d9b..04c9d72 100755 --- a/opac/opac-MARCdetail.pl +++ b/opac/opac-MARCdetail.pl @@ -67,7 +67,7 @@ my ( $template, $loggedinuser, $cookie ) = get_template_and_user( template_name => "opac-MARCdetail.tmpl", query => $query, type => "opac", - authnotrequired => 1, + authnotrequired => (C4::Context->preference("OpacNotPublic") ? 0 : 1), debug => 1, } ); diff --git a/opac/opac-addbybiblionumber.pl b/opac/opac-addbybiblionumber.pl index cb3a372..cbdcb41 100755 --- a/opac/opac-addbybiblionumber.pl +++ b/opac/opac-addbybiblionumber.pl @@ -59,7 +59,7 @@ my ( $template, $loggedinuser, $cookie ) = get_template_and_user( template_name => "opac-addbybiblionumber.tmpl", query => $query, type => "opac", - authnotrequired => 1, + authnotrequired => (C4::Context->preference("OpacNotPublic") ? 0 : 1), } ); diff --git a/opac/opac-alert-subscribe.pl b/opac/opac-alert-subscribe.pl index 8e827b6..bfd5429 100755 --- a/opac/opac-alert-subscribe.pl +++ b/opac/opac-alert-subscribe.pl @@ -46,7 +46,7 @@ my $biblionumber = $query->param('biblionumber'); template_name => "opac-alert-subscribe.tmpl", query => $query, type => "opac", - authnotrequired => 1, + authnotrequired => (C4::Context->preference("OpacNotPublic") ? 0 : 1), debug => 1, } ); diff --git a/opac/opac-authorities-home.pl b/opac/opac-authorities-home.pl index 98f00ce..658be31 100755 --- a/opac/opac-authorities-home.pl +++ b/opac/opac-authorities-home.pl @@ -75,7 +75,7 @@ if ( $op eq "do_search" ) { template_name => "opac-authoritiessearchresultlist.tmpl", query => $query, type => 'opac', - authnotrequired => 1, + authnotrequired => (C4::Context->preference("OpacNotPublic") ? 0 : 1), debug => 1, } ); @@ -151,7 +151,7 @@ else { template_name => "opac-authorities-home.tmpl", query => $query, type => 'opac', - authnotrequired => 1, + authnotrequired => (C4::Context->preference("OpacNotPublic") ? 0 : 1), debug => 1, } ); diff --git a/opac/opac-authoritiesdetail.pl b/opac/opac-authoritiesdetail.pl index 8df9d47..84a0495 100755 --- a/opac/opac-authoritiesdetail.pl +++ b/opac/opac-authoritiesdetail.pl @@ -63,7 +63,7 @@ my ( $template, $loggedinuser, $cookie ) = get_template_and_user( template_name => "opac-authoritiesdetail.tmpl", query => $query, type => "opac", - authnotrequired => 1, + authnotrequired => (C4::Context->preference("OpacNotPublic") ? 0 : 1), debug => 1, } ); diff --git a/opac/opac-basket.pl b/opac/opac-basket.pl index 26e2e17..a1b54df 100755 --- a/opac/opac-basket.pl +++ b/opac/opac-basket.pl @@ -32,7 +32,7 @@ my ( $template, $borrowernumber, $cookie ) = get_template_and_user ( template_name => "opac-basket.tmpl", query => $query, type => "opac", - authnotrequired => 1, + authnotrequired => (C4::Context->preference("OpacNotPublic") ? 0 : 1), flagsrequired => { borrow => 1 }, } ); diff --git a/opac/opac-browser.pl b/opac/opac-browser.pl index df9c3ca..960de49 100755 --- a/opac/opac-browser.pl +++ b/opac/opac-browser.pl @@ -44,7 +44,7 @@ my ( $template, $loggedinuser, $cookie ) = get_template_and_user( template_name => "opac-browser.tmpl", query => $query, type => "opac", - authnotrequired => 1, + authnotrequired => (C4::Context->preference("OpacNotPublic") ? 0 : 1), debug => 1, } ); diff --git a/opac/opac-detail.pl b/opac/opac-detail.pl index d43651b..cf0dd91 100755 --- a/opac/opac-detail.pl +++ b/opac/opac-detail.pl @@ -55,7 +55,7 @@ my ( $template, $borrowernumber, $cookie ) = get_template_and_user( template_name => "opac-detail.tmpl", query => $query, type => "opac", - authnotrequired => 1, + authnotrequired => (C4::Context->preference("OpacNotPublic") ? 0 : 1), flagsrequired => { borrow => 1 }, } ); diff --git a/opac/opac-downloadcart.pl b/opac/opac-downloadcart.pl index a670a65..1b3b70e 100755 --- a/opac/opac-downloadcart.pl +++ b/opac/opac-downloadcart.pl @@ -40,7 +40,7 @@ my ( $template, $borrowernumber, $cookie ) = get_template_and_user ( template_name => "opac-downloadcart.tmpl", query => $query, type => "opac", - authnotrequired => 1, + authnotrequired => (C4::Context->preference("OpacNotPublic") ? 0 : 1), flagsrequired => { borrow => 1 }, } ); diff --git a/opac/opac-downloadshelf.pl b/opac/opac-downloadshelf.pl index 94785be..da941d3 100755 --- a/opac/opac-downloadshelf.pl +++ b/opac/opac-downloadshelf.pl @@ -40,7 +40,7 @@ my ( $template, $borrowernumber, $cookie ) = get_template_and_user ( template_name => "opac-downloadshelf.tmpl", query => $query, type => "opac", - authnotrequired => 1, + authnotrequired => (C4::Context->preference("OpacNotPublic") ? 0 : 1), flagsrequired => { borrow => 1 }, } ); diff --git a/opac/opac-main.pl b/opac/opac-main.pl index e0a65a9..b7ea156 100755 --- a/opac/opac-main.pl +++ b/opac/opac-main.pl @@ -36,7 +36,7 @@ my ( $template, $borrowernumber, $cookie ) = get_template_and_user( template_name => "opac-main.tmpl", type => "opac", query => $input, - authnotrequired => 1, + authnotrequired => (C4::Context->preference("OpacNotPublic") ? 0 : 1), flagsrequired => { borrow => 1 }, } ); diff --git a/opac/opac-review.pl b/opac/opac-review.pl index 57a460f..75886ac 100755 --- a/opac/opac-review.pl +++ b/opac/opac-review.pl @@ -36,7 +36,7 @@ my ( $template, $borrowernumber, $cookie ) = get_template_and_user( template_name => "opac-review.tmpl", query => $query, type => "opac", - authnotrequired => 1, + authnotrequired => (C4::Context->preference("OpacNotPublic") ? 0 : 1), } ); diff --git a/opac/opac-search-history.pl b/opac/opac-search-history.pl index 8c461d2..fb539ca 100755 --- a/opac/opac-search-history.pl +++ b/opac/opac-search-history.pl @@ -40,7 +40,7 @@ my ($template, $loggedinuser, $cookie) = get_template_and_user({template_name => "opac-search-history.tmpl", query => $cgi, type => "opac", - authnotrequired => 1, + authnotrequired => (C4::Context->preference("OpacNotPublic") ? 0 : 1), flagsrequired => {borrowers => 1}, debug => 1, }); diff --git a/opac/opac-search.pl b/opac/opac-search.pl index 261f274..05e4b46 100755 --- a/opac/opac-search.pl +++ b/opac/opac-search.pl @@ -79,7 +79,7 @@ else { template_name => $template_name, query => $cgi, type => "opac", - authnotrequired => 1, + authnotrequired => (C4::Context->preference("OpacNotPublic") ? 0 : 1), } ); diff --git a/opac/opac-sendbasket.pl b/opac/opac-sendbasket.pl index 76400a5..0c63e23 100755 --- a/opac/opac-sendbasket.pl +++ b/opac/opac-sendbasket.pl @@ -62,7 +62,7 @@ if ( $email_add ) { template_name => "opac-sendbasket.tmpl", query => $query, type => "opac", - authnotrequired => 1, + authnotrequired => (C4::Context->preference("OpacNotPublic") ? 0 : 1), flagsrequired => { borrow => 1 }, } ); diff --git a/opac/opac-sendshelf.pl b/opac/opac-sendshelf.pl index 1f94989..861ac14 100755 --- a/opac/opac-sendshelf.pl +++ b/opac/opac-sendshelf.pl @@ -40,7 +40,7 @@ my ( $template, $borrowernumber, $cookie ) = get_template_and_user ( template_name => "opac-sendshelfform.tmpl", query => $query, type => "opac", - authnotrequired => 1, + authnotrequired => (C4::Context->preference("OpacNotPublic") ? 0 : 1), flagsrequired => { borrow => 1 }, } ); @@ -64,7 +64,7 @@ if ( $email ) { template_name => "opac-sendshelf.tmpl", query => $query, type => "opac", - authnotrequired => 1, + authnotrequired => (C4::Context->preference("OpacNotPublic") ? 0 : 1), flagsrequired => { borrow => 1 }, } ); diff --git a/opac/opac-serial-issues.pl b/opac/opac-serial-issues.pl index 8993d7f..f824008 100755 --- a/opac/opac-serial-issues.pl +++ b/opac/opac-serial-issues.pl @@ -48,7 +48,7 @@ if ( $selectview eq "full" ) { template_name => "opac-full-serial-issues.tmpl", query => $query, type => "opac", - authnotrequired => 1, + authnotrequired => (C4::Context->preference("OpacNotPublic") ? 0 : 1), debug => 1, } ); @@ -86,7 +86,7 @@ else { template_name => "opac-serial-issues.tmpl", query => $query, type => "opac", - authnotrequired => 1, + authnotrequired => (C4::Context->preference("OpacNotPublic") ? 0 : 1), debug => 1, } ); diff --git a/opac/opac-shelves.pl b/opac/opac-shelves.pl index dbd598c..27e193f 100755 --- a/opac/opac-shelves.pl +++ b/opac/opac-shelves.pl @@ -29,7 +29,7 @@ my ( $template, $loggedinuser, $cookie ) = get_template_and_user({ template_name => "opac-shelves.tmpl", query => $query, type => "opac", - authnotrequired => 1, + authnotrequired => (C4::Context->preference("OpacNotPublic") ? 0 : 1), }); $template->param(listsview => 1); # if $loggedinuser is not defined, set it to -1, which should diff --git a/opac/opac-showmarc.pl b/opac/opac-showmarc.pl index 2024bcb..5d0d624 100755 --- a/opac/opac-showmarc.pl +++ b/opac/opac-showmarc.pl @@ -48,7 +48,7 @@ my ( $template, $loggedinuser, $cookie ) = get_template_and_user({ template_name => "opac-showmarc.tmpl", query => $input, type => "opac", - authnotrequired => 1, + authnotrequired => (C4::Context->preference("OpacNotPublic") ? 0 : 1), debug => 1, }); diff --git a/opac/opac-showreviews.pl b/opac/opac-showreviews.pl index ac8343a..f9e4213 100755 --- a/opac/opac-showreviews.pl +++ b/opac/opac-showreviews.pl @@ -34,7 +34,7 @@ my ( $template, $borrowernumber, $cookie ) = &get_template_and_user( template_name => "opac-showreviews.tmpl", query => $query, type => "opac", - authnotrequired => 1, + authnotrequired => (C4::Context->preference("OpacNotPublic") ? 0 : 1), } ); diff --git a/opac/opac-suggestions.pl b/opac/opac-suggestions.pl index e11cd0b..e151b70 100755 --- a/opac/opac-suggestions.pl +++ b/opac/opac-suggestions.pl @@ -44,7 +44,7 @@ if ( C4::Context->preference("AnonSuggestions") ) { template_name => "opac-suggestions.tmpl", query => $input, type => "opac", - authnotrequired => 1, + authnotrequired => (C4::Context->preference("OpacNotPublic") ? 0 : 1), } ); if ( !$$suggestion{suggestedby} ) { diff --git a/opac/opac-tags.pl b/opac/opac-tags.pl index dc229fd..a94b6f5 100755 --- a/opac/opac-tags.pl +++ b/opac/opac-tags.pl @@ -107,7 +107,7 @@ if ($is_ajax) { template_name => "opac-tags.tmpl", query => $query, type => "opac", - authnotrequired => ($add_op ? 0 : 1), # auth required to add tags + authnotrequired => ($add_op && C4::Context->preference("OpacNotPublic") ? 0 : 1), # auth required to add tags debug => 1, }); } diff --git a/opac/opac-tags_subject.pl b/opac/opac-tags_subject.pl index 5836f70..8316412 100755 --- a/opac/opac-tags_subject.pl +++ b/opac/opac-tags_subject.pl @@ -44,7 +44,7 @@ my ( $template, $loggedinuser, $cookie ) = get_template_and_user( template_name => "opac-tags_subject.tmpl", query => $query, type => "opac", - authnotrequired => 1, + authnotrequired => (C4::Context->preference("OpacNotPublic") ? 0 : 1), debug => 1, } ); diff --git a/opac/opac-topissues.pl b/opac/opac-topissues.pl index 1b0d42a..7bf890b 100755 --- a/opac/opac-topissues.pl +++ b/opac/opac-topissues.pl @@ -48,7 +48,7 @@ my ($template, $borrowernumber, $cookie) = get_template_and_user({template_name => 'opac-topissues.tmpl', query => $input, type => "opac", - authnotrequired => 1, + authnotrequired => (C4::Context->preference("OpacNotPublic") ? 0 : 1), debug => 1, }); my $dbh = C4::Context->dbh; diff --git a/opac/opac-userupdate.pl b/opac/opac-userupdate.pl index 8495d34..539efda 100755 --- a/opac/opac-userupdate.pl +++ b/opac/opac-userupdate.pl @@ -66,7 +66,7 @@ if ( !$updateemailaddress || $updateemailaddress eq '' ) { template_name => "kohaerror.tmpl", query => $query, type => "opac", - authnotrequired => 1, + authnotrequired => (C4::Context->preference("OpacNotPublic") ? 0 : 1), flagsrequired => { borrow => 1 }, debug => 1, }