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

(-)a/Koha/Schema/Result/ExportFormat.pm (-5 / +5 lines)
Lines 85-91 __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
88
=head2 staff_only
89
89
90
  data_type: 'tinyint'
90
  data_type: 'tinyint'
91
  default_value: 0
91
  default_value: 0
Lines 129-135 __PACKAGE__->add_columns( Link Here
129
    is_nullable => 1,
129
    is_nullable => 1,
130
    size => 255,
130
    size => 255,
131
  },
131
  },
132
  "opac_option",
132
  "staff_only",
133
  { data_type => "tinyint", default_value => 0, is_nullable => 0 },
133
  { data_type => "tinyint", default_value => 0, is_nullable => 0 },
134
);
134
);
135
135
Lines 146-153 __PACKAGE__->add_columns( Link Here
146
__PACKAGE__->set_primary_key("export_format_id");
146
__PACKAGE__->set_primary_key("export_format_id");
147
147
148
148
149
# Created by DBIx::Class::Schema::Loader v0.07046 @ 2020-04-20 20:08:25
149
# Created by DBIx::Class::Schema::Loader v0.07046 @ 2020-07-20 14:15:46
150
# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:J2VDj9yI8uanFR9EGv2sXw
150
# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:O8kM+dd6GTS2qS39lnDG1g
151
151
152
sub koha_object_class {
152
sub koha_object_class {
153
    'Koha::CsvProfile';
153
    'Koha::CsvProfile';
Lines 157-163 sub koha_objects_class { Link Here
157
}
157
}
158
158
159
__PACKAGE__->add_columns(
159
__PACKAGE__->add_columns(
160
    '+opac_option' => { is_boolean => 1 },
160
    '+staff_only' => { is_boolean => 1 },
161
);
161
);
162
162
163
1;
163
1;
(-)a/installer/data/mysql/atomicupdate/bug_5087_-_add_opac_option_field_to_export_formats.perl (-3 / +7 lines)
Lines 1-8 Link Here
1
$DBversion = 'XXX';
1
$DBversion = 'XXX';
2
if( CheckVersion( $DBversion ) ) {
2
if( CheckVersion( $DBversion ) ) {
3
    unless( column_exists( 'export_format', 'opac_option' ) ) {
3
    unless( column_exists( 'export_format', 'staff_only' ) ) {
4
        $dbh->do(q|ALTER TABLE export_format ADD opac_option TINYINT(1) NOT NULL DEFAULT 0 AFTER used_for|);
4
        $dbh->do(q|
5
            ALTER TABLE export_format
6
                ADD staff_only TINYINT(1) NOT NULL DEFAULT 0 AFTER used_for,
7
                ADD KEY `staff_only_idx` (`staff_only`);
8
        |);
5
    }
9
    }
6
10
7
    NewVersion( $DBversion, 5087, "Add export_format.opac_option" );
11
    NewVersion( $DBversion, 5087, "Add export_format.staff_only" );
8
}
12
}
(-)a/installer/data/mysql/kohastructure.sql (-2 / +3 lines)
Lines 691-698 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
  `opac_option` TINYINT(1) NOT NULL DEFAULT 0,
694
  `staff_only` TINYINT(1) NOT NULL DEFAULT 0,
695
  PRIMARY KEY (`export_format_id`)
695
  PRIMARY KEY (`export_format_id`),
696
  KEY `staff_only_idx` (`staff_only`)
696
) ENGINE=InnoDB  DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='Used for CSV export';
697
) ENGINE=InnoDB  DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='Used for CSV export';
697
698
698
--
699
--
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/csv-profiles.tt (-4 / +4 lines)
Lines 193-203 Link Here
193
                </li>
193
                </li>
194
194
195
                <li class="marc_specific">
195
                <li class="marc_specific">
196
                    <label for="opac_option">Show option in OPAC: </label>
196
                    <label for="staff_only">Only available on the staff interface: </label>
197
                    [% IF csv_profile.opac_option %]
197
                    [% IF csv_profile.staff_only %]
198
                        <input type="checkbox" name="opac_option" id="opac_option" value="1" checked="checked">
198
                        <input type="checkbox" name="staff_only" id="staff_only" value="1" checked="checked">
199
                    [% ELSE %]
199
                    [% ELSE %]
200
                        <input type="checkbox" name="opac_option" id="opac_option" value="1">
200
                        <input type="checkbox" name="staff_only" id="staff_only" value="1">
201
                    [% END %]
201
                    [% END %]
202
                </li>
202
                </li>
203
203
(-)a/opac/opac-basket.pl (-1 / +5 lines)
Lines 166-172 my $resultsarray = \@results; Link Here
166
# my $itemsarray=\@items;
166
# my $itemsarray=\@items;
167
167
168
$template->param(
168
$template->param(
169
    csv_profiles => [ Koha::CsvProfiles->search({ type => 'marc', used_for => 'export_records' }) ],
169
    csv_profiles => [
170
        Koha::CsvProfiles->search(
171
            { type => 'marc', used_for => 'export_records', staff_only => 0 }
172
        )
173
    ],
170
    bib_list => $bib_list,
174
    bib_list => $bib_list,
171
    BIBLIO_RESULTS => $resultsarray,
175
    BIBLIO_RESULTS => $resultsarray,
172
);
176
);
(-)a/opac/opac-downloadcart.pl (-1 / +11 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', opac_option => 1 }) ]);
127
    $template->param(
128
        csv_profiles => [
129
            Koha::CsvProfiles->search(
130
                {
131
                    type       => 'marc',
132
                    used_for   => 'export_records',
133
                    staff_only => 0
134
                }
135
            )
136
        ]
137
    );
128
    $template->param(bib_list => $bib_list); 
138
    $template->param(bib_list => $bib_list); 
129
    output_html_with_http_headers $query, $cookie, $template->output;
139
    output_html_with_http_headers $query, $cookie, $template->output;
130
}
140
}
(-)a/tools/csv-profiles.pl (-4 / +3 lines)
Lines 84-90 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
    my $staff_only         = $input->param("staff_only") ? 1 : 0;
88
88
89
    if ($export_format_id) {
89
    if ($export_format_id) {
90
        my $csv_profile = Koha::CsvProfiles->find($export_format_id)
90
        my $csv_profile = Koha::CsvProfiles->find($export_format_id)
Lines 98-104 if ( $op eq 'add_form' ) { Link Here
98
        $csv_profile->encoding($encoding);
98
        $csv_profile->encoding($encoding);
99
        $csv_profile->type($type);
99
        $csv_profile->type($type);
100
        $csv_profile->used_for($used_for);
100
        $csv_profile->used_for($used_for);
101
        $csv_profile->opac_option($opac_option);
101
        $csv_profile->staff_only($staff_only);
102
        eval { $csv_profile->store; };
102
        eval { $csv_profile->store; };
103
103
104
        if ($@) {
104
        if ($@) {
Lines 117-123 if ( $op eq 'add_form' ) { Link Here
117
                encoding           => $encoding,
117
                encoding           => $encoding,
118
                type               => $type,
118
                type               => $type,
119
                used_for           => $used_for,
119
                used_for           => $used_for,
120
                opac_option        => $opac_option
120
                staff_only         => $staff_only
121
            }
121
            }
122
        );
122
        );
123
        eval { $csv_profile->store; };
123
        eval { $csv_profile->store; };
124
- 

Return to bug 5087