[Koha-cvs] koha/C4 Acquisition.pm

Robert Lyon bob at katipo.co.nz
Wed Dec 13 21:02:34 CET 2006


CVSROOT:	/sources/koha
Module name:	koha
Changes by:	Robert Lyon <bob_lyon>	06/12/13 20:02:34

Modified files:
	C4             : Acquisition.pm 

Log message:
	Adding in missing subroutine bookseller

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/koha/C4/Acquisition.pm?cvsroot=koha&r1=1.47&r2=1.48

Patches:
Index: Acquisition.pm
===================================================================
RCS file: /sources/koha/koha/C4/Acquisition.pm,v
retrieving revision 1.47
retrieving revision 1.48
diff -u -b -r1.47 -r1.48
--- Acquisition.pm	20 Sep 2006 21:48:44 -0000	1.47
+++ Acquisition.pm	13 Dec 2006 20:02:34 -0000	1.48
@@ -17,7 +17,7 @@
 # Koha; if not, write to the Free Software Foundation, Inc., 59 Temple Place,
 # Suite 330, Boston, MA  02111-1307 USA
 
-# $Id: Acquisition.pm,v 1.47 2006/09/20 21:48:44 tgarip1957 Exp $
+# $Id: Acquisition.pm,v 1.48 2006/12/13 20:02:34 bob_lyon Exp $
 
 use strict;
 require Exporter;
@@ -30,7 +30,7 @@
 use vars qw($VERSION @ISA @EXPORT);
 
 # set the version for version checking
-$VERSION = do { my @v = '$Revision: 1.47 $' =~ /\d+/g; shift(@v) . "." . join( "_", map { sprintf "%03d", $_ } @v ); };
+$VERSION = do { my @v = '$Revision: 1.48 $' =~ /\d+/g; shift(@v) . "." . join( "_", map { sprintf "%03d", $_ } @v ); };
 
 # used in receiveorder subroutine
 # to provide library specific handling
@@ -63,6 +63,7 @@
    &GetHistory
   &ModOrder &ModReceiveOrder 
   &GetSingleOrder
+  &bookseller
 );
 
 
@@ -959,6 +960,39 @@
     return \@order_loop, $total_qty, $total_price, $total_qtyreceived;
 }
 
+#------------------------------------------------------------#
+
+=head3 bookseller
+
+=over 4
+
+($count, @results) = &bookseller($searchstring);
+
+Looks up a book seller. C<$searchstring> may be either a book seller
+ID, or a string to look for in the book seller's name.
+
+C<$count> is the number of elements in C<@results>. C<@results> is an
+array of references-to-hash, whose keys are the fields of of the
+aqbooksellers table in the Koha database.
+
+=back
+
+=cut
+
+sub bookseller {
+        my ($searchstring) = @_;
+        my $dbh            = C4::Context->dbh;
+        my $sth            =
+        $dbh->prepare("Select * from aqbooksellers where name like ? or id = ?");
+        $sth->execute( "$searchstring%", $searchstring );
+        my @results;
+        while ( my $data = $sth->fetchrow_hashref ) {
+	            push( @results, $data );
+	        }
+        $sth->finish;
+        return ( scalar(@results), @results );
+}
+
 END { }    # module clean-up code here (global destructor)
 
 1;





More information about the Koha-cvs mailing list