Bugzilla – Attachment 158935 Details for
Bug 30070
Performance issues with edifactmsgs when you have a large number of messages
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 30070: Update edifactmsgs to use the API
Bug-30070-Update-edifactmsgs-to-use-the-API.patch (text/plain), 7.68 KB, created by
Martin Renvoize (ashimema)
on 2023-11-14 15:43:08 UTC
(
hide
)
Description:
Bug 30070: Update edifactmsgs to use the API
Filename:
MIME Type:
Creator:
Martin Renvoize (ashimema)
Created:
2023-11-14 15:43:08 UTC
Size:
7.68 KB
patch
obsolete
>From cc7ab8d338c0d5db027d994fb5e035c92879f067 Mon Sep 17 00:00:00 2001 >From: Martin Renvoize <martin.renvoize@ptfs-europe.com> >Date: Fri, 10 Nov 2023 15:06:04 +0000 >Subject: [PATCH] Bug 30070: Update edifactmsgs to use the API > >--- > acqui/edifactmsgs.pl | 13 -- > .../prog/en/modules/acqui/edifactmsgs.tt | 140 ++++++++++-------- > 2 files changed, 77 insertions(+), 76 deletions(-) > >diff --git a/acqui/edifactmsgs.pl b/acqui/edifactmsgs.pl >index 179b23423ff..72b429f5854 100755 >--- a/acqui/edifactmsgs.pl >+++ b/acqui/edifactmsgs.pl >@@ -50,17 +50,4 @@ if ( $cmd && $cmd eq 'import' ) { > process_invoice($invoice); > } > >-my @msgs = $schema->resultset('EdifactMessage')->search( >- { >- deleted => 0, >- }, >- { >- join => 'vendor', >- order_by => { -desc => 'transfer_date' }, >- } >- >-)->all; >- >-$template->param( messages => \@msgs ); >- > output_html_with_http_headers( $q, $cookie, $template->output ); >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 7940e17a8ad..b21e6b76e9f 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/edifactmsgs.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/edifactmsgs.tt >@@ -40,58 +40,7 @@ > <h1>EDIFACT messages</h1> > <div id="acqui_edifactmsgs" class="page-section"> > >-[% IF ( messages ) %] >-<table id="edi_msgs"> >-<thead> >-<tr> >-<th>Type</th> >-<th>Transferred</th> >-<th>Status</th> >-<th>Vendor</th> >-<th>Details</th> >-<th>Filename</th> >-<th class="noExport">Actions</th> >-</tr> >-</thead> >-<tbody> >-[% FOREACH msg IN messages %] >-<tr> >-<td>[% msg.message_type | html %]</td> >-<td data-order="[% msg.transfer_date | html %]">[% msg.transfer_date | $KohaDates %]</td> >-<td>[% msg.status | html %]</td> >-<td> >- <a href="/cgi-bin/koha/acqui/supplier.pl?booksellerid=[% msg.vendor_id | uri %]"> >- [% msg.vendor.name | html %] >- </a> >-</td> >-<td> >-[% IF msg.message_type == 'QUOTE' || msg.message_type == 'ORDERS' %] >- [% IF msg.basketno %] >- <a href="/cgi-bin/koha/acqui/basket.pl?basketno=[% msg.basketno.basketno | uri %]"> >- Basket: [% msg.basketno.basketno | html %] >- </a> >- [% END %] >-[% ELSE %] >-<!-- Assuming invoices --> >- <a href="/cgi-bin/koha/acqui/invoices.pl?message_id=[% msg.id | uri %]&op=do_search"> >- Invoices >- </a> >-[% END %] >-</td> >-<td>[% msg.filename | html %]</td> >- >-<td class="actions"> >- <a class="btn btn-default btn-xs view_message" target="_blank" href="/cgi-bin/koha/acqui/edimsg.pl?id=[% msg.id | html %]"><i class="fa fa-search"></i> View message</a> >- <a class="btn btn-default btn-xs delete_msg" href="/cgi-bin/koha/acqui/edifactmsgs.pl?op=delete&message_id=[% msg.id | html %]"><i class="fa fa-trash-can"></i> Delete</a> >- [% IF msg.status == 'new' %] >- <a class="btn btn-default btn-xs import_msg" href="/cgi-bin/koha/acqui/edifactmsgs.pl?op=import&message_id=[% msg.id | html %]"><i class="fa fa-cog"></i> Import</a> >- [% END %] >-</td> >-</tr> >-[% END %] >- >-</tbody> >-</table> >+<table id="edi_msgs"></table> > > <!-- Modal to display EDIFACT messages --> > <div class="modal" id="EDI_modal" tabindex="-1" role="dialog" aria-labelledby="EDI_modal_label" aria-hidden="true"> >@@ -111,11 +60,6 @@ > </div> > </div> > >- >-[% ELSE %] >- <div class="dialog message">There are no EDIFACT messages.</div> >-[% END %] >- > </div> <!-- /#acqui_edifactmsgs --> > </main> > </div> <!-- /.col-sm-10.col-sm-push-2 --> >@@ -132,13 +76,83 @@ > [% INCLUDE 'datatables.inc' %] > <script> > $(document).ready(function() { >- $('#edi_msgs').dataTable($.extend(true, {}, dataTablesDefaults, { >- 'aaSorting': [[1, "desc" ]], >- 'sPaginationType': "full", >- "aoColumnDefs": [ >- { "aTargets": [ -1 ], "bSortable": false, "bSearchable": false } >+ let edi_msgs_table_url = '/api/v1/acquisitions/edifiles?'; >+ >+ var edi_msgs_table = $("#edi_msgs").kohaTable({ >+ "ajax": { >+ "url": edi_msgs_table_url >+ }, >+ "embed": [ >+ "vendor", >+ "basket" >+ ], >+ "columns": [ >+ { >+ "data": "type", >+ "title": "Type", >+ "searchable": true, >+ "orderable": true >+ }, >+ { >+ "data": "transfer_date", >+ "title": "Transferred", >+ "searchable": true, >+ "orderable": true, >+ "render": function(data, type, row, meta) { >+ return $date(row.transfer_date); >+ } >+ }, >+ { >+ "data": "status", >+ "title": "Status", >+ "searchable": true, >+ "orderable": true >+ }, >+ { >+ "data": "vendor.name", >+ "title": "Vendor", >+ "searchable": true, >+ "orderable": true, >+ "render": function(data, type, row, meta) { >+ return '<a href="/cgi-bin/koha/acqui/supplier.pl?booksellerid="'+row.vendor_id+'>'+row.vendor.name+'</a>'; >+ } >+ }, >+ { >+ "title": "Details", >+ "searchable": false, >+ "orderable": false, >+ "render": function(data, type, row, meta) { >+ if ( row.type == 'QUOTE' || row.type == 'ORDERS' ) { >+ if ( row.basked_id ) { >+ return '<a href="/cgi-bin/koha/acqui/basket.pl?basketno='+row.basked_id+'">Basket: '+row.basket_id+'</a>'; >+ } >+ } else { >+ return '<a href="/cgi-bin/koha/acqui/invoices.pl?message_id='+row.id+'&op=do_search">Invoices</a>'; >+ } >+ } >+ }, >+ { >+ "data": "filename", >+ "title": "Filename", >+ "searchable": true, >+ "orderable": true >+ }, >+ { >+ "title": "Actions", >+ "searchable": false, >+ "orderable": false, >+ "render": function( row, type, val, meta ) { >+ >+ var result = '<a class="btn btn-default btn-xs view_message" target="_blank" href="/cgi-bin/koha/acqui/edimsg.pl?id='+encodeURIComponent(row.id)+'"><i class="fa fa-search"></i> View message</a>'; >+ result += '<a class="btn btn-default btn-xs delete_msg" href="/cgi-bin/koha/acqui/edifactmsgs.pl?op=delete&message_id='+encodeURIComponent(row.id)+'"><i class="fa fa-trash-can"></i> Delete</a>'; >+ if ( row.status == 'new' ) { >+ reslt += '<a class="btn btn-default btn-xs import_msg" href="/cgi-bin/koha/acqui/edifactmsgs.pl?op=import&message_id='+encodeURIComponent(row.id)+'"><i class="fa fa-cog"></i> Import</a>'; >+ } >+ return result; >+ } >+ } > ] >- })); >+ }, {}, 0); > > var EDIModal = $("#EDI_modal"); > var EDIModalBody = $("#EDI_modal .modal-body"); >-- >2.41.0
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 30070
:
158808
|
158809
|
158810
|
158887
|
158903
|
158904
|
158905
|
158906
|
158907
|
158908
|
158909
|
158910
|
158911
|
158912
|
158913
|
158914
|
158915
|
158918
|
158920
|
158922
|
158923
|
158924
|
158925
|
158926
|
158927
|
158928
|
158929
|
158930
|
158931
|
158932
|
158933
|
158934
|
158935
|
158936
|
158937
|
158938
|
158939
|
158940
|
158941
|
158942
|
158943
|
158944
|
158945
|
158946
|
158947
|
158948
|
158949
|
158950
|
158951
|
158952
|
158953
|
158954
|
158955
|
158963
|
158964
|
158965
|
158966
|
158967
|
158968
|
158969
|
158970
|
158971
|
158972
|
158973
|
158974
|
158975
|
159026
|
159027
|
159028
|
159029
|
159030
|
159031
|
159032
|
159033
|
159034
|
159035
|
159036
|
160336
|
160337
|
160338
|
160339
|
160340
|
160341
|
160342
|
160343
|
160344
|
160345
|
160346
|
160347
|
160348