Bug 42309: JS error when there are no cash registers

This patch corrects a JavaScript error that appears on the cash
registers page when there are no cash registers yet.

To test :
BEFORE applying the patch
0. Make sure there are no cash registers in the database (reset_all if using ktd, or delete them)

1. Enable UseCashRegisters
   1.1. Go to Administration > System preferences
   1.2. Search for UseCashRegisters
   1.3. Set UseCashRegisters to Use
   1.4. Click Save all Accounting preferences

2. Open the browser developer tools (F12) and select the Console tab

3. Go to Administration > Cash registers
   --> Uncaught TypeError: can't access property "DataTable", crtable is undefined

4. Apply the patch

5. Refresh the cash registers page
   --> The error is gone!

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Brendan Lawlor <blawlor@clamsnet.org>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
This commit is contained in:
Caroline Cyr La Rose 2026-04-08 14:14:44 -04:00 committed by Lucas Gass
parent da121583a4
commit b74f544231
No known key found for this signature in database
GPG Key ID: 60B447398B0D36CA
1 changed files with 1 additions and 1 deletions

View File

@ -240,7 +240,7 @@
order: [[1, "asc"]],
paginationType: "full",
});
var crtable_dt = crtable.DataTable();
var crtable_dt = crtable?.DataTable();
$("#branch_filter").on("change", function () {
// Table must be filtered by the <option>'s text, not its value