[followup](bug #3348) fix spent values and spent resume
authorNahuel ANGELINETTI <nahuel.angelinetti@biblibre.com>
Thu, 21 Jan 2010 11:15:49 +0000 (12:15 +0100)
committerHenri-Damien LAURENT <henridamien.laurent@biblibre.com>
Wed, 27 Jan 2010 13:14:49 +0000 (14:14 +0100)
This fix the way to get spent datas, to user aqbudgetid instead of bookfund.

C4/Bookfund.pm
acqui/acqui-home.pl
acqui/spent.pl
koha-tmpl/intranet-tmpl/prog/en/modules/acqui/acqui-home.tmpl

index 1743a38..2624ede 100644 (file)
@@ -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 ) {
index b8e6162..929779d 100755 (executable)
@@ -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'};
index 89a71e5..a47d119 100755 (executable)
@@ -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;
index 87365b5..af98fa1 100644 (file)
@@ -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>