[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Koha-cvs] koha/C4 Breeding.pm
From: |
Antoine Farnault |
Subject: |
[Koha-cvs] koha/C4 Breeding.pm |
Date: |
Tue, 10 Jul 2007 14:34:32 +0000 |
CVSROOT: /sources/koha
Module name: koha
Changes by: Antoine Farnault <toins> 07/07/10 14:34:32
Modified files:
C4 : Breeding.pm
Log message:
bug fix : Sometime importing biblio return no breedingid.
+ remove warn compilation
+ remove pod error.
CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/koha/C4/Breeding.pm?cvsroot=koha&r1=1.15&r2=1.16
Patches:
Index: Breeding.pm
===================================================================
RCS file: /sources/koha/koha/C4/Breeding.pm,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -b -r1.15 -r1.16
--- Breeding.pm 29 Mar 2007 13:30:31 -0000 1.15
+++ Breeding.pm 10 Jul 2007 14:34:32 -0000 1.16
@@ -58,16 +58,25 @@
@ISA = qw(Exporter);
@EXPORT = qw(&ImportBreeding &BreedingSearch);
+=head2 ImportBreeding
+
+
ImportBreeding($marcrecords,$overwrite_biblio,$filename,$encoding,$z3950random);
+
+ TODO description
+
+=cut
+
sub ImportBreeding {
my ($marcrecords,$overwrite_biblio,$filename,$encoding,$z3950random) = @_;
my @marcarray = split /\x1D/, $marcrecords;
+
my $dbh = C4::Context->dbh;
my $searchisbn = $dbh->prepare("select biblioitemnumber from biblioitems
where isbn=?");
my $searchissn = $dbh->prepare("select biblioitemnumber from biblioitems
where issn=?");
- my $searchbreeding = $dbh->prepare("select id from marc_breeding
-where isbn=? and title=?");
+ my $searchbreeding = $dbh->prepare("select id from marc_breeding where
isbn=? and title=?");
my $insertsql = $dbh->prepare("insert into marc_breeding
(file,isbn,title,author,marc,encoding,z3950random) values(?,?,?,?,?,?,?)");
my $replacesql = $dbh->prepare("update marc_breeding set
file=?,isbn=?,title=?,author=?,marc=?,encoding=?,z3950random=? where id=?");
+
$encoding = C4::Context->preference("marcflavour") unless $encoding;
# fields used for import results
my $imported=0;
@@ -77,7 +86,9 @@
my $breedingid;
for (my $i=0;$i<=$#marcarray;$i++) {
my $marcrecord = FixEncoding($marcarray[$i]."\x1D");
+
my @warnings = $marcrecord->warnings();
+
if (scalar($marcrecord->fields()) == 0) {
$notmarcrecord++;
} else {
@@ -107,7 +118,6 @@
$alreadyindb++;
} else {
# search in breeding farm
-# my $breedingid;
if ($oldbiblio->{isbn}) {
$searchbreeding->execute($oldbiblio->{isbn},$oldbiblio->{title});
($breedingid) = $searchbreeding->fetchrow;
@@ -115,12 +125,12 @@
$searchbreeding->execute($oldbiblio->{issn},$oldbiblio->{title});
($breedingid) = $searchbreeding->fetchrow;
}
- if ($breedingid && $overwrite_biblio eq 0) {
+ if ($breedingid && $overwrite_biblio eq '0') {
$alreadyinfarm++;
} else {
my $recoded;
$recoded = $marcrecord->as_usmarc();
- if ($breedingid && $overwrite_biblio eq 1) {
+ if ($breedingid && $overwrite_biblio eq '1') {
$replacesql
->execute($filename,substr($oldbiblio->{isbn}.$oldbiblio->{issn},0,$isbnlength),$oldbiblio->{title},$oldbiblio->{author},$recoded,$encoding,$z3950random,$breedingid);
} else {
$insertsql
->execute($filename,substr($oldbiblio->{isbn}.$oldbiblio->{issn},0,$isbnlength),$oldbiblio->{title},$oldbiblio->{author},$recoded,$encoding,$z3950random);
@@ -135,7 +145,7 @@
}
-=item BreedingSearch
+=head2 BreedingSearch
($count, @results) = &BreedingSearch($title,$isbn,$random);
C<$title> contains the title,
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Koha-cvs] koha/C4 Breeding.pm,
Antoine Farnault <=