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

(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/members/notices.tt (-7 / +39 lines)
Lines 49-63 Link Here
49
                    <h1>Sent notices for [% INCLUDE 'patron-title.inc' %]</h1>
49
                    <h1>Sent notices for [% INCLUDE 'patron-title.inc' %]</h1>
50
50
51
                    [% IF ( QUEUED_MESSAGES ) %]
51
                    [% IF ( QUEUED_MESSAGES ) %]
52
                        <div class="page-section">
52
                    <div class="page-section">
53
                        <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>
54
                        <form id="print_multiple" action="/cgi-bin/koha/tools/print_notice.pl" method="post" target="_blank">
55
                            [% INCLUDE 'csrf-token.inc' %]
56
53
                            <table id="noticestable">
57
                            <table id="noticestable">
54
                                <thead>
58
                                <thead>
55
                                    <tr>
59
                                    <tr>
60
                                        <th class="nosort">&nbsp;</th>
61
                                        <th>Time created</th>
56
                                        <th>Notice</th>
62
                                        <th>Notice</th>
57
                                        <th>Type</th>
63
                                        <th>Type</th>
58
                                        <th>Status</th>
64
                                        <th>Status</th>
59
                                        <th>Updated on</th>
65
                                        <th>Updated on</th>
60
                                        <th>Time created</th>
61
                                        <th>Delivery note</th>
66
                                        <th>Delivery note</th>
62
                                        [% IF CAN_user_tools_view_generated_notices %]
67
                                        [% IF CAN_user_tools_view_generated_notices %]
63
                                        <th>Actions</th>
68
                                        <th>Actions</th>
Lines 67-72 Link Here
67
                                <tbody>
72
                                <tbody>
68
                                    [% FOREACH QUEUED_MESSAGE IN QUEUED_MESSAGES %]
73
                                    [% FOREACH QUEUED_MESSAGE IN QUEUED_MESSAGES %]
69
                                        <tr>
74
                                        <tr>
75
                                            <td><input type="checkbox" name="message_ids" value="[% QUEUED_MESSAGE.message_id | html %]"></td>
76
                                            <td data-order="[% QUEUED_MESSAGE.time_queued | html %]">[% QUEUED_MESSAGE.time_queued | $KohaDates  with_hours => 1 %]</td>
70
                                            <td>
77
                                            <td>
71
                                                <a class="notice-title" data-noticeid="[% QUEUED_MESSAGE.message_id | html %]" href="/cgi-bin/koha/members/notices.pl?borrowernumber=[% borrowernumber | uri %]&amp;noticeid=[% QUEUED_MESSAGE.message_id | uri %]">[% QUEUED_MESSAGE.subject | html %]</a>
78
                                                <a class="notice-title" data-noticeid="[% QUEUED_MESSAGE.message_id | html %]" href="/cgi-bin/koha/members/notices.pl?borrowernumber=[% borrowernumber | uri %]&amp;noticeid=[% QUEUED_MESSAGE.message_id | uri %]">[% QUEUED_MESSAGE.subject | html %]</a>
72
                                                <iframe class="notice" id="notice[% QUEUED_MESSAGE.message_id | html %]" srcdoc="[% QUEUED_MESSAGE.html_content | html %]"></iframe>
79
                                                <iframe class="notice" id="notice[% QUEUED_MESSAGE.message_id | html %]" srcdoc="[% QUEUED_MESSAGE.html_content | html %]"></iframe>
Lines 96-102 Link Here
96
                                                [% END %]
103
                                                [% END %]
97
                                            </td>
104
                                            </td>
98
                                            <td data-order="[% QUEUED_MESSAGE.updated_on | html %]">[% QUEUED_MESSAGE.updated_on | $KohaDates  with_hours => 1 %]</td>
105
                                            <td data-order="[% QUEUED_MESSAGE.updated_on | html %]">[% QUEUED_MESSAGE.updated_on | $KohaDates  with_hours => 1 %]</td>
99
                                            <td data-order="[% QUEUED_MESSAGE.time_queued | html %]">[% QUEUED_MESSAGE.time_queued | $KohaDates  with_hours => 1 %]</td>
100
                                            <td>
106
                                            <td>
101
                                                [% IF ( QUEUED_MESSAGE.failure_code ) %]
107
                                                [% IF ( QUEUED_MESSAGE.failure_code ) %]
102
                                                    [% IF ( QUEUED_MESSAGE.failure_code == "INVALID_BORNUMBER" ) %]<span class="clearfix">Invalid borrowernumber [% borrowernumber | html %]</span>
108
                                                    [% IF ( QUEUED_MESSAGE.failure_code == "INVALID_BORNUMBER" ) %]<span class="clearfix">Invalid borrowernumber [% borrowernumber | html %]</span>
Lines 130-140 Link Here
130
                                    [% END %]
136
                                    [% END %]
131
                                </tbody>
137
                                </tbody>
132
                            </table>
138
                            </table>
133
                        </div> <!-- /.page-section -->
139
                            <fieldset class="action">
140
                                <input type="submit" class="btn btn-primary" value="Print selected notices" id="print_multiple_button">
141
                            </fieldset>
142
                        </form>
143
                    </div> <!-- /.page-section -->
134
                    [% ELSE %]
144
                    [% ELSE %]
135
                        <div class="alert alert-info">There is no record of any messages that have been sent to this patron.</div>
145
                    <div class="alert alert-info">There is no record of any messages that have been sent to this patron.</div>
136
                    [% END %]
146
                    [% END %]
137
138
                </main>
147
                </main>
139
            </div> <!-- /.col-md-10.order-md-2 -->
148
            </div> <!-- /.col-md-10.order-md-2 -->
140
149
Lines 158-164 Link Here
158
                    </div>
167
                    </div>
159
                    <div class="modal-footer">
168
                    <div class="modal-footer">
160
                        <button type="button" id="resend-notice" class="btn btn-default" style="display:none"><i class="fa-solid fa-rotate" aria-hidden="true"></i> Resend</button>
169
                        <button type="button" id="resend-notice" class="btn btn-default" style="display:none"><i class="fa-solid fa-rotate" aria-hidden="true"></i> Resend</button>
161
                        <button type="button" class="btn btn-default deny cancel" data-bs-dismiss="modal"><i class="fa fa-times"></i> Close</button>
170
                        <button type="button" class="btn btn-default deny cancel" data-bs-dismiss="modal"><i class="fa fa-remove"></i> Close</button>
162
                    </div>
171
                    </div>
163
                </div> <!-- /.modal-content -->
172
                </div> <!-- /.modal-content -->
164
            </div> <!-- /.modal-dialog -->
173
            </div> <!-- /.modal-dialog -->
Lines 198-203 Link Here
198
                $("#noticeModalLabel").text("");
207
                $("#noticeModalLabel").text("");
199
                $("#noticeModal .modal-body").html("");
208
                $("#noticeModal .modal-body").html("");
200
            });
