Line 0
Link Here
|
0 |
- |
1 |
use Modern::Perl; |
|
|
2 |
use Koha::Installer::Output qw(say_warning say_failure say_success say_info); |
3 |
|
4 |
return { |
5 |
bug_number => "37954", |
6 |
description => "Move holdings_barcodes setting to holdings_barcode", |
7 |
up => sub { |
8 |
my ($args) = @_; |
9 |
my ( $dbh, $out ) = @$args{qw(dbh out)}; |
10 |
|
11 |
my ($existing_holdings_barcode_setting) = $dbh->selectrow_array( |
12 |
q{ |
13 |
SELECT COUNT(*) FROM columns_settings WHERE module='catalogue' AND page='detail' AND tablename='holdings_table' AND columnname='holdings_barcode' |
14 |
} |
15 |
); |
16 |
if ($existing_holdings_barcode_setting) { |
17 |
say_info( $out, "Settings already exist" ); |
18 |
} else { |
19 |
my ( $cannot_be_toggled, $is_hidden ) = $dbh->selectrow_array( |
20 |
q{ |
21 |
SELECT cannot_be_toggled,is_hidden FROM columns_settings WHERE module='catalogue' AND page='detail' AND tablename='holdings_table' AND columnname='holdings_barcodes' |
22 |
} |
23 |
); |
24 |
|
25 |
if ( defined $cannot_be_toggled || defined $is_hidden ) { |
26 |
$dbh->do( |
27 |
qq{ |
28 |
INSERT IGNORE INTO columns_settings VALUES |
29 |
('catalogue', 'detail', 'holdings_table', 'holdings_barcode', $cannot_be_toggled, $is_hidden ) |
30 |
} |
31 |
); |
32 |
say_success( $out, "Settings moved to holdings_barcode" ); |
33 |
} else { |
34 |
say_info( $out, "No settings for holdings_barcodes found" ); |
35 |
} |
36 |
} |
37 |
$dbh->do( |
38 |
q{ |
39 |
DELETE FROM columns_settings WHERE module='catalogue' AND page='detail' AND tablename='holdings_table' AND columnname='holdings_barcodes' |
40 |
} |
41 |
); |
42 |
say $out "Removed settings for holdings_barcodes"; |
43 |
}, |
44 |
}; |