Bugzilla – Attachment 175540 Details for
Bug 33260
Show message queue on staff interface and make notices printable
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 33260: Add Notice management tool
Bug-33260-Add-Notice-management-tool.patch (text/plain), 31.86 KB, created by
Martin Renvoize (ashimema)
on 2024-12-16 18:26:37 UTC
(
hide
)
Description:
Bug 33260: Add Notice management tool
Filename:
MIME Type:
Creator:
Martin Renvoize (ashimema)
Created:
2024-12-16 18:26:37 UTC
Size:
31.86 KB
patch
obsolete
>From 21e88d3e2e9dd9c42994294f6399f8746609b70e Mon Sep 17 00:00:00 2001 >From: Aleisha Amohia <aleishaamohia@hotmail.com> >Date: Tue, 21 Mar 2023 02:49:45 +0000 >Subject: [PATCH] Bug 33260: Add Notice management tool > >This enhancement makes it easy for the library to view sent notices and filter by various search parameters. > >You can also print sent notices, individually or in a batch. > >This enhancement uses a new system preference NoticesManagement and a new view_generated_notices user permission. > >This enhancement has been built on top of Bug 33478 so print format settings are taken into account when printing notices. > >To test: >1. Apply patches, install database updates, restart services >2. Make sure your logged in user has the view_generated_notices permission checked >3. Enable the NoticesManagement system preference >4. Generate a few notices. There are a few ways to do this including: >- place holds, check in items and confirm the holds >- place recalls, check in items and confirm the recalls >5. Go to Tools -> Notices management >6. There are two search functions on the left navigation. Confirm the patron search box works by searching for one of the patrons you generated a notice for, you should be redirected to their Notice history. >7. Go back to Notices management. Use the set of search filters to search for notices. Leaving the search filters empty will return all notices generated. Confirm the filters work as expected by using different combinations of filters. >8. Conduct a search so your notices show in a table. Confirm the information fetched about the notices is correct. >9. Click on a notice title. Confirm the contents of the notice show in a pop-up box. >10. Click one of the Print buttons next to a notice. Confirm the notice is opened to be printed. >11. Redo your notices search. Confirm the status of the notice you just printed has now been updated to 'sent'. >12. Use the 'Select all' and 'Clear all' buttons to select or clear the checkboxes. >13. Select a few checkboxes and click the button at the bottom of the table to 'Print selected notices'. Confirm the notices have been collated into one document, separated by horizontal lines, and prints successfully. The statuses for the notices should all be updated to 'sent'. >14. Confirm the Notices management page is not visible without the view_generated_notices permission >15. Confirm the Notices management page is not visible without the NoticesManagement system preference being enabled. >16. Go to a patron's Notices history. If the view_generated_notices user permission is checked for your logged in patron, you should see a Print button for each notice. Confirm this works. Confirm this button doesn't show if your logged in patron does not have the view_generated_notices user permission. It does not require the NoticesManagement system preference. > >17. Go to Tools -> Notices & slips >18. Edit the format settings of a few different notices i.e. HOLD and WELCOME >19. Generate these notices by filling a hold for a patron and sending a welcome email >20. Search for all notices under Tools -> Notices management >21. Select all notices and print selected notices >22. Confirm the notices different format settings are taken into account in the printed PDF > >Sponsored-by: Colorado Library Consortium >Signed-off-by: kelly <kelly@bywatersolutions.com> >Signed-off-by: David Nind <david@davidnind.com> >Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> >--- > .../prog/en/includes/tools-menu.inc | 5 +- > .../prog/en/modules/members/notices.tt | 4 + > .../prog/en/modules/tools/notices.tt | 310 ++++++++++++++++++ > .../prog/en/modules/tools/tools-home.tt | 7 +- > .../intranet-tmpl/prog/js/staff-global.js | 4 +- > tools/notices.pl | 95 ++++++ > tools/print_notice.pl | 60 ++++ > 7 files changed, 482 insertions(+), 3 deletions(-) > create mode 100644 koha-tmpl/intranet-tmpl/prog/en/modules/tools/notices.tt > create mode 100755 tools/notices.pl > create mode 100755 tools/print_notice.pl > >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 b106cffbea8..22d3ecd6f1d 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/includes/tools-menu.inc >+++ b/koha-tmpl/intranet-tmpl/prog/en/includes/tools-menu.inc >@@ -7,7 +7,7 @@ > <ul> > <li><a href="/cgi-bin/koha/tools/tools-home.pl">Tools home</a></li> > </ul> >- [% IF ( CAN_user_tools_manage_patron_lists || CAN_user_clubs || CAN_user_tools_moderate_comments || CAN_user_tools_import_patrons || CAN_user_tools_edit_notices || CAN_user_tools_edit_notice_status_triggers || CAN_user_tools_label_creator || CAN_user_tools_delete_anonymize_patrons || CAN_user_tools_edit_patrons || CAN_user_tools_moderate_tags || ( CAN_user_tools_batch_upload_patron_images && Koha.Preference('patronimages') ) || CAN_user_tools_rotating_collections ) %] >+ [% IF ( CAN_user_tools_manage_patron_lists || CAN_user_clubs || CAN_user_tools_moderate_comments || CAN_user_tools_import_patrons || CAN_user_tools_edit_notices || CAN_user_tools_edit_notice_status_triggers || CAN_user_tools_label_creator || CAN_user_tools_delete_anonymize_patrons || CAN_user_tools_edit_patrons || CAN_user_tools_moderate_tags || ( CAN_user_tools_batch_upload_patron_images && Koha.Preference('patronimages') ) || CAN_user_tools_rotating_collections ) || ( CAN_user_tools_view_generated_notices && Koha.Preference('NoticesManagement') ) %] > <h5>Patrons and circulation</h5> > <ul> > [% IF ( CAN_user_tools_manage_patron_lists ) %] >@@ -28,6 +28,9 @@ > [% IF ( CAN_user_tools_edit_notice_status_triggers ) %] > <li><a href="/cgi-bin/koha/tools/overduerules.pl">Overdue notice/status triggers</a></li> > [% END %] >+ [% IF ( CAN_user_tools_view_generated_notices && Koha.Preference('NoticesManagement') ) %] >+ <li><a href="/cgi-bin/koha/tools/notices.pl">Notices management</a></li> >+ [% END %] > [% IF ( CAN_user_tools_label_creator ) %] > <li><a href="/cgi-bin/koha/patroncards/home.pl">Patron card creator</a></li> > [% END %] >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/members/notices.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/members/notices.tt >index a9920782018..50a0dfe6efd 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/members/notices.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/members/notices.tt >@@ -59,6 +59,9 @@ > <th>Updated on</th> > <th>Time created</th> > <th>Delivery note</th> >+ [% IF CAN_user_tools_view_generated_notices %] >+ <th>Actions</th> >+ [% END %] > </tr> > </thead> > <tbody> >@@ -122,6 +125,7 @@ > [% END %] > [% END %] > </td> >+ [% IF CAN_user_tools_view_generated_notices %]<td class="actions"><a target="_blank" class="btn btn-default btn-xs" href="/cgi-bin/koha/tools/print_notice.pl?message_ids=[% QUEUED_MESSAGE.message_id | uri %]"><i class="fa fa-print"></i> Print</a></td>[% END %] > </tr> > [% END %] > </tbody> >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/notices.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/notices.tt >new file mode 100644 >index 00000000000..5052028ddc0 >--- /dev/null >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/notices.tt >@@ -0,0 +1,310 @@ >+[% USE raw %] >+[% USE Asset %] >+[% USE KohaDates %] >+[% USE Branches %] >+[% USE Categories %] >+[% USE TablesSettings %] >+[% SET footerjs = 1 %] >+[% INCLUDE 'doc-head-open.inc' %] >+<title>Notices management › Tools › Koha</title> >+[% PROCESS "patron-search.inc" %] >+[% SET libraries = Branches.all %] >+[% SET categories = Categories.all.unblessed %] >+[% SET columns = ['name', 'cardnumber', 'dateofbirth', 'category', 'branch', 'address', 'phone'] %] >+[% INCLUDE 'doc-head-close.inc' %] >+<style> >+ .notice { display: none; } >+</style> >+</head> >+ >+<body id="tools_notices_mgmt" class="tools"> >+[% WRAPPER 'header.inc' %] >+ [% INCLUDE 'circ-search.inc' %] >+[% END %] >+ >+[% WRAPPER 'sub-header.inc' %] >+<nav id="breadcrumbs" aria-label="Breadcrumb" class="breadcrumb"> >+ <ol> >+ <li> >+ <a href="/cgi-bin/koha/mainpage.pl">Home</a> >+ </li> >+ <li> >+ <a href="/cgi-bin/koha/tools/tools-home.pl">Tools</a> >+ </li> >+ <li> >+ <a href="#" aria-current="page"> >+ Notices management >+ </a> >+ </li> >+ </ol> >+</nav> >+[% END %] >+ >+<div class="main container-fluid"> >+ <div class="row"> >+ <div class="col-sm-10 col-sm-push-2"> >+ <main> >+ >+ <h1>Notices management</h1> >+ >+ [% IF notices && notices.count > 0 %] >+ >+ <div class="dialog message">Printing a notice will mark it as sent.</div> >+ >+ <span id="checkbox_actions"><a href="#" class="select_all"><i class="fa fa-check"></i> Select all</a> | <a href="#" class="clear_all"><i class="fa fa-remove"></i> Clear all</a></span> >+ >+ <form id="print_multiple" action="/cgi-bin/koha/tools/print_notice.pl" method="post" target="_blank"> >+ >+ <table id="notices"> >+ <thead> >+ <tr> >+ <th class="nosort"> </th> >+ <th>Time created</th> >+ <th>Patron</th> >+ <th>Notice</th> >+ <th>Type</th> >+ <th>Status</th> >+ <th>Updated on</th> >+ <th class="nosort">Actions</th> >+ </tr> >+ </thead> >+ <tbody> >+ [% FOREACH notice IN notices %] >+ <tr> >+ <td><input type="checkbox" name="message_ids" value="[% notice.message_id | html %]"></td> >+ <td>[% notice.time_queued | $KohaDates with_hours = 1 %]</td> >+ <td>[% INCLUDE 'patron-title.inc' patron=notice.patron hide_patron_infos_if_needed=1 %]</td> >+ <td> >+ <a class="notice-title" data-noticeid="[% notice.message_id | html %]" href="/cgi-bin/koha/members/notices.pl?borrowernumber=[% notice.borrowernumber | uri %]&noticeid=[% notice.message_id | uri %]">[% notice.subject | html %]</a> >+ <iframe class="notice" id="notice[% notice.message_id | html %]" srcdoc="[% notice.html_content | html %]"></iframe> >+ </td> >+ <td>[% notice.message_transport_type | html %]</td> >+ <td>[% notice.status | html %]</td> >+ <td>[% notice.updated_on | $KohaDates with_hours = 1 %]</td> >+ <td class="actions"><a target="_blank" class="btn btn-default btn-xs print" href="/cgi-bin/koha/tools/print_notice.pl?message_ids=[% notice.message_id | uri %]"><i class="fa fa-print"></i> Print</a></td> >+ </tr> >+ [% END %] >+ </tbody> >+ </table> >+ >+ <input type="submit" class="btn btn-primary" value="Print selected notices" id="print_multiple_button"> >+ >+ </form> >+ >+ [% ELSE %] >+ >+ <div> >+ Use the search form on the left to find sent notices. >+ </div> >+ >+ [% IF notices && notices.count == 0 %] >+ >+ <div class="dialog message"> >+ No sent notices were found with those search parameters. >+ </div> >+ >+ [% END %] >+ >+ [% END %] >+ >+ </main> >+ </div> <!-- /.col-sm-10.col-sm-push-2 --> >+ >+ <div class="col-sm-2 col-sm-pull-10"> >+ <aside> >+ <fieldset class="sidebar brief"> >+ <h3>Go to a patron's notices</h3> >+ <ol> >+ <li> >+ <div id="notices_patronsearch_pane" role="tabpanel" class="tab-pane active"> >+ [% PROCESS patron_search_filters_simple %] >+ [% PROCESS patron_search_table table_id => 'table_borrowers', open_on_row_click => 1 %] >+ </div> >+ </li> >+ </ol> >+ </fieldset> >+ <fieldset class="sidebar brief"> >+ <form id="notices-search" action="/cgi-bin/koha/tools/notices.pl" method="post"> >+ <input type="hidden" name="op" value="search"> >+ <h3>Search filters</h3> >+ <ol> >+ <li> >+ <label for="branchcode">Library:</label> >+ <select id="branchcode" name="branchcode"> >+ <option value="">All libraries</option> >+ [% FOREACH branch IN Branches.all( selected => branchcode ) %] >+ [% IF ( branch.selected ) %] >+ <option selected="selected" value="[% branch.branchcode | html %]">[% branch.branchname | html %]</option> >+ [% ELSE %] >+ <option value="[% branch.branchcode | html %]">[% branch.branchname | html %]</option> >+ [% END %] >+ [% END %] >+ </select> >+ </li> >+ <li> >+ <label for="letter_code">Notice:</label> >+ <select id="letter_code" name="letter_code"> >+ <option value="">All notices</option> >+ [% FOREACH letter IN letters %] >+ [% IF ( letter.code == letter_code ) %] >+ <option selected="selected" value="[% letter.code | html %]">[% letter.name | html %] ([% letter.code | html %])</option> >+ [% ELSE %] >+ <option value="[% letter.code | html %]">[% letter.name | html %] ([% letter.code | html %])</option> >+ [% END %] >+ [% END %] >+ </select> >+ </li> >+ <li> >+ <label for="status">Notice status:</label> >+ <select id="status" name="status"> >+ <option value="">All statuses</option> >+ [% IF status == 'sent' %] >+ <option selected="selected" value="sent">Sent</option> >+ [% ELSE %] >+ <option value="sent">Sent</option> >+ [% END %] >+ [% IF status == 'sent' %] >+ <option selected="selected" value="pending">Pending</option> >+ [% ELSE %] >+ <option value="pending">Pending</option> >+ [% END %] >+ [% IF status == 'sent' %] >+ <option selected="selected" value="failed">Failed</option> >+ [% ELSE %] >+ <option value="failed">Failed</option> >+ [% END %] >+ [% IF status == 'sent' %] >+ <option selected="selected" value="deleted">Deleted</option> >+ [% ELSE %] >+ <option value="deleted">Deleted</option> >+ [% END %] >+ </select> >+ </li> >+ <li> >+ <fieldset class="brief"> >+ <legend>Date queued</legend> >+ <ol> >+ <li> >+ <label for="from">From:</label> >+ <input type="text" id="from" name="from" size="10" value="[% from | html %]" class="flatpickr" data-date_to="to" /> >+ <div class="hint">[% INCLUDE 'date-format.inc' %]</div> >+ </li> >+ <li> >+ <label for="to">To:</label> >+ <input type="text" id="to" name="to" size="10" value="[% to | html %]" class="flatpickr" /> >+ <div class="hint">[% INCLUDE 'date-format.inc' %]</div> >+ </li> >+ </ol> >+ </fieldset> >+ </li> >+ <li> >+ <label for="categorycode">Patron category:</label> >+ <select id="categorycode" name="categorycode"> >+ <option value="">All patron categories</option> >+ [% FOREACH category IN Categories.all %] >+ [% IF ( category.categorycode == categorycode ) %] >+ <option selected="selected" value="[% category.categorycode | html %]">[% category.description | html %]</option> >+ [% ELSE %] >+ <option value="[% category.categorycode | html %]">[% category.description | html %]</option> >+ [% END %] >+ [% END %] >+ </select> >+ </li> >+ </ol> >+ <fieldset class="action"> >+ <input type="submit" class="btn btn-default" value="Search"> >+ </fieldset> >+ </form> >+ </fieldset> >+ [% INCLUDE 'tools-menu.inc' %] >+ </aside> >+ </div> <!-- /.col-sm-2.col-sm-pull-10 --> >+ </div> <!-- /.row --> >+ >+<!-- Modal --> >+<div class="modal" id="noticeModal" tabindex="-1" aria-labelledby="noticeModalLabel" aria-hidden="true"> >+ <div class="modal-dialog"> >+ <div class="modal-content"> >+ <div class="modal-header"> >+ <button type="button" class="closebtn" data-dismiss="modal" aria-label="Close"> >+ <span aria-hidden="true">×</span> >+ </button> >+ <h5 class="modal-title" id="noticeModalLabel">Notice</h5> >+ </div> >+ <div class="modal-body"> >+ ... >+ </div> >+ <div class="modal-footer"> >+ <button type="button" class="btn btn-default deny cancel" data-dismiss="modal"><i class="fa fa-remove"></i> Close</button> >+ </div> >+ </div> <!-- /.modal-content --> >+ </div> <!-- /.modal-dialog --> >+</div> <!-- /.modal --> >+ >+[% MACRO jsinclude BLOCK %] >+ [% Asset.js("js/tools-menu.js") | $raw %] >+ [% INCLUDE 'calendar.inc' %] >+ [% INCLUDE 'datatables.inc' %] >+ [% PROCESS patron_search_js table_id => 'table_borrowers', categories => categories, libraries => libraries, extended_attribute_types => attribute_type_codes, columns => columns, open_on_row_click => 1, on_click_url => '/cgi-bin/koha/tools/notices.pl?', redirect_if_one_result => 1, redirect_url => '/cgi-bin/koha/tools/notices.pl?', redirect_if_attribute_equal => 'cardnumber' %] >+ >+ <script> >+ table_settings = [% TablesSettings.GetColumns( 'circ', 'circulation', 'table_borrowers', 'json' ) | $raw %]; >+ $(document).ready(function() { >+ $("#notices").dataTable($.extend(true, {}, dataTablesDefaults, { >+ "aoColumnDefs": [ >+ { 'bSortable': false, 'aTargets': [ 'nosort' ] } >+ ], >+ "aaSorting": [[1, "desc" ]], >+ "sPaginationType": "full" >+ })); >+ >+ $("#notices").on("click", ".notice-title", function(e){ >+ e.preventDefault(); >+ var title = $(this).text(); >+ var noticeid = $(this).data("noticeid"); >+ var body = $("#notice" + noticeid ).attr("srcdoc"); >+ $("#noticeModalLabel").text( title ); >+ $("#noticeModal .modal-body").html( body ); >+ $("#noticeModal").modal("show"); >+ }); >+ >+ $("#noticeModal").on("hide.bs.modal", function(){ >+ $("#noticeModalLabel").text(""); >+ $("#noticeModal .modal-body").html(""); >+ }); >+ >+ $("#notices_patronsearch").on("submit", filter); >+ [% UNLESS notices %] >+ [% IF ( Koha.Preference('PatronAutoComplete') ) %] >+ patron_autocomplete($("#search_patron_filter"), { 'link-to': 'notices', 'url-params': '[% url_biblio_params | url %]' }); >+ [% END %] >+ [% END %] >+ >+ $("#print_multiple_button").click(function(e){ >+ var selected_notices = $("#print_multiple").find("input[name='message_ids']:checked"); >+ if ( selected_notices.length == 0 ) { >+ alert(_("Please select at least one sent notice.")); >+ e.preventDefault(); >+ return false; >+ } >+ }); >+ >+ $(".select_all").click(function(e){ >+ e.preventDefault(); >+ $("input[name='message_ids']").each(function(){ >+ $(this).prop("checked", true); >+ }); >+ }); >+ >+ $(".clear_all").click(function(e){ >+ e.preventDefault(); >+ $("input[name='message_ids']").each(function(){ >+ $(this).prop("checked", false); >+ }); >+ }); >+ }); >+ </script> >+ >+[% 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 c63b73cbc8e..476e8d92889 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 >@@ -30,7 +30,7 @@ > <h1>Tools</h1> > <div class="row"> > <div class="col-sm-6"> >- [% IF ( CAN_user_tools_manage_patron_lists || CAN_user_clubs || CAN_user_tools_moderate_comments || CAN_user_tools_import_patrons || CAN_user_tools_edit_notices || CAN_user_tools_edit_notice_status_triggers || CAN_user_tools_label_creator || CAN_user_tools_delete_anonymize_patrons || CAN_user_tools_edit_patrons || CAN_user_tools_batch_extend_due_dates || CAN_user_tools_moderate_tags || CAN_user_tools_rotating_collections || ( CAN_user_tools_batch_upload_patron_images && Koha.Preference('patronimages') ) ) %] >+ [% IF ( CAN_user_tools_manage_patron_lists || CAN_user_clubs || CAN_user_tools_moderate_comments || CAN_user_tools_import_patrons || CAN_user_tools_edit_notices || CAN_user_tools_edit_notice_status_triggers || CAN_user_tools_label_creator || CAN_user_tools_delete_anonymize_patrons || CAN_user_tools_edit_patrons || CAN_user_tools_batch_extend_due_dates || CAN_user_tools_moderate_tags || CAN_user_tools_rotating_collections || ( CAN_user_tools_batch_upload_patron_images && Koha.Preference('patronimages') ) || ( CAN_user_tools_view_generated_notices && Koha.Preference('NoticesManagement') ) ) %] > <h3>Patrons and circulation</h3> > [% END %] > <dl> >@@ -69,6 +69,11 @@ > <dd>Set notice/status triggers for overdue items</dd> > [% END %] > >+ [% IF ( CAN_user_tools_view_generated_notices && Koha.Preference('NoticesManagement') ) %] >+ <dt><a href="/cgi-bin/koha/tools/notices.pl">Notices management</a></dt> >+ <dd>View and print generated notices</dd> >+ [% END %] >+ > [% IF ( CAN_user_tools_label_creator ) %] > <dt><a href="/cgi-bin/koha/patroncards/home.pl">Patron card creator</a></dt> > <dd>Create printable patron cards</dd> >diff --git a/koha-tmpl/intranet-tmpl/prog/js/staff-global.js b/koha-tmpl/intranet-tmpl/prog/js/staff-global.js >index e76bf876f68..8050bf1ca00 100644 >--- a/koha-tmpl/intranet-tmpl/prog/js/staff-global.js >+++ b/koha-tmpl/intranet-tmpl/prog/js/staff-global.js >@@ -676,7 +676,9 @@ function patron_autocomplete(node, options) { > ? "/cgi-bin/koha/circ/circulation.pl" > : link_to == "reserve" > ? "/cgi-bin/koha/reserve/request.pl" >- : "/cgi-bin/koha/members/moremember.pl"; >+ : link_to == 'notices' >+ ? "/cgi-bin/koha/members/notices.pl" >+ : "/cgi-bin/koha/members/moremember.pl"; > item.link += > (url_params ? "?" + url_params + "&" : "?") + > "borrowernumber=" + >diff --git a/tools/notices.pl b/tools/notices.pl >new file mode 100755 >index 00000000000..432046d1d8e >--- /dev/null >+++ b/tools/notices.pl >@@ -0,0 +1,95 @@ >+#!/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::Notice::Messages; >+use Koha::DateUtils qw( dt_from_string ); >+ >+my $query = CGI->new; >+my ( $template, $loggedinuser, $cookie ) = get_template_and_user( >+ { >+ template_name => "tools/notices.tt", >+ query => $query, >+ type => "intranet", >+ flagsrequired => { tools => 'view_generated_notices' }, >+ } >+); >+ >+unless ( C4::Context->preference('NoticesManagement') ) { >+ print $query->redirect('/cgi-bin/koha/tools/tools-home.pl'); >+} >+ >+my $op = $query->param('op'); >+ >+if ( $op and $op eq 'search' ) { >+ my $letter_code = $query->param('letter_code') || undef; >+ my $categorycode = $query->param('categorycode') || undef; >+ my $branchcode = $query->param('branchcode') || undef; >+ my $from = $query->param('from') || undef; >+ my $to = $query->param('to') || undef; >+ my $status = $query->param('status') || undef; >+ >+ my %where = (); >+ $where{'me.letter_code'} = $letter_code if ($letter_code); >+ $where{'borrowernumber.categorycode'} = $categorycode if ($categorycode); >+ $where{'borrowernumber.branchcode'} = $branchcode if ($branchcode); >+ if ($from) { >+ if ($to) { >+ $where{'me.time_queued'} = [ >+ -and => { '<=', $to }, >+ { '>=', $from } >+ ]; >+ } else { >+ $where{'me.time_queued'} = { '>=', $from }; >+ } >+ } elsif ($to) { >+ $where{'me.time_queued'} = { '<=', $to }; >+ } >+ $where{'me.status'} = $status if ($status); >+ >+ my $notices = Koha::Notice::Messages->search( >+ {%where}, >+ { join => 'borrowernumber', order_by => { -desc => 'time_queued' } } >+ ); >+ >+ $template->param( >+ notices => $notices, >+ letter_code => $letter_code, >+ categorycode => $categorycode, >+ branchcode => $branchcode, >+ from => $from, >+ to => $to, >+ status => $status, >+ ); >+} >+ >+$template->param( >+ letters => Koha::Notice::Templates->search( >+ {}, { select => [ 'name', 'code' ], group_by => [ 'name', 'code' ], order_by => { -asc => 'code' } } >+ ), >+ attribute_type_codes => ( >+ C4::Context->preference('ExtendedPatronAttributes') >+ ? [ Koha::Patron::Attribute::Types->search( { staff_searchable => 1 } )->get_column('code') ] >+ : [] >+ ), >+); >+ >+output_html_with_http_headers $query, $cookie, $template->output; >diff --git a/tools/print_notice.pl b/tools/print_notice.pl >new file mode 100755 >index 00000000000..74f2fd059b9 >--- /dev/null >+++ b/tools/print_notice.pl >@@ -0,0 +1,60 @@ >+#!/usr/bin/perl >+ >+# Copyright 2023 Aleisha Amohia <aleisha@catalyst.net.nz> >+# >+# 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::Context; >+use C4::Output qw( output_html_with_http_headers ); >+use C4::Auth qw( get_template_and_user ); >+ >+my $input = CGI->new; >+ >+my ( $template, $loggedinuser, $cookie ) = get_template_and_user( >+ { >+ template_name => "circ/printslip.tt", >+ query => $input, >+ type => "intranet", >+ flagsrequired => { tools => 'view_generated_notices' }, >+ } >+); >+ >+my @message_ids = $input->multi_param('message_ids'); >+my @slips; >+foreach my $message_id (@message_ids) { >+ my $message = Koha::Notice::Messages->find($message_id); >+ >+ my $template = Koha::Notice::Templates->find( $message->letter_id )->unblessed; >+ >+ push @slips, { >+ content => $message->content, >+ is_html => $template->{is_html}, >+ style => $template->{style}, >+ id => $message_id, >+ }; >+ >+ $message->update( { status => 'sent' } ); >+} >+$template->param( >+ slips => \@slips, >+ caller => 'notice_mgmt', >+ stylesheet => C4::Context->preference("SlipCSS"), >+ IntranetSlipPrinterJS => C4::Context->preference('IntranetSlipPrinterJS'), >+); >+ >+output_html_with_http_headers $input, $cookie, $template->output; >-- >2.47.1
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 33260
:
148437
|
148438
|
148439
|
148440
|
148943
|
149009
|
149413
|
149581
|
149593
|
149594
|
149595
|
149596
|
149597
|
149598
|
150346
|
150347
|
154927
|
154928
|
157383
|
157384
|
157385
|
157386
|
158852
|
158853
|
158854
|
158855
|
162570
|
162571
|
162572
|
162573
|
162574
|
162624
|
162625
|
162677
|
162678
|
162679
|
162680
|
162681
|
164783
|
164784
|
164785
|
164786
|
164787
|
165238
|
165239
|
165717
|
165939
|
165946
|
165947
|
165948
|
165949
|
165950
|
165951
|
166020
|
166178
|
166335
|
166336
|
166337
|
166338
|
166339
|
166340
|
166341
|
166342
|
166343
|
166344
|
166345
|
166362
|
166363
|
166364
|
166365
|
166366
|
166367
|
166368
|
166369
|
166370
|
166371
|
166372
|
166373
|
167909
|
167910
|
167911
|
167912
|
167913
|
167914
|
167915
|
167916
|
167917
|
167918
|
167919
|
167920
|
172247
|
172248
|
172303
|
172307
|
172308
|
172309
|
172310
|
172311
|
172312
|
172313
|
172314
|
172315
|
172316
|
172317
|
172318
|
172319
|
172320
|
172321
|
172322
|
172342
|
172343
|
172344
|
172345
|
172346
|
172347
|
172348
|
172349
|
172350
|
172351
|
172352
|
172353
|
172354
|
172355
|
172356
|
172357
|
172358
|
172359
|
172379
|
175501
|
175502
|
175503
|
175504
|
175505
|
175506
|
175507
|
175508
|
175509
|
175510
|
175511
|
175512
|
175513
|
175514
|
175515
|
175516
|
175517
|
175518
|
175519
|
175520
|
175521
|
175522
|
175523
|
175524
|
175525
|
175530
|
175537
|
175538
|
175539
|
175540
|
175541
|
175542
|
175543
|
175544
|
175545
|
175546
|
175547
|
175548
|
175549
|
175550
|
175551
|
175552
|
175553
|
175554
|
175555
|
175556
|
175557
|
175558
|
175559
|
175560
|
175561
|
175562
|
175563
|
175730
|
175731
|
175732
|
175733
|
175734
|
175735
|
175736
|
175737
|
175738
|
175739
|
175740
|
175741
|
175742
|
175743
|
175744
|
175745
|
175746
|
175747
|
175748
|
175749
|
175750
|
175751
|
175752
|
175753
|
175754
|
175755
|
175756
|
178733
|
178734
|
178735
|
178736
|
178737
|
178738
|
178739
|
178740
|
178741
|
178742
|
178743
|
178744
|
178745
|
178746
|
178747
|
178748
|
178749
|
178750
|
178751
|
178752
|
178753
|
178754
|
178755
|
178756
|
178757
|
178758
|
178759