From c2127901da52e0c35124b97ff4626d3ea943e655 Mon Sep 17 00:00:00 2001 From: Owen Leonard Date: Thu, 4 Jun 2020 11:51:38 +0000 Subject: [PATCH] Bug 25627: Move OPAC problem reports from administration to tools This patch moves the OPAC problem report management page from the Administration section to the Tools section. I think this makes sense because management of reports is an ongoing task, not a configuration. To test, apply the patch and enable the OPACReportProblem system preference. - Go to Administration. There should be no link to OPAC problem reports. - Open an administration page which shows the Administration menu in the left-hand sidebar, e.g. Libraries. There should be no link to OPAC problem reports in the menu. - Go to Tools. There should be a link to OPAC problem reports in the "Addional tools" section. - Open the OPAC problem reports page and confirm that it works correctly. - The breadcrumbs menu should show "Tools > OPAC problem reports." - Confirm that the link in the sidebar menu works correctly. - If necessary, submit an OPAC problem report via the OPAC so that there is a pending report. Go to the staff interface home page and check that the "OPAC problem reports pending" link works correctly. Signed-off-by: David Nind Signed-off-by: Katrin Fischer Signed-off-by: Jonathan Druart --- admin/problem-reports.pl | 73 ------ .../intranet-tmpl/prog/en/includes/admin-menu.inc | 3 - .../intranet-tmpl/prog/en/includes/tools-menu.inc | 3 + .../prog/en/modules/admin/admin-home.tt | 4 - .../prog/en/modules/admin/problem-reports.tt | 231 -------------------- .../intranet-tmpl/prog/en/modules/intranet-main.tt | 2 +- .../prog/en/modules/tools/problem-reports.tt | 231 ++++++++++++++++++++ .../prog/en/modules/tools/tools-home.tt | 5 + tools/problem-reports.pl | 73 ++++++ 9 files changed, 313 insertions(+), 312 deletions(-) delete mode 100755 admin/problem-reports.pl delete mode 100644 koha-tmpl/intranet-tmpl/prog/en/modules/admin/problem-reports.tt create mode 100644 koha-tmpl/intranet-tmpl/prog/en/modules/tools/problem-reports.tt create mode 100755 tools/problem-reports.pl diff --git a/admin/problem-reports.pl b/admin/problem-reports.pl deleted file mode 100755 index 70b9727..0000000 --- a/admin/problem-reports.pl +++ /dev/null @@ -1,73 +0,0 @@ -#!/usr/bin/perl - -# Copyright 2020 Aleisha Amohia -# -# 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::Context; -use C4::Output; -use C4::Auth; -use Koha::ProblemReports; - -my $query = new CGI; - -my ( $template, $loggedinuser, $cookie ) = get_template_and_user( - { - template_name => "admin/problem-reports.tt", - query => $query, - type => "intranet", - authnotrequired => 0, - flagsrequired => { problem_reports => 1 }, - } -); - -my $action; -foreach (qw( viewed closed new )) { - $action = $_ if ( $query->param("mark_selected-$_") ); -} -$action ||= 'none'; - -my @report_ids = $query->multi_param('report_ids'); - -if ( $action eq 'viewed' ) { - foreach my $report_id ( @report_ids ) { - my $report = Koha::ProblemReports->find($report_id); - $report->set({ status => 'Viewed' })->store; - } -} elsif ( $action eq 'closed' ) { - foreach my $report_id ( @report_ids ) { - my $report = Koha::ProblemReports->find($report_id); - $report->set({ status => 'Closed' })->store; - } - -} elsif ( $action eq 'new' ) { - foreach my $report_id ( @report_ids ) { - my $report = Koha::ProblemReports->find($report_id); - $report->set({ status => 'New' })->store; - } -} - -my $problem_reports = Koha::ProblemReports->search(); -$template->param( - selected_count => scalar(@report_ids), - action => $action, - problem_reports => $problem_reports, -); - -output_html_with_http_headers $query, $cookie, $template->output; diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/admin-menu.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/admin-menu.inc index 53d1610..1be43b1 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/includes/admin-menu.inc +++ b/koha-tmpl/intranet-tmpl/prog/en/includes/admin-menu.inc @@ -151,9 +151,6 @@ [% IF ( Koha.Preference('EnableAdvancedCatalogingEditor') && CAN_user_parameters_manage_keyboard_shortcuts ) %]
  • Keyboard shortcuts
  • [% END %] - [% IF ( Koha.Preference('OPACReportProblem') && CAN_user_problem_reports ) %] -
  • OPAC problem reports
  • - [% END %] [% END %] diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/tools-menu.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/tools-menu.inc index 6526d0c..ba3f54a 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/includes/tools-menu.inc +++ b/koha-tmpl/intranet-tmpl/prog/en/includes/tools-menu.inc @@ -133,6 +133,9 @@ [% IF ( CAN_user_tools_access_files ) %]
  • Access files
  • [% END %] + [% IF ( Koha.Preference('OPACReportProblem') && CAN_user_problem_reports ) %] +
  • OPAC problem reports
  • + [% END %] [% END %] diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/admin-home.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/admin-home.tt index bb6a94b..f1ef9fc 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/admin-home.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/admin-home.tt @@ -240,10 +240,6 @@
    Keyboard shortcuts
    Define which keys trigger actions in the advanced cataloging editor
    [% END %] - [% IF ( Koha.Preference('OPACReportProblem') && CAN_user_problem_reports ) %] -
    OPAC problem reports
    -
    Manage OPAC problem reports submitted by patrons
    - [% END %] [% END %] diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/problem-reports.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/problem-reports.tt deleted file mode 100644 index b2e0ea5..0000000 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/problem-reports.tt +++ /dev/null @@ -1,231 +0,0 @@ -[% USE raw %] -[% USE Asset %] -[% USE Koha %] -[% USE KohaDates %] -[% SET footerjs = 1 %] -[% INCLUDE 'doc-head-open.inc' %] -Koha › Administration › OPAC problem reports -[% INCLUDE 'doc-head-close.inc' %] - - - - -[% INCLUDE 'header.inc' %] -[% INCLUDE 'prefs-admin-search.inc' %] - - -
    -
    -
    -
    - -

    OPAC problem reports

    - - - - [% IF ( selected_count ) %] -
    - [% IF ( action == 'viewed' ) %] - [% selected_count | html %] problem report(s) marked as viewed. - [% ELSIF ( action == 'closed' ) %] - [% selected_count | html %] problem report(s) marked as closed. - [% ELSIF ( action == 'new' ) %] - [% selected_count | html %] problem report(s) marked as new. - [% ELSE %] - Failed to change the status of [% selected_count | html %] problem report(s). - [% END %] -
    - [% END %] - - [% IF ( problem_reports.count ) %] -
    -
    - - - -
    - -
    - Select all - | Clear all - | Hide viewed - | Hide closed - | Hide new - | Show all -
    - - - - - - - - - - - - - - - - [% FOREACH report IN problem_reports %] - - - - - - - - - - - [% END %] - -
     MessageProblem pageSent toCreated onSet byStatusActions
    - [% report.title | html %]
    - [% report.content | html %] -
    [% OPACBaseURL | url %][% report.problempage | html %][% report.recipient | html %][% report.created_on | $KohaDates with_hours => 1 %][% INCLUDE 'patron-title.inc' patron => report.patron hide_patron_infos_if_needed=1 %][% report.status | html %] - [% IF ( report.status == 'New' ) %] - - [% ELSIF ( report.status == 'Viewed' ) %] - - [% ELSE %] - - [% END %] -
    - -
    - - [% ELSE %] -
    There are currently no problem reports.
    - [% END %] - -
    -
    - -
    - -
    - -
    - -[% MACRO jsinclude BLOCK %] - [% Asset.js("lib/jquery/plugins/jquery.checkboxes.min.js") | $raw %] - [% INCLUDE 'calendar.inc' %] - [% INCLUDE 'datatables.inc' %] - -[% END %] - -[% INCLUDE 'intranet-bottom.inc' %] 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 fbf727b..569af7a 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/intranet-main.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/intranet-main.tt @@ -190,7 +190,7 @@ [% IF ( Koha.Preference('OPACReportProblem') && CAN_user_problem_reports && pending_problem_reports.count ) %]
    - OPAC problem reports pending: + OPAC problem reports pending: [% pending_problem_reports.count | html %]
    [% END %] diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/problem-reports.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/problem-reports.tt new file mode 100644 index 0000000..889a235 --- /dev/null +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/problem-reports.tt @@ -0,0 +1,231 @@ +[% USE raw %] +[% USE Asset %] +[% USE Koha %] +[% USE KohaDates %] +[% SET footerjs = 1 %] +[% INCLUDE 'doc-head-open.inc' %] +Koha › Administration › OPAC problem reports +[% INCLUDE 'doc-head-close.inc' %] + + + + +[% INCLUDE 'header.inc' %] +[% INCLUDE 'prefs-admin-search.inc' %] + + +
    +
    +
    +
    + +

    OPAC problem reports

    + + + + [% IF ( selected_count ) %] +
    + [% IF ( action == 'viewed' ) %] + [% selected_count | html %] problem report(s) marked as viewed. + [% ELSIF ( action == 'closed' ) %] + [% selected_count | html %] problem report(s) marked as closed. + [% ELSIF ( action == 'new' ) %] + [% selected_count | html %] problem report(s) marked as new. + [% ELSE %] + Failed to change the status of [% selected_count | html %] problem report(s). + [% END %] +
    + [% END %] + + [% IF ( problem_reports.count ) %] +
    +
    + + + +
    + +
    + Select all + | Clear all + | Hide viewed + | Hide closed + | Hide new + | Show all +
    + + + + + + + + + + + + + + + + [% FOREACH report IN problem_reports %] + + + + + + + + + + + [% END %] + +
     MessageProblem pageSent toCreated onSet byStatusActions
    + [% report.title | html %]
    + [% report.content | html %] +
    [% OPACBaseURL | url %][% report.problempage | html %][% report.recipient | html %][% report.created_on | $KohaDates with_hours => 1 %][% INCLUDE 'patron-title.inc' patron => report.patron hide_patron_infos_if_needed=1 %][% report.status | html %] + [% IF ( report.status == 'New' ) %] + + [% ELSIF ( report.status == 'Viewed' ) %] + + [% ELSE %] + + [% END %] +
    + +
    + + [% ELSE %] +
    There are currently no problem reports.
    + [% END %] + +
    +
    + +
    + +
    + +
    + +[% MACRO jsinclude BLOCK %] + [% Asset.js("lib/jquery/plugins/jquery.checkboxes.min.js") | $raw %] + [% INCLUDE 'calendar.inc' %] + [% INCLUDE 'datatables.inc' %] + +[% END %] + +[% INCLUDE 'intranet-bottom.inc' %] diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/tools-home.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/tools-home.tt index f0a35aa..ae4608c 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/tools-home.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/tools-home.tt @@ -78,6 +78,7 @@
    Upload patron images
    Upload patron images in a batch or one at a time
    [% END %] +
    @@ -141,6 +142,10 @@ [% END %] [% END %] + [% IF ( Koha.Preference('OPACReportProblem') && CAN_user_problem_reports ) %] +
    OPAC problem reports
    +
    Manage OPAC problem reports submitted by patrons
    + [% END %]
    diff --git a/tools/problem-reports.pl b/tools/problem-reports.pl new file mode 100755 index 0000000..c9a1afd --- /dev/null +++ b/tools/problem-reports.pl @@ -0,0 +1,73 @@ +#!/usr/bin/perl + +# Copyright 2020 Aleisha Amohia +# +# 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::Context; +use C4::Output; +use C4::Auth; +use Koha::ProblemReports; + +my $query = new CGI; + +my ( $template, $loggedinuser, $cookie ) = get_template_and_user( + { + template_name => "tools/problem-reports.tt", + query => $query, + type => "intranet", + authnotrequired => 0, + flagsrequired => { problem_reports => 1 }, + } +); + +my $action; +foreach (qw( viewed closed new )) { + $action = $_ if ( $query->param("mark_selected-$_") ); +} +$action ||= 'none'; + +my @report_ids = $query->multi_param('report_ids'); + +if ( $action eq 'viewed' ) { + foreach my $report_id ( @report_ids ) { + my $report = Koha::ProblemReports->find($report_id); + $report->set({ status => 'Viewed' })->store; + } +} elsif ( $action eq 'closed' ) { + foreach my $report_id ( @report_ids ) { + my $report = Koha::ProblemReports->find($report_id); + $report->set({ status => 'Closed' })->store; + } + +} elsif ( $action eq 'new' ) { + foreach my $report_id ( @report_ids ) { + my $report = Koha::ProblemReports->find($report_id); + $report->set({ status => 'New' })->store; + } +} + +my $problem_reports = Koha::ProblemReports->search(); +$template->param( + selected_count => scalar(@report_ids), + action => $action, + problem_reports => $problem_reports, +); + +output_html_with_http_headers $query, $cookie, $template->output; -- 1.7.2.5