Bugzilla – Attachment 175515 Details for
Bug 33260
Show message queue on staff interface and make notices printable
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 33260: (follow-up) Sync functionality and ordering of display
Bug-33260-follow-up-Sync-functionality-and-orderin.patch (text/plain), 23.57 KB, created by
Martin Renvoize (ashimema)
on 2024-12-16 16:31:59 UTC
(
hide
)
Description:
Bug 33260: (follow-up) Sync functionality and ordering of display
Filename:
MIME Type:
Creator:
Martin Renvoize (ashimema)
Created:
2024-12-16 16:31:59 UTC
Size:
23.57 KB
patch
obsolete
>From 4fbd3bc03d2c826e04cbf022782696c279729231 Mon Sep 17 00:00:00 2001 >From: Martin Renvoize <martin.renvoize@ptfs-europe.com> >Date: Wed, 2 Oct 2024 14:44:19 +0100 >Subject: [PATCH] Bug 33260: (follow-up) Sync functionality and ordering of > display > >This patch syncs up the functionality and order of the notice displays. > >We allow for resending of notices via the modal in the new tools page >and we add print in bulk to the members notices page. > >We also fix the modal on the tools page to work with bootstrap 5 >correctly. >--- > .../prog/en/modules/members/notices.tt | 90 ++++++++++++------- > .../prog/en/modules/tools/notices.tt | 83 ++++++++++++++--- > 2 files changed, 127 insertions(+), 46 deletions(-) > >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/members/notices.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/members/notices.tt >index 50a0dfe6efd..18a114499eb 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/members/notices.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/members/notices.tt >@@ -49,26 +49,31 @@ > <h1>Sent notices for [% INCLUDE 'patron-title.inc' %]</h1> > > [% IF ( QUEUED_MESSAGES ) %] >- <div class="page-section"> >+ <div class="page-section"> >+ <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> >+ <form id="print_multiple" action="/cgi-bin/koha/tools/print_notice.pl" method="post" target="_blank"> >+ [% INCLUDE 'csrf-token.inc' %] >+ > <table id="noticestable"> > <thead> > <tr> >+ <th class="nosort"> </th> >+ <th>Time created</th> > <th>Notice</th> > <th>Type</th> > <th>Status</th> > <th>Updated on</th> >- <th>Time created</th> > <th>Delivery note</th> >- [% IF CAN_user_tools_view_generated_notices %] > <th>Actions</th> >- [% END %] > </tr> > </thead> > <tbody> > [% FOREACH QUEUED_MESSAGE IN QUEUED_MESSAGES %] > <tr> >+ <td><input type="checkbox" name="message_ids" value="[% QUEUED_MESSAGE.message_id | html %]" [% IF QUEDUE_MESSAGE.status == 'pending' %]disabled="disabled"[% END %]></td> >+ <td data-order="[% QUEUED_MESSAGE.time_queued | html %]">[% QUEUED_MESSAGE.time_queued | $KohaDates with_hours => 1 %]</td> > <td> >- <a class="notice-title" data-noticeid="[% QUEUED_MESSAGE.message_id | html %]" href="/cgi-bin/koha/members/notices.pl?borrowernumber=[% borrowernumber | uri %]&noticeid=[% QUEUED_MESSAGE.message_id | uri %]">[% QUEUED_MESSAGE.subject | html %]</a> >+ <a class="notice-title" data-noticeid="[% QUEUED_MESSAGE.message_id | html %]" data-status="[% QUEUED_MESSAGE.status | html %]" data-borrowernumber="[% borrowernumber | html %]" href="/cgi-bin/koha/members/notices.pl?borrowernumber=[% borrowernumber | uri %]&noticeid=[% QUEUED_MESSAGE.message_id | uri %]">[% QUEUED_MESSAGE.subject | html %]</a> > <iframe class="notice" id="notice[% QUEUED_MESSAGE.message_id | html %]" srcdoc="[% QUEUED_MESSAGE.html_content | html %]"></iframe> > </td> > <td> >@@ -84,19 +89,8 @@ > [% ELSIF ( QUEUED_MESSAGE.status == 'failed' ) %]<span>failed</span> > [% ELSIF ( QUEUED_MESSAGE.status == 'deleted' ) %]<span>deleted</span> > [% ELSE %][% QUEUED_MESSAGE.status | html %][% END %] >- [% IF ( QUEUED_MESSAGE.status != 'pending' ) %] >- <div class="notice"> >- <form id="resend_notice[% QUEUED_MESSAGE.message_id | html %]" action="/cgi-bin/koha/members/notices.pl?borrowernumber=[% borrowernumber | html %]" method="POST"> >- [% INCLUDE 'csrf-token.inc' %] >- <input type="hidden" name="op" value="cud-resend_notice" /> >- <input type="hidden" name="borrowernumber" value="[% borrowernumber | html %]" /> >- <input type="hidden" name="message_id" value="[% QUEUED_MESSAGE.message_id | html %]" /> >- </form> >- </div> >- [% END %] > </td> > <td data-order="[% QUEUED_MESSAGE.updated_on | html %]">[% QUEUED_MESSAGE.updated_on | $KohaDates with_hours => 1 %]</td> >- <td data-order="[% QUEUED_MESSAGE.time_queued | html %]">[% QUEUED_MESSAGE.time_queued | $KohaDates with_hours => 1 %]</td> > <td> > [% IF ( QUEUED_MESSAGE.failure_code ) %] > [% IF ( QUEUED_MESSAGE.failure_code == "INVALID_BORNUMBER" ) %]<span class="clearfix">Invalid borrowernumber [% borrowernumber | html %]</span> >@@ -113,7 +107,7 @@ > <span class="clearfix">Message failed to send with the following error: [% QUEUED_MESSAGE.failure_code | html %]</span> > [% END %] > [% END %] >- [% IF ( QUEUED_MESSAGE.status == 'sent' ) %] >+ [% IF ( QUEUED_MESSAGE.status != 'pending' ) %] > [% IF ( QUEUED_MESSAGE.from_address ) %] > <span class="clearfix"><span class="label">From:</span> [% QUEUED_MESSAGE.from_address | html %]</span> > [% END %] >@@ -125,16 +119,19 @@ > [% END %] > [% END %] > </td> >- [% 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 %] >+ <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> > </tr> > [% END %] > </tbody> > </table> >- </div> <!-- /.page-section --> >+ <fieldset class="action"> >+ <input type="submit" class="btn btn-primary" value="Print selected notices" id="print_multiple_button"> >+ </fieldset> >+ </form> >+ </div> <!-- /.page-section --> > [% ELSE %] >- <div class="alert alert-info">There is no record of any messages that have been sent to this patron.</div> >+ <div class="alert alert-info">There is no record of any messages that have been sent to this patron.</div> > [% END %] >- > </main> > </div> <!-- /.col-md-10.order-md-2 --> > >@@ -157,8 +154,14 @@ > ... > </div> > <div class="modal-footer"> >- <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> >- <button type="button" class="btn btn-default deny cancel" data-bs-dismiss="modal"><i class="fa fa-times"></i> Close</button> >+ <form id="resend_notice" action="/cgi-bin/koha/members/notices.pl" method="POST" style="display:none"> >+ [% INCLUDE 'csrf-token.inc' %] >+ <input type="hidden" name="op" value="cud-resend_notice" /> >+ <input type="hidden" name="borrowernumber" value="" /> >+ <input type="hidden" name="message_id" value="" /> >+ <button type="submit" id="resend_notice_button" class="btn btn-default"><i class="fa-solid fa-rotate" aria-hidden="true"></i> Resend</button> >+ </form> >+ <button type="button" class="btn btn-default deny cancel" data-bs-dismiss="modal"><i class="fa fa-remove"></i> Close</button> > </div> > </div> <!-- /.modal-content --> > </div> <!-- /.modal-dialog --> >@@ -178,26 +181,47 @@ > var title = $(this).text(); > var noticeid = $(this).data("noticeid"); > var body = $("#notice" + noticeid ).attr("srcdoc"); >- if( $("#resend_notice" + noticeid ).length ){ >- $("#resend-notice").show(); >+ if( $(this).data("status") !== 'pending' ){ >+ let borrowerNumber = $(this).data("borrowernumber"); >+ $('#resend_notice input[name="borrowernumber"]').val(borrowerNumber); >+ $('#resend_notice input[name="message_id"]').val(noticeid); >+ $("#resend_notice").show(); > } >- $("#resend-notice").data("noticeid", noticeid ); > $("#noticeModalLabel").text( title ); > $("#noticeModal .modal-body").html( body ); > $("#noticeModal").modal("show"); > }); > >- $("#resend-notice").on("click", function(e){ >- e.preventDefault(); >- var noticeid = $(this).data("noticeid"); >- $("#resend_notice" + noticeid ).submit(); >- }); >- > $("#noticeModal").on("hide.bs.modal", function(){ >- $("#resend-notice").removeData("noticeid").hide(); >+ $('#resend_notice input[name="borrowernumber"]').val(''); >+ $('#resend_notice input[name="message_id"]').val(''); >+ $("#resend_notice").hide(); > $("#noticeModalLabel").text(""); > $("#noticeModal .modal-body").html(""); > }); >+ >+ $("#print_multiple_button").click(function(e){ >+ var selected_notices = $("#print_multiple").find("input[name='message_ids']:checked"); >+ if ( selected_notices.length == 0 ) { >+ alert(_("Please select at least one sent notice.")); >+ e.preventDefault(); >+ return false; >+ } >+ }); >+ >+ $(".select_all").click(function(e){ >+ e.preventDefault(); >+ $("input[name='message_ids']").each(function(){ >+ $(this).prop("checked", true); >+ }); >+ }); >+ >+ $(".clear_all").click(function(e){ >+ e.preventDefault(); >+ $("input[name='message_ids']").each(function(){ >+ $(this).prop("checked", false); >+ }); >+ }); > }); > </script> > [% INCLUDE 'str/members-menu.inc' %] >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/notices.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/notices.tt >index 9f0e0d90d7d..ce45c8f4c89 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/notices.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/notices.tt >@@ -46,7 +46,7 @@ > > <h1>Notices management</h1> > >- <div class="page-section bg-warning">Printing a notice will mark it as sent.</div> >+ <div class="alert alert-warning">Printing a notice will mark it as sent.</div> > > [% IF notices.count == 0 %] > >@@ -70,6 +70,7 @@ > <th>Type</th> > <th>Status</th> > <th>Updated on</th> >+ <th>Delivery note</th> > <th class="nosort">Actions</th> > </tr> > </thead> >@@ -77,21 +78,63 @@ > [% FOREACH notice IN notices %] > <tr> > <td><input type="checkbox" name="message_ids" value="[% notice.message_id | html %]"></td> >- <td>[% notice.time_queued | $KohaDates with_hours = 1 %]</td> >+ <td data-order="[% notice.time_queued | html %]">[% notice.time_queued | $KohaDates with_hours = 1 %]</td> > <td>[% INCLUDE 'patron-title.inc' patron=notice.patron hide_patron_infos_if_needed=1 %]</td> > <td> >- <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> >+ <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> > <iframe class="notice" id="notice[% notice.message_id | html %]" srcdoc="[% notice.html_content | html %]"></iframe> > </td> >- <td>[% notice.message_transport_type | html %]</td> >- <td>[% notice.status | html %]</td> >- <td>[% notice.updated_on | $KohaDates with_hours = 1 %]</td> >+ <td> >+ [% IF ( notice.message_transport_type == 'email' ) %]<span>email</span> >+ [% ELSIF ( notice.message_transport_type == 'print' ) %]<span>print</span> >+ [% ELSIF ( notice.message_transport_type == 'feed' ) %]<span>feed</span> >+ [% ELSIF ( notice.message_transport_type == 'sms' ) %]<span>sms</span> >+ [% ELSE %][% notice.message_transport_type | html %][% END %] >+ </td> >+ <td> >+ [% IF ( notice.status == 'sent' ) %]<span>sent</span> >+ [% ELSIF ( notice.status == 'pending' ) %]<span>pending</span> >+ [% ELSIF ( notice.status == 'failed' ) %]<span>failed</span> >+ [% ELSIF ( notice.status == 'deleted' ) %]<span>deleted</span> >+ [% ELSE %][% notice.status | html %][% END %] >+ </td> >+ <td data-order="[% noice.updated_on | html %]">[% notice.updated_on | $KohaDates with_hours = 1 %]</td> >+ <td> >+ [% IF ( notice.failure_code ) %] >+ [% IF ( notice.failure_code == "INVALID_BORNUMBER" ) %]<span class="clearfix">Invalid borrowernumber [% notice.borrowernumber | html %]</span> >+ [% ELSIF ( notice.failure_code == 'NO_EMAIL' ) %]<span class="clearfix">Unable to find an email address for this patron</span> >+ [% ELSIF ( matches = notice.failure_code.match('INVALID_EMAIL:(\w+)') ) %]<span class="clearfix">Invalid [% matches.0 | html %] email address found [% borrowernumber | html %]</span> >+ [% ELSIF ( notice.failure_code == 'NO_FROM' ) %]<span class="clearfix">Missing from email address</span> >+ [% ELSIF ( notice.failure_code == 'MISSING_SMS' ) %]<span class="clearfix">Missing SMS number</span> >+ [% ELSIF ( notice.failure_code == 'DUPLICATE_MESSAGE' ) %]<span class="clearfix">Message is duplicate</span> >+ [% ELSIF ( notice.failure_code == 'NO_NOTES' ) %]<span class="clearfix">No notes from SMS driver</span> >+ [% ELSIF ( notice.failure_code == 'SMS_SEND_DRIVER_MISSING' ) %]<span class="clearfix">The SMS driver could not be loaded</span> >+ [% ELSIF ( notice.failure_code == 'SENDMAIL' ) %]<span class="clearfix">Unhandled email failure, check the logs for further details</span> >+ [% ELSIF ( notice.failure_code == "UNKNOWN_ERROR" ) %]<span class="clearfix">Unknown error</span> >+ [% ELSE %] >+ <span class="clearfix">Message failed to send with the following error: [% notice.failure_code | html %]</span> >+ [% END %] >+ [% END %] >+ [% IF ( notice.status == 'sent' ) %] >+ [% IF ( notice.from_address ) %] >+ <span class="clearfix"><span class="label">From:</span> [% notice.from_address | html %]</span> >+ [% END %] >+ [% IF ( notice.to_address ) %] >+ <span class="clearfix"><span class="label">To:</span> [% notice.to_address | html %]</span> >+ [% END %] >+ [% IF ( notice.cc_address ) %] >+ <span class="clearfix"><span class="label">CC:</span> [% notice.cc_address | html %]</span> >+ [% END %] >+ [% END %] >+ </td> > <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> > </tr> > [% END %] > </tbody> > </table> >- <input type="submit" class="btn btn-primary" value="Print selected notices" id="print_multiple_button"> >+ <fieldset class="action"> >+ <input type="submit" class="btn btn-primary" value="Print selected notices" id="print_multiple_button"> >+ </fieldset> > </form> > </div> > >@@ -204,16 +247,21 @@ > <div class="modal-dialog"> > <div class="modal-content"> > <div class="modal-header"> >- <button type="button" class="closebtn" data-dismiss="modal" aria-label="Close"> >- <span aria-hidden="true">×</span> >- </button> >- <h5 class="modal-title" id="noticeModalLabel">Notice</h5> >+ <h1 class="modal-title" id="noticeModalLabel">Notice</h1> >+ <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button> > </div> > <div class="modal-body"> > ... > </div> > <div class="modal-footer"> >- <button type="button" class="btn btn-default deny cancel" data-dismiss="modal"><i class="fa fa-remove"></i> Close</button> >+ <form id="resend_notice" action="/cgi-bin/koha/members/notices.pl" method="POST" style="display:none"> >+ [% INCLUDE 'csrf-token.inc' %] >+ <input type="hidden" name="op" value="cud-resend_notice" /> >+ <input type="hidden" name="borrowernumber" value="" /> >+ <input type="hidden" name="message_id" value="" /> >+ <button type="submit" id="resend_notice_button" class="btn btn-default"><i class="fa-solid fa-rotate" aria-hidden="true"></i> Resend</button> >+ </form> >+ <button type="button" class="btn btn-default deny cancel" data-bs-dismiss="modal"><i class="fa fa-remove"></i> Close</button> > </div> > </div> <!-- /.modal-content --> > </div> <!-- /.modal-dialog --> >@@ -239,18 +287,27 @@ > var title = $(this).text(); > var noticeid = $(this).data("noticeid"); > var body = $("#notice" + noticeid ).attr("srcdoc"); >+ if( $(this).data("status") !== 'pending' ){ >+ let borrowerNumber = $(this).data("borrowernumber"); >+ $('#resend_notice input[name="borrowernumber"]').val(borrowerNumber); >+ $('#resend_notice input[name="message_id"]').val(noticeid); >+ $("#resend_notice").show(); >+ } > $("#noticeModalLabel").text( title ); > $("#noticeModal .modal-body").html( body ); > $("#noticeModal").modal("show"); > }); > > $("#noticeModal").on("hide.bs.modal", function(){ >+ $('#resend_notice input[name="borrowernumber"]').val(''); >+ $('#resend_notice input[name="message_id"]').val(''); >+ $("#resend_notice").hide(); > $("#noticeModalLabel").text(""); > $("#noticeModal .modal-body").html(""); > }); > > $("#print_multiple_button").click(function(e){ >- var selected_notices = $("#print_multiple").find("input[name='message_ids']:checked"); >+ var selected_notices = $("#notices").find("input[name='message_ids']:checked"); > if ( selected_notices.length == 0 ) { > alert(_("Please select at least one sent notice.")); > e.preventDefault(); >-- >2.47.1
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 33260
:
148437
|
148438
|
148439
|
148440
|
148943
|
149009
|
149413
|
149581
|
149593
|
149594
|
149595
|
149596
|
149597
|
149598
|
150346
|
150347
|
154927
|
154928
|
157383
|
157384
|
157385
|
157386
|
158852
|
158853
|
158854
|
158855
|
162570
|
162571
|
162572
|
162573
|
162574
|
162624
|
162625
|
162677
|
162678
|
162679
|
162680
|
162681
|
164783
|
164784
|
164785
|
164786
|
164787
|
165238
|
165239
|
165717
|
165939
|
165946
|
165947
|
165948
|
165949
|
165950
|
165951
|
166020
|
166178
|
166335
|
166336
|
166337
|
166338
|
166339
|
166340
|
166341
|
166342
|
166343
|
166344
|
166345
|
166362
|
166363
|
166364
|
166365
|
166366
|
166367
|
166368
|
166369
|
166370
|
166371
|
166372
|
166373
|
167909
|
167910
|
167911
|
167912
|
167913
|
167914
|
167915
|
167916
|
167917
|
167918
|
167919
|
167920
|
172247
|
172248
|
172303
|
172307
|
172308
|
172309
|
172310
|
172311
|
172312
|
172313
|
172314
|
172315
|
172316
|
172317
|
172318
|
172319
|
172320
|
172321
|
172322
|
172342
|
172343
|
172344
|
172345
|
172346
|
172347
|
172348
|
172349
|
172350
|
172351
|
172352
|
172353
|
172354
|
172355
|
172356
|
172357
|
172358
|
172359
|
172379
|
175501
|
175502
|
175503
|
175504
|
175505
|
175506
|
175507
|
175508
|
175509
|
175510
|
175511
|
175512
|
175513
|
175514
|
175515
|
175516
|
175517
|
175518
|
175519
|
175520
|
175521
|
175522
|
175523
|
175524
|
175525
|
175530
|
175537
|
175538
|
175539
|
175540
|
175541
|
175542
|
175543
|
175544
|
175545
|
175546
|
175547
|
175548
|
175549
|
175550
|
175551
|
175552
|
175553
|
175554
|
175555
|
175556
|
175557
|
175558
|
175559
|
175560
|
175561
|
175562
|
175563
|
175730
|
175731
|
175732
|
175733
|
175734
|
175735
|
175736
|
175737
|
175738
|
175739
|
175740
|
175741
|
175742
|
175743
|
175744
|
175745
|
175746
|
175747
|
175748
|
175749
|
175750
|
175751
|
175752
|
175753
|
175754
|
175755
|
175756
|
178733
|
178734
|
178735
|
178736
|
178737
|
178738
|
178739
|
178740
|
178741
|
178742
|
178743
|
178744
|
178745
|
178746
|
178747
|
178748
|
178749
|
178750
|
178751
|
178752
|
178753
|
178754
|
178755
|
178756
|
178757
|
178758
|
178759