[Koha-patches] [PATCH] [SIGNED-OFF] Bug 5915 : C4::AuthoritiesMarc AddAuthority
Jonathan Druart
jonathan.druart at biblibre.com
Tue Apr 5 11:04:42 CEST 2011
From: Paul Poulain <paul.poulain at biblibre.com>
Fixing 100$a simple error: Sometimes, language is encoded fre50 and not
frey50.
This patch adds check for that problem
Signed-off-by: Jonathan Druart <jonathan.druart at biblibre.com>
---
C4/AuthoritiesMarc.pm | 20 ++++++++++++--------
1 files changed, 12 insertions(+), 8 deletions(-)
diff --git a/C4/AuthoritiesMarc.pm b/C4/AuthoritiesMarc.pm
index 0122ca8..6d6d9c1 100644
--- a/C4/AuthoritiesMarc.pm
+++ b/C4/AuthoritiesMarc.pm
@@ -651,17 +651,21 @@ sub AddAuthority {
}
}
- if (($format eq "UNIMARCAUTH") && (!$record->subfield('100','a'))){
+ if ($format eq "UNIMARCAUTH") {
$record->leader(" nx j22 ") unless ($record->leader());
my $date=POSIX::strftime("%Y%m%d",localtime);
- if ($record->field('100')){
+ 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");
- } else {
- $record->append_fields(
- MARC::Field->new('100',' ',' '
- ,'a'=>$date."afrey50 ba0")
- );
- }
+ } else {
+ $record->append_fields(
+ MARC::Field->new('100',' ',' '
+ ,'a'=>$date."afrey50 ba0")
+ );
+ }
}
my ($auth_type_tag, $auth_type_subfield) = get_auth_type_location($authtypecode);
if (!$authid and $format eq "MARC21") {
--
1.7.1
More information about the Koha-patches
mailing list