From 5987860b388441a2663b2b3aae10ff0131b51035 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 Signed-off-by: Martin Renvoize Signed-off-by: Lucas Gass --- .../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 2c307445e6..b8b5fe1d56 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.39.5