Bugzilla – Attachment 178363 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), 7.23 KB, created by
Martin Renvoize (ashimema)
on 2025-02-19 16:02:05 UTC
(
hide
)
Description:
Bug 38689: Display errors in a modal
Filename:
MIME Type:
Creator:
Martin Renvoize (ashimema)
Created:
2025-02-19 16:02:05 UTC
Size:
7.23 KB
patch
obsolete
>From 49b3323dd97cf1f5dd5796d89e3789b17e7b0d5c 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. > >Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com> >--- > api/v1/swagger/definitions/edifact_file.yaml | 4 +- > .../prog/en/modules/acqui/edifactmsgs.tt | 88 +++++++++++++++---- > 2 files changed, 74 insertions(+), 18 deletions(-) > >diff --git a/api/v1/swagger/definitions/edifact_file.yaml b/api/v1/swagger/definitions/edifact_file.yaml >index 4602ba28b68..46ff9c8f4f9 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 >-additionalProperties: false >+ errors: >+ type: array >+additionalProperties: false >\ No newline at end of file >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 142f51c8420..b7fe904f912 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/edifactmsgs.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/edifactmsgs.tt >@@ -34,26 +34,42 @@ > <h1>EDIFACT messages</h1> > <div id="acqui_edifactmsgs" class="page-section"> > <table id="edi_msgs"></table> >+ </div> >+ <!-- /#acqui_edifactmsgs --> > >- <!-- 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"> >- <div class="modal-content"> >- <div class="modal-header"> >- <h1 class="modal-title" id="EDI_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> >+ <!-- 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"> >+ <div class="modal-content"> >+ <div class="modal-header"> >+ <h1 class="modal-title" id="EDI_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> >+ <div class="modal-footer"> >+ <button class="btn btn-default" data-bs-dismiss="modal">Close</button> >+ </div> >+ </div> >+ </div> >+ </div> >+ >+ <!-- 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 processing errors for <span id="EDI_errors_filename"></span></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> >- <!-- /#acqui_edifactmsgs --> > [% END %] > > [% MACRO jsinclude BLOCK %] >@@ -69,7 +85,8 @@ > }, > "embed": [ > "vendor", >- "basket" >+ "basket", >+ "errors" > ], > "order": [[ 1, "desc" ]], > "columns": [ >@@ -92,7 +109,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 + '" data-bs-filename="' + row.filename + '">' + _("with errors") + '</a>)'; >+ } else { >+ rendered = row.status; >+ } >+ return rendered; >+ } > }, > { > "data": "vendor.name", >@@ -167,6 +200,27 @@ > 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 filename = link.getAttribute('data-bs-filename') >+ const errors = link.getAttribute('data-bs-errors') >+ >+ // Update the modal's title. >+ const modalTitleSpan = errorsModal.querySelector('.modal-title #EDI_errors_filename') >+ modalTitleSpan.textContent = filename; >+ >+ // 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.48.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
|
178359
|
178360
|
178361
|
178362
|
178363
|
178364
|
178365
|
178366
|
178367
|
178368
|
178492
|
178493
|
178494
|
178495
|
178496
|
178497
|
178498
|
178499
|
178500
|
178501
|
178719