From 4911e528ce62f9f99bad69f936571534dc0110cb Mon Sep 17 00:00:00 2001 From: Vitor FERNANDES Date: Wed, 5 Dec 2012 15:34:24 +0000 Subject: [PATCH] [PASSED QA] BUG 8347 - Koha forces UNIMARC 100 field code language to 'fre' Changed Charset.pm to use defaultlanguage instead of 'fre'. http://bugs.koha-community.org/show_bug.cgi?id=8347 Signed-off-by: Katrin Fischer Passes all tests and QA script. 1) Check system preference was added correctly: UNIMARCField100Language 2) Change code in preference to be not 'fre'. 3) Catalog a bibliographic record. - check plugin shows new value - check empty field is filled with new value from the plugin - check you can still edit it to be something else --- C4/Charset.pm | 11 +++++++---- installer/data/mysql/sysprefs.sql | 1 - installer/data/mysql/updatedatabase.pl | 1 - 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/C4/Charset.pm b/C4/Charset.pm index c294b36..f8ddd63 100644 --- a/C4/Charset.pm +++ b/C4/Charset.pm @@ -324,8 +324,10 @@ sub SetMarcUnicodeFlag { substr($leader, 9, 1) = 'a'; $marc_record->leader($leader); } elsif ($marc_flavour =~/UNIMARC/) { + my $defaultlanguage = C4::Context->preference("UNIMARCField100Language"); + $defaultlanguage = "fre" if (!$defaultlanguage || length($defaultlanguage) != 3); my $string; - my ($subflength,$encodingposition)=($marc_flavour=~/AUTH/?(21,9):(36,22)); + my ($subflength,$encodingposition)=($marc_flavour=~/AUTH/?(21,12):(36,25)); $string=$marc_record->subfield( 100, "a" ); if (defined $string && length($string)==$subflength) { $string = substr $string, 0,$subflength if (length($string)>$subflength); @@ -333,9 +335,10 @@ sub SetMarcUnicodeFlag { else { $string = POSIX::strftime( "%Y%m%d", localtime ); $string =~ s/\-//g; - $string = sprintf( "%-*s", $subflength, $string ); + $string = sprintf( "%-*s", $subflength, $string ); + substr ( $string, ($encodingposition - 3), 3, $defaultlanguage); } - substr( $string, $encodingposition, 8, "frey50 " ); + substr( $string, $encodingposition, 3, "y50" ); if ( $marc_record->subfield( 100, "a" ) ) { $marc_record->field('100')->update(a=>$string); } @@ -343,7 +346,7 @@ sub SetMarcUnicodeFlag { $marc_record->insert_grouped_field( MARC::Field->new( 100, '', '', "a" => $string ) ); } - $debug && warn "encodage: ", substr( $marc_record->subfield(100, 'a'), $encodingposition, 8 ); + $debug && warn "encodage: ", substr( $marc_record->subfield(100, 'a'), $encodingposition, 3 ); } else { warn "Unrecognized marcflavour: $marc_flavour"; } diff --git a/installer/data/mysql/sysprefs.sql b/installer/data/mysql/sysprefs.sql index 6f066bb..bab2709 100644 --- a/installer/data/mysql/sysprefs.sql +++ b/installer/data/mysql/sysprefs.sql @@ -389,7 +389,6 @@ INSERT INTO systempreferences (variable,value,explanation,type) VALUES('INTRAdid INSERT INTO systempreferences (variable, value, options, explanation, type) VALUES ('BlockReturnOfWithdrawnItems', '1', '0', 'If enabled, items that are marked as withdrawn cannot be returned.', 'YesNo'); INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES('HoldsToPullStartDate','2','Set the default start date for the Holds to pull list to this many days ago',NULL,'Integer'); INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES('alphabet','A B C D E F G H I J K L M N O P Q R S T U V W X Y Z','Alphabet than can be expanded into browse links, e.g. on Home > Patrons',NULL,'free'); -<<<<<<< HEAD INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES('RefundLostItemFeeOnReturn', '1', 'If enabled, the lost item fee charged to a borrower will be refunded when the lost item is returned.', NULL, 'YesNo'); INSERT INTO systempreferences (`variable`, `value`, `options`, `explanation`, `type`) VALUES ('PatronSelfRegistration', '0', NULL, 'If enabled, patrons will be able to register themselves via the OPAC.', 'YesNo'), diff --git a/installer/data/mysql/updatedatabase.pl b/installer/data/mysql/updatedatabase.pl index 31695ef..2a6b105 100755 --- a/installer/data/mysql/updatedatabase.pl +++ b/installer/data/mysql/updatedatabase.pl @@ -1,4 +1,3 @@ - #!/usr/bin/perl # Database Updater -- 1.7.9.5