209
            });
210
211
            $("#print_multiple_button").click(function(e){
212
                var selected_notices = $("#print_multiple").find("input[name='message_ids']:checked");
213
                if ( selected_notices.length == 0 ) {
214
                    alert(_("Please select at least one sent notice."));
215
                    e.preventDefault();
216
                    return false;
217
                }
218
            });
219
220
            $(".select_all").click(function(e){
221
                e.preventDefault();
222
                $("input[name='message_ids']").each(function(){
223
                    $(this).prop("checked", true);
224
                });
225
            });
226
227
            $(".clear_all").click(function(e){
228
                e.preventDefault();
229
                $("input[name='message_ids']").each(function(){
230
                    $(this).prop("checked", false);
231
                });
232
            });
201
        });
233
        });
202
    </script>
234
    </script>
203
    [% INCLUDE 'str/members-menu.inc' %]
235
    [% INCLUDE 'str/members-menu.inc' %]
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/notices.tt (-12 / +74 lines)
Lines 46-52 Link Here
46
46
47
                <h1>Notices management</h1>
47
                <h1>Notices management</h1>
48
48
49
                <div class="page-section bg-warning">Printing a notice will mark it as sent.</div>
49
                <div class="alert alert-warning">Printing a notice will mark it as sent.</div>
50
50
51
                [% IF notices.count == 0 %]
51
                [% IF notices.count == 0 %]
52
52
Lines 70-75 Link Here
70
                                    <th>Type</th>
70
                                    <th>Type</th>
71
                                    <th>Status</th>
71
                                    <th>Status</th>
72
                                    <th>Updated on</th>
72
                                    <th>Updated on</th>
73
                                    <th>Delivery note</th>
73
                                    <th class="nosort">Actions</th>
74
                                    <th class="nosort">Actions</th>
74
                                </tr>
75
                                </tr>
75
                            </thead>
76
                            </thead>
Lines 77-97 Link Here
77
                                [% FOREACH notice IN notices %]
78
                                [% FOREACH notice IN notices %]
78
                                <tr>
79
                                <tr>
79
                                    <td><input type="checkbox" name="message_ids" value="[% notice.message_id | html %]"></td>
80
                                    <td><input type="checkbox" name="message_ids" value="[% notice.message_id | html %]"></td>
