@@ -, +, @@ --- .../bug_5087_-_add_opac_option_field_to_export_formats.perl | 9 +++++++++ installer/data/mysql/kohastructure.sql | 3 ++- koha-tmpl/intranet-tmpl/prog/en/modules/tools/csv-profiles.tt | 9 +++++++++ opac/opac-downloadcart.pl | 2 +- tools/csv-profiles.pl | 3 +++ 5 files changed, 24 insertions(+), 2 deletions(-) create mode 100644 installer/data/mysql/atomicupdate/bug_5087_-_add_opac_option_field_to_export_formats.perl --- a/installer/data/mysql/atomicupdate/bug_5087_-_add_opac_option_field_to_export_formats.perl +++ a/installer/data/mysql/atomicupdate/bug_5087_-_add_opac_option_field_to_export_formats.perl @@ -0,0 +1,9 @@ +$DBversion = 'XXX'; +if( CheckVersion( $DBversion ) ) { + unless( column_exists( 'export_format', 'opac_option' ) ) { + $dbh->do(q|ALTER TABLE export_format ADD opac_option TINYINT(1) NOT NULL DEFAULT 0 AFTER used_for|); + } + + SetVersion( $DBversion ); + print "Upgrade to $DBversion done (Bug 5087: Add export_format.opac_option)\n"; +} --- a/installer/data/mysql/kohastructure.sql +++ a/installer/data/mysql/kohastructure.sql @@ -673,7 +673,8 @@ CREATE TABLE `export_format` ( `encoding` varchar(255) NOT NULL DEFAULT 'utf8', `type` varchar(255) DEFAULT 'marc', `used_for` varchar(255) DEFAULT 'export_records', - PRIMARY KEY (`export_format_id`) + `opac_option` TINYINT(1) NOT NULL DEFAULT 0, + PRIMARY KEY (`export_format_id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='Used for CSV export'; -- --- a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/csv-profiles.tt +++ a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/csv-profiles.tt @@ -192,6 +192,15 @@
  • + + [% IF csv_profile.opac_option %] + + [% ELSE %] + + [% END %] +
  • + +
  • Required --- a/opac/opac-downloadcart.pl +++ a/opac/opac-downloadcart.pl @@ -122,7 +122,7 @@ if ($bib_list && $format) { print $output; } else { - $template->param(csv_profiles => [ Koha::CsvProfiles->search({ type => 'marc', used_for => 'export_records' }) ]); + $template->param(csv_profiles => [ Koha::CsvProfiles->search({ type => 'marc', used_for => 'export_records', opac_option => 1 }) ]); $template->param(bib_list => $bib_list); output_html_with_http_headers $query, $cookie, $template->output; } --- a/tools/csv-profiles.pl +++ a/tools/csv-profiles.pl @@ -84,6 +84,7 @@ if ( $op eq 'add_form' ) { my $field_separator = $input->param("field_separator"); my $subfield_separator = $input->param("subfield_separator"); my $encoding = $input->param("encoding"); + my $opac_option = $input->param("opac_option"); if ($export_format_id) { my $csv_profile = Koha::CsvProfiles->find($export_format_id) @@ -97,6 +98,7 @@ if ( $op eq 'add_form' ) { $csv_profile->encoding($encoding); $csv_profile->type($type); $csv_profile->used_for($used_for); + $csv_profile->opac_option($opac_option); eval { $csv_profile->store; }; if ($@) { @@ -115,6 +117,7 @@ if ( $op eq 'add_form' ) { encoding => $encoding, type => $type, used_for => $used_for, + opac_option => $opac_option } ); eval { $csv_profile->store; }; --