koha-cvs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Koha-cvs] koha/C4 Acquisition.pm [rel_2_2]


From: paul poulain
Subject: [Koha-cvs] koha/C4 Acquisition.pm [rel_2_2]
Date: Thu, 05 Jan 2006 15:12:36 +0000

CVSROOT:        /cvsroot/koha
Module name:    koha
Branch:         rel_2_2
Changes by:     paul poulain <address@hidden>   06/01/05 15:12:36

Modified files:
        C4             : Acquisition.pm 

Log message:
        * when a budget has no line (or an outdated line, it does not appear 
anymore in acquisition)
        * orders where always attached to the last budget line, not to their 
real line (=depending on date)

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/koha/koha/C4/Acquisition.pm.diff?only_with_tag=rel_2_2&tr1=1.9.2.12&tr2=1.9.2.13&r1=text&r2=text

Patches:
Index: koha/C4/Acquisition.pm
diff -u koha/C4/Acquisition.pm:1.9.2.12 koha/C4/Acquisition.pm:1.9.2.13
--- koha/C4/Acquisition.pm:1.9.2.12     Wed Dec 14 19:55:33 2005
+++ koha/C4/Acquisition.pm      Thu Jan  5 15:12:36 2006
@@ -830,11 +830,11 @@
   
   if (!($branch eq '')) {
       $strsth="Select * from aqbookfund,aqbudget where aqbookfund.bookfundid
-      =aqbudget.bookfundid and (aqbookfund.branchcode is null or 
aqbookfund.branchcode='' or aqbookfund.branchcode= ? )
+      =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
+      =aqbudget.bookfundid and startdate<now() and enddate>now()
       group by aqbookfund.bookfundid order by bookfundname";
   }
   my $sth=$dbh->prepare($strsth);
@@ -853,19 +853,27 @@
 
 =item bookfundbreakdown
 
-       returns the total comtd & spent for a given bookfund
+       returns the total comtd & spent for a given bookfund, and a given year
        used in acqui-home.pl
 =cut
 #'
 
 sub bookfundbreakdown {
-  my ($id)address@hidden;
+  my ($id, $year)address@hidden;
   my $dbh = C4::Context->dbh;
-  my $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')");
+  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()");
   $sth->execute($id);
   my $comtd=0;
   my $spent=0;




reply via email to

[Prev in Thread] Current Thread [Next in Thread]