80
                                    <td>[% notice.time_queued | $KohaDates with_hours = 1 %]</td>
81
                                    <td data-order="[% notice.time_queued | html %]">[% notice.time_queued | $KohaDates with_hours = 1 %]</td>
81
                                    <td>[% INCLUDE 'patron-title.inc' patron=notice.patron hide_patron_infos_if_needed=1 %]</td>
82
                                    <td>[% INCLUDE 'patron-title.inc' patron=notice.patron hide_patron_infos_if_needed=1 %]</td>
82
                                    <td>
83
                                    <td>
83
                                        <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>
84
                                        <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>
84
                                        <iframe class="notice" id="notice[% notice.message_id | html %]" srcdoc="[% notice.html_content | html %]"></iframe>
85
                                        <iframe class="notice" id="notice[% notice.message_id | html %]" srcdoc="[% notice.html_content | html %]"></iframe>
85
                                    </td>
86
                                    </td>
86
                                    <td>[% notice.message_transport_type | html %]</td>
87
                                    <td>
87
                                    <td>[% notice.status | html %]</td>
88
                                        [% IF ( notice.message_transport_type == 'email' ) %]<span>email</span>
88
                                    <td>[% notice.updated_on | $KohaDates with_hours = 1 %]</td>
89
                                        [% ELSIF ( notice.message_transport_type == 'print' ) %]<span>print</span>
90
                                        [% ELSIF ( notice.message_transport_type == 'feed' ) %]<span>feed</span>
91
                                        [% ELSIF ( notice.message_transport_type == 'sms' ) %]<span>sms</span>
92
                                        [% ELSE %][% notice.message_transport_type | html %][% END %]
93
                                    </td>
94
                                    <td>
95
                                        [% IF ( notice.status == 'sent' ) %]<span>sent</span>
96
                                        [% ELSIF ( notice.status == 'pending' ) %]<span>pending</span>
97
                                        [% ELSIF ( notice.status == 'failed' ) %]<span>failed</span>
98
                                        [% ELSIF ( notice.status == 'deleted' ) %]<span>deleted</span>
99
                                        [% ELSE %][% notice.status | html %][% END %]
100
                                        [% IF ( notice.status != 'pending' ) %]
101
                                            <div class="notice">
102
                                                <form id="resend_notice[% notice.message_id | html %]" action="/cgi-bin/koha/members/notices.pl?borrowernumber=[% borrowernumber | html %]" method="POST">
103
                                                    [% INCLUDE 'csrf-token.inc' %]
104
                                                    <input type="hidden" name="op" value="cud-resend_notice" />
105
                                                    <input type="hidden" name="borrowernumber" value="[% notice.borrowernumber | html %]" />
106
                                                    <input type="hidden" name="message_id" value="[% notice.message_id | html %]" />
107
                                                </form>
108
                                            </div>
109
                                        [% END %]
110
                                    </td>
111
                                    <td data-order="[% noice.updated_on | html %]">[% notice.updated_on | $KohaDates with_hours = 1 %]</td>
112
                                    <td>
113
                                        [% IF ( notice.failure_code ) %]
114
                                            [% IF ( notice.failure_code == "INVALID_BORNUMBER" ) %]<span class="clearfix">Invalid borrowernumber [% notice.borrowernumber | html %]</span>
115
                                            [% ELSIF ( notice.failure_code == 'NO_EMAIL' ) %]<span class="clearfix">Unable to find an email address for this patron</span>
116
                                            [% ELSIF ( matches = notice.failure_code.match('INVALID_EMAIL:(\w+)') ) %]<span class="clearfix">Invalid [% matches.0 | html %] email address found [% borrowernumber | html %]</span>
117
                                            [% ELSIF ( notice.failure_code == 'NO_FROM' ) %]<span class="clearfix">Missing from email address</span>
118
                                            [% ELSIF ( notice.failure_code == 'MISSING_SMS' ) %]<span class="clearfix">Missing SMS number</span>
119
                                            [% ELSIF ( notice.failure_code == 'DUPLICATE_MESSAGE' ) %]<span class="clearfix">Message is duplicate</span>
120
                                            [% ELSIF ( notice.failure_code == 'NO_NOTES' ) %]<span class="clearfix">No notes from SMS driver</span>
121
                                            [% ELSIF ( notice.failure_code == 'SMS_SEND_DRIVER_MISSING' ) %]<span class="clearfix">The SMS driver could not be loaded</span>
122
                                            [% ELSIF ( notice.failure_code == 'SENDMAIL' ) %]<span class="clearfix">Unhandled email failure, check the logs for further details</span>
