Bug 34478: import_export_authtype - cud-import, export

Changing action to op.

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
This commit is contained in:
Marcel de Rooy 2024-02-23 10:41:02 +00:00 committed by Jonathan Druart
parent 8eed84fe0b
commit 647d59b449
Signed by: jonathan.druart
GPG key ID: A085E712BEF0E0F0
2 changed files with 5 additions and 5 deletions

View file

@ -41,10 +41,10 @@ unless ($auth_status eq 'ok') {
}
my $authtypecode = $input->param('authtypecode') || 'default';
my $action = $input->param('action') || 'cud-export';
my $op = $input->param('op') || 'export';
## Exporting
if ($action eq 'cud-export' && $input->request_method() eq 'GET') {
if ( $op eq 'export' ) { # GET operation for downloading
my $strXml = '';
my $format = $input->param('type_export_' . $authtypecode);
if ($authtypecode eq 'default') {
@ -68,8 +68,7 @@ if ($action eq 'cud-export' && $input->request_method() eq 'GET') {
print $input->header(-type => 'application/vnd.oasis.opendocument.spreadsheet', -attachment => 'export_' . $authtypecode . '.ods');
print $strODS;
}
## Importing
} elsif ($input->request_method() eq 'POST') {
} elsif ( $op eq 'cud-import' ) { # POST for importing
my $ok = -1;
my $fieldname = 'file_import_' . $authtypecode;
if ($authtypecode eq 'default'){

View file

@ -237,6 +237,7 @@
<form action="/cgi-bin/koha/admin/import_export_authtype.pl" name="form_[% authority_type.authtypecode | html %]" method="get" target="_blank" class="form_export">
<div class="modal-body">
<fieldset>
<input type="hidden" name="op" value="export" />
<input type="hidden" name="authtypecode" value="[% authority_type.authtypecode | html %]" />
<p><label for="csv_type_export_[% authority_type.authtypecode | html %][% loop.count | html %]"><input type="radio" name="type_export_[% authority_type.authtypecode | html %]" value="csv" id="csv_type_export_[% authority_type.authtypecode | html %][% loop.count | html %]" checked="checked" /> Export to CSV spreadsheet</label></p>
<p><label for="ods_type_export_[% authority_type.authtypecode | html %][% loop.count | html %]"><input type="radio" name="type_export_[% authority_type.authtypecode | html %]" value="ods" id="ods_type_export_[% authority_type.authtypecode | html %][% loop.count | html %]" /> Export to OpenDocument spreadsheet format</label></p>
@ -263,7 +264,7 @@
[% INCLUDE 'csrf-token.inc' %]
<div class="modal-body">
<input type="hidden" name="authtypecode" value="[% authority_type.authtypecode | html %]" />
<input type="hidden" name="action" value="import" />
<input type="hidden" name="op" value="cud-import" />
<p><label for="file_import_[% authority_type.authtypecode | html %]">Upload file:</label> <input type="file" name="file_import_[% authority_type.authtypecode | html %]" id="file_import_[% authority_type.authtypecode | html %]" class="input_import" /></p>
<div id="importing_[% authority_type.authtypecode | html %]" style="display:none" class="importing"><img src="[% interface | html %]/[% theme | html %]/img/loading-small.gif" alt="" /><span class="importing_msg"></span></div>
</div>