item rework: moved GetItem
authorGalen Charlton <galen.charlton@liblime.com>
Thu, 3 Jan 2008 18:36:21 +0000 (12:36 -0600)
committerJoshua Ferraro <jmf@liblime.com>
Thu, 3 Jan 2008 22:24:04 +0000 (16:24 -0600)
Moved from C4::Biblio to C4::Items.

Signed-off-by: Chris Cormack <crc@liblime.com>
Signed-off-by: Joshua Ferraro <jmf@liblime.com>

C4/Biblio.pm
C4/Items.pm
C4/Reserves.pm
opac/opac-reserve.pl
opac/opac-user.pl
opac/sco/sco-main.pl
reserve/placerequest.pl
virtualshelves/shelves.pl

index 2c7ee4f..d637cf7 100755 (executable)
@@ -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
index 02aebe1..2624f7e 100644 (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
index 847f7d1..2a5a2fd 100644 (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;
index 6e07518..98fa43f 100755 (executable)
@@ -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;
index a7b8d61..4e32b4b 100755 (executable)
@@ -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
index 83c3176..1fcd091 100755 (executable)
@@ -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)
index 64eb94a..36379f8 100755 (executable)
@@ -23,6 +23,7 @@
 
 use strict;
 use C4::Biblio;
+use C4::Items;
 use CGI;
 use C4::Output;
 use C4::Reserves;
index 79c4495..6c82e53 100755 (executable)
@@ -67,6 +67,7 @@ use strict;
 use CGI;
 use C4::VirtualShelves;
 use C4::Biblio;
+use C4::Items;
 use C4::Auth;
 use C4::Output;