View | Details | Raw Unified | Return to bug 5087
Collapse All | Expand All

(-)a/Koha/Schema/Result/ExportFormat.pm (-2 / +14 lines)
Lines 85-90 __PACKAGE__->table("export_format"); Link Here
85
  is_nullable: 1
85
  is_nullable: 1
86
  size: 255
86
  size: 255
87
87
88
=head2 opac_option
89
90
  data_type: 'tinyint'
91
  default_value: 0
92
  is_nullable: 0
93
88
=cut
94
=cut
89
95
90
__PACKAGE__->add_columns(
96
__PACKAGE__->add_columns(
Lines 123-128 __PACKAGE__->add_columns( Link Here
123
    is_nullable => 1,
129
    is_nullable => 1,
124
    size => 255,
130
    size => 255,
125
  },
131
  },
132
  "opac_option",
133
  { data_type => "tinyint", default_value => 0, is_nullable => 0 },
126
);
134
);
127
135
128
=head1 PRIMARY KEY
136
=head1 PRIMARY KEY
Lines 138-145 __PACKAGE__->add_columns( Link Here
138
__PACKAGE__->set_primary_key("export_format_id");
146
__PACKAGE__->set_primary_key("export_format_id");
139
147
140
148
141
# Created by DBIx::Class::Schema::Loader v0.07042 @ 2018-02-16 17:54:53
149
# Created by DBIx::Class::Schema::Loader v0.07046 @ 2020-04-20 20:08:25
142
# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:YSQshI3mJfO0LsOlwvdIdg
150
# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:J2VDj9yI8uanFR9EGv2sXw
143
151
144
sub koha_object_class {
152
sub koha_object_class {
145
    'Koha::CsvProfile';
153
    'Koha::CsvProfile';
Lines 148-151 sub koha_objects_class { Link Here
148
    'Koha::CsvProfiles';
156
    'Koha::CsvProfiles';
149
}
157
}
150
158
159
__PACKAGE__->add_columns(
160
    '+opac_option' => { is_boolean => 1 },
161
);
162
151
1;
163
1;
(-)a/installer/data/mysql/atomicupdate/bug_5087_-_add_opac_option_field_to_export_formats.perl (+8 lines)
Line 0 Link Here
1
$DBversion = 'XXX';
2
if( CheckVersion( $DBversion ) ) {
3
    unless( column_exists( 'export_format', 'opac_option' ) ) {
4
        $dbh->do(q|ALTER TABLE export_format ADD opac_option TINYINT(1) NOT NULL DEFAULT 0 AFTER used_for|);
5
    }
6
7
    NewVersion( $DBversion, 5087, "Add export_format.opac_option" );
8
}
(-)a/installer/data/mysql/kohastructure.sql (-1 / +2 lines)
Lines 691-697 CREATE TABLE `export_format` ( Link Here
691
  `encoding` varchar(255) NOT NULL DEFAULT 'utf8',
691
  `encoding` varchar(255) NOT NULL DEFAULT 'utf8',
692
  `type` varchar(255) DEFAULT 'marc',
692
  `type` varchar(255) DEFAULT 'marc',
693
  `used_for` varchar(255) DEFAULT 'export_records',
693
  `used_for` varchar(255) DEFAULT 'export_records',
694
  PRIMARY KEY  (`export_format_id`)
694
  `opac_option` TINYINT(1) NOT NULL DEFAULT 0,
695
  PRIMARY KEY (`export_format_id`)
695
) ENGINE=InnoDB  DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='Used for CSV export';
696
) ENGINE=InnoDB  DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='Used for CSV export';
696
697
697
--
698
--
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/csv-profiles.tt (+9 lines)
Lines 192-197 Link Here
192
                    </select>
192
                    </select>
193
                </li>
193
                </li>
194
194
195
                <li class="marc_specific">
196
                    <label for="opac_option">Show option in OPAC: </label>
197
                    [% IF csv_profile.opac_option %]
198
                        <input type="checkbox" name="opac_option" id="opac_option" value="1" checked="checked">
199
                    [% ELSE %]
200
                        <input type="checkbox" name="opac_option" id="opac_option" value="1">
201
                    [% END %]
202
                </li>
203
195
                <li class="marc_specific">
204
                <li class="marc_specific">
196
                    <label for="marc_content" class="required">Profile MARC fields: </label>
205
                    <label for="marc_content" class="required">Profile MARC fields: </label>
197
                    <textarea cols="50" rows="2" name="marc_content" id="marc_content">[% csv_profile.content | html %]</textarea>
206
                    <textarea cols="50" rows="2" name="marc_content" id="marc_content">[% csv_profile.content | html %]</textarea>
(-)a/opac/opac-downloadcart.pl (-1 / +1 lines)
Lines 124-130 if ($bib_list && $format) { Link Here
124
    print $output;
124
    print $output;
125
125
126
} else { 
126
} else { 
127
    $template->param(csv_profiles => [ Koha::CsvProfiles->search({ type => 'marc', used_for => 'export_records' }) ]);
127
    $template->param(csv_profiles => [ Koha::CsvProfiles->search({ type => 'marc', used_for => 'export_records', opac_option => 1 }) ]);
128
    $template->param(bib_list => $bib_list); 
128
    $template->param(bib_list => $bib_list); 
129
    output_html_with_http_headers $query, $cookie, $template->output;
129
    output_html_with_http_headers $query, $cookie, $template->output;
130
}
130
}
(-)a/tools/csv-profiles.pl (-1 / +3 lines)
Lines 84-89 if ( $op eq 'add_form' ) { Link Here
84
    my $field_separator    = $input->param("field_separator");
84
    my $field_separator    = $input->param("field_separator");
85
    my $subfield_separator = $input->param("subfield_separator");
85
    my $subfield_separator = $input->param("subfield_separator");
86
    my $encoding           = $input->param("encoding");
86
    my $encoding           = $input->param("encoding");
87
    my $opac_option        = $input->param("opac_option");
87
88
88
    if ($export_format_id) {
89
    if ($export_format_id) {
89
        my $csv_profile = Koha::CsvProfiles->find($export_format_id)
90
        my $csv_profile = Koha::CsvProfiles->find($export_format_id)
Lines 97-102 if ( $op eq 'add_form' ) { Link Here
97
        $csv_profile->encoding($encoding);
98
        $csv_profile->encoding($encoding);
98
        $csv_profile->type($type);
99
        $csv_profile->type($type);
99
        $csv_profile->used_for($used_for);
100
        $csv_profile->used_for($used_for);
101
        $csv_profile->opac_option($opac_option);
100
        eval { $csv_profile->store; };
102
        eval { $csv_profile->store; };
101
103
102
        if ($@) {
104
        if ($@) {
Lines 115-120 if ( $op eq 'add_form' ) { Link Here
115
                encoding           => $encoding,
117
                encoding           => $encoding,
116
                type               => $type,
118
                type               => $type,
117
                used_for           => $used_for,
119
                used_for           => $used_for,
120
                opac_option        => $opac_option
118
            }
121
            }
119
        );
122
        );
120
        eval { $csv_profile->store; };
123
        eval { $csv_profile->store; };
121
- 

Return to bug 5087