[Koha-cvs] koha/C4 AuthoritiesMarc.pm [rel_2_2]
Joshua Ferraro
jmf at kados.org
Mon Apr 10 22:06:16 CEST 2006
CVSROOT: /sources/koha
Module name: koha
Branch: rel_2_2
Changes by: Joshua Ferraro <kados at savannah.gnu.org> 06/04/10 20:06:16
Modified files:
C4 : AuthoritiesMarc.pm
Log message:
Adding support for bulkauthimport of records where authid already exists.
This commit should be tested with other uses of AUTHaddauthority to ensure
it works.
CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/koha/koha/C4/AuthoritiesMarc.pm.diff?only_with_tag=rel_2_2&tr1=1.9.2.16&tr2=1.9.2.17&r1=text&r2=text
Patches:
Index: koha/C4/AuthoritiesMarc.pm
diff -u koha/C4/AuthoritiesMarc.pm:1.9.2.16 koha/C4/AuthoritiesMarc.pm:1.9.2.17
--- koha/C4/AuthoritiesMarc.pm:1.9.2.16 Mon Apr 3 12:52:50 2006
+++ koha/C4/AuthoritiesMarc.pm Mon Apr 10 20:06:15 2006
@@ -223,7 +223,7 @@
} elsif ($record->field('148')) {
$heading.= $field->as_string('abvxyz68');
} elsif ($record->field('150')) {
- $heading.= $field->as_string('abvxyz68');
+ $heading.= $field->as_string('abvxyz68');
} elsif ($record->field('151')) {
$heading.= $field->as_string('avxyz68');
} elsif ($record->field('155')) {
@@ -239,16 +239,17 @@
} else {
$heading.= $field->as_string();
}
- }
+ } #See From
foreach my $field ($record->field('4..')) {
- $summary.= " ".$field->as_string()."<br />";
- $summary.= " <i>see:</i> ".$heading."<br />";
- }
+ $seeheading.= " ".$field->as_string()."<br />";
+ $seeheading.= " <i>see:</i> ".$seeheading."<br />";
+ } #See Also
foreach my $field ($record->field('5..')) {
- $seeheading.= " <i>see also:</i> ".$field->as_string()."<br />";
+ $altheading.= " <i>see also:</i> ".$field->as_string()."<br />";
$altheading.= " ".$field->as_string()."<br />";
- $altheading.= " <i>see also:</i> ".$heading."<br />";
+ $altheading.= " <i>see also:</i> ".$altheading."<br />";
}
+ $summary.=$heading.$seeheading.$altheading;
}
}
# then add a line for the template loop
@@ -484,15 +485,22 @@
my @fields=$record->fields();
# adding main table, and retrieving authid
# if authid is sent, then it's not a true add, it's only a re-add, after a delete (ie, a mod)
-# if authid empty => true add, find a new authid number
- unless ($authid) {
+# In fact, it could still be a true add, in the case of a bulkauthimort for instance with previously
+# existing authids in the records. I've adjusted below to account for this instance --JF.
+ if ($authid) {
$dbh->do("lock tables auth_header WRITE,auth_subfield_table WRITE, auth_word WRITE, stopwords READ");
- my $sth=$dbh->prepare("insert into auth_header (datecreated,authtypecode) values (now(),?)");
- $sth->execute($authtypecode);
- $sth=$dbh->prepare("select max(authid) from auth_header");
- $sth->execute;
- ($authid)=$sth->fetchrow;
+ my $sth=$dbh->prepare("insert into auth_header (authid,datecreated,authtypecode) values (?,now(),?)");
+ $sth->execute($authid,$authtypecode);
$sth->finish;
+# if authid empty => true add, find a new authid number
+ } else {
+ $dbh->do("lock tables auth_header WRITE,auth_subfield_table WRITE, auth_word WRITE, stopwords READ");
+ my $sth=$dbh->prepare("insert into auth_header (datecreated,authtypecode) values (now(),?)");
+ $sth->execute($authtypecode);
+ $sth=$dbh->prepare("select max(authid) from auth_header");
+ $sth->execute;
+ ($authid)=$sth->fetchrow;
+ $sth->finish;
}
my $fieldcount=0;
# now, add subfields...
@@ -1069,8 +1077,13 @@
=cut
-# $Id: AuthoritiesMarc.pm,v 1.9.2.16 2006/04/03 12:52:50 tipaul Exp $
+# $Id: AuthoritiesMarc.pm,v 1.9.2.17 2006/04/10 20:06:15 kados Exp $
# $Log: AuthoritiesMarc.pm,v $
+# Revision 1.9.2.17 2006/04/10 20:06:15 kados
+# Adding support for bulkauthimport of records where authid already exists.
+# This commit should be tested with other uses of AUTHaddauthority to ensure
+# it works.
+#
# Revision 1.9.2.16 2006/04/03 12:52:50 tipaul
# oups, sorry kados, I had removed something you wrote for MARC21 authorities...
#
More information about the Koha-cvs
mailing list