Bugzilla – Attachment 103668 Details for
Bug 25274
JavaScript error in OPAC cart when more details are shown
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 25274: Don't initialize DataTable if table isn't present
Bug-25274-Dont-initialize-DataTable-if-table-isnt-.patch (text/plain), 2.99 KB, created by
Owen Leonard
on 2020-04-24 11:56:08 UTC
(
hide
)
Description:
Bug 25274: Don't initialize DataTable if table isn't present
Filename:
MIME Type:
Creator:
Owen Leonard
Created:
2020-04-24 11:56:08 UTC
Size:
2.99 KB
patch
obsolete
>From 1fe13098fd5ced8226e96ea2aaca741c09a233d5 Mon Sep 17 00:00:00 2001 >From: Owen Leonard <oleonard@myacpl.org> >Date: Fri, 24 Apr 2020 11:49:21 +0000 >Subject: [PATCH] Bug 25274: Don't initialize DataTable if table isn't present > >This patch modifies the OPAC basket JavaScript so that a check is added >for the existence of the "itemst" table. This avoids an error if the >"More details" view is selected and hte "itemst" table isn't present. > >To reproduce the error, add some items to the OPAC cart and open the >cart window. Open the JavaScript console in your browser and click the >"More details" link. You'll see an error. > >To test, apply the patch and perform the same test as above. The error >should not be present. Test that table sorting in the "brief" view words >correctly. >--- > .../opac-tmpl/bootstrap/en/modules/opac-basket.tt | 41 +++++++++++----------- > 1 file changed, 21 insertions(+), 20 deletions(-) > >diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-basket.tt b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-basket.tt >index 94e3ec3a5c..415ed112fe 100644 >--- a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-basket.tt >+++ b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-basket.tt >@@ -428,26 +428,27 @@ > return false; > }); > >- var itemst = $("#itemst").dataTable($.extend(true, {}, dataTablesDefaults, { >- "order": [[ 1, "asc" ]], >- "columnDefs": [ >- { "targets": [ 0,-1 ], "sortable": false, "searchable": false } >- ], >- "columns": [ >- null, >- { "type": "anti-the" }, >- null, >- null, >- null >- ], >- >- })); >- >- var buttons = new $.fn.dataTable.Buttons(itemst, { >- buttons: [ >- 'print' >- ] >- }).container().appendTo($('#toolbar')); >+ if( $("#itemst").length > 0 ){ >+ var itemst = $("#itemst").dataTable($.extend(true, {}, dataTablesDefaults, { >+ "order": [[ 1, "asc" ]], >+ "columnDefs": [ >+ { "targets": [ 0,-1 ], "sortable": false, "searchable": false } >+ ], >+ "columns": [ >+ null, >+ { "type": "anti-the" }, >+ null, >+ null, >+ null >+ ], >+ })); >+ >+ var buttons = new $.fn.dataTable.Buttons(itemst, { >+ buttons: [ >+ 'print' >+ ] >+ }).container().appendTo($('#toolbar')); >+ } > > $(".cb").change(function(){ > selRecord( $(this).val(), $(this).prop("checked") ); >-- >2.11.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 25274
:
103668
|
103669
|
103681