item rework: moved GetItem

Moved from C4::Biblio to C4::Items.

Signed-off-by: Chris Cormack <crc@liblime.com>
Signed-off-by: Joshua Ferraro <jmf@liblime.com>
This commit is contained in:
Galen Charlton 2008-01-03 12:36:21 -06:00 committed by Joshua Ferraro
parent a4919280d2
commit 9e7c94bf96
8 changed files with 42 additions and 34 deletions

View File

@ -52,7 +52,6 @@ push @EXPORT, qw(
&GetBiblioItemByBiblioNumber
&GetBiblioFromItemNumber
&GetItem
&GetItemInfosOf
&GetItemStatus
&GetItemLocation
@ -1311,39 +1310,6 @@ sub GetBiblio {
return ( $count, @results );
} # sub GetBiblio
=head2 GetItem
=over 4
$data = &GetItem($itemnumber,$barcode);
return Item information, for a given itemnumber or barcode
=back
=cut
sub GetItem {
my ($itemnumber,$barcode) = @_;
my $dbh = C4::Context->dbh;
if ($itemnumber) {
my $sth = $dbh->prepare("
SELECT * FROM items
WHERE itemnumber = ?");
$sth->execute($itemnumber);
my $data = $sth->fetchrow_hashref;
return $data;
} else {
my $sth = $dbh->prepare("
SELECT * FROM items
WHERE barcode = ?"
);
$sth->execute($barcode);
my $data = $sth->fetchrow_hashref;
return $data;
}
} # sub GetItem
=head2 get_itemnumbers_of
=over 4

View File

@ -36,6 +36,7 @@ my $VERSION = 3.00;
# function exports
@EXPORT = qw(
GetItem
AddItemFromMarc
AddItem
ModItemFromMarc
@ -85,6 +86,41 @@ of C<C4::Items>
=cut
=head2 GetItem
=over 4
$item = GetItem($itemnumber,$barcode);
=back
Return item information, for a given itemnumber or barcode.
The return value is a hashref mapping item column
names to values.
=cut
sub GetItem {
my ($itemnumber,$barcode) = @_;
my $dbh = C4::Context->dbh;
if ($itemnumber) {
my $sth = $dbh->prepare("
SELECT * FROM items
WHERE itemnumber = ?");
$sth->execute($itemnumber);
my $data = $sth->fetchrow_hashref;
return $data;
} else {
my $sth = $dbh->prepare("
SELECT * FROM items
WHERE barcode = ?"
);
$sth->execute($barcode);
my $data = $sth->fetchrow_hashref;
return $data;
}
} # sub GetItem
=head2 AddItemFromMarc
=over 4

View File

@ -27,6 +27,7 @@ use strict;
require Exporter;
use C4::Context;
use C4::Biblio;
use C4::Items;
use C4::Search;
use C4::Circulation;
use C4::Accounts;

View File

@ -19,6 +19,7 @@ use strict;
require Exporter;
use CGI;
use C4::Biblio;
use C4::Items;
use C4::Auth; # checkauth, getborrowernumber.
use C4::Koha;
use C4::Circulation;

View File

@ -27,6 +27,7 @@ use C4::Reserves;
use C4::Members;
use C4::Output;
use C4::Biblio;
use C4::Items;
use C4::Dates qw/format_date/;
use C4::Letters;
use C4::Branch; # GetBranches

View File

@ -20,6 +20,7 @@ use C4::Members;
use HTML::Template::Pro;
use C4::Dates;
use C4::Biblio;
use C4::Items;
my $query = new CGI;
my ($template, $loggedinuser, $cookie)

View File

@ -23,6 +23,7 @@
use strict;
use C4::Biblio;
use C4::Items;
use CGI;
use C4::Output;
use C4::Reserves;

View File

@ -67,6 +67,7 @@ use strict;
use CGI;
use C4::VirtualShelves;
use C4::Biblio;
use C4::Items;
use C4::Auth;
use C4::Output;