Bugzilla – Attachment 107167 Details for
Bug 5087
Option to not show CSV profiles in OPAC
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 5087: (QA follow-up) Rename the attribute to fit later API usage
Bug-5087-QA-follow-up-Rename-the-attribute-to-fit-.patch (text/plain), 7.73 KB, created by
Tomás Cohen Arazi (tcohen)
on 2020-07-21 17:17:17 UTC
(
hide
)
Description:
Bug 5087: (QA follow-up) Rename the attribute to fit later API usage
Filename:
MIME Type:
Creator:
Tomás Cohen Arazi (tcohen)
Created:
2020-07-21 17:17:17 UTC
Size:
7.73 KB
patch
obsolete
>From 3ad07f9da57d6ed986f68884ba0119c82e581aff Mon Sep 17 00:00:00 2001 >From: Tomas Cohen Arazi <tomascohen@theke.io> >Date: Mon, 20 Jul 2020 11:09:01 -0300 >Subject: [PATCH] Bug 5087: (QA follow-up) Rename the attribute to fit later > API usage > >This patch renames the introduced attribute for later usage on the API, >and changes the logic to use it the other way around. > >It also adds a KEY for the flag, as it will be used in WHERE statements. > >Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> >--- > 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(-) > >diff --git a/Koha/Schema/Result/ExportFormat.pm b/Koha/Schema/Result/ExportFormat.pm >index 1816f0d2ea..675c6e2738 100644 >--- a/Koha/Schema/Result/ExportFormat.pm >+++ b/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; >diff --git a/installer/data/mysql/atomicupdate/bug_5087_-_add_opac_option_field_to_export_formats.perl b/installer/data/mysql/atomicupdate/bug_5087_-_add_opac_option_field_to_export_formats.perl >index c2b4021552..7eaffd409d 100644 >--- a/installer/data/mysql/atomicupdate/bug_5087_-_add_opac_option_field_to_export_formats.perl >+++ b/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" ); > } >diff --git a/installer/data/mysql/kohastructure.sql b/installer/data/mysql/kohastructure.sql >index e57cf00510..456f7b1134 100644 >--- a/installer/data/mysql/kohastructure.sql >+++ b/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'; > > -- >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/csv-profiles.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/csv-profiles.tt >index 55f7f7afc9..1d2dbfd2d0 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/csv-profiles.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/csv-profiles.tt >@@ -193,11 +193,11 @@ > </li> > > <li class="marc_specific"> >- <label for="opac_option">Show option in OPAC: </label> >- [% IF csv_profile.opac_option %] >- <input type="checkbox" name="opac_option" id="opac_option" value="1" checked="checked"> >+ <label for="staff_only">Only available on the staff interface: </label> >+ [% IF csv_profile.staff_only %] >+ <input type="checkbox" name="staff_only" id="staff_only" value="1" checked="checked"> > [% ELSE %] >- <input type="checkbox" name="opac_option" id="opac_option" value="1"> >+ <input type="checkbox" name="staff_only" id="staff_only" value="1"> > [% END %] > </li> > >diff --git a/opac/opac-basket.pl b/opac/opac-basket.pl >index a7e7100ec5..1713de4993 100755 >--- a/opac/opac-basket.pl >+++ b/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, > ); >diff --git a/opac/opac-downloadcart.pl b/opac/opac-downloadcart.pl >index 671542a517..7720cd461e 100755 >--- a/opac/opac-downloadcart.pl >+++ b/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; > } >diff --git a/tools/csv-profiles.pl b/tools/csv-profiles.pl >index b1bbcba6cd..284fdc17ce 100755 >--- a/tools/csv-profiles.pl >+++ b/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; }; >-- >2.27.0
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 5087
:
2450
|
83438
|
83664
|
98779
|
103437
|
103506
|
103955
|
107111
|
107112
|
107113
|
107114
|
107166
| 107167 |
107168
|
107169
|
107224