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(q{UPDATE marc_subfield_structure SET maxlength=16 WHERE tagfield='005' AND maxlength=9999}); |
16 |
$dbh->do(q{UPDATE marc_subfield_structure SET maxlength=18 WHERE tagfield='006' AND maxlength=9999}); |
17 |
$dbh->do(q{UPDATE marc_subfield_structure SET maxlength=23 WHERE tagfield='007' AND maxlength=9999}); |
18 |
my ($count2) = $dbh->selectrow_array( |
19 |
q{SELECT COUNT(*) FROM marc_subfield_structure WHERE tagfield in ('005','006','007') AND maxlength=9999} |
20 |
); |
21 |
say_success( $out, "Adjusted maxlength in $count records/fields" ) if $count; |
22 |
say_warning( $out, "$count2 records remaining" ) if $count2; |
23 |
} |
24 |
}, |
25 |
}; |