[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Koha-cvs] koha/C4 Biblio.pm [rel_2_2]
From: |
Ryan Higgins |
Subject: |
[Koha-cvs] koha/C4 Biblio.pm [rel_2_2] |
Date: |
Wed, 25 Apr 2007 14:17:18 +0000 |
CVSROOT: /sources/koha
Module name: koha
Branch: rel_2_2
Changes by: Ryan Higgins <rych> 07/04/25 14:17:18
Modified files:
C4 : Biblio.pm
Log message:
item tagorder, again- wrap in if to get around table lock
CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/koha/C4/Biblio.pm?cvsroot=koha&only_with_tag=rel_2_2&r1=1.115.2.69&r2=1.115.2.70
Patches:
Index: Biblio.pm
===================================================================
RCS file: /sources/koha/koha/C4/Biblio.pm,v
retrieving revision 1.115.2.69
retrieving revision 1.115.2.70
diff -u -b -r1.115.2.69 -r1.115.2.70
--- Biblio.pm 25 Apr 2007 06:05:29 -0000 1.115.2.69
+++ Biblio.pm 25 Apr 2007 14:17:18 -0000 1.115.2.70
@@ -26,7 +26,7 @@
use vars qw($VERSION @ISA @EXPORT);
# set the version for version checking
-$VERSION = do { my @v = '$Revision: 1.115.2.69 $' =~ /\d+/g;
+$VERSION = do { my @v = '$Revision: 1.115.2.70 $' =~ /\d+/g;
shift(@v) . "." . join("_", map {sprintf "%03d", $_ } @v);
};
@ISA = qw(Exporter);
@@ -329,21 +329,8 @@
my @fields=$record->fields();
# adding main table, and retrieving bibid
# if bibid is sent, then it's not a true add, it's only a re-add, after a
delete (ie, a mod)
- # if bibid empty => true add, find a new bibid number
- unless ($bibid) {
- $dbh->do(
- "LOCK TABLES marc_biblio WRITE,marc_subfield_table WRITE,
marc_word WRITE, marc_blob_subfield WRITE, stopwords READ"
- );
- my $sth =
- $dbh->prepare(
- "INSERT INTO marc_biblio (datecreated,biblionumber,frameworkcode)
VALUES (NOW(),?,?)"
- );
- $sth->execute( $biblionumber, $frameworkcode );
- $sth = $dbh->prepare("SELECT MAX(bibid) FROM marc_biblio");
- $sth->execute;
- ($bibid) = $sth->fetchrow;
- $sth->finish;
- }
+ # if bibid empty => true add, find a new bibid number (and there are no
items)
+ if ($bibid) {
#shift the items' tagorders for this biblio so we don't overwrite item
tags with biblio tags..
my $sth = $dbh->prepare("SELECT tagfield FROM marc_subfield_structure
WHERE kohafield LIKE 'items.%'");
$sth->execute;
@@ -361,9 +348,23 @@
}
$updatesth->execute($fieldcount,$subfieldid);
}
+ } else {
+ $dbh->do(
+ "LOCK TABLES marc_biblio WRITE,marc_subfield_table WRITE,
marc_word WRITE, marc_blob_subfield WRITE, stopwords READ"
+ );
+ my $sth =
+ $dbh->prepare(
+ "INSERT INTO marc_biblio (datecreated,biblionumber,frameworkcode)
VALUES (NOW(),?,?)"
+ );
+ $sth->execute( $biblionumber, $frameworkcode );
+ $sth = $dbh->prepare("SELECT MAX(bibid) FROM marc_biblio");
+ $sth->execute;
+ ($bibid) = $sth->fetchrow;
+ $sth->finish;
+ }
#done moving item tagorders - now write the biblio tags.
- $fieldcount = 1;
+ my $fieldcount = 1;
# save leader first
&MARCaddsubfield($dbh,$bibid,'000','',$fieldcount,'',1,$record->leader);
@@ -3034,8 +3035,11 @@
=cut
-# $Id: Biblio.pm,v 1.115.2.69 2007/04/25 06:05:29 rych Exp $
+# $Id: Biblio.pm,v 1.115.2.70 2007/04/25 14:17:18 rych Exp $
# $Log: Biblio.pm,v $
+# Revision 1.115.2.70 2007/04/25 14:17:18 rych
+# item tagorder, again- wrap in if to get around table lock
+#
# Revision 1.115.2.69 2007/04/25 06:05:29 rych
# Item tagorder bug revisited: had been merging items due to repeating tagorder
# when called from addbiblio.