# Koha; if not, write to the Free Software Foundation, Inc., 59 Temple Place,
# Suite 330, Boston, MA 02111-1307 USA
-# $Id$
use strict;
require Exporter;
my $library_name = C4::Context->preference("LibraryName");
# set the version for version checking
-$VERSION = do { my @v = '$Revision$' =~ /\d+/g; shift(@v) . "." . join( "_", map { sprintf "%03d", $_ } @v ); };
+$VERSION = 3.00;
=head1 NAME
my $dbh = C4::Context->dbh;
my $const = lc substr( $constraint, 0, 1 );
my $query = qq/
- SELECT * FROM borrowers,categories
+ SELECT * FROM borrowers
+ LEFT JOIN categories ON borrowers.categorycode = categories.categorycode
WHERE borrowernumber = ?
- AND borrowers.categorycode = categories.categorycode
/;
my $sth = $dbh->prepare($query);
$sth->execute($borrowernumber);
# first find biblioitem records
my @biblioitems;
my $sth1 = $dbh->prepare(
- "SELECT * FROM biblio,biblioitems
- WHERE (biblio.biblionumber = ?)
- AND (biblio.biblionumber = biblioitems.biblionumber)"
+ "SELECT * FROM biblio LEFT JOIN biblioitems on biblio.biblionumber = biblioitems.biblionumber
+ WHERE (biblio.biblionumber = ?)"
);
$sth1->execute($biblionumber);
while ( my $data1 = $sth1->fetchrow_hashref ) {
# Look up the item by itemnumber
my $query = "
SELECT items.biblionumber, items.biblioitemnumber, itemtypes.notforloan
- FROM items, biblioitems, itemtypes
- WHERE items.biblioitemnumber = biblioitems.biblioitemnumber
- AND biblioitems.itemtype = itemtypes.itemtype
- AND itemnumber=$qitem
+ FROM items
+ LEFT JOIN biblioitems ON items.biblioitemnumber = biblioitems.biblioitemnumber
+ LEFT JOIN itemtypes ON biblioitems.itemtype = itemtypes.itemtype
+ WHERE itemnumber=$qitem
";
$sth = $dbh->prepare($query);
}
# Look up the item by barcode
my $query = "
SELECT items.biblionumber, items.biblioitemnumber, itemtypes.notforloan
- FROM items, biblioitems, itemtypes
+ FROM items
+ LEFT JOIN biblioitems ON items.biblioitemnumber = biblioitems.biblioitemnumber
+ LEFT JOIN itemtypes ON biblioitems.itemtype = itemtypes.itemtype
WHERE items.biblioitemnumber = biblioitems.biblioitemnumber
AND biblioitems.itemtype = itemtypes.itemtype
AND barcode=$qbc
sub CancelReserve {
my ( $biblio, $item, $borr ) = @_;
my $dbh = C4::Context->dbh;
- if ( ( $item and $borr ) and ( not $biblio ) ) {
+ if ( $item and $borr ) {
# removing a waiting reserve record....
# update the database...
my $query = "
$sth->execute( $item, $borr );
$sth->finish;
}
- if ( ( $biblio and $borr ) and ( not $item ) ) {
+ else {
# removing a reserve record....
# get the prioritiy on this record....
my $priority;