Fix for bug 1730 fixing display for pay.pl
authorChris Cormack <crc@liblime.com>
Mon, 7 Jan 2008 00:58:53 +0000 (18:58 -0600)
committerJoshua Ferraro <jmf@liblime.com>
Mon, 7 Jan 2008 07:57:50 +0000 (01:57 -0600)
Signed-off-by: Joshua Ferraro <jmf@liblime.com>
C4/Members.pm
C4/Overdues.pm
koha-tmpl/intranet-tmpl/prog/en/modules/members/pay.tmpl
members/pay.pl

index 7963598..bcb0f00 100644 (file)
@@ -1132,10 +1132,11 @@ sub GetBorNotifyAcctRecord {
                 FROM accountlines 
                 WHERE borrowernumber=? 
                     AND notify_id=? 
-                    AND (accounttype='FU' OR accounttype='N' OR accounttype='M'OR accounttype='A'OR accounttype='F'OR accounttype='L' OR accounttype='IP' OR accounttype='CH' OR accounttype='RE' OR accounttype='RL')
                     AND amountoutstanding != '0' 
                 ORDER BY notify_id,accounttype
                 ");
+#                    AND (accounttype='FU' OR accounttype='N' OR accounttype='M'OR accounttype='A'OR accounttype='F'OR accounttype='L' OR accounttype='IP' OR accounttype='CH' OR accounttype='RE' OR accounttype='RL')
+
     $sth->execute( $borrowernumber, $notifyid );
     my $total = 0;
     while ( my $data = $sth->fetchrow_hashref ) {
index 7cf64ab..87dfbb6 100644 (file)
@@ -695,9 +695,9 @@ return $result;
 }
 
 
-=item AmountNotify
+=item NumberNotifyId
 
-(@notify) = &AmountNotify($borrowernumber);
+(@notify) = &NumberNotifyId($borrowernumber);
 
 Returns amount for all file per borrowers
 C<@notify> array contains all file per borrowers
@@ -733,19 +733,19 @@ C<$notifyid> is the file number
 
 C<$totalnotify> contains amount of a file
 
-C<$notify_id> contains the file number for the borrower number nad item number
+C<$notify_id> contains the file number for the borrower number and item number
 
 =cut
 
 sub AmountNotify{
-    my ($notifyid)=@_;
+    my ($notifyid,$borrowernumber)=@_;
     my $dbh = C4::Context->dbh;
     my $query=qq|    SELECT sum(amountoutstanding)
             FROM accountlines
-            WHERE notify_id=?|;
+            WHERE notify_id=? AND borrowernumber = ?|;
     my $sth=$dbh->prepare($query);
-        $sth->execute($notifyid);
-          my $totalnotify=$sth->fetchrow;
+       $sth->execute($notifyid,$borrowernumber);
+       my $totalnotify=$sth->fetchrow;
     $sth->finish;
     return ($totalnotify);
 }
index c80f9a0..a3bcaa0 100644 (file)
 <!-- TMPL_LOOP name="allfile" -->
        <!-- TMPL_LOOP name="loop_pay" -->
 <tr>
-       <td><select name="payfine<!-- TMPL_VAR name="i" -->">
+       <td>
+       <!-- TMPL_IF EXPR="amountoutstanding > 0" -->
+       <select name="payfine<!-- TMPL_VAR name="i" -->">
        <option value="no">Unpaid</option>
        <option value="yes">Paid</option>
        <option value="wo">Writeoff</option>
        </select>
+       <!-- /TMPL_IF -->
        <input type="hidden" name="itemnumber<!-- TMPL_VAR name="i" -->" value="<!-- TMPL_VAR name="itemnumber" -->" />
        <input type="hidden" name="accounttype<!-- TMPL_VAR name="i" -->" value="<!-- TMPL_VAR name="accounttype" -->" />
        <input type="hidden" name="amount<!-- TMPL_VAR name="i" -->" value="<!-- TMPL_VAR name="amount" -->" />
 <!-- TMPL_IF  NAME="total"-->
 <tr>
 
-       <td colspan="6">Total Due</td>
+       <td colspan="6">Sub Total</td>
        <td><!-- TMPL_VAR name="total" --></td>
 </tr>
 <!--/TMPL_IF-->
 <!-- /TMPL_LOOP  -->
+<tr>
+       <td colspan="6">Total Due</td>
+       <td><!-- TMPL_VAR name="total" --></td>
+</tr>
 </table>
 <fieldset class="action"><input type="submit" name="submit"  value="Make Payment" class="submit" /> <a class="cancel" href="/cgi-bin/koha/members/boraccount.pl?borrowernumber=<!-- TMPL_VAR NAME="borrowernumber" -->">Cancel</a></fieldset></form><!-- TMPL_ELSE --><p><!-- TMPL_VAR NAME="firstname" --> <!-- TMPL_VAR NAME="surname" --> has no outstanding fines.</p><!-- /TMPL_IF -->
 </div></div>
index 4e060c4..a1213bb 100755 (executable)
@@ -99,7 +99,7 @@ if ( $check == 0 ) {
           GetBorNotifyAcctRecord( $borrowernumber, $notify[$j] );
         for ( my $i = 0 ; $i < $numaccts ; $i++ ) {
             my %line;
-            if ( $accts->[$i]{'amountoutstanding'} > 0 ) {
+            if ( $accts->[$i]{'amountoutstanding'} != 0 ) {
                 $accts->[$i]{'amount'}            += 0.00;
                 $accts->[$i]{'amountoutstanding'} += 0.00;
                 $line{i}           = $j . "" . $i;
@@ -119,13 +119,14 @@ if ( $check == 0 ) {
             push( @loop_pay, \%line );
         }
 
-        my $totalnotify = AmountNotify( $notify[$j] );
+        my $totalnotify = AmountNotify( $notify[$j], $borrowernumber );
         ( $totalnotify = '0' ) if ( $totalnotify =~ /^0.00/ );
         push @allfile,
           {
             'loop_pay' => \@loop_pay,
             'notify'   => $notify[$j],
-            'total'    => $totalnotify
+            'total'    =>  sprintf( "%.2f",$totalnotify),
+                       
           };
     }