Bug 39715 - Do not quote DataTables options
Summary: Do not quote DataTables options
Status: Pushed to main
Alias: None
Product: Koha
Classification: Unclassified
Component: Templates (show other bugs)
Version: Main
Hardware: All All
: P5 - low enhancement
Assignee: Owen Leonard
QA Contact: Lucas Gass (lukeg)
URL:
Keywords:
Depends on:
Blocks: 41324 41563 41564 41565 41566 41567 41568 41569 41573 41575 41579 41580 41581 41582
  Show dependency treegraph
 
Reported: 2025-04-23 16:42 UTC by Owen Leonard
Modified: 2026-01-23 14:30 UTC (History)
3 users (show)

See Also:
GIT URL:
Initiative type: ---
Sponsorship status: ---
Comma delimited list of Sponsors:
Crowdfunding goal: 0
Patch complexity: Medium patch
Documentation contact:
Documentation submission:
Text to go in the release notes:
This patch updates templates so that the options passed to DataTables, via KohaTable, are not quoted. The quotes are not necessary, and are not consistent with official DataTables documentation. This establishes a standard for us to follow in the future.
Version(s) released in:
26.05.00
Circulation function:


Attachments
Bug 39715: Do not quote DataTables options (150.96 KB, patch)
2025-06-06 11:11 UTC, Owen Leonard
Details | Diff | Splinter Review
Descriptions of updated pages (1.71 KB, text/plain)
2025-06-06 11:13 UTC, Owen Leonard
Details
Bug 39715: Do not quote DataTables options (150.22 KB, patch)
2025-06-24 19:15 UTC, Owen Leonard
Details | Diff | Splinter Review
Bug 39715: Do not quote DataTables options (150.68 KB, patch)
2025-09-08 17:55 UTC, Owen Leonard
Details | Diff | Splinter Review
Bug 39715: Do not quote DataTables options (132.04 KB, patch)
2025-10-28 11:02 UTC, Owen Leonard
Details | Diff | Splinter Review
Bug 39715: Do not quote DataTables options (132.75 KB, patch)
2025-11-27 14:17 UTC, Jonathan Druart
Details | Diff | Splinter Review
Bug 39715: Do not quote DataTables options (129.44 KB, patch)
2026-01-05 13:16 UTC, Owen Leonard
Details | Diff | Splinter Review
Bug 39715: (follow-up) Undo change to shelves_results.tt (1.10 KB, patch)
2026-01-08 16:12 UTC, Owen Leonard
Details | Diff | Splinter Review
Bug 39715: (follow-up) Undo change to shelves_results.tt (1.17 KB, patch)
2026-01-09 08:36 UTC, Jonathan Druart
Details | Diff | Splinter Review
Bug 39715: Do not quote DataTables options (129.49 KB, patch)
2026-01-21 21:26 UTC, Lucas Gass (lukeg)
Details | Diff | Splinter Review
Bug 39715: (follow-up) Undo change to shelves_results.tt (1.22 KB, patch)
2026-01-21 21:26 UTC, Lucas Gass (lukeg)
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Owen Leonard 2025-04-23 16:42:02 UTC
Koha templates are inconsistent when it comes to quoting DataTables options:

