[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Koha-cvs] koha/C4 Acquisition.pm
From: |
Chris Cormack |
Subject: |
[Koha-cvs] koha/C4 Acquisition.pm |
Date: |
Wed, 07 Jun 2006 00:39:23 +0000 |
CVSROOT: /sources/koha
Module name: koha
Changes by: Chris Cormack <rangi> 06/06/07 00:39:23
Modified files:
C4 : Acquisition.pm
Log message:
Merging katipo changes
Last of the changes for Acquisitions.pm, bookfundbreakdowns
CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/koha/C4/Acquisition.pm?cvsroot=koha&r1=1.29&r2=1.30
Patches:
Index: Acquisition.pm
===================================================================
RCS file: /sources/koha/koha/C4/Acquisition.pm,v
retrieving revision 1.29
retrieving revision 1.30
diff -u -b -r1.29 -r1.30
--- Acquisition.pm 7 Jun 2006 00:07:59 -0000 1.29
+++ Acquisition.pm 7 Jun 2006 00:39:22 -0000 1.30
@@ -29,7 +29,7 @@
use vars qw($VERSION @ISA @EXPORT);
# set the version for version checking
-$VERSION = do { my @v = '$Revision: 1.29 $' =~ /\d+/g; shift(@v) . "." . join(
"_", map { sprintf "%03d", $_ } @v ); };
+$VERSION = do { my @v = '$Revision: 1.30 $' =~ /\d+/g; shift(@v) . "." . join(
"_", map { sprintf "%03d", $_ } @v ); };
# used in reciveorder subroutine
# to provide library specific handling
@@ -1051,18 +1051,18 @@
my $branch = $userenv->{branch};
my $strsth;
- if ( !( $branch eq '' ) ) {
- $strsth = "Select * from aqbookfund,aqbudget where
aqbookfund.bookfundid
- =aqbudget.bookfundid and startdate<now() and enddate>now() and
(aqbookfund.branchcode is null or aqbookfund.branchcode='' or
aqbookfund.branchcode= ? )
- group by aqbookfund.bookfundid order by bookfundname";
+ if ( $branch ne '' ) {
+ $strsth = "SELECT * FROM aqbookfund,aqbudget WHERE
aqbookfund.bookfundid
+ =aqbudget.bookfundid AND startdate<now() AND enddate>now() AND
(aqbookfund.branchcode is null or aqbookfund.branchcode='' or
aqbookfund.branchcode= ? )
+ GROUP BY aqbookfund.bookfundid ORDER BY bookfundname";
}
else {
- $strsth = "Select * from aqbookfund,aqbudget where
aqbookfund.bookfundid
- =aqbudget.bookfundid and startdate<now() and enddate>now()
- group by aqbookfund.bookfundid order by bookfundname";
+ $strsth = "SELECT * FROM aqbookfund,aqbudget WHERE
aqbookfund.bookfundid
+ =aqbudget.bookfundid AND startdate<now() AND enddate>now()
+ GROUP BY aqbookfund.bookfundid ORDER BY bookfundname";
}
my $sth = $dbh->prepare($strsth);
- if ( !( $branch eq '' ) ) {
+ if ( $branch ne '' ) {
$sth->execute($branch);
}
else {
@@ -1088,21 +1088,31 @@
my ( $id, $year ) = @_;
my $dbh = C4::Context->dbh;
my $sth = $dbh->prepare(
-"SELECT startdate, enddate, quantity, datereceived, freight, unitprice,
listprice, ecost, quantityreceived, subscription
-FROM aqorders, aqorderbreakdown, aqbudget, aqbasket
-WHERE aqorderbreakdown.bookfundid = ?
-AND aqorders.ordernumber = aqorderbreakdown.ordernumber
-AND (
-datecancellationprinted IS NULL
-OR datecancellationprinted = '0000-00-00'
-)
-AND aqbudget.bookfundid = aqorderbreakdown.bookfundid
-AND aqbasket.basketno = aqorders.basketno
-AND aqbasket.creationdate >= startdate
-AND enddate >= aqbasket.creationdate
-and startdate<=now() and enddate>=now()"
+ "SELECT quantity,datereceived,freight,unitprice,listprice,ecost,
+ quantityreceived,subscription
+ FROM aqorders,aqorderbreakdown WHERE bookfundid=? AND
+ aqorders.ordernumber=aqorderbreakdown.ordernumber
+ AND (datecancellationprinted is NULL OR
+ datecancellationprinted='0000-00-00')"
);
+ if ($start) {
+ $sth = $dbh->prepare(
+ "SELECT quantity,datereceived,freight,unitprice,listprice,ecost,
+ quantityreceived,subscription
+ FROM aqorders,aqorderbreakdown
+ WHERE bookfundid=? AND
+ aqorders.ordernumber=aqorderbreakdown.ordernumber
+ AND (datecancellationprinted is NULL OR
+ datecancellationprinted='0000-00-00')
+ AND ((datereceived >= ? AND datereceived < ?) OR
+ (budgetdate >= ? AND budgetdate < ?))"
+ );
+ $sth->execute( $id, $start, $end, $start, $end );
+ }
+ else {
$sth->execute($id);
+ }
+
my $comtd = 0;
my $spent = 0;
while ( my $data = $sth->fetchrow_hashref ) {