[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Koha-cvs] koha/C4 Reserves2.pm [dev_week]
From: |
Chris Cormack |
Subject: |
[Koha-cvs] koha/C4 Reserves2.pm [dev_week] |
Date: |
Mon, 11 Jun 2007 22:36:41 +0000 |
CVSROOT: /sources/koha
Module name: koha
Branch: dev_week
Changes by: Chris Cormack <rangi> 07/06/11 22:36:41
Modified files:
C4 : Reserves2.pm
Log message:
Committing item level types changes, before adding itemlevel reserves
CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/koha/C4/Reserves2.pm?cvsroot=koha&only_with_tag=dev_week&r1=1.38.4.2&r2=1.38.4.3
Patches:
Index: Reserves2.pm
===================================================================
RCS file: /sources/koha/koha/C4/Attic/Reserves2.pm,v
retrieving revision 1.38.4.2
retrieving revision 1.38.4.3
diff -u -b -r1.38.4.2 -r1.38.4.3
--- Reserves2.pm 10 Aug 2006 02:10:21 -0000 1.38.4.2
+++ Reserves2.pm 11 Jun 2007 22:36:40 -0000 1.38.4.3
@@ -3,7 +3,7 @@
package C4::Reserves2;
-# $Id: Reserves2.pm,v 1.38.4.2 2006/08/10 02:10:21 kados Exp $
+# $Id: Reserves2.pm,v 1.38.4.3 2007/06/11 22:36:40 rangi Exp $
# Copyright 2000-2002 Katipo Communications
#
@@ -68,6 +68,7 @@
&updatereserves
&UpdateReserve
&getreservetitle
+ &getAllreservenotes
&Findgroupreserve
);
@@ -204,28 +205,31 @@
#'
sub CheckReserves {
my ($item, $barcode) = @_;
-# warn "In CheckReserves: itemnumber = $item";
+ #warn "In CheckReserves: itemnumber = $item , barcode: $barcode";
my $dbh = C4::Context->dbh;
- my $sth;
- if ($item) {
- my $qitem=$dbh->quote($item);
- # Look up the item by itemnumber
- $sth=$dbh->prepare("SELECT items.biblionumber, items.biblioitemnumber,
itemtypes.notforloan
- FROM items, biblioitems, itemtypes
- WHERE items.biblioitemnumber =
biblioitems.biblioitemnumber
- AND biblioitems.itemtype = itemtypes.itemtype
- AND itemnumber=$qitem");
+ my ( $sth, $query ) ;
+ if (C4::Context->preference("item-level_itypes") ) {
+ $query = "SELECT items.biblionumber, items.biblioitemnumber,
itemtypes.notforloan
+ FROM items, itemtypes
+ WHERE items.itype = itemtypes.itemtype " ;
} else {
- my $qbc=$dbh->quote($barcode);
- # Look up the item by barcode
- $sth=$dbh->prepare("SELECT items.biblionumber, items.biblioitemnumber,
itemtypes.notforloan
+ $query = "SELECT items.biblionumber, items.biblioitemnumber,
itemtypes.notforloan
FROM items, biblioitems, itemtypes
WHERE items.biblioitemnumber =
biblioitems.biblioitemnumber
- AND biblioitems.itemtype = itemtypes.itemtype
- AND barcode=$qbc");
- # FIXME - This function uses $item later on. Ought to set it here.
- }
- $sth->execute;
+ AND biblioitems.itemtype = itemtypes.itemtype ";
+ };
+ if ($item) {
+ $query .= " AND itemnumber= ?"; # .
$dbh->quote($item);
+ $sth = $dbh->prepare($query);
+ $sth->execute($item);
+ } else {
+ $query .= " AND barcode=?"; # .
$dbh->quote($barcode); # the execute() placeholder handles quoting.
+ $sth = $dbh->prepare($query);
+ $sth->execute($barcode);
+ };
+
+# # FIXME - This function uses $item later on. Ought to set it here.
+
my ($biblio, $bibitem, $notforloan) = $sth->fetchrow_array;
$sth->finish;
# if item is not for loan it cannot be reserved either.....
@@ -233,6 +237,7 @@
# get the reserves...
# Find this item in the reserves
my ($count, @reserves) = Findgroupreserve($bibitem, $biblio);
+#warn "Found $count reserves.";
# $priority and $highest are used to find the most important item
# in the list returned by &Findgroupreserve. (The lower $priority,
# the more important the item.)
@@ -435,7 +440,6 @@
return $branchcode;
}
-# XXX - POD
sub CheckWaiting {
my ($borr)address@hidden;
my $dbh = C4::Context->dbh;
@@ -452,6 +456,21 @@
return (scalar(@itemswaiting),address@hidden);
}
+# for SMFPL
+sub getAllreservenotes {
+ my ($biblionumber)address@hidden;
+ my $dbh = C4::Context->dbh;
+ my @notes;
+ my $sth = $dbh->prepare("SELECT borrowernumber, reservenotes, priority
FROM reserves WHERE biblionumber = ?
+ AND reserves.found = 'W' AND cancellationdate is
NULL order by priority");
+ $sth->execute($biblionumber);
+ while (my $data=$sth->fetchrow_hashref) {
+ push(@notes,$data);
+ }
+ $sth->finish;
+ return (address@hidden);
+}
+
=item Findgroupreserve
($count, @results) = &Findgroupreserve($biblioitemnumber, $biblionumber);
- [Koha-cvs] koha/C4 Reserves2.pm [dev_week],
Chris Cormack <=