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 7-13 Link Here
7
        <ul>
7
        <ul>
8
            <li><a href="/cgi-bin/koha/tools/tools-home.pl">Tools home</a></li>
8
            <li><a href="/cgi-bin/koha/tools/tools-home.pl">Tools home</a></li>
9
        </ul>
9
        </ul>
10
        [% 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 ) %]
10
        [% 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') ) %]
11
            <h5>Patrons and circulation</h5>
11
            <h5>Patrons and circulation</h5>
12
            <ul>
12
            <ul>
13
                [% IF ( CAN_user_tools_manage_patron_lists ) %]
13
                [% IF ( CAN_user_tools_manage_patron_lists ) %]
Lines 28-33 Link Here
28
                [% IF ( CAN_user_tools_edit_notice_status_triggers ) %]
28
                [% IF ( CAN_user_tools_edit_notice_status_triggers ) %]
29
                    <li><a href="/cgi-bin/koha/tools/overduerules.pl">Overdue notice/status triggers</a></li>
29
                    <li><a href="/cgi-bin/koha/tools/overduerules.pl">Overdue notice/status triggers</a></li>
30
                [% END %]
30
                [% END %]
31
                [% IF ( CAN_user_tools_view_generated_notices && Koha.Preference('NoticesManagement') ) %]
32
                    <li><a href="/cgi-bin/koha/tools/notices.pl">Notices management</a></li>
33
                [% END %]
31
                [% IF ( CAN_user_tools_label_creator ) %]
34
                [% IF ( CAN_user_tools_label_creator ) %]
32
                    <li><a href="/cgi-bin/koha/patroncards/home.pl">Patron card creator</a></li>
35
                    <li><a href="/cgi-bin/koha/patroncards/home.pl">Patron card creator</a></li>
33
                [% END %]
36
                [% END %]
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/members/notices.tt (+4 lines)
Lines 59-64 Link Here
59
                                        <th>Updated on</th>
59
                                        <th>Updated on</th>
60
                                        <th>Time created</th>
60
                                        <th>Time created</th>
61
                                        <th>Delivery note</th>
61
                                        <th>Delivery note</th>
62
                                        [% IF CAN_user_tools_view_generated_notices %]
63
                                        <th>Actions</th>
64
                                        [% END %]
62
                                    </tr>
65
                                    </tr>
63
                                </thead>
66
                                </thead>
64
                                <tbody>
67
                                <tbody>
Lines 122-127 Link Here
122
                                                    [% END %]
125
                                                    [% END %]
123
                                                [% END %]
126
                                                [% END %]
124
                                            </td>
127
                                            </td>
128
                                            [% 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 %]
125
                                        </tr>
129
                                        </tr>
126
                                    [% END %]
130
                                    [% END %]
127
                                </tbody>
131
                                </tbody>
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/notices.tt (+310 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 { display: none; }
17
</style>
18
</head>
19
20
<body id="tools_notices_mgmt" class="tools">
21
[% WRAPPER 'header.inc' %]
22
    [% INCLUDE 'circ-search.inc' %]
23
[% END %]
24
25
[% WRAPPER 'sub-header.inc' %]
26
<nav id="breadcrumbs" aria-label="Breadcrumb" class="breadcrumb">
27
    <ol>
28
        <li>
29
            <a href="/cgi-bin/koha/mainpage.pl">Home</a>
30
        </li>
31
        <li>
32
            <a href="/cgi-bin/koha/tools/tools-home.pl">Tools</a>
33
        </li>
34
        <li>
35
            <a href="#" aria-current="page">
36
                Notices management
37
            </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
48
                <h1>Notices management</h1>
49
50
                [% IF notices && notices.count > 0 %]
51
52
                <div class="dialog message">Printing a notice will mark it as sent.</div>
53
54
                <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>
55
56
                <form id="print_multiple" action="/cgi-bin/koha/tools/print_notice.pl" method="post" target="_blank">
57
58
                    <table id="notices">
59
                        <thead>
60
                            <tr>
61
                                <th class="nosort">&nbsp;</th>
62
                                <th>Time created</th>
63
                                <th>Patron</th>
64
                                <th>Notice</th>
65
                                <th>Type</th>
66
                                <th>Status</th>
67
                                <th>Updated on</th>
68
                                <th class="nosort">Actions</th>
69
                            </tr>
70
                        </thead>
71
                        <tbody>
72
                            [% FOREACH notice IN notices %]
73
                            <tr>
74
                                <td><input type="checkbox" name="message_ids" value="[% notice.message_id | html %]"></td>
75
                                <td>[% notice.time_queued | $KohaDates with_hours = 1 %]</td>
76
                                <td>[% INCLUDE 'patron-title.inc' patron=notice.patron hide_patron_infos_if_needed=1 %]</td>
77
                                <td>
78
                                    <a class="notice-title" data-noticeid="[% notice.message_id | html %]" href="/cgi-bin/koha/members/notices.pl?borrowernumber=[% notice.borrowernumber | uri %]&amp;noticeid=[% notice.message_id | uri %]">[% notice.subject | html %]</a>
79
                                    <iframe class="notice" id="notice[% notice.message_id | html %]" srcdoc="[% notice.html_content | html %]"></iframe>
80
                                </td>
81
                                <td>[% notice.message_transport_type | html %]</td>
82
                                <td>[% notice.status | html %]</td>
83
                                <td>[% notice.updated_on | $KohaDates with_hours = 1 %]</td>
84
                                <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>
85
                            </tr>
86
                            [% END %]
87
                        </tbody>
88
                    </table>
89
90
                    <input type="submit" class="btn btn-primary" value="Print selected notices" id="print_multiple_button">
91
92
                </form>
93
94
                [% ELSE %]
95
96
                    <div>
97
                        Use the search form on the left to find sent notices.
98
                    </div>
99
100
                    [% IF notices && notices.count == 0 %]
101
102
                    <div class="dialog message">
103
                        No sent notices were found with those search parameters.
104
                    </div>
105
106
                    [% END %]
107
108
                [% END %]
109
110
            </main>
111
        </div> <!-- /.col-sm-10.col-sm-push-2 -->
112
113
        <div class="col-sm-2 col-sm-pull-10">
114
            <aside>
115
                <fieldset class="sidebar brief">
116
                    <h3>Go to a patron's notices</h3>
117
                    <ol>
118
                        <li>
119
                            <div id="notices_patronsearch_pane" role="tabpanel" class="tab-pane active">
120
                                [% PROCESS patron_search_filters_simple %]
121
                                [% PROCESS patron_search_table table_id => 'table_borrowers', open_on_row_click => 1 %]
122
                            </div>
123
                        </li>
124
                    </ol>
125
                </fieldset>
126
                <fieldset class="sidebar brief">
127
                    <form id="notices-search" action="/cgi-bin/koha/tools/notices.pl" method="post">
128
                        <input type="hidden" name="op" value="search">
129
                        <h3>Search filters</h3>
130
                        <ol>
131
                            <li>
132
                                <label for="branchcode">Library:</label>
133
                                <select id="branchcode" name="branchcode">
134
                                    <option value="">All libraries</option>
135
                                    [% FOREACH branch IN Branches.all( selected => branchcode ) %]
136
                                        [% IF ( branch.selected ) %]
137
                                            <option selected="selected" value="[% branch.branchcode | html %]">[% branch.branchname | html %]</option>
138
                                        [% ELSE %]
139
                                            <option value="[% branch.branchcode | html %]">[% branch.branchname | html %]</option>
140
                                        [% END %]
141
                                    [% END %]
142
                                </select>
143
                            </li>
144
                            <li>
145
                                <label for="letter_code">Notice:</label>
146
                                <select id="letter_code" name="letter_code">
147
                                    <option value="">All notices</option>
148
                                    [% FOREACH letter IN letters %]
149
                                        [% IF ( letter.code == letter_code ) %]
150
                                            <option selected="selected" value="[% letter.code | html %]">[% letter.name | html %] ([% letter.code | html %])</option>
151
                                        [% ELSE %]
152
                                            <option value="[% letter.code | html %]">[% letter.name | html %] ([% letter.code | html %])</option>
153
                                        [% END %]
154
                                    [% END %]
155
                                </select>
156
                            </li>
157
                            <li>
158
                                <label for="status">Notice status:</label>
159
                                <select id="status" name="status">
160
                                    <option value="">All statuses</option>
161
                                    [% IF status == 'sent' %]
162
                                    <option selected="selected" value="sent">Sent</option>
163
                                    [% ELSE %]
164
                                    <option value="sent">Sent</option>
165
                                    [% END %]
166
                                    [% IF status == 'sent' %]
167
                                    <option selected="selected" value="pending">Pending</option>
168
                                    [% ELSE %]
169
                                    <option value="pending">Pending</option>
170
                                    [% END %]
171
                                    [% IF status == 'sent' %]
172
                                    <option selected="selected" value="failed">Failed</option>
173
                                    [% ELSE %]
174
                                    <option value="failed">Failed</option>
175
                                    [% END %]
176
                                    [% IF status == 'sent' %]
177
                                    <option selected="selected" value="deleted">Deleted</option>
178
                                    [% ELSE %]
179
                                    <option value="deleted">Deleted</option>
180
                                    [% END %]
181
                                </select>
182
                            </li>
183
                            <li>
184
                                <fieldset class="brief">
185
                                    <legend>Date queued</legend>
186
                                    <ol>
187
                                        <li>
188
                                            <label for="from">From:</label>
189
                                            <input type="text" id="from" name="from" size="10" value="[% from | html %]" class="flatpickr" data-date_to="to" />
190
                                            <div class="hint">[% INCLUDE 'date-format.inc' %]</div>
191
                                        </li>
192
                                        <li>
193
                                            <label for="to">To:</label>
194
                                            <input type="text" id="to" name="to" size="10" value="[% to | html %]" class="flatpickr" />
195
                                            <div class="hint">[% INCLUDE 'date-format.inc' %]</div>
196
                                        </li>
197
                                    </ol>
198
                                </fieldset>
199
                            </li>
200
                            <li>
201
                                <label for="categorycode">Patron category:</label>
202
                                <select id="categorycode" name="categorycode">
203
                                    <option value="">All patron categories</option>
204
                                    [% FOREACH category IN Categories.all %]
205
                                        [% IF ( category.categorycode == categorycode ) %]
206
                                            <option selected="selected" value="[% category.categorycode | html %]">[% category.description | html %]</option>
207
                                        [% ELSE %]
208
                                            <option value="[% category.categorycode | html %]">[% category.description | html %]</option>
209
                                        [% END %]
210
                                    [% END %]
211
                                </select>
212
                            </li>
213
                        </ol>
214
                        <fieldset class="action">
215
                            <input type="submit" class="btn btn-default" value="Search">
216
                        </fieldset>
217
                    </form>
218
                </fieldset>
219
                [% INCLUDE 'tools-menu.inc' %]
220
            </aside>
221
        </div> <!-- /.col-sm-2.col-sm-pull-10 -->
222
     </div> <!-- /.row -->
223
224
<!-- Modal -->
225
<div class="modal" id="noticeModal" tabindex="-1" aria-labelledby="noticeModalLabel" aria-hidden="true">
226
    <div class="modal-dialog">
227
        <div class="modal-content">
228
            <div class="modal-header">
229
                <button type="button" class="closebtn" data-dismiss="modal" aria-label="Close">
230
                    <span aria-hidden="true">&times;</span>
231
                </button>
232
                <h5 class="modal-title" id="noticeModalLabel">Notice</h5>
233
            </div>
234
            <div class="modal-body">
235
                ...
236
            </div>
237
            <div class="modal-footer">
238
                <button type="button" class="btn btn-default deny cancel" data-dismiss="modal"><i class="fa fa-remove"></i> Close</button>
239
            </div>
240
        </div> <!-- /.modal-content -->
241
    </div> <!-- /.modal-dialog -->
242
</div> <!-- /.modal -->
243
244
[% MACRO jsinclude BLOCK %]
245
    [% Asset.js("js/tools-menu.js") | $raw %]
246
    [% INCLUDE 'calendar.inc' %]
247
    [% INCLUDE 'datatables.inc' %]
248
    [% 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' %]
249
250
    <script>
251
        table_settings = [% TablesSettings.GetColumns( 'circ', 'circulation', 'table_borrowers', 'json' ) | $raw %];
252
        $(document).ready(function() {
253
            $("#notices").dataTable($.extend(true, {}, dataTablesDefaults, {
254
                "aoColumnDefs": [
255
                    { 'bSortable': false, 'aTargets': [ 'nosort' ] }
256
                ],
257
                "aaSorting": [[1, "desc" ]],
258
                "sPaginationType": "full"
259
            }));
260
261
            $("#notices").on("click", ".notice-title", function(e){
262
                e.preventDefault();
263
                var title = $(this).text();
264
                var noticeid = $(this).data("noticeid");
265
                var body = $("#notice" + noticeid ).attr("srcdoc");
266
                $("#noticeModalLabel").text( title );
267
                $("#noticeModal .modal-body").html( body );
268
                $("#noticeModal").modal("show");
269
            });
270
271
            $("#noticeModal").on("hide.bs.modal", function(){
272
                $("#noticeModalLabel").text("");
273
                $("#noticeModal .modal-body").html("");
274
            });
275
276
            $("#notices_patronsearch").on("submit", filter);
277
            [% UNLESS notices %]
278
                [% IF ( Koha.Preference('PatronAutoComplete') ) %]
279
                    patron_autocomplete($("#search_patron_filter"), { 'link-to': 'notices', 'url-params': '[% url_biblio_params | url %]' });
280
                [% END %]
281
            [% END %]
282
283
            $("#print_multiple_button").click(function(e){
284
                var selected_notices = $("#print_multiple").find("input[name='message_ids']:checked");
285
                if ( selected_notices.length == 0 ) {
286
                    alert(_("Please select at least one sent notice."));
287
                    e.preventDefault();
288
                    return false;
289
                }
290
            });
291
292
            $(".select_all").click(function(e){
293
                e.preventDefault();
294
                $("input[name='message_ids']").each(function(){
295
                    $(this).prop("checked", true);
296
                });
297
            });
298
299
            $(".clear_all").click(function(e){
300
                e.preventDefault();
301
                $("input[name='message_ids']").each(function(){
302
                    $(this).prop("checked", false);
303
                });
304
            });
305
        });
306
    </script>
307
308
[% END %]
309
310
[% INCLUDE 'intranet-bottom.inc' %]
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/tools-home.tt (-1 / +6 lines)
Lines 30-36 Link Here
30
            <h1>Tools</h1>
30
            <h1>Tools</h1>
31
            <div class="row">
31
            <div class="row">
32
                <div class="col-sm-6">
32
                <div class="col-sm-6">
33
                    [% 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') ) ) %]
33
                    [% 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') ) ) %]
34
                        <h3>Patrons and circulation</h3>
34
                        <h3>Patrons and circulation</h3>
35
                    [% END %]
35
                    [% END %]
36
                    <dl>
36
                    <dl>
Lines 69-74 Link Here
69
                            <dd>Set notice/status triggers for overdue items</dd>
69
                            <dd>Set notice/status triggers for overdue items</dd>
70
                        [% END %]
70
                        [% END %]
71
71
72
                        [% IF ( CAN_user_tools_view_generated_notices && Koha.Preference('NoticesManagement') ) %]
73
                            <dt><a href="/cgi-bin/koha/tools/notices.pl">Notices management</a></dt>
74
                            <dd>View and print generated notices</dd>
75
                        [% END %]
76
72
                        [% IF ( CAN_user_tools_label_creator ) %]
77
                        [% IF ( CAN_user_tools_label_creator ) %]
73
                            <dt><a href="/cgi-bin/koha/patroncards/home.pl">Patron card creator</a></dt>
78
                            <dt><a href="/cgi-bin/koha/patroncards/home.pl">Patron card creator</a></dt>
74
                            <dd>Create printable patron cards</dd>
79
                            <dd>Create printable patron cards</dd>
(-)a/koha-tmpl/intranet-tmpl/prog/js/staff-global.js (-1 / +3 lines)
Lines 579-585 function patron_autocomplete(node, options) { Link Here
579
                    ? "/cgi-bin/koha/circ/circulation.pl"
579
                    ? "/cgi-bin/koha/circ/circulation.pl"
580
                    : link_to == "reserve"
580
                    : link_to == "reserve"
581
                    ? "/cgi-bin/koha/reserve/request.pl"
581
                    ? "/cgi-bin/koha/reserve/request.pl"
582
                    : "/cgi-bin/koha/members/moremember.pl";
582
                        : link_to == 'notices'
583
                            ? "/cgi-bin/koha/members/notices.pl"
584
                            : "/cgi-bin/koha/members/moremember.pl";
583
            item.link +=
585
            item.link +=
584
                (url_params ? "?" + url_params + "&" : "?") +
586
                (url_params ? "?" + url_params + "&" : "?") +
585
                "borrowernumber=" +
587
                "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