@@ -, +, @@ API usage --- Koha/Schema/Result/ExportFormat.pm | 10 +++++----- ...87_-_add_opac_option_field_to_export_formats.perl | 10 +++++++--- installer/data/mysql/kohastructure.sql | 5 +++-- .../prog/en/modules/tools/csv-profiles.tt | 8 ++++---- opac/opac-basket.pl | 6 +++++- opac/opac-downloadcart.pl | 12 +++++++++++- tools/csv-profiles.pl | 6 +++--- 7 files changed, 38 insertions(+), 19 deletions(-) --- a/Koha/Schema/Result/ExportFormat.pm +++ a/Koha/Schema/Result/ExportFormat.pm @@ -85,7 +85,7 @@ __PACKAGE__->table("export_format"); is_nullable: 1 size: 255 -=head2 opac_option +=head2 staff_only data_type: 'tinyint' default_value: 0 @@ -129,7 +129,7 @@ __PACKAGE__->add_columns( is_nullable => 1, size => 255, }, - "opac_option", + "staff_only", { data_type => "tinyint", default_value => 0, is_nullable => 0 }, ); @@ -146,8 +146,8 @@ __PACKAGE__->add_columns( __PACKAGE__->set_primary_key("export_format_id"); -# Created by DBIx::Class::Schema::Loader v0.07046 @ 2020-04-20 20:08:25 -# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:J2VDj9yI8uanFR9EGv2sXw +# Created by DBIx::Class::Schema::Loader v0.07046 @ 2020-07-20 14:15:46 +# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:O8kM+dd6GTS2qS39lnDG1g sub koha_object_class { 'Koha::CsvProfile'; @@ -157,7 +157,7 @@ sub koha_objects_class { } __PACKAGE__->add_columns( - '+opac_option' => { is_boolean => 1 }, + '+staff_only' => { is_boolean => 1 }, ); 1; --- 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 @@ -1,8 +1,12 @@ $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|); + unless( column_exists( 'export_format', 'staff_only' ) ) { + $dbh->do(q| + ALTER TABLE export_format + ADD staff_only TINYINT(1) NOT NULL DEFAULT 0 AFTER used_for, + ADD KEY `staff_only_idx` (`staff_only`); + |); } - NewVersion( $DBversion, 5087, "Add export_format.opac_option" ); + NewVersion( $DBversion, 5087, "Add export_format.staff_only" ); } --- a/installer/data/mysql/kohastructure.sql +++ a/installer/data/mysql/kohastructure.sql @@ -691,8 +691,9 @@ CREATE TABLE `export_format` ( `encoding` varchar(255) NOT NULL DEFAULT 'utf8', `type` varchar(255) DEFAULT 'marc', `used_for` varchar(255) DEFAULT 'export_records', - `opac_option` TINYINT(1) NOT NULL DEFAULT 0, - PRIMARY KEY (`export_format_id`) + `staff_only` TINYINT(1) NOT NULL DEFAULT 0, + PRIMARY KEY (`export_format_id`), + KEY `staff_only_idx` (`staff_only`) ) 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 @@ -193,11 +193,11 @@
  • - - [% IF csv_profile.opac_option %] - + + [% IF csv_profile.staff_only %] + [% ELSE %] - + [% END %]
  • --- a/opac/opac-basket.pl +++ a/opac/opac-basket.pl @@ -166,7 +166,11 @@ my $resultsarray = \@results; # my $itemsarray=\@items; $template->param( - csv_profiles => [ Koha::CsvProfiles->search({ type => 'marc', used_for => 'export_records' }) ], + csv_profiles => [ + Koha::CsvProfiles->search( + { type => 'marc', used_for => 'export_records', staff_only => 0 } + ) + ], bib_list => $bib_list, BIBLIO_RESULTS => $resultsarray, ); --- a/opac/opac-downloadcart.pl +++ a/opac/opac-downloadcart.pl @@ -124,7 +124,17 @@ if ($bib_list && $format) { print $output; } else { - $template->param(csv_profiles => [ Koha::CsvProfiles->search({ type => 'marc', used_for => 'export_records', opac_option => 1 }) ]); + $template->param( + csv_profiles => [ + Koha::CsvProfiles->search( + { + type => 'marc', + used_for => 'export_records', + staff_only => 0 + } + ) + ] + ); $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,7 +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"); + my $staff_only = $input->param("staff_only") ? 1 : 0; if ($export_format_id) { my $csv_profile = Koha::CsvProfiles->find($export_format_id) @@ -98,7 +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); + $csv_profile->staff_only($staff_only); eval { $csv_profile->store; }; if ($@) { @@ -117,7 +117,7 @@ if ( $op eq 'add_form' ) { encoding => $encoding, type => $type, used_for => $used_for, - opac_option => $opac_option + staff_only => $staff_only } ); eval { $csv_profile->store; }; --