Bugzilla – Attachment 175809 Details for
Bug 38689
EDIFACT errors should log to a staff accessible location
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 38689: Display errors in a modal
Bug-38689-Display-errors-in-a-modal.patch (text/plain), 6.05 KB, created by
Martin Renvoize (ashimema)
on 2024-12-20 08:45:08 UTC
(
hide
)
Description:
Bug 38689: Display errors in a modal
Filename:
MIME Type:
Creator:
Martin Renvoize (ashimema)
Created:
2024-12-20 08:45:08 UTC
Size:
6.05 KB
patch
obsolete
>From c08d98881405a9516ffdf4f72e3220eea78152e5 Mon Sep 17 00:00:00 2001 >From: Martin Renvoize <martin.renvoize@ptfs-europe.com> >Date: Thu, 19 Dec 2024 17:37:31 +0000 >Subject: [PATCH] Bug 38689: Display errors in a modal > >This patch adds a `(with errors)` link next to the status of any edifact >messages that produced errors on processing. The link will popup a >modal containing the error details recorded for that message. >--- > api/v1/swagger/definitions/edifact_file.yaml | 2 + > .../prog/en/modules/acqui/edifactmsgs.tt | 74 ++++++++++++++++--- > 2 files changed, 64 insertions(+), 12 deletions(-) > >diff --git a/api/v1/swagger/definitions/edifact_file.yaml b/api/v1/swagger/definitions/edifact_file.yaml >index 4602ba28b68..de74f020934 100644 >--- a/api/v1/swagger/definitions/edifact_file.yaml >+++ b/api/v1/swagger/definitions/edifact_file.yaml >@@ -55,4 +55,6 @@ properties: > - string > - "null" > description: EDIFACT file name >+ errors: >+ type: array > additionalProperties: false >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/edifactmsgs.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/edifactmsgs.tt >index 69cb4c43c53..184ff762cdf 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/edifactmsgs.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/edifactmsgs.tt >@@ -40,6 +40,17 @@ > > <table id="edi_msgs"></table> > >+</div> <!-- /#acqui_edifactmsgs --> >+</main> >+</div> <!-- /.col-md-10.order-md-2 --> >+ >+ <div class="col-md-2 order-sm-2 order-md-1"> >+ <aside> >+ [% INCLUDE 'acquisitions-menu.inc' %] >+ </aside> >+ </div> >+</div> <!-- /.row --> >+ > <!-- Modal to display EDIFACT messages --> > <div class="modal" id="EDI_modal" tabindex="-1" role="dialog" aria-labelledby="EDI_modal_label" aria-hidden="true"> > <div class="modal-dialog modal-lg"> >@@ -49,7 +60,6 @@ > <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button> > </div> > <div class="modal-body"> >- <div id="loading"> <img src="[% interface | html %]/[% theme | html %]/img/spinner-small.gif" alt="" /> Loading </div> > </div> > <div class="modal-footer"> > <button class="btn btn-default" data-bs-dismiss="modal">Close</button> >@@ -58,16 +68,23 @@ > </div> > </div> > >-</div> <!-- /#acqui_edifactmsgs --> >-</main> >-</div> <!-- /.col-md-10.order-md-2 --> >- >- <div class="col-md-2 order-sm-2 order-md-1"> >- <aside> >- [% INCLUDE 'acquisitions-menu.inc' %] >- </aside> >+<!-- Modal to display EDIFACT errors --> >+<div class="modal" id="EDI_errors_modal" tabindex="-1" role="dialog" aria-labelledby="EDI_errors_modal_label" aria-hidden="true"> >+ <div class="modal-dialog modal-lg"> >+ <div class="modal-content"> >+ <div class="modal-header"> >+ <h1 class="modal-title" id="EDI_errors_modal_label">EDIFACT message</h1> >+ <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button> >+ </div> >+ <div class="modal-body"> >+ <div id="loading"> <img src="[% interface | html %]/[% theme | html %]/img/spinner-small.gif" alt="" /> Loading </div> >+ </div> >+ <div class="modal-footer"> >+ <button class="btn btn-default" data-bs-dismiss="modal">Close</button> >+ </div> >+ </div> > </div> >-</div> <!-- /.row --> >+</div> > > [% MACRO jsinclude BLOCK %] > [% Asset.js("js/acquisitions-menu.js") | $raw %] >@@ -82,7 +99,8 @@ > }, > "embed": [ > "vendor", >- "basket" >+ "basket", >+ "errors" > ], > "columns": [ > { >@@ -104,7 +122,23 @@ > "data": "status", > "title": _("Status"), > "searchable": true, >- "orderable": true >+ "orderable": true, >+ "render": function(daya, type, row, meta) { >+ let rendered = ''; >+ if ( row.errors.length > 0 ) { >+ let errorsList = '<ul>'; >+ row.errors.forEach(error => { >+ if (error.details) { >+ errorsList += '<li>' + error.details + '</li>'; >+ } >+ }); >+ errorsList += '</ul>'; >+ rendered = row.status + ' (<a href="#" data-bs-toggle="modal" data-bs-target="#EDI_errors_modal" data-bs-errors="'+ errorsList + '">' + _("with errors") + '</a>)'; >+ } else { >+ rendered = row.status; >+ } >+ return rendered; >+ } > }, > { > "data": "vendor.name", >@@ -179,6 +213,22 @@ > EDIModal.on("hidden.bs.modal", function(){ > EDIModalBody.html("<div id=\"loading\"><img src=\"[% interface | html %]/[% theme | html %]/img/spinner-small.gif\" alt=\"\" /> "+_("Loading")+"</div>"); > }); >+ >+ const errorsModal = document.getElementById('EDI_errors_modal') >+ if (errorsModal) { >+ errorsModal.addEventListener('show.bs.modal', event => { >+ // Link that triggered the modal >+ const link = event.relatedTarget >+ >+ // Extract info from data-bs-* attributes >+ const errors = link.getAttribute('data-bs-errors') >+ >+ // Update the modal's content. >+ const modalBody = errorsModal.querySelector('.modal-body') >+ modalBody.innerHTML = errors; >+ }) >+ } >+ > $("body").on("click", ".delete_msg" ,function(){ > return confirm(_("Are you sure you want to delete this message?")); > }); >-- >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 38689
:
175788
|
175789
|
175790
|
175793
|
175794
|
175795
|
175796
|
175797
|
175809
|
175810
|
175811
|
175812
|
175813
|
175814
|
175815
|
175816
|
175817
|
176127
|
176128
|
176129
|
176130
|
176131
|
176132
|
176133
|
176134
|
176173
|
176174
|
176175
|
176176
|
176177
|
176178
|
176179
|
176180
|
176181
|
176182
|
176183
|
176373
|
176374
|
176375
|
176376
|
176377
|
176378
|
176379
|
176380
|
176381
|
176382
|
176524
|
176525
|
176526
|
176527
|
176528
|
176529
|
176530
|
176531
|
176532
|
176533
|
176605
|
176606
|
176607
|
176608
|
176609
|
176610
|
176611
|
176612
|
176613
|
176614