From bc0c98268318e44a2cab454f7e83fae4a8c3a8b6 Mon Sep 17 00:00:00 2001
From: Nick Clemens <nick@bywatersolutions.com>
Date: Tue, 21 Dec 2021 13:20:46 +0000
Subject: [PATCH] Bug 29747: Delete columns that don't exist from settings

This patch simply checks if we are callinmg from the plugin, and removes
two columns from the settings if so

To test:
 1 - In Admin->Marc bibliographic framework got to Marc Structure for default framework
 2 - Search for 856$u
 3 - Set Plugin to upload.pl
 4 - Edit a record in the default framework
 5 - Under 856u, click 'Upload'
 6 - Uplaod a file and then click 'Choose'
 7 - nothing happens
 8 - View consiole (f12) and see error
 9 - Apply patch
10 - Reload the page
11 - No more error
12 - Click choose
13 - Record link is populated
---
 koha-tmpl/intranet-tmpl/prog/en/modules/tools/upload.tt | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/upload.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/upload.tt
index 7a232de0ef..3127015171 100644
--- a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/upload.tt
+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/upload.tt
@@ -460,6 +460,10 @@
             window.close();
         }
         var columns_settings = [% TablesSettings.GetColumns( 'tools', 'upload', 'uploadresults', 'json' ) | $raw %];
+        [% IF plugin %]
+            delete columns_settings[6];
+            delete columns_settings[5];
+        [% END %]
         $(document).ready(function() {
             KohaTable("uploadresults",{
             }, columns_settings);
-- 
2.20.1