From ec565aafb93105d52c488579edd32163b0935fa3 Mon Sep 17 00:00:00 2001 From: Nick Clemens Date: Thu, 5 Sep 2019 13:53:50 +0000 Subject: [PATCH] Bug 21406: [18.11.x only] Prevent errors from undefined fields in requests To test: 1 - In 18.11 enable ILL and install the freeform backend 2 - Create a request for 'Journal article' 3 - Note there is no 'Author' field 4 - Try to view ILL requests 5 - You get a datatables error about missing metadata_author column 6 - Apply patch 7 - No more error --- koha-tmpl/intranet-tmpl/prog/en/modules/ill/ill-requests.tt | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/ill/ill-requests.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/ill/ill-requests.tt index 5173a18c47..33c97b865e 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/ill/ill-requests.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/ill/ill-requests.tt @@ -262,6 +262,16 @@ expandExpand(row); }); + //Not all types have all core columns, mark them 'N/A' if not applied + //Otherwise we get errors on table load + dataCopy.forEach(function(thisRow){ + core.forEach(function(thisCore){ + if ( typeof thisRow[thisCore] == 'undefined' ){ + thisRow[thisCore] = 'N/A'; + } + }); + }); + // Assemble an array of column definitions for passing // to datatables var colData = []; -- 2.11.0