Bug 18111: Fix import of default framework
Caused by bug 16035. Recreate the issue: Go to Home › Administration › MARC frameworks For the default framework: Actions > import It will not work Test plan: Confirm test plans from bug 16035 and bug 17389 still pass Confirm that the import for the default framework now works Signed-off-by: Josef Moravec <josef.moravec@gmail.com> Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
This commit is contained in:
parent
830786aba7
commit
c12aa9664c
2 changed files with 9 additions and 12 deletions
|
@ -46,41 +46,38 @@ unless ($authenticated) {
|
||||||
exit 0;
|
exit 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
my $frameworkcode = $input->param('frameworkcode') || 'default';
|
my $frameworkcode = $input->param('frameworkcode') || '';
|
||||||
|
my $framework_name = $frameworkcode || 'default';
|
||||||
my $action = $input->param('action') || 'export';
|
my $action = $input->param('action') || 'export';
|
||||||
|
|
||||||
## Exporting
|
## Exporting
|
||||||
if ($action eq 'export' && $input->request_method() eq 'GET') {
|
if ($action eq 'export' && $input->request_method() eq 'GET') {
|
||||||
my $strXml = '';
|
my $strXml = '';
|
||||||
my $format = $input->param('type_export_' . $frameworkcode);
|
my $format = $input->param('type_export_' . $framework_name);
|
||||||
if ($frameworkcode eq 'default') {
|
|
||||||
ExportFramework('', \$strXml, $format);
|
|
||||||
} else {
|
|
||||||
ExportFramework($frameworkcode, \$strXml, $format);
|
ExportFramework($frameworkcode, \$strXml, $format);
|
||||||
}
|
|
||||||
|
|
||||||
if ($format eq 'csv') {
|
if ($format eq 'csv') {
|
||||||
# CSV file
|
# CSV file
|
||||||
|
|
||||||
# Correctly set the encoding to output plain text in UTF-8
|
# Correctly set the encoding to output plain text in UTF-8
|
||||||
binmode(STDOUT,':encoding(UTF-8)');
|
binmode(STDOUT,':encoding(UTF-8)');
|
||||||
print $input->header(-type => 'application/vnd.ms-excel', -attachment => 'export_' . $frameworkcode . '.csv');
|
print $input->header(-type => 'application/vnd.ms-excel', -attachment => 'export_' . $framework_name . '.csv');
|
||||||
print $strXml;
|
print $strXml;
|
||||||
} elsif ($format eq 'excel') {
|
} elsif ($format eq 'excel') {
|
||||||
# Excel-xml file
|
# Excel-xml file
|
||||||
print $input->header(-type => 'application/excel', -attachment => 'export_' . $frameworkcode . '.xml');
|
print $input->header(-type => 'application/excel', -attachment => 'export_' . $framework_name . '.xml');
|
||||||
print $strXml;
|
print $strXml;
|
||||||
} else {
|
} else {
|
||||||
# ODS file
|
# ODS file
|
||||||
my $strODS = '';
|
my $strODS = '';
|
||||||
createODS($strXml, 'en', \$strODS);
|
createODS($strXml, 'en', \$strODS);
|
||||||
print $input->header(-type => 'application/vnd.oasis.opendocument.spreadsheet', -attachment => 'export_' . $frameworkcode . '.ods');
|
print $input->header(-type => 'application/vnd.oasis.opendocument.spreadsheet', -attachment => 'export_' . $framework_name . '.ods');
|
||||||
print $strODS;
|
print $strODS;
|
||||||
}
|
}
|
||||||
## Importing
|
## Importing
|
||||||
} elsif ($input->request_method() eq 'POST') {
|
} elsif ($input->request_method() eq 'POST') {
|
||||||
my $ok = -1;
|
my $ok = -1;
|
||||||
my $fieldname = 'file_import_' . $frameworkcode;
|
my $fieldname = 'file_import_' . $framework_name;
|
||||||
my $filename = $input->param($fieldname);
|
my $filename = $input->param($fieldname);
|
||||||
# upload the input file
|
# upload the input file
|
||||||
if ($filename && $filename =~ /\.(csv|ods|xml)$/i) {
|
if ($filename && $filename =~ /\.(csv|ods|xml)$/i) {
|
||||||
|
|
|
@ -189,7 +189,7 @@
|
||||||
</div>
|
</div>
|
||||||
<form action="/cgi-bin/koha/admin/import_export_framework.pl" name="form_i_default" id="form_i_default" method="post" enctype="multipart/form-data" class="form_import">
|
<form action="/cgi-bin/koha/admin/import_export_framework.pl" name="form_i_default" id="form_i_default" method="post" enctype="multipart/form-data" class="form_import">
|
||||||
<div class="modal-body">
|
<div class="modal-body">
|
||||||
<input type="hidden" name="frameworkcode" value="default" />
|
<input type="hidden" name="frameworkcode" value="" />
|
||||||
<input type="hidden" name="action" value="import" />
|
<input type="hidden" name="action" value="import" />
|
||||||
<p><label for="file_import_default">Upload file:</label> <input type="file" name="file_import_default" id="file_import_default" class="input_import" /></p>
|
<p><label for="file_import_default">Upload file:</label> <input type="file" name="file_import_default" id="file_import_default" class="input_import" /></p>
|
||||||
<div id="importing_default" style="display:none" class="importing"><img src="[% interface %]/[% theme %]/img/spinner-small.gif" alt="" /><span class="importing_msg"></span></div>
|
<div id="importing_default" style="display:none" class="importing"><img src="[% interface %]/[% theme %]/img/spinner-small.gif" alt="" /><span class="importing_msg"></span></div>
|
||||||
|
|
Loading…
Reference in a new issue