Use MARCAuthorityControlField008 in AddAuthority for empty 008s

The old default value for field 008 didn't have the correct length,
which could potentially cause data corruptions.

Uses the MARCAuthorityControlField008 preference added by BUG4839.

http://bugs.koha-community.org/show_bug.cgi?id=7072
Signed-off-by: Jared Camins-Esakov <jcamins@cpbibliography.com>
Signed-off-by: Paul Poulain <paul.poulain@biblibre.com>
(cherry picked from commit 6408547cc0)

Signed-off-by: Chris Nighswonger <chris.nighswonger@gmail.com>
(cherry picked from commit df6f4d0c34)

Signed-off-by: Chris Nighswonger <chris.nighswonger@gmail.com>
This commit is contained in:
Frédérick Capovilla 2011-10-20 12:05:02 -04:00 committed by Chris Nighswonger
parent b444177688
commit fc37c59432
1 changed files with 10 additions and 3 deletions

View File

@ -639,9 +639,16 @@ sub AddAuthority {
}
my $date=POSIX::strftime("%y%m%d",localtime);
if (!$record->field('008')) {
$record->insert_fields_ordered(
MARC::Field->new('008',$date."|||a|||||| | ||| d")
);
# Get a valid default value for field 008
my $default_008 = C4::Context->preference('MARCAuthorityControlField008');
if(!$default_008 or length($default_008)<34) {
$default_008 = '|| aca||aabn | a|a d';
}
else {
$default_008 = substr($default_008,0,34);
}
$record->insert_fields_ordered( MARC::Field->new('008',$date.$default_008) );
}
if (!$record->field('040')) {
$record->insert_fields_ordered(