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 %]&noticeid=[% notice.message_id | uri %]">[% notice.subject | html %]</a> |
84 |
<a class="notice-title" data-noticeid="[% notice.message_id | html %]" data-status="[% notice.status | html %]" data-borrowernumber="[% notice.borrowernumber | html %]" href="/cgi-bin/koha/members/notices.pl?borrowernumber=[% notice.borrowernumber | uri %]&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 |
</td> |
101 |
<td data-order="[% noice.updated_on | html %]">[% notice.updated_on | $KohaDates with_hours = 1 %]</td> |
102 |
<td> |
103 |
[% IF ( notice.failure_code ) %] |
104 |
[% IF ( notice.failure_code == "INVALID_BORNUMBER" ) %]<span class="clearfix">Invalid borrowernumber [% notice.borrowernumber | html %]</span> |
105 |
[% ELSIF ( notice.failure_code == 'NO_EMAIL' ) %]<span class="clearfix">Unable to find an email address for this patron</span> |
106 |
[% ELSIF ( matches = notice.failure_code.match('INVALID_EMAIL:(\w+)') ) %]<span class="clearfix">Invalid [% matches.0 | html %] email address found [% borrowernumber | html %]</span> |
107 |
[% ELSIF ( notice.failure_code == 'NO_FROM' ) %]<span class="clearfix">Missing from email address</span> |
108 |
[% ELSIF ( notice.failure_code == 'MISSING_SMS' ) %]<span class="clearfix">Missing SMS number</span> |
109 |
[% ELSIF ( notice.failure_code == 'DUPLICATE_MESSAGE' ) %]<span class="clearfix">Message is duplicate</span> |
110 |
[% ELSIF ( notice.failure_code == 'NO_NOTES' ) %]<span class="clearfix">No notes from SMS driver</span> |
111 |
[% ELSIF ( notice.failure_code == 'SMS_SEND_DRIVER_MISSING' ) %]<span class="clearfix">The SMS driver could not be loaded</span> |
112 |
[% ELSIF ( notice.failure_code == 'SENDMAIL' ) %]<span class="clearfix">Unhandled email failure, check the logs for further details</span> |
113 |
[% ELSIF ( notice.failure_code == "UNKNOWN_ERROR" ) %]<span class="clearfix">Unknown error</span> |
114 |
[% ELSE %] |
115 |
<span class="clearfix">Message failed to send with the following error: [% notice.failure_code | html %]</span> |
116 |
[% END %] |
117 |
[% END %] |
118 |
[% IF ( notice.status == 'sent' ) %] |
119 |
[% IF ( notice.from_address ) %] |
120 |
<span class="clearfix"><span class="label">From:</span> [% notice.from_address | html %]</span> |
121 |
[% END %] |
122 |
[% IF ( notice.to_address ) %] |
123 |
<span class="clearfix"><span class="label">To:</span> [% notice.to_address | html %]</span> |
124 |
[% END %] |
125 |
[% IF ( notice.cc_address ) %] |
126 |
<span class="clearfix"><span class="label">CC:</span> [% notice.cc_address | html %]</span> |
127 |
[% END %] |
128 |
[% END %] |
129 |
</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> |
130 |
<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> |
131 |
</tr> |
91 |
[% END %] |
132 |
[% END %] |
92 |
</tbody> |
133 |
</tbody> |
93 |
</table> |
134 |
</table> |
94 |
<input type="submit" class="btn btn-primary" value="Print selected notices" id="print_multiple_button"> |
135 |
<fieldset class="action"> |
|
|
136 |
<input type="submit" class="btn btn-primary" value="Print selected notices" id="print_multiple_button"> |
137 |
</fieldset> |
95 |
</form> |
138 |
</form> |
96 |
</div> |
139 |
</div> |
97 |
|
140 |
|
Lines 204-219
Link Here
|
204 |
<div class="modal-dialog"> |
247 |
<div class="modal-dialog"> |
205 |
<div class="modal-content"> |
248 |
<div class="modal-content"> |
206 |
<div class="modal-header"> |
249 |
<div class="modal-header"> |
207 |
<button type="button" class="closebtn" data-dismiss="modal" aria-label="Close"> |
250 |
<h1 class="modal-title" id="noticeModalLabel">Notice</h1> |
208 |
<span aria-hidden="true">×</span> |
251 |
<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> |
252 |
</div> |
212 |
<div class="modal-body"> |
253 |
<div class="modal-body"> |
213 |
... |
254 |
... |
214 |
</div> |
255 |
</div> |
215 |
<div class="modal-footer"> |
256 |
<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> |
257 |
<form id="resend_notice" action="/cgi-bin/koha/members/notices.pl" method="POST" style="display:none"> |
|
|
258 |
[% INCLUDE 'csrf-token.inc' %] |
259 |
<input type="hidden" name="op" value="cud-resend_notice" /> |
260 |
<input type="hidden" name="borrowernumber" value="" /> |
261 |
<input type="hidden" name="message_id" value="" /> |
262 |
<button type="submit" id="resend_notice_button" class="btn btn-default"><i class="fa-solid fa-rotate" aria-hidden="true"></i> Resend</button> |
263 |
</form> |
264 |
<button type="button" class="btn btn-default deny cancel" data-bs-dismiss="modal"><i class="fa fa-remove"></i> Close</button> |
217 |
</div> |
265 |
</div> |
218 |
</div> <!-- /.modal-content --> |
266 |
</div> <!-- /.modal-content --> |
219 |
</div> <!-- /.modal-dialog --> |
267 |
</div> <!-- /.modal-dialog --> |
Lines 239-256
Link Here
|
239 |
var title = $(this).text(); |
287 |
var title = $(this).text(); |
240 |
var noticeid = $(this).data("noticeid"); |
288 |
var noticeid = $(this).data("noticeid"); |
241 |
var body = $("#notice" + noticeid ).attr("srcdoc"); |
289 |
var body = $("#notice" + noticeid ).attr("srcdoc"); |
|
|
290 |
if( $(this).data("status") !== 'pending' ){ |
291 |
let borrowerNumber = $(this).data("borrowernumber"); |
292 |
$('#resend_notice input[name="borrowernumber"]').val(borrowerNumber); |
293 |
$('#resend_notice input[name="message_id"]').val(noticeid); |
294 |
$("#resend_notice").show(); |
295 |
} |
242 |
$("#noticeModalLabel").text( title ); |
296 |
$("#noticeModalLabel").text( title ); |
243 |
$("#noticeModal .modal-body").html( body ); |
297 |
$("#noticeModal .modal-body").html( body ); |
244 |
$("#noticeModal").modal("show"); |
298 |
$("#noticeModal").modal("show"); |
245 |
}); |
299 |
}); |
246 |
|
300 |
|
247 |
$("#noticeModal").on("hide.bs.modal", function(){ |
301 |
$("#noticeModal").on("hide.bs.modal", function(){ |
|
|
302 |
$('#resend_notice input[name="borrowernumber"]').val(''); |
303 |
$('#resend_notice input[name="message_id"]').val(''); |
304 |
$("#resend_notice").hide(); |
248 |
$("#noticeModalLabel").text(""); |
305 |
$("#noticeModalLabel").text(""); |
249 |
$("#noticeModal .modal-body").html(""); |
306 |
$("#noticeModal .modal-body").html(""); |
250 |
}); |
307 |
}); |
251 |
|
308 |
|
252 |
$("#print_multiple_button").click(function(e){ |
309 |
$("#print_multiple_button").click(function(e){ |
253 |
var selected_notices = $("#print_multiple").find("input[name='message_ids']:checked"); |
310 |
var selected_notices = $("#notices").find("input[name='message_ids']:checked"); |
254 |
if ( selected_notices.length == 0 ) { |
311 |
if ( selected_notices.length == 0 ) { |
255 |
alert(_("Please select at least one sent notice.")); |
312 |
alert(_("Please select at least one sent notice.")); |
256 |
e.preventDefault(); |
313 |
e.preventDefault(); |
257 |
- |
|
|