[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Koha-cvs] koha/C4/Circulation Circ2.pm [rel_3_0]
From: |
Antoine Farnault |
Subject: |
[Koha-cvs] koha/C4/Circulation Circ2.pm [rel_3_0] |
Date: |
Thu, 02 Nov 2006 13:29:44 +0000 |
CVSROOT: /sources/koha
Module name: koha
Branch: rel_3_0
Changes by: Antoine Farnault <toins> 06/11/02 13:29:44
Modified files:
C4/Circulation : Circ2.pm
Log message:
use Date::Calc instead of Date::Manip & make SQL query from getissues'
sub compatible with mysql 5.0
CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/koha/C4/Circulation/Circ2.pm?cvsroot=koha&only_with_tag=rel_3_0&r1=1.114.2.10&r2=1.114.2.11
Patches:
Index: Circ2.pm
===================================================================
RCS file: /sources/koha/koha/C4/Circulation/Circ2.pm,v
retrieving revision 1.114.2.10
retrieving revision 1.114.2.11
diff -u -b -r1.114.2.10 -r1.114.2.11
--- Circ2.pm 30 Oct 2006 09:49:05 -0000 1.114.2.10
+++ Circ2.pm 2 Nov 2006 13:29:44 -0000 1.114.2.11
@@ -3,7 +3,7 @@
package C4::Circulation::Circ2;
-# $Id: Circ2.pm,v 1.114.2.10 2006/10/30 09:49:05 tipaul Exp $
+# $Id: Circ2.pm,v 1.114.2.11 2006/11/02 13:29:44 toins Exp $
#package to deal with Returns
#written 3/11/99 by address@hidden
@@ -27,9 +27,7 @@
# Suite 330, Boston, MA 02111-1307 USA
use strict;
-use warnings; no warnings 'uninitialized';
require Exporter;
-#use DBI;
use C4::Context;
use C4::Stats;
use C4::Reserves2;
@@ -37,18 +35,17 @@
use C4::Biblio;
use C4::Accounts2;
use Date::Calc qw(
-Today
-Today_and_Now
-Add_Delta_YM
-Add_Delta_DHMS
-Date_to_Days
+ Today
+ Today_and_Now
+ Add_Delta_YM
+ Add_Delta_DHMS
+ Date_to_Days
);
-use Date::Manip;
use vars qw($VERSION @ISA @EXPORT @EXPORT_OK %EXPORT_TAGS);
# set the version for version checking
-$VERSION = 0.01;
+$VERSION = do { my @v = '$Revision: 1.114.2.11 $' =~ /\d+/g; shift(@v) . "." .
join( "_", map { sprintf "%03d", $_ } @v ); };
=head1 NAME
@@ -158,7 +155,7 @@
LEFT JOIN biblio on items.biblionumber=biblio.biblionumber
WHERE itemcallnumber>= ? and itemcallnumber <=? and
(datelastseen< ? or datelastseen is null) ORDER BY itemcallnumber,title";
$sth = $dbh->prepare($query);
- warn "DATELA :$datelastseen";
+# warn "DATELA :$datelastseen";
$sth->execute($minlocation,$maxlocation,$datelastseen);
} else {
my $query = "SELECT
itemnumber,barcode,itemcallnumber,title,author,datelastseen FROM items
@@ -346,7 +343,7 @@
{
if ($l == 1)
{
- print "Error!";
+ warn "Error!";
return;
}
$l = 4-$l;
@@ -835,7 +832,9 @@
if ($borrower->{flags}->{'DBARRED'}) {
$issuingimpossible{DEBARRED} = 1;
}
- if (&Date_Cmp(&ParseDate($borrower->{dateexpiry}),&ParseDate("today"))<0) {
+ if (Date_to_Days(Today()) > Date_to_Days(split /-/,
$borrower->{'dateexpiry'})) {
+ #
+ #if (&Date_Cmp(&ParseDate($borrower->{expiry}),&ParseDate("today"))<0) {
$issuingimpossible{EXPIRED} = 1;
}
#
@@ -988,7 +987,7 @@
if ($currentborrower ne '') {
# This book is currently on loan, but not to the person
# who wants to borrow it now. mark it returned before issuing to
the new borrower
- returnbook($iteminformation->{'barcode'}, $env->{'branchcode'});
+
returnbook($iteminformation->{'barcode'},C4::Context->userenv->{'branch'});
}
# See if the item is on reserve.
my ($restype, $res) = CheckReserves($iteminformation->{'itemnumber'});
@@ -997,9 +996,9 @@
if ($resbor eq $borrower->{'borrowernumber'}) {
# The item is on reserve to the current patron
FillReserve($res);
- warn "FillReserve";
+# warn "FillReserve";
} elsif ($restype eq "Waiting") {
- warn "Waiting";
+# warn "Waiting";
# The item is on reserve and waiting, but has been
# reserved by some other patron.
my ($resborrower, $flags)=getpatroninformation($env,
$resbor,0);
@@ -1696,6 +1695,7 @@
of the Koha database.
=cut
+
#'
sub getissues {
# New subroutine for Circ2.pm
@@ -1703,7 +1703,9 @@
my $dbh = C4::Context->dbh;
my $borrowernumber = $borrower->{'borrowernumber'};
my %currentissues;
- my $select = "SELECT items.*,issues.timestamp AS timestamp,
+ my $select = "
+ SELECT items.*,
+ issues.timestamp AS timestamp,
issues.date_due AS date_due,
items.barcode AS barcode,
biblio.title AS title,
@@ -1714,15 +1716,15 @@
biblioitems.ccode AS ccode,
biblioitems.isbn AS isbn,
biblioitems.classification AS classification
- FROM issues,items,biblioitems,biblio, itemtypes
+ FROM items
+ LEFT JOIN issues ON issues.itemnumber = items.itemnumber
+ LEFT JOIN biblio ON biblio.biblionumber = items.biblionumber
+ LEFT JOIN biblioitems ON items.biblioitemnumber =
biblioitems.biblioitemnumber
+ LEFT JOIN itemtypes ON itemtypes.itemtype =
biblioitems.itemtype
WHERE issues.borrowernumber = ?
- AND issues.itemnumber = items.itemnumber
- AND items.biblionumber = biblio.biblionumber
- AND items.biblioitemnumber = biblioitems.biblioitemnumber
- AND itemtypes.itemtype = biblioitems.itemtype
AND issues.returndate IS NULL
- ORDER BY issues.date_due DESC";
- # print $select;
+ ORDER BY issues.date_due DESC
+ ";
my $sth=$dbh->prepare($select);
$sth->execute($borrowernumber);
my $counter = 0;
@@ -1753,6 +1755,8 @@
# they're there for.
}
$sth->finish;
+ use Data::Dumper;
+ warn "currentissues==>".Dumper(\%currentissues);
return(\%currentissues);
}
@@ -1862,7 +1866,9 @@
my $iteminformation = getiteminformation($itemno,0);
my $borrower = getpatroninformation($env,$bornum,0);
my $loanlength =
getLoanLength($borrower->{'categorycode'},$iteminformation->{'itemtype'},$borrower->{'branchcode'});
- $datedue = UnixDate(DateCalc("today","$loanlength days"),"%Y-%m-%d");
+ my ($due_year, $due_month, $due_day) = Add_Delta_DHMS(Today_and_Now(),
$loanlength,0,0,0);
+ $datedue = "$due_year-$due_month-$due_day";
+ #$datedue = UnixDate(DateCalc("today","$loanlength days"),"%Y-%m-%d");
}
# Find the issues record for this book
- [Koha-cvs] koha/C4/Circulation Circ2.pm [rel_3_0],
Antoine Farnault <=
- [Koha-cvs] koha/C4/Circulation Circ2.pm [rel_3_0], Bruno Toumi, 2006/11/10
- [Koha-cvs] koha/C4/Circulation Circ2.pm [rel_3_0], Antoine Farnault, 2006/11/13
- [Koha-cvs] koha/C4/Circulation Circ2.pm [rel_3_0], Antoine Farnault, 2006/11/15
- [Koha-cvs] koha/C4/Circulation Circ2.pm [rel_3_0], Antoine Farnault, 2006/11/27
- [Koha-cvs] koha/C4/Circulation Circ2.pm [rel_3_0], Antoine Farnault, 2006/11/27
- [Koha-cvs] koha/C4/Circulation Circ2.pm [rel_3_0], Antoine Farnault, 2006/11/28
- [Koha-cvs] koha/C4/Circulation Circ2.pm [rel_3_0], Antoine Farnault, 2006/11/28
- [Koha-cvs] koha/C4/Circulation Circ2.pm [rel_3_0], Antoine Farnault, 2006/11/29