From a36df3c08e65fa23a7f27e0385892ef0301fa856 Mon Sep 17 00:00:00 2001 From: Vitor FERNANDES Date: Mon, 26 Nov 2012 12:28:39 +0000 Subject: [PATCH] [PASSED QA] BUG 9145: Authorities: standard language for UNIMARC New Authority system preference created UNIMARCAuthorityField100 with default value "afrey50 ba0". AuthoritiesMarc.pm uses the system preference instead of label "afrey50 ba0". Signed-off-by: Jonathan Druart Signed-off-by: Katrin Fischer Works as described, all tests and QA script pass. 1) Check system preference is created correctly. 2) Change pref. 3) Catalog a new authority. 4) Change framework to make 100 show in frameworks or check in the the database, that now 100 has the new defined value. --- C4/AuthoritiesMarc.pm | 7 ++++--- authorities/authorities.pl | 11 ----------- installer/data/mysql/sysprefs.sql | 1 + installer/data/mysql/updatedatabase.pl | 7 +++++++ .../en/modules/admin/preferences/authorities.pref | 6 ++++++ 5 files changed, 18 insertions(+), 14 deletions(-) diff --git a/C4/AuthoritiesMarc.pm b/C4/AuthoritiesMarc.pm index 4a3392f..b6e3690 100644 --- a/C4/AuthoritiesMarc.pm +++ b/C4/AuthoritiesMarc.pm @@ -706,17 +706,18 @@ sub AddAuthority { if ($format eq "UNIMARCAUTH") { $record->leader(" nx j22 ") unless ($record->leader()); - my $date=POSIX::strftime("%Y%m%d",localtime); + my $date=POSIX::strftime("%Y%m%d",localtime); + my $defaultfield100 = C4::Context->preference('UNIMARCAuthorityField100'); if (my $string=$record->subfield('100',"a")){ $string=~s/fre50/frey50/; $record->field('100')->update('a'=>$string); } elsif ($record->field('100')){ - $record->field('100')->update('a'=>$date."afrey50 ba0"); + $record->field('100')->update('a'=>$date.$defaultfield100); } else { $record->append_fields( MARC::Field->new('100',' ',' ' - ,'a'=>$date."afrey50 ba0") + ,'a'=>$date.$defaultfield100) ); } } diff --git a/authorities/authorities.pl b/authorities/authorities.pl index ee842e0..19a03e8 100755 --- a/authorities/authorities.pl +++ b/authorities/authorities.pl @@ -583,17 +583,6 @@ if ($op eq "add") { my @ind_tag = $input->param('ind_tag'); my @indicator = $input->param('indicator'); my $record = TransformHtmlToMarc($input); - if (C4::Context->preference("marcflavour") eq "UNIMARC"){ - unless ($record->field('100')){ - use POSIX qw(strftime); - my $string = strftime( "%Y%m%d", localtime(time) ); - # set 50 to position 26 is biblios, 13 if authorities - my $pos=13; - $string = sprintf( "%-*s", 35, $string ); - substr( $string, $pos , 2, "50" ); - $record->append_fields(MARC::Field->new('100','','',"a"=>$string)); - } - } my ($duplicateauthid,$duplicateauthvalue); ($duplicateauthid,$duplicateauthvalue) = FindDuplicateAuthority($record,$authtypecode) if ($op eq "add") && (!$is_a_modif); diff --git a/installer/data/mysql/sysprefs.sql b/installer/data/mysql/sysprefs.sql index 9032bfa..6242a47 100644 --- a/installer/data/mysql/sysprefs.sql +++ b/installer/data/mysql/sysprefs.sql @@ -321,6 +321,7 @@ INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES ( INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('UseTransportCostMatrix',0,"Use Transport Cost Matrix when filling holds",'','YesNo'); INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES ('BasketConfirmations', '1', 'When closing or reopening a basket,', 'always ask for confirmation.|do not ask for confirmation.', 'Choice'); INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES ('MARCAuthorityControlField008', '|| aca||aabn | a|a d', NULL, NULL, 'Textarea'); +INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES ('UNIMARCAuthorityField100', 'afrey50 ba0', NULL, NULL, 'Textarea'); INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES('OpenLibraryCovers',0,'If ON Openlibrary book covers will be show',NULL,'YesNo'); INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('BorrowerUnwantedField','','Name the fields you don\'t need to store for a patron\'s account',NULL,'free'); INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES ('OpacKohaUrl','1',"Show 'Powered by Koha' text on OPAC footer.",NULL,NULL); diff --git a/installer/data/mysql/updatedatabase.pl b/installer/data/mysql/updatedatabase.pl index ed922b8..e44c109 100755 --- a/installer/data/mysql/updatedatabase.pl +++ b/installer/data/mysql/updatedatabase.pl @@ -6399,6 +6399,13 @@ if ( CheckVersion($DBversion) ) { SetVersion($DBversion); } +$DBversion = "XXX"; +if (C4::Context->preference("Version") < TransformToNum($DBversion)) { + $dbh->do("INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES ('UNIMARCAuthorityField100', 'afrey50 ba0', NULL, NULL, 'Textarea')"); + print "Upgrade to $DBversion done (Bug 9144 - Add syspref UNIMARCAuthorityField100)\n"; + SetVersion ($DBversion); +} + =head1 FUNCTIONS diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/authorities.pref b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/authorities.pref index f4cc9e3..2369e2f 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/authorities.pref +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/authorities.pref @@ -43,6 +43,12 @@ Authorities: yes: Use no: "Don't use" - authority record numbers instead of text strings for searches from subject tracings. + - + - Use the following text for the contents of UNIMARC authority field 100 position (fixed length data elements). Do NOT include the date (position 00-05). + - pref: UNIMARCAuthorityField100 + defautl: "afrey50 ba0" + type: textarea + class: code Linker: - - Use the -- 1.7.9.5