BUG 9145: Authorities: standard language for UNIMARC
authorVitor FERNANDES <vfernandes@keep.pt>
Mon, 26 Nov 2012 12:28:39 +0000 (12:28 +0000)
committerJared Camins-Esakov <jcamins@cpbibliography.com>
Wed, 20 Feb 2013 13:42:10 +0000 (08:42 -0500)
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 <jonathan.druart@biblibre.com>
Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
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.
Signed-off-by: Jared Camins-Esakov <jcamins@cpbibliography.com>
C4/AuthoritiesMarc.pm
authorities/authorities.pl
installer/data/mysql/sysprefs.sql
installer/data/mysql/updatedatabase.pl
koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/authorities.pref

index 4a3392f..b6e3690 100644 (file)
@@ -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)
         );
     }      
   }
index ee842e0..19a03e8 100755 (executable)
@@ -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);
index 46c2371..fed22b6 100644 (file)
@@ -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);
index 15d900c..2d38546 100755 (executable)
@@ -6407,6 +6407,14 @@ 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 9145 - Add syspref UNIMARCAuthorityField100)\n";
+    SetVersion ($DBversion);
+}
+
+
 =head1 FUNCTIONS
 
 =head2 TableExists($table)
index f4cc9e3..2369e2f 100644 (file)
@@ -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