From f7e9e9eb3d1521adfe6aa43e662ffefde330bbc0 Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Thu, 20 Nov 2014 15:13:28 +0100 Subject: [PATCH] [SIGNED-OFF] Bug 13308: The output format should be 'iso2709' instead of 'marc' Content-Type: text/plain; charset="utf-8" In the template of the export tools, the value 'marc' is set for the 'format' variable. It should be 'iso2709'. There was a mess in the tools/export.pl script. 2 variables did the same thing: $format and $output_format This patch fixes that replacing $format with $output_format Test plan: Try to export biblio in iso2709 and csv using the export tools and from the checkout list. Signed-off-by: Owen Leonard Before applying the patch, attemping an MARC export from tools/export.pl resulted in an error. After the patch the export works correctly. Exports from the checkouts page also work correctly. --- .../intranet-tmpl/prog/en/modules/tools/export.tt | 2 +- tools/export.pl | 15 ++++++++------- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/export.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/export.tt index 0ac62d1..2e85732 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/export.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/export.tt @@ -128,7 +128,7 @@ $(document).ready(function() {
  1. diff --git a/tools/export.pl b/tools/export.pl index 98b9ef9..bae6941 100755 --- a/tools/export.pl +++ b/tools/export.pl @@ -33,7 +33,6 @@ use C4::Record; my $query = new CGI; my $clean; -my $output_format; my $dont_export_items; my $deleted_barcodes; my $timestamp; @@ -44,7 +43,7 @@ my $op = $query->param("op") || ''; my $filename = $query->param("filename") || 'koha.mrc'; my $dbh = C4::Context->dbh; my $marcflavour = C4::Context->preference("marcflavour"); -my $format = $query->param("format") || $query->param("output_format") || 'iso2709'; +my $output_format = $query->param("format") || $query->param("output_format") || 'iso2709'; # Checks if the script is called from commandline my $commandline = not defined $ENV{GATEWAY_INTERFACE}; @@ -94,7 +93,6 @@ _USAGE_ } # Default parameters values : - $output_format ||= 'marc'; $timestamp ||= ''; $dont_export_items ||= 0; $deleted_barcodes ||= 0; @@ -114,6 +112,11 @@ else { } +# Default value for output_format is 'iso2709' +$output_format ||= 'iso2709'; +# Retrocompatibility for the format parameter +$output_format = 'iso2709' if $output_format eq 'marc'; + my ( $template, $loggedinuser, $cookie, $flags ) = get_template_and_user( { template_name => "tools/export.tt", @@ -142,7 +145,7 @@ if ( C4::Context->preference("IndependentBranches") my $backupdir = C4::Context->config('backupdir'); if ( $op eq "export" ) { - if ( $format eq "iso2709" or $format eq "xml" ) { + if ( $output_format eq "iso2709" or $output_format eq "xml" ) { my $charset = 'utf-8'; my $mimetype = 'application/octet-stream'; binmode STDOUT, ':encoding(UTF-8)'; @@ -163,8 +166,6 @@ if ( $op eq "export" ) { ) unless ($commandline); $record_type = $query->param("record_type") unless ($commandline); - $output_format = $query->param("output_format") || 'marc' - unless ($commandline); my $export_remove_fields = $query->param("export_remove_fields"); my @biblionumbers = $query->param("biblionumbers"); my @itemnumbers = $query->param("itemnumbers"); @@ -433,7 +434,7 @@ if ( $op eq "export" ) { exit; } - elsif ( $format eq "csv" ) { + elsif ( $output_format eq "csv" ) { my @biblionumbers = uniq $query->param("biblionumbers"); my @itemnumbers = $query->param("itemnumbers"); my $output = -- 1.7.9.5