Bug 14647: (follow-up) Changes to script
authorAleisha Amohia <aleishaamohia@hotmail.com>
Mon, 10 Jul 2017 02:07:38 +0000 (02:07 +0000)
committerMartin Renvoize <martin.renvoize@ptfs-europe.com>
Thu, 20 Feb 2020 08:59:31 +0000 (08:59 +0000)
This patch adds the necessary changes to the script so that the filename
extensions works for exporting authorities.

To test:
1) Attempt to export with all filetypes for biblios and authorities
2) Confirm the extension for the exported file (after clicking the
    Export button) is correct for each one

Sponsored-by: Catalyst IT
Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

tools/export.pl

index e2d75d3..97ff255 100755 (executable)
@@ -39,7 +39,12 @@ my $record_type       = $query->param("record_type");
 my $op                = $query->param("op") || '';
 my $output_format     = $query->param("format") || $query->param("output_format") || 'iso2709';
 my $backupdir         = C4::Context->config('backupdir');
-my $filename          = $query->param("filename") || ( $output_format eq 'csv' ? 'koha.csv' : 'koha.mrc' );
+my $filename;
+if ( $record_type eq 'auths' ) {
+    $filename = $query->param("filename_auth") || ( $output_format eq 'xml' ? 'koha.xml' : 'koha.mrc' );
+} else {
+    $filename = $query->param("filename") || ( $output_format eq 'csv' ? 'koha.csv' : 'koha.mrc' );
+}
 $filename =~ s/(\r|\n)//;
 
 my $dbh = C4::Context->dbh;