[Koha-cvs] koha/C4 Biblio.pm
Antoine Farnault
antoine at koha-fr.org
Fri Aug 11 18:04:07 CEST 2006
CVSROOT: /sources/koha
Module name: koha
Changes by: Antoine Farnault <toins> 06/08/11 16:04:07
Modified files:
C4 : Biblio.pm
Log message:
re-input an old function.
CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/koha/C4/Biblio.pm?cvsroot=koha&r1=1.176&r2=1.177
Patches:
Index: Biblio.pm
===================================================================
RCS file: /sources/koha/koha/C4/Biblio.pm,v
retrieving revision 1.176
retrieving revision 1.177
diff -u -b -r1.176 -r1.177
--- Biblio.pm 10 Aug 2006 12:44:12 -0000 1.176
+++ Biblio.pm 11 Aug 2006 16:04:07 -0000 1.177
@@ -50,7 +50,7 @@
&getbiblioitembybiblionumber
&getbiblioitem &getitemsbybiblioitem
&skip &getitemtypes
-
+ &get_itemnumbers_of
&MARCfind_oldbiblionumber_from_MARCbibid
&MARCfind_MARCbibid_from_oldbiblionumber
@@ -371,26 +371,24 @@
my $sth = $dbh->prepare("select marcxml from biblioitems where biblionumber=? " );
$sth->execute($bibid);
my ($marcxml)=$sth->fetchrow;
- $marcxml =~ s/\<subfield code="[A-Z><]"\>/\<subfield code="a"\>/g;
+# $marcxml =~ s/\<subfield code="[A-Z><]"\>/\<subfield code="a"\>/g;
my $record = MARC::Record->new();
$record = MARC::Record::new_from_xml( $marcxml,'utf8' ) if $marcxml;
return $record;
}
############OLD VERSION HERE###############################################
# # Returns MARC::Record of the biblio passed in parameter.
+#sub MARCgetbiblio {
# my ( $dbh, $bibid ) = @_;
-#
-#
-# my $sth =
-# $dbh->prepare("select marcxml from biblioitems where biblionumber=? " );
-#
+# my $dbh = C4::Context->dbh;
+# my $sth = $dbh->prepare("select marcxml from biblioitems where biblionumber=? ");
# $sth->execute($bibid);
# my ($marc)=$sth->fetchrow;
# my $record = MARC::File::USMARC::decode($marc);
-#warn "=>".$record->as_formatted;
+# warn "=>".$record->as_formatted;
# return $record;
-#
#}
+#
#############################################################################
sub XMLgetbiblio {
@@ -403,12 +401,10 @@
$sth->execute($biblionumber);
my ($marc)=$sth->fetchrow;
- warn "******FOOO********";
$marc=MARC::File::USMARC::decode($marc);
# print Dumper($marc);
my $marcxml=$marc->as_xml_record();
print Dumper($marcxml);
- warn "*******BAR2******";
return $marcxml;
}
sub MARCgetbiblio2 {
@@ -2482,6 +2478,42 @@
return ( $count, @results );
} # sub getitemsbybiblioitem
+
+=head2 get_itemnumbers_of
+
+ my @itemnumbers_of = get_itemnumbers_of(@biblionumbers);
+
+Given a list of biblionumbers, return the list of corresponding itemnumbers
+for each biblionumber.
+
+Return a reference on a hash where keys are biblionumbers and values are
+references on array of itemnumbers.
+
+=cut
+sub get_itemnumbers_of {
+ my @biblionumbers = @_;
+
+ my $dbh = C4::Context->dbh;
+
+ my $query = '
+SELECT itemnumber,
+ biblionumber
+ FROM items
+ WHERE biblionumber IN (?'.(',?' x scalar @biblionumbers - 1).')
+';
+ my $sth = $dbh->prepare($query);
+ $sth->execute(@biblionumbers);
+
+ my %itemnumbers_of;
+
+ while (my ($itemnumber, $biblionumber) = $sth->fetchrow_array) {
+ push @{$itemnumbers_of{$biblionumber}}, $itemnumber;
+ }
+
+ return \%itemnumbers_of;
+}
+
+
sub logchange {
# Subroutine to log changes to databases
@@ -2946,8 +2978,11 @@
=cut
-# $Id: Biblio.pm,v 1.176 2006/08/10 12:44:12 toins Exp $
+# $Id: Biblio.pm,v 1.177 2006/08/11 16:04:07 toins Exp $
# $Log: Biblio.pm,v $
+# Revision 1.177 2006/08/11 16:04:07 toins
+# re-input an old function.
+#
# Revision 1.176 2006/08/10 12:44:12 toins
# sync with dev_week.
#
More information about the Koha-cvs
mailing list