Line 0
Link Here
|
|
|
1 |
use Modern::Perl; |
2 |
use Koha::Installer::Output qw(say_warning say_success say_info); |
3 |
|
4 |
return { |
5 |
bug_number => 40284, |
6 |
description => "Add maxlength for fields 005 to 007 in MARC21", |
7 |
up => sub { |
8 |
my ($args) = @_; |
9 |
my ( $dbh, $out ) = @$args{qw(dbh out)}; |
10 |
|
11 |
if ( C4::Context->preference('marcflavour') eq 'MARC21' ) { |
12 |
my ( $count ) = $dbh->selectrow_array( |
13 |
q{SELECT COUNT(*) FROM marc_subfield_structure WHERE tagfield in ('005','006','007') AND maxlength=9999} |
14 |
); |
15 |
$dbh->do( |
16 |
q{UPDATE marc_subfield_structure SET maxlength=16 WHERE tagfield='005' AND maxlength=9999} |
17 |
); |
18 |
$dbh->do( |
19 |
q{UPDATE marc_subfield_structure SET maxlength=18 WHERE tagfield='006' AND maxlength=9999} |
20 |
); |
21 |
$dbh->do( |
22 |
q{UPDATE marc_subfield_structure SET maxlength=23 WHERE tagfield='007' AND maxlength=9999} |
23 |
); |
24 |
my ( $count2 ) = $dbh->selectrow_array( |
25 |
q{SELECT COUNT(*) FROM marc_subfield_structure WHERE tagfield in ('005','006','007') AND maxlength=9999} |
26 |
); |
27 |
say_success( $out, "Adjusted maxlength in $count records/fields" ) if $count; |
28 |
say_warning( $out, "$count2 records remaining" ) if $count2; |
29 |
} |
30 |
}, |
31 |
}; |