|
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 %]" 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 |
[% 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">×</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 |
- |
|
|