From 8e9c97d4572957ec82bcc415ed580201f8bb6fa1 Mon Sep 17 00:00:00 2001 From: Aleisha Amohia Date: Thu, 19 Oct 2017 23:57:13 +0000 Subject: [PATCH] Bug 13952: [FOLLOW-UP] Fixing import for default auth type Signed-off-by: Katrin Fischer --- admin/import_export_authtype.pl | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/admin/import_export_authtype.pl b/admin/import_export_authtype.pl index 05cdb7c..7af823b 100755 --- a/admin/import_export_authtype.pl +++ b/admin/import_export_authtype.pl @@ -76,6 +76,9 @@ if ($action eq 'export' && $input->request_method() eq 'GET') { } elsif ($input->request_method() eq 'POST') { my $ok = -1; my $fieldname = 'file_import_' . $authtypecode; + if ($authtypecode eq 'default'){ + $fieldname = 'file_import_'; + } my $filename = $input->param($fieldname); # upload the input file if ($filename && $filename =~ /\.(csv|ods|xml)$/i) { @@ -84,11 +87,19 @@ if ($action eq 'export' && $input->request_method() eq 'GET') { if ($uploadFd && !$input->cgi_error) { my $tmpfilename = $input->tmpFileName(scalar $input->param($fieldname)); $filename = $tmpfilename . '.' . $extension; # rename the tmp file with the extension - $ok = ImportFramework($filename, $authtypecode, 1, 'authority') if (rename($tmpfilename, $filename)); + if ($authtypecode eq 'default') { + $ok = ImportFramework($filename, '', 1, 'authority') if (rename($tmpfilename, $filename)); + } else { + $ok = ImportFramework($filename, $authtypecode, 1, 'authority') if (rename($tmpfilename, $filename)); + } } } if ($ok >= 0) { # If everything went ok go to the authority type marc structure - print $input->redirect( -location => '/cgi-bin/koha/admin/auth_tag_structure.pl?authtypecode=' . $authtypecode); + if ($authtypecode eq 'default'){ + print $input->redirect( -location => '/cgi-bin/koha/admin/auth_tag_structure.pl?authtypecode='); + } else { + print $input->redirect( -location => '/cgi-bin/koha/admin/auth_tag_structure.pl?authtypecode=' . $authtypecode); + } } else { # If something failed go to the list of authority types and show message print $input->redirect( -location => '/cgi-bin/koha/admin/authtypes.pl?error_import_export=' . $authtypecode); -- 2.1.4