[Koha-patches] [PATCH] [followup](bug #3348) fix spent values and spent resume

Nahuel ANGELINETTI nahuel.angelinetti at biblibre.com
Thu Jan 21 12:16:34 CET 2010


This fix the way to get spent datas, to user aqbudgetid instead of bookfund.
---
 C4/Bookfund.pm                                     |    5 +++--
 acqui/acqui-home.pl                                |    3 ++-
 acqui/spent.pl                                     |    6 +++---
 .../prog/en/modules/acqui/acqui-home.tmpl          |    2 +-
 4 files changed, 9 insertions(+), 7 deletions(-)

diff --git a/C4/Bookfund.pm b/C4/Bookfund.pm
index 1743a38..2624ede 100644
--- a/C4/Bookfund.pm
+++ b/C4/Bookfund.pm
@@ -232,14 +232,15 @@ sub GetBookFundBreakdown {
         LEFT JOIN aqorderbreakdown USING (ordernumber)
         LEFT JOIN aqbasket USING (basketno)
         LEFT JOIN aqbudget USING (bookfundid)
-    WHERE bookfundid=?
+    WHERE aqbudgetid=?
         AND (datecancellationprinted IS NULL OR datecancellationprinted = '0000-00-00')
         AND closedate BETWEEN startdate AND enddate 
         AND creationdate > startdate
+        
     ORDER BY datereceived
     ";
     my $sth = $dbh->prepare($query);
-    $sth->execute( $id);
+    $sth->execute($id);
 
     my ($spent, $comtd) = (0, 0);
     while ( my $data = $sth->fetchrow_hashref ) {
diff --git a/acqui/acqui-home.pl b/acqui/acqui-home.pl
index b8e6162..929779d 100755
--- a/acqui/acqui-home.pl
+++ b/acqui/acqui-home.pl
@@ -67,6 +67,7 @@ my $borrower= GetMember($loggedinuser);
 my ( $flags, $homebranch )= ($borrower->{'flags'},$borrower->{'branchcode'});
 
 my @results = GetBookFunds($homebranch);
+
 my $count = scalar @results;
 
 my $classlist   = '';
@@ -77,7 +78,7 @@ my $totavail    = 0;
 my @loop_budget = ();
 
 for (my $i=0; $i<$count; $i++){
-	my ($spent,$comtd)=GetBookFundBreakdown($results[$i]->{'bookfundid'},$results[$i]->{'startdate'},$results[$i]->{'enddate'});
+	my ($spent,$comtd)=GetBookFundBreakdown($results[$i]->{'aqbudgetid'},$results[$i]->{'startdate'},$results[$i]->{'enddate'});
 	my $avail=$results[$i]->{'budgetamount'}-($spent+$comtd);
 	my %line;
 	$line{bookfundname} = $results[$i]->{'bookfundname'};
diff --git a/acqui/spent.pl b/acqui/spent.pl
index 89a71e5..a47d119 100755
--- a/acqui/spent.pl
+++ b/acqui/spent.pl
@@ -12,7 +12,7 @@ use CGI;
 
 my $dbh      = C4::Context->dbh;
 my $input    = new CGI;
-my $bookfund = $input->param('bookfund');
+my $budgetid = $input->param('aqbudgetid');
 my $start    = $input->param('start');
 my $end      = $input->param('end');
 
@@ -40,14 +40,14 @@ my $query =
     LEFT JOIN aqorderbreakdown USING (ordernumber)
     LEFT JOIN aqbasket USING (basketno)
     LEFT JOIN aqbudget USING (bookfundid)
-    WHERE bookfundid=?
+    WHERE aqbudgetid=?
     AND (datecancellationprinted IS NULL OR datecancellationprinted = '0000-00-00')
     AND closedate BETWEEN startdate AND enddate 
     AND creationdate > startdate
     ORDER BY datereceived
   ";
 my $sth = $dbh->prepare($query);
-$sth->execute( $bookfund);
+$sth->execute( $budgetid );
 
 my $total = 0;
 my $toggle;
diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/acqui-home.tmpl b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/acqui-home.tmpl
index 87365b5..af98fa1 100644
--- a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/acqui-home.tmpl
+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/acqui-home.tmpl
@@ -76,7 +76,7 @@
             <tr>
                 <td><!-- TMPL_VAR name="bookfundname" --></td>
                 <td><a href="/cgi-bin/koha/admin/aqbudget.pl?op=add_form&amp;aqbudgetid=<!--TMPL_VAR NAME="aqbudgetid"-->"><!-- TMPL_VAR name="budgetamount" --></a></td>
-                <td><a href="/cgi-bin/koha/acqui/spent.pl?bookfund=<!--TMPL_VAR NAME="bookfundid"-->&amp;start=<!--TMPL_VAR NAME="sdate"-->&amp;end=<!-- TMPL_VAR NAME="edate"-->"><!-- TMPL_VAR name="spent" --></a></td>
+                <td><a href="/cgi-bin/koha/acqui/spent.pl?aqbudgetid=<!--TMPL_VAR NAME="aqbudgetid"-->&amp;start=<!--TMPL_VAR NAME="sdate"-->&amp;end=<!-- TMPL_VAR NAME="edate"-->"><!-- TMPL_VAR name="spent" --></a></td>
                 <td><a href="/cgi-bin/koha/acqui/bookfund.pl?bookfund=<!--TMPL_VAR NAME="bookfundid"-->&amp;start=<!--TMPL_VAR NAME="sdate"-->&amp;end=<!-- TMPL_VAR NAME="edate"-->"><!-- TMPL_VAR name="comtd" --></a></td>
                 <td><!-- TMPL_VAR name="avail" --></td>
             </tr>
-- 
1.6.3.3




More information about the Koha-patches mailing list