123
                                            [% ELSIF ( notice.failure_code == "UNKNOWN_ERROR" ) %]<span class="clearfix">Unknown error</span>
124
                                            [% ELSE %]
125
                                                <span class="clearfix">Message failed to send with the following error: [% notice.failure_code | html %]</span>
126
                                            [% END %]
127
                                        [% END %]
128
                                        [% IF ( notice.status == 'sent' ) %]
129
                                            [% IF ( notice.from_address ) %]
130
                                                <span class="clearfix"><span class="label">From:</span> [% notice.from_address | html %]</span>
131
                                            [% END %]
132
                                            [% IF ( notice.to_address ) %]
133
                                                <span class="clearfix"><span class="label">To:</span> [% notice.to_address | html %]</span>
134
                                            [% END %]
135
                                            [% IF ( notice.cc_address ) %]
136
                                                <span class="clearfix"><span class="label">CC:</span> [% notice.cc_address | html %]</span>
137
                                            [% END %]
138
                                        [% END %]
139
                                    </td>
89
                                    <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>
140
                                    <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>
90
                                </tr>
141
                                </tr>
91
                                [% END %]
142
                                [% END %]
92
                            </tbody>
143
                            </tbody>
93
                        </table>
144
                        </table>
94
                        <input type="submit" class="btn btn-primary" value="Print selected notices" id="print_multiple_button">
145
                        <fieldset class="action">
146
                            <input type="submit" class="btn btn-primary" value="Print selected notices" id="print_multiple_button">
147
                        </fieldset>
95
                    </form>
148
                    </form>
96
                </div>
149
                </div>
97
150
Lines 204-219 Link Here
204
    <div class="modal-dialog">
257
    <div class="modal-dialog">
205
        <div class="modal-content">
258
        <div class="modal-content">
206
            <div class="modal-header">
259
            <div class="modal-header">
207
                <button type="button" class="closebtn" data-dismiss="modal" aria-label="Close">
260
                <h1 class="modal-title" id="noticeModalLabel">Notice</h1>
208
                    <span aria-hidden="true">&times;</span>
261
                <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
209
                </button>
210
                <h5 class="modal-title" id="noticeModalLabel">Notice</h5>
211
            </div>
262
            </div>
212
            <div class="modal-body">
263
            <div class="modal-body">
213
                ...
264
                ...
214
            </div>
265
            </div>
215
            <div class="modal-footer">
266
            <div class="modal-footer">
216
                <button type="button" class="btn btn-default deny cancel" data-dismiss="modal"><i class="fa fa-remove"></i> Close</button>
267
                <button type="button" id="resend-notice" class="btn btn-default" style="display:none"><i class="fa-solid fa-rotate" aria-hidden="true"></i> Resend</button>
268
                <button type="button" class="btn btn-default deny cancel" data-bs-dismiss="modal"><i class="fa fa-remove"></i> Close</button>
217
            </div>
269
            </div>
218
        </div> <!-- /.modal-content -->
270
        </div> <!-- /.modal-content -->
219
    </div> <!-- /.modal-dialog -->
271
    </div> <!-- /.modal-dialog -->
Lines 239-250 Link Here
239
                var title = $(this).text();
291
                var title = $(this).text();
240
                var noticeid = $(this).data("noticeid");
292
                var noticeid = $(this).data("noticeid");
241
                var body = $("#notice" + noticeid ).attr("srcdoc");
293
                var body = $("#notice" + noticeid ).attr("srcdoc");
294
                if( $("#resend_notice" + noticeid ).length ){
295
                    $("#resend-notice").show();
296
                }
297
                $("#resend-notice").data("noticeid", noticeid );
242
                $("#noticeModalLabel").text( title );
298
                $("#noticeModalLabel").text( title );
243
                $("#noticeModal .modal-body").html( body );
299
                $("#noticeModal .modal-body").html( body );
244
                $("#noticeModal").modal("show");
300
                $("#noticeModal").modal("show");
245
            });
301
            });
246
302
303
            $("#resend-notice").on("click", function(e){
304
                e.preventDefault();
305
                var noticeid = $(this).data("noticeid");
306
                $("#resend_notice" + noticeid ).submit();
307
            });
308
247
            $("#noticeModal").on("hide.bs.modal", function(){
309
            $("#noticeModal").on("hide.bs.modal", function(){
310
                $("#resend-notice").removeData("noticeid").hide();
248
                $("#noticeModalLabel").text("");
311
                $("#noticeModalLabel").text("");
249
                $("#noticeModal .modal-body").html("");
312
                $("#noticeModal .modal-body").html("");
250
            });
313
            });
251
- 

Return to bug 33260