Added a new system preference to set the UNIMARC field 100 default language.
The default value for that system preference is 'fre'.
Changed Biblio.pm to use the system preference:
- if the language is bad filled in the preferences it uses 'fre' as default value
- only replaces the language when the field 100 is empty
- if the language is filled with the plugin only replaces the positions 25-28 to 'y50'
Signed-off-by: Rolando Isodoro <rolando.isidoro@gmail.com>
Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
Signed-off-by: Jared Camins-Esakov <jcamins@cpbibliography.com>
# deal with UNIMARC field 100 (encoding) : create it if needed & set encoding to unicode
if ( $encoding eq "UNIMARC" ) {
+ my $defaultlanguage = C4::Context->preference("UNIMARCField100Language");
+ $defaultlanguage = "fre" if (!$defaultlanguage || length($defaultlanguage) != 3);
my $string = $record->subfield( 100, "a" );
if ( ($string) && ( length( $record->subfield( 100, "a" ) ) == 36 ) ) {
my $f100 = $record->field(100);
$string = POSIX::strftime( "%Y%m%d", localtime );
$string =~ s/\-//g;
$string = sprintf( "%-*s", 35, $string );
+ substr ( $string, 22, 3, $defaultlanguage);
}
- substr( $string, 22, 6, "frey50" );
+ substr( $string, 25, 3, "y50" );
unless ( $record->subfield( 100, "a" ) ) {
$record->insert_fields_ordered( MARC::Field->new( 100, "", "", "a" => $string ) );
}
my $dbh = C4::Context->dbh;
+ my $defaultlanguage = C4::Context->preference("UNIMARCField100Language");
+ $defaultlanguage = "fre" if (!$defaultlanguage || length($defaultlanguage) != 3);
+
my ( $template, $loggedinuser, $cookie ) = get_template_and_user(
{
template_name => "cataloguing/value_builder/unimarc_field_100.tmpl",
debug => 1,
}
);
- $result = ' d u y0frey50 ba' unless $result;
+ $result = " d u y0".$defaultlanguage."y50 ba" unless $result;
my $f1 = substr( $result, 0, 8 );
if ( $f1 eq ' ' ) {
my @today = Date::Calc::Today();
INSERT IGNORE INTO systempreferences (variable,value,explanation,options,type) VALUES('IDreamBooksResults','0','Display IDreamBooks.com rating in search results','','YesNo');
INSERT INTO systempreferences (variable,value,options,explanation,type) VALUES ('OPACNumbersPreferPhrase','0', NULL, 'Control the use of phr operator in callnumber and standard number OPAC searches', 'YesNo');
INSERT INTO systempreferences (variable,value,options,explanation,type) VALUES ('IntranetNumbersPreferPhrase','0', NULL, 'Control the use of phr operator in callnumber and standard number staff client searches', 'YesNo');
+INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES('UNIMARCField100Language', 'fre','UNIMARC field 100 default language',NULL,'short');
+
#!/usr/bin/perl
# Database Updater
SetVersion ($DBversion);
}
+$DBversion = "3.11.00.XXX";
+if ( C4::Context->preference("Version") < TransformToNum($DBversion) ) {
+ $dbh->do("INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES('UNIMARCField100Language', 'fre','UNIMARC field 100 default language',NULL,'short')");
+ print "Upgrade to $DBversion done (Bug 8347 - Koha forces UNIMARC 100 field code language to 'fre')\n";
+ SetVersion($DBversion);
+}
=head1 FUNCTIONS