Bugzilla – Attachment 98779 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: Ability to define whether CSV profile shows in OPAC
Bug-5087-Ability-to-define-whether-CSV-profile-sho.patch (text/plain), 5.56 KB, created by
Aleisha Amohia
on 2020-02-12 21:34:52 UTC
(
hide
)
Description:
Bug 5087: Ability to define whether CSV profile shows in OPAC
Filename:
MIME Type:
Creator:
Aleisha Amohia
Created:
2020-02-12 21:34:52 UTC
Size:
5.56 KB
patch
obsolete
>From d3b9211f95dc38124829a40338d93b1d3903c923 Mon Sep 17 00:00:00 2001 >From: Aleisha Amohia <aleishaamohia@hotmail.com> >Date: Thu, 20 Dec 2018 22:52:59 +0000 >Subject: [PATCH] Bug 5087: Ability to define whether CSV profile shows in OPAC > >To test: >1) Update database >2) Update schema >3) In staff side, go to Tools -> CSV profiles >4) Make a CSV profile with profile type = MARC and usage = Export >records >5) Leave 'Show option in OPAC' unchecked and save >6) Go to OPAC and add an item to your cart >7) Click Cart, click Download, confirm that your newly created CSV >profile does not show as an option >8) Go back and edit CSV profile on staff side >9) Check the 'Show option in OPAC' checkbox and save >10) Go back to download cart in OPAC >11) Confirm the CSV profile now shows in the dropdown > >Sponsored-by: Catalyst IT >Signed-off-by: Maryse Simard <maryse.simard@inlibro.com> >--- > .../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 > >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 >new file mode 100644 >index 0000000..81bf5df >--- /dev/null >+++ b/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"; >+} >diff --git a/installer/data/mysql/kohastructure.sql b/installer/data/mysql/kohastructure.sql >index 0aa3a9b..4a0962d 100644 >--- a/installer/data/mysql/kohastructure.sql >+++ b/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'; > > -- >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 8a1bea4..6293bcc 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 >@@ -192,6 +192,15 @@ > </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"> >+ [% ELSE %] >+ <input type="checkbox" name="opac_option" id="opac_option" value="1"> >+ [% END %] >+ </li> >+ >+ <li class="marc_specific"> > <label for="marc_content" class="required">Profile MARC fields: </label> > <textarea cols="50" rows="2" name="marc_content" id="marc_content">[% csv_profile.content | html %]</textarea> > <span class="required">Required</span> >diff --git a/opac/opac-downloadcart.pl b/opac/opac-downloadcart.pl >index ec5e2c8..0ceb74e 100755 >--- a/opac/opac-downloadcart.pl >+++ b/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; > } >diff --git a/tools/csv-profiles.pl b/tools/csv-profiles.pl >index dd09677..b1bbcba 100755 >--- a/tools/csv-profiles.pl >+++ b/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; }; >-- >2.1.4
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