-=head2 &GetBiblioItemData
-
- $itemdata = &GetBiblioItemData($biblioitemnumber);
-
-Looks up the biblioitem with the given biblioitemnumber. Returns a
-reference-to-hash. The keys are the fields from the C<biblio>,
-C<biblioitems>, and C<itemtypes> tables in the Koha database, except
-that C<biblioitems.notes> is given as C<$itemdata-E<gt>{bnotes}>.
-
-=cut
-
-#'
-sub GetBiblioItemData {
- my ($biblioitemnumber) = @_;
- my $dbh = C4::Context->dbh;
- my $query = "SELECT *,biblioitems.notes AS bnotes
- FROM biblio LEFT JOIN biblioitems on biblio.biblionumber=biblioitems.biblionumber ";
- unless ( C4::Context->preference('item-level_itypes') ) {
- $query .= "LEFT JOIN itemtypes on biblioitems.itemtype=itemtypes.itemtype ";
- }
- $query .= " WHERE biblioitemnumber = ? ";
- my $sth = $dbh->prepare($query);
- my $data;
- $sth->execute($biblioitemnumber);
- $data = $sth->fetchrow_hashref;
- $sth->finish;
- return ($data);
-} # sub &GetBiblioItemData
-
-=head2 GetBiblioItemByBiblioNumber
-
-NOTE : This function has been copy/paste from C4/Biblio.pm from head before zebra integration.
-
-=cut
-
-sub GetBiblioItemByBiblioNumber {
- my ($biblionumber) = @_;
- my $dbh = C4::Context->dbh;
- my $sth = $dbh->prepare("Select * FROM biblioitems WHERE biblionumber = ?");
- my $count = 0;
- my @results;
-
- $sth->execute($biblionumber);
-
- while ( my $data = $sth->fetchrow_hashref ) {
- push @results, $data;
- }
-
- $sth->finish;
- return @results;
-}
-
-=head2 GetBiblionumberFromItemnumber
-
-
-=cut
-
-sub GetBiblionumberFromItemnumber {
- my ($itemnumber) = @_;
- my $dbh = C4::Context->dbh;
- my $sth = $dbh->prepare("Select biblionumber FROM items WHERE itemnumber = ?");
-
- $sth->execute($itemnumber);
- my ($result) = $sth->fetchrow;
- return ($result);
-}
-
-=head2 GetBiblioFromItemNumber
-
- $item = &GetBiblioFromItemNumber($itemnumber,$barcode);
-
-Looks up the item with the given itemnumber. if undef, try the barcode.
-
-C<&itemnodata> returns a reference-to-hash whose keys are the fields
-from the C<biblio>, C<biblioitems>, and C<items> tables in the Koha
-database.
-
-=cut
-
-#'
-sub GetBiblioFromItemNumber {
- my ( $itemnumber, $barcode ) = @_;
- my $dbh = C4::Context->dbh;
- my $sth;
- if ($itemnumber) {
- $sth = $dbh->prepare(
- "SELECT * FROM items
- LEFT JOIN biblio ON biblio.biblionumber = items.biblionumber
- LEFT JOIN biblioitems ON biblioitems.biblioitemnumber = items.biblioitemnumber
- WHERE items.itemnumber = ?"
- );
- $sth->execute($itemnumber);
- } else {
- $sth = $dbh->prepare(
- "SELECT * FROM items
- LEFT JOIN biblio ON biblio.biblionumber = items.biblionumber
- LEFT JOIN biblioitems ON biblioitems.biblioitemnumber = items.biblioitemnumber
- WHERE items.barcode = ?"
- );
- $sth->execute($barcode);
- }
- my $data = $sth->fetchrow_hashref;
- $sth->finish;
- return ($data);
-}
-