From c581c834a947129d75abcd05ef039019719caf66 Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Fri, 7 Apr 2023 14:51:50 +0200 Subject: [PATCH] Bug 30708: Koha controller script and template changes Content-Type: text/plain; charset=utf-8 Sponsored-by: BULAC - http://www.bulac.fr/ Signed-off-by: BULAC - http://www.bulac.fr/ Signed-off-by: Heather Hernandez Signed-off-by: Laurence Rault Signed-off-by: Marcel de Rooy --- .../intranet-tmpl/prog/en/includes/header.inc | 3 ++ .../prog/en/includes/permissions.inc | 3 ++ .../prog/en/includes/prefs-menu.inc | 10 ++++ .../prog/en/includes/preservation-menu.inc | 11 ++++ .../prog/en/includes/preservation-search.inc | 22 ++++++++ .../prog/en/includes/preservation-toolbar.inc | 6 +++ .../admin/preferences/preservation.pref | 16 ++++++ .../prog/en/modules/intranet-main.tt | 6 +++ .../prog/en/modules/preservation/home.tt | 42 +++++++++++++++ preservation/home.pl | 52 +++++++++++++++++++ 10 files changed, 171 insertions(+) create mode 100644 koha-tmpl/intranet-tmpl/prog/en/includes/preservation-menu.inc create mode 100644 koha-tmpl/intranet-tmpl/prog/en/includes/preservation-search.inc create mode 100644 koha-tmpl/intranet-tmpl/prog/en/includes/preservation-toolbar.inc create mode 100644 koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/preservation.pref create mode 100644 koha-tmpl/intranet-tmpl/prog/en/modules/preservation/home.tt create mode 100755 preservation/home.pl diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/header.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/header.inc index 0ab7ddbfdc..b67f82c838 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/includes/header.inc +++ b/koha-tmpl/intranet-tmpl/prog/en/includes/header.inc @@ -52,6 +52,9 @@ [% IF ( Koha.Preference('UseCourseReserves') ) %]
  • Course reserves
  • [% END %] + [% IF Koha.Preference('PreservationModule') && CAN_user_preservation %] +
  • Preservation
  • + [% END %] [% IF ( CAN_user_reports ) %]
  • Reports
  • [% END %] diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/permissions.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/permissions.inc index a4d3316231..aa40a2fe11 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/includes/permissions.inc +++ b/koha-tmpl/intranet-tmpl/prog/en/includes/permissions.inc @@ -84,6 +84,9 @@ [%- CASE 'loggedinlibrary' -%] Allow staff to change logged in library ([% name | html %]) + [%- CASE 'preservation' -%] + Manage the preservation module + ([% name | html %]) [%- END -%] [%- END -%] diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/prefs-menu.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/prefs-menu.inc index dbd8bce95e..021b8f7bf7 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/includes/prefs-menu.inc +++ b/koha-tmpl/intranet-tmpl/prog/en/includes/prefs-menu.inc @@ -139,6 +139,16 @@ [% END %] + [% IF ( preservation ) %] +
  • + Preservation + [% PROCESS subtabs %] + [% ELSE %] +
  • + Preservation + [% END %] +
  • + [% IF ( searching ) %]
  • Searching diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/preservation-menu.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/preservation-menu.inc new file mode 100644 index 0000000000..e284b96a42 --- /dev/null +++ b/koha-tmpl/intranet-tmpl/prog/en/includes/preservation-menu.inc @@ -0,0 +1,11 @@ +[% USE Koha %] + diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/preservation-search.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/preservation-search.inc new file mode 100644 index 0000000000..b02dd79a49 --- /dev/null +++ b/koha-tmpl/intranet-tmpl/prog/en/includes/preservation-search.inc @@ -0,0 +1,22 @@ + + + + + diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/preservation-toolbar.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/preservation-toolbar.inc new file mode 100644 index 0000000000..5c4a620359 --- /dev/null +++ b/koha-tmpl/intranet-tmpl/prog/en/includes/preservation-toolbar.inc @@ -0,0 +1,6 @@ +[% INCLUDE 'blocking_errors.inc' %] + + + diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/preservation.pref b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/preservation.pref new file mode 100644 index 0000000000..0a3eb22c95 --- /dev/null +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/preservation.pref @@ -0,0 +1,16 @@ +Preservation: + Interface: + - + - pref: PreservationModule + choices: + 1: Enable + 0: Disable + - the preservation module + - + - Use the NOT_LOAN authorized value + - pref: PreservationNotForLoanWaitingListIn + - to apply to items added to the waiting list + - + - Use the NOT_LOAN authorized value + - pref: PreservationNotForLoanDefaultTrainIn + - to apply to items added to a train diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/intranet-main.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/intranet-main.tt index 1b4dfe93dd..ad7bf2915f 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/intranet-main.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/intranet-main.tt @@ -150,6 +150,12 @@
  • [% END %] + [% IF Koha.Preference('PreservationModule') && CAN_user_preservation%] +
  • + Preservation +
  • + [% END %] + [% IF ( CAN_user_tools || CAN_user_clubs ) %]
  • diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/preservation/home.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/preservation/home.tt new file mode 100644 index 0000000000..5740f51d5e --- /dev/null +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/preservation/home.tt @@ -0,0 +1,42 @@ +[% USE raw %] +[% USE To %] +[% USE Asset %] +[% USE KohaDates %] +[% USE TablesSettings %] +[% USE AuthorisedValues %] +[% SET footerjs = 1 %] +[% PROCESS 'i18n.inc' %] +[% INCLUDE 'doc-head-open.inc' %] + + Preservation › Koha + +[% INCLUDE 'doc-head-close.inc' %] + + + +[% WRAPPER 'header.inc' %] + [% INCLUDE 'preservation-search.inc' %] +[% END %] + +
    + +[% MACRO jsinclude BLOCK %] + [% INCLUDE 'calendar.inc' %] + [% INCLUDE 'datatables.inc' %] + [% INCLUDE 'columns_settings.inc' %] + [% INCLUDE 'js-patron-format.inc' %] + [% INCLUDE 'js-date-format.inc' %] + [% INCLUDE 'js-biblio-format.inc' %] + + + + [% Asset.js("js/vue/dist/preservation.js") | $raw %] + +[% END %] +[% INCLUDE 'intranet-bottom.inc' %] diff --git a/preservation/home.pl b/preservation/home.pl new file mode 100755 index 0000000000..af66337c78 --- /dev/null +++ b/preservation/home.pl @@ -0,0 +1,52 @@ +#!/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 . + +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::Database::Columns; + +my $query = CGI->new; +my ( $template, $loggedinuser, $cookie, $userflags ) = get_template_and_user( + { + template_name => 'preservation/home.tt', + query => $query, + type => 'intranet', + flagsrequired => { preservation => '*' }, + } +); + +my $columns = Koha::Database::Columns::columns; +$template->param( + db_columns => { + map { + my $table = $_; + map { ( $table . '.' . $_ => $columns->{$table}->{$_} ) } + keys %{ $columns->{$table} } + } qw( biblio biblioitems items ) + }, + api_mappings => { + items => Koha::Item->to_api_mapping, + biblioitems => Koha::Biblioitem->to_api_mapping, + biblio => Koha::Biblio->to_api_mapping, + }, +); + +output_html_with_http_headers $query, $cookie, $template->output; -- 2.30.2