Bugzilla – Attachment 181871 Details for
Bug 39779
Table.row.add error in point of sale table
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 39779: (QA follow-up) Undo revert and instead call .api()
Bug-39779-QA-follow-up-Undo-revert-and-instead-cal.patch (text/plain), 4.09 KB, created by
Martin Renvoize (ashimema)
on 2025-05-02 15:17:22 UTC
(
hide
)
Description:
Bug 39779: (QA follow-up) Undo revert and instead call .api()
Filename:
MIME Type:
Creator:
Martin Renvoize (ashimema)
Created:
2025-05-02 15:17:22 UTC
Size:
4.09 KB
patch
obsolete
>From 1c93bb3267252e6b62320126acc388f7321c0876 Mon Sep 17 00:00:00 2001 >From: Martin Renvoize <martin.renvoize@openfifth.co.uk> >Date: Fri, 2 May 2025 16:13:20 +0100 >Subject: [PATCH] Bug 39779: (QA follow-up) Undo revert and instead call .api() > >This patch leaves Laura's patch intact for the record, but effectively >reverts it's reversion of bug 38255 in which all ajax DataTables were >converted to a standard kohaTable instantiation structure. > >We need a DataTable() api in subsequent uses of the table and not the >jQuery object that kohaTable returns so I update all calls to >saleDataTable to sale_kohaTable.api() which returns us the DataTable() >api instance from the dataTable jQuery object. > >Signed-off-by: Martin Renvoize <martin.renvoize@openfifth.co.uk> >--- > koha-tmpl/intranet-tmpl/prog/en/modules/pos/pay.tt | 14 +++++++------- > 1 file changed, 7 insertions(+), 7 deletions(-) > >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/pos/pay.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/pos/pay.tt >index b2de99c85bd..a1eca52972b 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/pos/pay.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/pos/pay.tt >@@ -335,7 +335,7 @@ > > $(document).ready(function() { > const sale_table = document.getElementById('sale'); >- const saleDataTable = $("#sale").DataTable({ >+ const sale_kohaTable = $("#sale").kohaTable({ > "paginate": false, > "searching": false, > "info": false, >@@ -364,7 +364,7 @@ > "rowCallback": function( row, data ) { > const total = data[1] * data[2]; > data[3] = total; >- saleDataTable.cell(row, 3).invalidate(); >+ sale_kohaTable.api().cell(row, 3).invalidate(); > }, > "footerCallback": function(tfoot, data, start, end, display) { > let total_price = 0; >@@ -387,7 +387,7 @@ > }); > > $("#sale").on("click", "button.drop", function(){ >- saleDataTable.row($(this).parents('tr')).remove().draw(false); >+ sale_kohaTable.api().row($(this).parents('tr')).remove().draw(false); > }); > > // Set up editable columns based on header classes >@@ -430,7 +430,7 @@ > function updateCell() { > const newValue = input.value.trim() || originalContent; // Fallback to original content > cell.textContent = newValue; // Set the final value in the cell >- saleDataTable.cell(cell).data(newValue).invalidate().draw(false); // Update DataTable data >+ sale_kohaTable.api().cell(cell).data(newValue).invalidate().draw(false); // Update dataTable data > } > } > }); >@@ -448,7 +448,7 @@ > > $("#invoices").on("click", ".add_button", function(e) { > e.preventDefault(); >- fnClickAddRow(saleDataTable, $( this ).data('invoiceCode'), $( this ).data('invoiceTitle'), $( this ).data('invoicePrice') ); >+ fnClickAddRow(sale_kohaTable.api(), $( this ).data('invoiceCode'), $( this ).data('invoiceTitle'), $( this ).data('invoicePrice') ); > if($('#invoices_filter').find('input[type=search]').val() !== ''){ > items_table.DataTable().search('').draw(); > } >@@ -494,12 +494,12 @@ > }); > } > >- // now, process the current & fresh contents of the saleDataTable >+ // now, process the current & fresh contents of the sale_kohaTable > if (change != undefined && change.innerHTML > 0.00 && !checked) { > e.preventDefault(); > $("#confirm_change_form").modal("show"); > } else { >- var rows = saleDataTable.data().toArray(); >+ var rows = sale_kohaTable.api().data().toArray(); > rows.forEach(function (row, index) { > var sale = { > code: row[5], >-- >2.49.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 39779
:
181682
|
181686
|
181870
| 181871