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

paul poulain paul at koha-fr.org
Thu Jan 5 16:12:36 CET 2006


CVSROOT:	/cvsroot/koha
Module name:	koha
Branch: 	rel_2_2
Changes by:	paul poulain <tipaul at savannah.gnu.org>	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)=@_;
+  my ($id, $year)=@_;
   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;





More information about the Koha-cvs mailing list