01091c8089
To test: 1. Take note of what your logged in library is 2. Add a new page that can be viewed on the OPAC and staff interface. Limit the library to a different library, not your logged in library 3. Use a News item to create a hyperlink to your new page on the OPAC and staff interface. 4. Confirm that a page error shows if you try to view the new page. 5. Edit the new page and set the library to All libraries. 6. Try to go to the new page again and confirm it shows. 7. Log out and log back into the staff interface as a staff user that isn't a superlibrarian 8. Confirm you can view the new page as this user Sponsored-by: Horowhenua Libraries Trust Signed-off-by: Owen Leonard <oleonard@myacpl.org> Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com> Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
48 lines
1.5 KiB
Perl
Executable file
48 lines
1.5 KiB
Perl
Executable file
#!/usr/bin/perl
|
|
|
|
# This file is part of Koha.
|
|
#
|
|
# Koha is free software; you can redistribute it and/or modify it
|
|
# under the terms of the GNU General Public License as published by
|
|
# the Free Software Foundation; either version 3 of the License, or
|
|
# (at your option) any later version.
|
|
#
|
|
# Koha is distributed in the hope that it will be useful, but
|
|
# WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
# GNU General Public License for more details.
|
|
#
|
|
# You should have received a copy of the GNU General Public License
|
|
# along with Koha; if not, see <http://www.gnu.org/licenses>.
|
|
|
|
use Modern::Perl;
|
|
|
|
use CGI qw ( -utf8 );
|
|
use C4::Auth qw( get_template_and_user );
|
|
use C4::Output qw( output_html_with_http_headers );
|
|
use Koha::AdditionalContents;
|
|
|
|
my $query = CGI->new;
|
|
my ( $template, $loggedinuser, $cookie ) = get_template_and_user(
|
|
{
|
|
template_name => "tools/page.tt",
|
|
query => $query,
|
|
type => "intranet",
|
|
flagsrequired => { catalogue => 1 },
|
|
}
|
|
);
|
|
|
|
my $page_id = $query->param('page_id');
|
|
my $page;
|
|
|
|
if (defined $page_id){
|
|
my $branch = C4::Context->userenv->{'branch'};
|
|
$page = Koha::AdditionalContents->search({ idnew => $page_id, location => ['staff_only', 'staff_and_opac'], branchcode => [ $branch, undef ] });
|
|
if ( $page->count > 0){
|
|
$template->param( page => $page->next );
|
|
} else {
|
|
$template->param( page_error => 1 );
|
|
}
|
|
}
|
|
|
|
output_html_with_http_headers $query, $cookie, $template->output;
|