View | Details | Raw Unified | Return to bug 33260
Collapse All | Expand All

(-)a/koha-tmpl/intranet-tmpl/prog/en/includes/tools-menu.inc (-1 / +4 lines)
Lines 6-12 Link Here
6
    <ul>
6
    <ul>
7
        <li><a href="/cgi-bin/koha/tools/tools-home.pl">Tools home</a></li>
7
        <li><a href="/cgi-bin/koha/tools/tools-home.pl">Tools home</a></li>
8
    </ul>
8
    </ul>
9
    [% 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 ) %]
9
    [% 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') ) %]
10
        <h5>Patrons and circulation</h5>
10
        <h5>Patrons and circulation</h5>
11
        <ul>
11
        <ul>
12
            [% IF ( CAN_user_tools_manage_patron_lists ) %]
12
            [% IF ( CAN_user_tools_manage_patron_lists ) %]
Lines 27-32 Link Here
27
            [% IF ( CAN_user_tools_edit_notice_status_triggers ) %]
27
            [% IF ( CAN_user_tools_edit_notice_status_triggers ) %]
28
                <li><a href="/cgi-bin/koha/tools/overduerules.pl">Overdue notice/status triggers</a></li>
28
                <li><a href="/cgi-bin/koha/tools/overduerules.pl">Overdue notice/status triggers</a></li>
29
            [% END %]
29
            [% END %]
30
            [% IF ( CAN_user_tools_view_generated_notices && Koha.Preference('NoticesManagement') ) %]
31
                <li><a href="/cgi-bin/koha/tools/notices.pl">Notices management</a></li>
32
            [% END %]
30
            [% IF ( CAN_user_tools_label_creator ) %]
33
            [% IF ( CAN_user_tools_label_creator ) %]
31
                <li><a href="/cgi-bin/koha/patroncards/home.pl">Patron card creator</a></li>
34
                <li><a href="/cgi-bin/koha/patroncards/home.pl">Patron card creator</a></li>
32
            [% END %]
35
            [% END %]
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/members/notices.tt (+8 lines)
Lines 58-63 Link Here
58
                        <th>Updated on</th>
58
                        <th>Updated on</th>
59
                        <th>Time created</th>
59
                        <th>Time created</th>
60
                        <th>Delivery note</th>
60
                        <th>Delivery note</th>
61
                        [% IF CAN_user_tools_view_generated_notices %]
62
                            <th>Actions</th>
63
                        [% END %]
61
                    </tr>
64
                    </tr>
62
                </thead>
65
                </thead>
63
                <tbody>
66
                <tbody>
Lines 148-153 Link Here
148
                                    [% END %]
151
                                    [% END %]
149
                                [% END %]
152
                                [% END %]
150
                            </td>
153
                            </td>
154
                            [% IF CAN_user_tools_view_generated_notices %]
155
                                <td class="actions"
156
                                    ><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
157
                                >
158
                            [% END %]
151
                        </tr>
159
                        </tr>
152
                    [% END %]
160
                    [% END %]
153
                </tbody>
161
                </tbody>
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/notices.tt (+308 lines)
Line 0 Link Here
1
[% USE raw %]
2
[% USE Asset %]
3
[% USE KohaDates %]
4
[% USE Branches %]
5
[% USE Categories %]
6
[% USE TablesSettings %]
7
[% SET footerjs = 1 %]
8
[% INCLUDE 'doc-head-open.inc' %]
9
<title>Notices management &rsaquo; Tools &rsaquo; Koha</title>
10
[% PROCESS "patron-search.inc" %]
11
[% SET libraries = Branches.all %]
12
[% SET categories = Categories.all.unblessed %]
13
[% SET columns = ['name', 'cardnumber', 'dateofbirth', 'category', 'branch', 'address', 'phone'] %]
14
[% INCLUDE 'doc-head-close.inc' %]
15
<style>
16
    .notice {
17
        display: none;
18
    }
19
</style>
20
</head>
21
22
<body id="tools_notices_mgmt" class="tools">
23
[% WRAPPER 'header.inc' %]
24
    [% INCLUDE 'circ-search.inc' %]
25
[% END %]
26
27
[% WRAPPER 'sub-header.inc' %]
28
    <nav id="breadcrumbs" aria-label="Breadcrumb" class="breadcrumb">
29
        <ol>
30
            <li>
31
                <a href="/cgi-bin/koha/mainpage.pl">Home</a>
32
            </li>
33
            <li>
34
                <a href="/cgi-bin/koha/tools/tools-home.pl">Tools</a>
35
            </li>
36
            <li>
37
                <a href="#" aria-current="page"> Notices management </a>
38
            </li>
39
        </ol>
40
    </nav>
41
[% END %]
42
43
<div class="main container-fluid">
44
    <div class="row">
45
        <div class="col-sm-10 col-sm-push-2">
46
            <main>
47
                <h1>Notices management</h1>
48
49
                [% IF notices && notices.count > 0 %]
50
                    <div class="dialog message">Printing a notice will mark it as sent.</div>
51
52
                    <span id="checkbox_actions"
53
                        ><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
54
                    >
55
56
                    <form id="print_multiple" action="/cgi-bin/koha/tools/print_notice.pl" method="post" target="_blank">
57
                        <table id="notices">
58
                            <thead>
59
                                <tr>
60
                                    <th class="nosort">&nbsp;</th>
61
                                    <th>Time created</th>
62
                                    <th>Patron</th>
63
                                    <th>Notice</th>
64
                                    <th>Type</th>
65
                                    <th>Status</th>
66
                                    <th>Updated on</th>
67
                                    <th class="nosort">Actions</th>
68
                                </tr>
69
                            </thead>
70
                            <tbody>
71
                                [% FOREACH notice IN notices %]
72
                                    <tr>
73
                                        <td><input type="checkbox" name="message_ids" value="[% notice.message_id | html %]" /></td>
74
                                        <td>[% notice.time_queued | $KohaDates with_hours = 1 %]</td>
75
                                        <td>[% INCLUDE 'patron-title.inc' patron=notice.patron hide_patron_infos_if_needed=1 %]</td>
76
                                        <td>
77
                                            <a
78
                                                class="notice-title"
79
                                                data-noticeid="[% notice.message_id | html %]"
80
                                                href="/cgi-bin/koha/members/notices.pl?borrowernumber=[% notice.borrowernumber | uri %]&amp;noticeid=[% notice.message_id | uri %]"
81
                                                >[% notice.subject | html %]</a
82
                                            >
83
                                            <iframe class="notice" id="notice[% notice.message_id | html %]" srcdoc="[% notice.html_content | html %]"></iframe>
84
                                        </td>
85
                                        <td>[% notice.message_transport_type | html %]</td>
86
                                        <td>[% notice.status | html %]</td>
87
                                        <td>[% notice.updated_on | $KohaDates with_hours = 1 %]</td>
88
                                        <td class="actions"
89
                                            ><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
90
                                        >
91
                                    </tr>
92
                                [% END %]
93
                            </tbody>
94
                        </table>
95
96
                        <input type="submit" class="btn btn-primary" value="Print selected notices" id="print_multiple_button" />
97
                    </form>
98
                [% ELSE %]
99
                    <div> Use the search form on the left to find sent notices. </div>
100
101
                    [% IF notices && notices.count == 0 %]
102
                        <div class="dialog message"> No sent notices were found with those search parameters. </div>
103
                    [% END %]
104
                [% END %]
105
            </main>
106
        </div>
107
        <!-- /.col-sm-10.col-sm-push-2 -->
108
109
        <div class="col-sm-2 col-sm-pull-10">
110
            <aside>
111
                <fieldset class="sidebar brief">
112
                    <h3>Go to a patron's notices</h3>
113
                    <ol>
114
                        <li>
115
                            <div id="notices_patronsearch_pane" role="tabpanel" class="tab-pane active">
116
                                [% PROCESS patron_search_filters_simple %]
117
                                [% PROCESS patron_search_table table_id => 'table_borrowers', open_on_row_click => 1 %]
118
                            </div>
119
                        </li>
120
                    </ol>
121
                </fieldset>
122
                <fieldset class="sidebar brief">
123
                    <form id="notices-search" action="/cgi-bin/koha/tools/notices.pl" method="post">
124
                        <input type="hidden" name="op" value="search" />
125
                        <h3>Search filters</h3>
126
                        <ol>
127
                            <li>
128
                                <label for="branchcode">Library:</label>
129
                                <select id="branchcode" name="branchcode">
130
                                    <option value="">All libraries</option>
131
                                    [% FOREACH branch IN Branches.all( selected => branchcode ) %]
132
                                        [% IF ( branch.selected ) %]
133
                                            <option selected="selected" value="[% branch.branchcode | html %]">[% branch.branchname | html %]</option>
134
                                        [% ELSE %]
135
                                            <option value="[% branch.branchcode | html %]">[% branch.branchname | html %]</option>
136
                                        [% END %]
137
                                    [% END %]
138
                                </select>
139
                            </li>
140
                            <li>
141
                                <label for="letter_code">Notice:</label>
142
                                <select id="letter_code" name="letter_code">
143
                                    <option value="">All notices</option>
144
                                    [% FOREACH letter IN letters %]
145
                                        [% IF ( letter.code == letter_code ) %]
146
                                            <option selected="selected" value="[% letter.code | html %]">[% letter.name | html %] ([% letter.code | html %])</option>
147
                                        [% ELSE %]
148
                                            <option value="[% letter.code | html %]">[% letter.name | html %] ([% letter.code | html %])</option>
149
                                        [% END %]
150
                                    [% END %]
151
                                </select>
152
                            </li>
153
                            <li>
154
                                <label for="status">Notice status:</label>
155
                                <select id="status" name="status">
156
                                    <option value="">All statuses</option>
157
                                    [% IF status == 'sent' %]
158
                                        <option selected="selected" value="sent">Sent</option>
159
                                    [% ELSE %]
160
                                        <option value="sent">Sent</option>
161
                                    [% END %]
162
                                    [% IF status == 'sent' %]
163
                                        <option selected="selected" value="pending">Pending</option>
164
                                    [% ELSE %]
165
                                        <option value="pending">Pending</option>
166
                                    [% END %]
167
                                    [% IF status == 'sent' %]
168
                                        <option selected="selected" value="failed">Failed</option>
169
                                    [% ELSE %]
170
                                        <option value="failed">Failed</option>
171
                                    [% END %]
172
                                    [% IF status == 'sent' %]
173
                                        <option selected="selected" value="deleted">Deleted</option>
174
                                    [% ELSE %]
175
                                        <option value="deleted">Deleted</option>
176
                                    [% END %]
177
                                </select>
178
                            </li>
179
                            <li>
180
                                <fieldset class="brief">
181
                                    <legend>Date queued</legend>
182
                                    <ol>
183
                                        <li>
184
                                            <label for="from">From:</label>
185
                                            <input type="text" id="from" name="from" size="10" value="[% from | html %]" class="flatpickr" data-date_to="to" />
186
                                            <div class="hint">[% INCLUDE 'date-format.inc' %]</div>
187
                                        </li>
188
                                        <li>
189
                                            <label for="to">To:</label>
190
                                            <input type="text" id="to" name="to" size="10" value="[% to | html %]" class="flatpickr" />
191
                                            <div class="hint">[% INCLUDE 'date-format.inc' %]</div>
192
                                        </li>
193
                                    </ol>
194
                                </fieldset>
195
                            </li>
196
                            <li>
197
                                <label for="categorycode">Patron category:</label>
198
                                <select id="categorycode" name="categorycode">
199
                                    <option value="">All patron categories</option>
200
                                    [% FOREACH category IN Categories.all %]
201
                                        [% IF ( category.categorycode == categorycode ) %]
202
                                            <option selected="selected" value="[% category.categorycode | html %]">[% category.description | html %]</option>
203
                                        [% ELSE %]
204
                                            <option value="[% category.categorycode | html %]">[% category.description | html %]</option>
205
                                        [% END %]
206
                                    [% END %]
207
                                </select>
208
                            </li>
209
                        </ol>
210
                        <fieldset class="action">
211
                            <input type="submit" class="btn btn-default" value="Search" />
212
                        </fieldset>
213
                    </form>
214
                </fieldset>
215
                [% INCLUDE 'tools-menu.inc' %]
216
            </aside>
217
        </div>
218
        <!-- /.col-sm-2.col-sm-pull-10 -->
219
    </div>
220
    <!-- /.row -->
221
222
    <!-- Modal -->
223
    <div class="modal" id="noticeModal" tabindex="-1" aria-labelledby="noticeModalLabel" aria-hidden="true">
224
        <div class="modal-dialog">
225
            <div class="modal-content">
226
                <div class="modal-header">
227
                    <button type="button" class="closebtn" data-dismiss="modal" aria-label="Close">
228
                        <span aria-hidden="true">&times;</span>
229
                    </button>
230
                    <h5 class="modal-title" id="noticeModalLabel">Notice</h5>
231
                </div>
232
                <div class="modal-body"> ... </div>
233
                <div class="modal-footer">
234
                    <button type="button" class="btn btn-default deny cancel" data-dismiss="modal"><i class="fa fa-remove"></i> Close</button>
235
                </div>
236
            </div>
237
            <!-- /.modal-content -->
238
        </div>
239
        <!-- /.modal-dialog -->
240
    </div>
241
    <!-- /.modal -->
242
243
    [% MACRO jsinclude BLOCK %]
244
        [% Asset.js("js/tools-menu.js") | $raw %]
245
        [% INCLUDE 'calendar.inc' %]
246
        [% INCLUDE 'datatables.inc' %]
247
        [% 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' %]
248
        <script>
249
            table_settings = [% TablesSettings.GetColumns( 'circ', 'circulation', 'table_borrowers', 'json' ) | $raw %];
250
            $(document).ready(function() {
251
                $("#notices").dataTable($.extend(true, {}, dataTablesDefaults, {
252
                    "aoColumnDefs": [
253
                        { 'bSortable': false, 'aTargets': [ 'nosort' ] }
254
                    ],
255
                    "aaSorting": [[1, "desc" ]],
256
                    "sPaginationType": "full"
257
                }));
258
259
                $("#notices").on("click", ".notice-title", function(e){
260
                    e.preventDefault();
261
                    var title = $(this).text();
262
                    var noticeid = $(this).data("noticeid");
263
                    var body = $("#notice" + noticeid ).attr("srcdoc");
264
                    $("#noticeModalLabel").text( title );
265
                    $("#noticeModal .modal-body").html( body );
266
                    $("#noticeModal").modal("show");
267
                });
268
269
                $("#noticeModal").on("hide.bs.modal", function(){
270
                    $("#noticeModalLabel").text("");
271
                    $("#noticeModal .modal-body").html("");
272
                });
273
274
                $("#notices_patronsearch").on("submit", filter);
275
                [% UNLESS notices %]
276
                    [% IF ( Koha.Preference('PatronAutoComplete') ) %]
277
                        patron_autocomplete($("#search_patron_filter"), { 'link-to': 'notices', 'url-params': '[% url_biblio_params | url %]' });
278
                    [% END %]
279
                [% END %]
280
281
                $("#print_multiple_button").click(function(e){
282
                    var selected_notices = $("#print_multiple").find("input[name='message_ids']:checked");
283
                    if ( selected_notices.length == 0 ) {
284
                        alert(_("Please select at least one sent notice."));
285
                        e.preventDefault();
286
                        return false;
287
                    }
288
                });
289
290
                $(".select_all").click(function(e){
291
                    e.preventDefault();
292
                    $("input[name='message_ids']").each(function(){
293
                        $(this).prop("checked", true);
294
                    });
295
                });
296
297
                $(".clear_all").click(function(e){
298
                    e.preventDefault();
299
                    $("input[name='message_ids']").each(function(){
300
                        $(this).prop("checked", false);
301
                    });
302
                });
303
            });
304
        </script>
305
    [% END %]
306
307
    [% INCLUDE 'intranet-bottom.inc' %]</div
308
>
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/tools-home.tt (-1 / +6 lines)
Lines 29-35 Link Here
29
    <h1>Tools</h1>
29
    <h1>Tools</h1>
30
    <div class="row">
30
    <div class="row">
31
        <div class="col-sm-6">
31
        <div class="col-sm-6">
32
            [% 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') ) ) %]
32
            [% 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') ) ) %]
33
                <h3>Patrons and circulation</h3>
33
                <h3>Patrons and circulation</h3>
34
            [% END %]
34
            [% END %]
35
            <dl>
35
            <dl>
Lines 68-73 Link Here
68
                    <dd>Set notice/status triggers for overdue items</dd>
68
                    <dd>Set notice/status triggers for overdue items</dd>
69
                [% END %]
69
                [% END %]
70
70
71
                [% IF ( CAN_user_tools_view_generated_notices && Koha.Preference('NoticesManagement') ) %]
72
                    <dt><a href="/cgi-bin/koha/tools/notices.pl">Notices management</a></dt>
73
                    <dd>View and print generated notices</dd>
74
                [% END %]
75
71
                [% IF ( CAN_user_tools_label_creator ) %]
76
                [% IF ( CAN_user_tools_label_creator ) %]
72
                    <dt><a href="/cgi-bin/koha/patroncards/home.pl">Patron card creator</a></dt>
77
                    <dt><a href="/cgi-bin/koha/patroncards/home.pl">Patron card creator</a></dt>
73
                    <dd>Create printable patron cards</dd>
78
                    <dd>Create printable patron cards</dd>
(-)a/koha-tmpl/intranet-tmpl/prog/js/staff-global.js (-1 / +3 lines)
Lines 749-755 function patron_autocomplete(node, options) { Link Here
749
                    ? "/cgi-bin/koha/circ/circulation.pl"
749
                    ? "/cgi-bin/koha/circ/circulation.pl"
750
                    : link_to == "reserve"
750
                    : link_to == "reserve"
751
                      ? "/cgi-bin/koha/reserve/request.pl"
751
                      ? "/cgi-bin/koha/reserve/request.pl"
752
                      : "/cgi-bin/koha/members/moremember.pl";
752
                      : link_to == "notices"
753
                        ? "/cgi-bin/koha/members/notices.pl"
754
                        : "/cgi-bin/koha/members/moremember.pl";
753
            item.link +=
755
            item.link +=
754
                (url_params ? "?" + url_params + "&" : "?") +
756
                (url_params ? "?" + url_params + "&" : "?") +
755
                "borrowernumber=" +
757
                "borrowernumber=" +
(-)a/tools/notices.pl (+95 lines)
Line 0 Link Here
1
#!/usr/bin/perl
2
3
# This file is part of Koha.
4
#
5
# Koha is free software; you can redistribute it and/or modify it
6
# under the terms of the GNU General Public License as published by
7
# the Free Software Foundation; either version 3 of the License, or
8
# (at your option) any later version.
9
#
10
# Koha is distributed in the hope that it will be useful, but
11
# WITHOUT ANY WARRANTY; without even the implied warranty of
12
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
# GNU General Public License for more details.
14
#
15
# You should have received a copy of the GNU General Public License
16
# along with Koha; if not, see <http://www.gnu.org/licenses>.
17
18
use Modern::Perl;
19
20
use CGI        qw ( -utf8 );
21
use C4::Auth   qw( get_template_and_user );
22
use C4::Output qw( output_html_with_http_headers );
23
use Koha::Notice::Messages;
24
use Koha::DateUtils qw( dt_from_string );
25
26
my $query = CGI->new;
27
my ( $template, $loggedinuser, $cookie ) = get_template_and_user(
28
    {
29
        template_name => "tools/notices.tt",
30
        query         => $query,
31
        type          => "intranet",
32
        flagsrequired => { tools => 'view_generated_notices' },
33
    }
34
);
35
36
unless ( C4::Context->preference('NoticesManagement') ) {
37
    print $query->redirect('/cgi-bin/koha/tools/tools-home.pl');
38
}
39
40
my $op = $query->param('op');
41
42
if ( $op and $op eq 'search' ) {
43
    my $letter_code  = $query->param('letter_code')  || undef;
44
    my $categorycode = $query->param('categorycode') || undef;
45
    my $branchcode   = $query->param('branchcode')   || undef;
46
    my $from         = $query->param('from')         || undef;
47
    my $to           = $query->param('to')           || undef;
48
    my $status       = $query->param('status')       || undef;
49
50
    my %where = ();
51
    $where{'me.letter_code'}              = $letter_code  if ($letter_code);
52
    $where{'borrowernumber.categorycode'} = $categorycode if ($categorycode);
53
    $where{'borrowernumber.branchcode'}   = $branchcode   if ($branchcode);
54
    if ($from) {
55
        if ($to) {
56
            $where{'me.time_queued'} = [
57
                -and => { '<=', $to },
58
                { '>=', $from }
59
            ];
60
        } else {
61
            $where{'me.time_queued'} = { '>=', $from };
62
        }
63
    } elsif ($to) {
64
        $where{'me.time_queued'} = { '<=', $to };
65
    }
66
    $where{'me.status'} = $status if ($status);
67
68
    my $notices = Koha::Notice::Messages->search(
69
        {%where},
70
        { join => 'borrowernumber', order_by => { -desc => 'time_queued' } }
71
    );
72
73
    $template->param(
74
        notices      => $notices,
75
        letter_code  => $letter_code,
76
        categorycode => $categorycode,
77
        branchcode   => $branchcode,
78
        from         => $from,
79
        to           => $to,
80
        status       => $status,
81
    );
82
}
83
84
$template->param(
85
    letters => Koha::Notice::Templates->search(
86
        {}, { select => [ 'name', 'code' ], group_by => [ 'name', 'code' ], order_by => { -asc => 'code' } }
87
    ),
88
    attribute_type_codes => (
89
        C4::Context->preference('ExtendedPatronAttributes')
90
        ? [ Koha::Patron::Attribute::Types->search( { staff_searchable => 1 } )->get_column('code') ]
91
        : []
92
    ),
93
);
94
95
output_html_with_http_headers $query, $cookie, $template->output;
(-)a/tools/print_notice.pl (-1 / +60 lines)
Line 0 Link Here
0
- 
1
#!/usr/bin/perl
2
3
# Copyright 2023 Aleisha Amohia <aleisha@catalyst.net.nz>
4
#
5
# This file is part of Koha.
6
#
7
# Koha is free software; you can redistribute it and/or modify it
8
# under the terms of the GNU General Public License as published by
9
# the Free Software Foundation; either version 3 of the License, or
10
# (at your option) any later version.
11
#
12
# Koha is distributed in the hope that it will be useful, but
13
# WITHOUT ANY WARRANTY; without even the implied warranty of
14
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15
# GNU General Public License for more details.
16
#
17
# You should have received a copy of the GNU General Public License
18
# along with Koha; if not, see <http://www.gnu.org/licenses>.
19
20
use Modern::Perl;
21
use CGI qw ( -utf8 );
22
use C4::Context;
23
use C4::Output qw( output_html_with_http_headers );
24
use C4::Auth   qw( get_template_and_user );
25
26
my $input = CGI->new;
27
28
my ( $template, $loggedinuser, $cookie ) = get_template_and_user(
29
    {
30
        template_name => "circ/printslip.tt",
31
        query         => $input,
32
        type          => "intranet",
33
        flagsrequired => { tools => 'view_generated_notices' },
34
    }
35
);
36
37
my @message_ids = $input->multi_param('message_ids');
38
my @slips;
39
foreach my $message_id (@message_ids) {
40
    my $message = Koha::Notice::Messages->find($message_id);
41
42
    my $template = Koha::Notice::Templates->find( $message->letter_id )->unblessed;
43
44
    push @slips, {
45
        content => $message->content,
46
        is_html => $template->{is_html},
47
        style   => $template->{style},
48
        id      => $message_id,
49
    };
50
51
    $message->update( { status => 'sent' } );
52
}
53
$template->param(
54
    slips                 => \@slips,
55
    caller                => 'notice_mgmt',
56
    stylesheet            => C4::Context->preference("SlipCSS"),
57
    IntranetSlipPrinterJS => C4::Context->preference('IntranetSlipPrinterJS'),
58
);
59
60
output_html_with_http_headers $input, $cookie, $template->output;

Return to bug 33260