(https://gitlab.com/koha-community/Koha/-/blob/main/koha-tmpl/intranet-tmpl/prog/en/modules/admin/cities.tt#L221)

var cities_table = $("#table_cities").kohaTable({
    "ajax": {
        "url": cities_table_url
    },
    "order": [[ 1, "asc" ]],
    "columnDefs": [ {
        "targets": [0,1,2,3,4],
        "render": function (data, type, row, meta) {
            if ( type == 'display' ) {
                if ( data != null ) {
                    return data.escapeHtml();
                } else {
                    return "";
                }
            }
            return data;
        }
    } ],

Options in this example like "ajax", "order", and "columnDefs" are quoted in this example but other templates will have unquoted options. I think we should standardize on having no quotes around the options. The quotes are unnecessary, and inconsistent with up-to-date DataTables documentation.
Comment 1 Owen Leonard 2025-06-06 11:11:06 UTC Comment hidden (obsolete)
Comment 2 Owen Leonard 2025-06-06 11:13:05 UTC
Created attachment 183068 [details]
Descriptions of updated pages
Comment 3 Owen Leonard 2025-06-24 19:15:10 UTC
Created attachment 183473 [details] [review]
Bug 39715: Do not quote DataTables options

This patch updates templates so that the options passed to DataTables
(via kohaTable) are not quoted. The quotes are not necessary, and
are not consistent with official DataTables documentation. This
establishes a standard for us to follow in the future.

The patch also corrects some option names which required upates,
particularly "sorting" -> "order".

To test, apply the patch and test updated DataTables.

Sponsored-by: Athens County Public Libraries
Comment 4 Owen Leonard 2025-09-08 17:55:09 UTC
Created attachment 186267 [details] [review]
Bug 39715: Do not quote DataTables options

This patch updates templates so that the options passed to DataTables
(via kohaTable) are not quoted. The quotes are not necessary, and
are not consistent with official DataTables documentation. This
establishes a standard for us to follow in the future.

The patch also corrects some option names which required upates,
particularly "sorting" -> "order".

To test, apply the patch and test updated DataTables.

Sponsored-by: Athens County Public Libraries
Comment 5 Owen Leonard 2025-10-28 11:02:20 UTC
Created attachment 188502 [details] [review]
Bug 39715: Do not quote DataTables options

This patch updates templates so that the options passed to DataTables
(via kohaTable) are not quoted. The quotes are not necessary, and
are not consistent with official DataTables documentation. This
establishes a standard for us to follow in the future.

The patch also corrects some option names which required upates,
particularly "sorting" -> "order".

To test, apply the patch and test updated DataTables.

Sponsored-by: Athens County Public Libraries
Comment 6 Jonathan Druart 2025-11-27 14:17:51 UTC
Created attachment 189993 [details] [review]
Bug 39715: Do not quote DataTables options

This patch updates templates so that the options passed to DataTables
(via kohaTable) are not quoted. The quotes are not necessary, and
are not consistent with official DataTables documentation. This
establishes a standard for us to follow in the future.

The patch also corrects some option names which required upates,
particularly "sorting" -> "order".

To test, apply the patch and test updated DataTables.

Sponsored-by: Athens County Public Libraries

Rebased-by: Jonathan Druart
paginate => paging

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Comment 7 Owen Leonard 2026-01-05 13:16:04 UTC
Created attachment 190886 [details] [review]
Bug 39715: Do not quote DataTables options

This patch updates templates so that the options passed to DataTables
(via kohaTable) are not quoted. The quotes are not necessary, and
are not consistent with official DataTables documentation. This
establishes a standard for us to follow in the future.

The patch also corrects some option names which required upates,
particularly "sorting" -> "order".

To test, apply the patch and test updated DataTables.

Sponsored-by: Athens County Public Libraries

Rebased-by: Jonathan Druart
paginate => paging

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Comment 8 Jonathan Druart 2026-01-08 15:33:36 UTC
koha-tmpl/intranet-tmpl/prog/en/modules/virtualshelves/tables/shelves_results.tt

-    "data": [
+    data: [

This breaks the JSON response of the svc/virtualshelves/search script (Something went wrong when loading the table.)
Comment 9 Owen Leonard 2026-01-08 16:12:59 UTC
Created attachment 191028 [details] [review]
Bug 39715: (follow-up) Undo change to shelves_results.tt

This must have been an overzealous find and replace. A similar template,
itemsearch_json.tt, was not similarly affected.
Comment 10 Jonathan Druart 2026-01-09 08:36:28 UTC
Created attachment 191046 [details] [review]
Bug 39715: (follow-up) Undo change to shelves_results.tt

This must have been an overzealous find and replace. A similar template,
itemsearch_json.tt, was not similarly affected.

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Comment 11 Lucas Gass (lukeg) 2026-01-21 21:26:30 UTC
Created attachment 191840 [details] [review]
Bug 39715: Do not quote DataTables options

This patch updates templates so that the options passed to DataTables
(via kohaTable) are not quoted. The quotes are not necessary, and
are not consistent with official DataTables documentation. This
establishes a standard for us to follow in the future.

The patch also corrects some option names which required upates,
particularly "sorting" -> "order".

To test, apply the patch and test updated DataTables.

Sponsored-by: Athens County Public Libraries

Rebased-by: Jonathan Druart
paginate => paging

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
Comment 12 Lucas Gass (lukeg) 2026-01-21 21:26:32 UTC
Created attachment 191841 [details] [review]
Bug 39715: (follow-up) Undo change to shelves_results.tt

This must have been an overzealous find and replace. A similar template,
itemsearch_json.tt, was not similarly affected.

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
Comment 13 Lucas Gass (lukeg) 2026-01-23 14:30:09 UTC
Nice work everyone!

Pushed to main for 26.05