@@ -, +, @@ --- C4/Auth.pm | 6 +++++- installer/data/mysql/updatedatabase.pl | 6 ++++++ koha-tmpl/opac-tmpl/prog/en/includes/masthead.inc | 4 ++++ opac/opac-ISBDdetail.pl | 2 +- opac/opac-MARCdetail.pl | 2 +- opac/opac-addbybiblionumber.pl | 2 +- opac/opac-alert-subscribe.pl | 2 +- opac/opac-authorities-home.pl | 2 +- opac/opac-authoritiesdetail.pl | 2 +- opac/opac-basket.pl | 2 +- opac/opac-browser.pl | 2 +- opac/opac-detail.pl | 2 +- opac/opac-main.pl | 2 +- opac/opac-review.pl | 2 +- opac/opac-search.pl | 2 +- opac/opac-sendbasket.pl | 2 +- opac/opac-shelves.pl | 2 +- opac/opac-showmarc.pl | 2 +- opac/opac-showreviews.pl | 2 +- opac/opac-suggestions.pl | 2 +- opac/opac-tags_subject.pl | 2 +- opac/opac-topissues.pl | 2 +- opac/opac-user.pl | 2 +- opac/opac-userupdate.pl | 2 +- 24 files changed, 36 insertions(+), 22 deletions(-) --- a/C4/Auth.pm +++ a/C4/Auth.pm @@ -456,6 +456,8 @@ sub get_template_and_user { SyndeticsSeries => C4::Context->preference("SyndeticsSeries"), SyndeticsCoverImageSize => C4::Context->preference("SyndeticsCoverImageSize"), ); + + $template->param(OpacPublic => '1') if ($template->param( 'loggedinusername') || C4::Context->preference("OpacPublic")); } $template->param(listloop=>[{shelfname=>"Freelist", shelfnumber=>110}]); return ( $template, $borrowernumber, $cookie, $flags); @@ -943,8 +945,10 @@ sub checkauth { TemplateEncoding => C4::Context->preference("TemplateEncoding"), IndependantBranches=> C4::Context->preference("IndependantBranches"), AutoLocation => C4::Context->preference("AutoLocation"), - wrongip => $info{'wrongip'} + wrongip => $info{'wrongip'}, ); + + $template->param( OpacPublic => C4::Context->preference("OpacPublic")); $template->param( loginprompt => 1 ) unless $info{'nopermission'}; if ($cas) { --- a/installer/data/mysql/updatedatabase.pl +++ a/installer/data/mysql/updatedatabase.pl @@ -3744,6 +3744,12 @@ if (C4::Context->preference("Version") < TransformToNum($DBversion)) { SetVersion ($DBversion); } +$DBversion = "3.00.xx.xxx"; +if (C4::Context->preference("Version") < TransformToNum($DBversion)) { + $dbh->do("INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES ('OpacPublic','1','If set to OFF and user is not logged in, all OPAC pages require authentication, and OPAC searchbar is removed)','','YesNo')"); + print "Upgrade to $DBversion done (added 'OpacPublic' syspref)\n"; + SetVersion ($DBversion); +} =item DropAllForeignKeys($table) --- a/koha-tmpl/opac-tmpl/prog/en/includes/masthead.inc +++ a/koha-tmpl/opac-tmpl/prog/en/includes/masthead.inc @@ -25,6 +25,8 @@ Koha Online Catalog
+ +
+ +
Your cart is empty.
--- a/opac/opac-ISBDdetail.pl +++ a/opac/opac-ISBDdetail.pl @@ -64,7 +64,7 @@ my ( $template, $loggedinuser, $cookie ) = get_template_and_user( template_name => "opac-ISBDdetail.tmpl", query => $query, type => "opac", - authnotrequired => 1, + authnotrequired => ( C4::Context->preference("OpacPublic") ? 1 : 0 ), debug => 1, } ); --- a/opac/opac-MARCdetail.pl +++ a/opac/opac-MARCdetail.pl @@ -70,7 +70,7 @@ my ( $template, $loggedinuser, $cookie ) = get_template_and_user( template_name => "opac-MARCdetail.tmpl", query => $query, type => "opac", - authnotrequired => 1, + authnotrequired => ( C4::Context->preference("OpacPublic") ? 1 : 0 ), debug => 1, } ); --- a/opac/opac-addbybiblionumber.pl +++ a/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("OpacPublic") ? 1 : 0 ), } ); --- a/opac/opac-alert-subscribe.pl +++ a/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("OpacPublic") ? 1 : 0 ), debug => 1, } ); --- a/opac/opac-authorities-home.pl +++ a/opac/opac-authorities-home.pl @@ -151,7 +151,7 @@ else { template_name => "opac-authorities-home.tmpl", query => $query, type => 'opac', - authnotrequired => 1, + authnotrequired => ( C4::Context->preference("OpacPublic") ? 1 : 0 ), debug => 1, } ); --- a/opac/opac-authoritiesdetail.pl +++ a/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("OpacPublic") ? 1 : 0 ), debug => 1, } ); --- a/opac/opac-basket.pl +++ a/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("OpacPublic") ? 1 : 0 ), flagsrequired => { borrow => 1 }, } ); --- a/opac/opac-browser.pl +++ a/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("OpacPublic") ? 1 : 0 ), debug => 1, } ); --- a/opac/opac-detail.pl +++ a/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("OpacPublic") ? 1 : 0 ), flagsrequired => { borrow => 1 }, } ); --- a/opac/opac-main.pl +++ a/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("OpacPublic") ? 1 : 0 ), flagsrequired => { borrow => 1 }, } ); --- a/opac/opac-review.pl +++ a/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("OpacPublic") ? 1 : 0 ), } ); --- a/opac/opac-search.pl +++ a/opac/opac-search.pl @@ -80,7 +80,7 @@ else { template_name => $template_name, query => $cgi, type => "opac", - authnotrequired => 1, + authnotrequired => ( C4::Context->preference("OpacPublic") ? 1 : 0 ), } ); --- a/opac/opac-sendbasket.pl +++ a/opac/opac-sendbasket.pl @@ -38,7 +38,7 @@ my ( $template, $borrowernumber, $cookie ) = get_template_and_user ( template_name => "opac-sendbasketform.tmpl", query => $query, type => "opac", - authnotrequired => 0, + authnotrequired => ( C4::Context->preference("OpacPublic") ? 1 : 0 ), flagsrequired => { borrow => 1 }, } ); --- a/opac/opac-shelves.pl +++ a/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("OpacPublic") ? 1 : 0 ), }); $template->param(listsview => 1); # if $loggedinuser is not defined, set it to -1, which should --- a/opac/opac-showmarc.pl +++ a/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("OpacPublic") ? 1 : 0 ), debug => 1, }); --- a/opac/opac-showreviews.pl +++ a/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("OpacPublic") ? 1 : 0 ), } ); --- a/opac/opac-suggestions.pl +++ a/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("OpacPublic") ? 1 : 0 ), } ); if ( !$$suggestion{suggestedby} ) { --- a/opac/opac-tags_subject.pl +++ a/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("OpacPublic") ? 1 : 0 ), debug => 1, } ); --- a/opac/opac-topissues.pl +++ a/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("OpacPublic") ? 1 : 0 ), debug => 1, }); my $dbh = C4::Context->dbh; --- a/opac/opac-user.pl +++ a/opac/opac-user.pl @@ -47,7 +47,7 @@ my ( $template, $borrowernumber, $cookie ) = get_template_and_user( template_name => "opac-user.tmpl", query => $query, type => "opac", - authnotrequired => 0, + authnotrequired => ( C4::Context->preference("OpacPublic") ? 1 : 0 ), flagsrequired => { borrow => 1 }, debug => 1, } --- a/opac/opac-userupdate.pl +++ a/opac/opac-userupdate.pl @@ -40,7 +40,7 @@ my ( $template, $borrowernumber, $cookie ) = get_template_and_user( template_name => "opac-userupdate.tmpl", query => $query, type => "opac", - authnotrequired => 0, + authnotrequired => ( C4::Context->preference("OpacPublic") ? 1 : 0 ), flagsrequired => { borrow => 1 }, debug => 1, } --