[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Koha-cvs] koha pay_by_amount.pl koha-tmpl/intranet-tmpl/c... [dev_week]
From: |
Kyle Hall |
Subject: |
[Koha-cvs] koha pay_by_amount.pl koha-tmpl/intranet-tmpl/c... [dev_week] |
Date: |
Fri, 27 Apr 2007 13:15:52 +0000 |
CVSROOT: /sources/koha
Module name: koha
Branch: dev_week
Changes by: Kyle Hall <kylemhall> 07/04/27 13:15:52
Modified files:
. : pay_by_amount.pl
koha-tmpl/intranet-tmpl/ccfls/en/members: pay.tmpl
Log message:
Cleaned up pay_by_amount.pl
CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/koha/pay_by_amount.pl?cvsroot=koha&only_with_tag=dev_week&r1=1.1.2.3&r2=1.1.2.4
http://cvs.savannah.gnu.org/viewcvs/koha/koha-tmpl/intranet-tmpl/ccfls/en/members/pay.tmpl?cvsroot=koha&only_with_tag=dev_week&r1=1.1.2.1.2.2&r2=1.1.2.1.2.3
Patches:
Index: pay_by_amount.pl
===================================================================
RCS file: /sources/koha/koha/Attic/pay_by_amount.pl,v
retrieving revision 1.1.2.3
retrieving revision 1.1.2.4
diff -u -b -r1.1.2.3 -r1.1.2.4
--- pay_by_amount.pl 19 Dec 2006 16:10:28 -0000 1.1.2.3
+++ pay_by_amount.pl 27 Apr 2007 13:15:52 -0000 1.1.2.4
@@ -1,11 +1,15 @@
-#!/usr/bin/perl -w
+#!/usr/bin/perl
+# WARNING: Not enough context to figure out the correct tabstop size
+# WARNING: Assume that this file uses 4-character tabs
-# written 12/07/2006 by address@hidden
-# part of the koha library system, script to facilitate paying off fines
+# $Id: pay_by_amount.pl,v 1.1.2.4 2007/04/27 13:15:52 kylemhall Exp $
-# This script, rather than paying idividual fines, accepts a payment amount
and pays fines
-# unil the give amount is paid.
+#written 11/1/2000 by address@hidden
+#part of the koha library system, script to facilitate paying off fines
+
+# Copyright 2000-2002 Katipo Communications
+#
# This file is part of Koha.
#
# Koha is free software; you can redistribute it and/or modify it under the
@@ -33,55 +37,39 @@
my $input = new CGI;
-# get the POST variables
-my $bornum = $input->param( 'bornum' );
-my $amount = $input->param( 'amount' );
-my $amountpaid = $amount;
-
-# create database handle
-my $dbh = C4::Context->dbh;
-my $env;
-my $sth;
-
-# get all unpaid fines for this user
-# Loop through the fines due, paying them until $amountpaid is 0, or all fines
have been paid.
-# If all fines have been paid and $amountpaid is still greater than 0, just
insert a payment for the leftover amount.
-$sth = $dbh->prepare( "SELECT * FROM accountlines WHERE borrowernumber = ? AND
amountoutstanding > 0" ) || die $sth->errstr;
-$sth->execute( $bornum ) || die $sth->errstr;
-
-while ( my $data = $sth->fetchrow_hashref() && $amountpaid > 0 ) { #was my
@data = ...
- my $accountno = $data{'accountno'}; #was $data['accoutno']
- my $amountoutstanding = $data{'amountoutstanding'};
-
- # If the amount paid in is less than the current fine, just lower the
amountoutstanding by what is in $amountpaid
- my $balance = 0;
- if ( $amountoutstanding > $amountpaid ) {
- $balance = $amountoutstanding - $amountpaid;
- }
-
- # Update the amount outstanding for this fine, set to 0 if
$amountoutstanding is less than $amountpaid, $amountpaid otherwise
- $sth = $dbh->prepare( "UPDATE accountlines SET amountoutstanding = ? WHERE
borrowernumber = ? AND accountno = ?" ) || die $sth->errstr;
- $sth->execute( $balance, $bornum, $accountno ) || die $sth->errstr;
+my $bornum = $input->param('bornum');
- # decrement $amountpaid by the amount of the fine just paid
- $amountpaid -= $amountoutstanding;
+if ($bornum eq ''){
+ $bornum=$input->param('bornum0');
}
-# Grab the next accountno to use for inserting the payment row into
accountlines
-$sth = $dbh->prepare( "SELECT MAX(accountno) FROM accountlines" ) || die
$sth->errstr;
-$sth->execute || die $sth->errstr;
-my $data = $sth->fetchrow_hashref;
-$sth->finish;
-my $nextAccountno = $data->{ 'MAX(accountno)' } + 1;
-
-# Insert a payment line into accountlines for the entire payment
-$sth = $dbh->prepare( "INSERT INTO accountlines (
- borrowernumber, accountno, itemnumber, date, amount,
description, dispute, accounttype, amountoutstanding, timestamp
- ) VALUES (
- ?, ?, NULL , 'TODAY()', '?', 'Payment', NULL , 'Pay',
'0.000000', NOW()
- )" ) || die $sth->errstr;
-$sth->execute( $bornum, $nextAccountno, $amount * -1 ) || die $sth->errstr;
+#get borrower details
+my $borrowerData = borrdata( '', $bornum );
+my $user = $input->remote_user;
+
+my($template, $loggedinuser, $cookie)
+ = get_template_and_user ({ template_name => "members/pay.tmpl",
+ query => $input,
+ type => "intranet",
+ authnotrequired => 0,
+ flagsrequired => {borrowers => 1},
+ debug => 1,
+ });
+
+#get account details
+my %bor;
+$bor{'borrowernumber'} = $bornum;
+
+my @names = $input->param;
+my %env;
+
+$env{'branchcode'} = $user;
+my $total = $input->param('total');
-# Redirect user back to the members page
-print $input->redirect("/cgi-bin/koha/members/moremember.pl?bornum=$bornum");
+print STDERR "Branchcode: $user Bornumber: $bornum Total: $total \n";
+
+if ($total ne ''){
+ recordpayment(\%env,$bornum,$total);
+}
\ No newline at end of file
+print $input->redirect("/cgi-bin/koha/pay.pl?bornum=$bornum");
Index: koha-tmpl/intranet-tmpl/ccfls/en/members/pay.tmpl
===================================================================
RCS file:
/sources/koha/koha/koha-tmpl/intranet-tmpl/ccfls/en/members/Attic/pay.tmpl,v
retrieving revision 1.1.2.1.2.2
retrieving revision 1.1.2.1.2.3
diff -u -b -r1.1.2.1.2.2 -r1.1.2.1.2.3
--- koha-tmpl/intranet-tmpl/ccfls/en/members/pay.tmpl 14 Dec 2006 12:51:13
-0000 1.1.2.1.2.2
+++ koha-tmpl/intranet-tmpl/ccfls/en/members/pay.tmpl 27 Apr 2007 13:15:52
-0000 1.1.2.1.2.3
@@ -79,8 +79,7 @@
<caption>Pay Fines By Amount</caption>
<tr>
<td>
- <input type="hidden" name="bornum" value="<!-- TMPL_VAR
name="bornum" -->" />
- Amount to be paid: <input type="text" name="amount" />
+ Amount to be paid: <input type="text" name="total" />
</td>
<tr>
</table>
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Koha-cvs] koha pay_by_amount.pl koha-tmpl/intranet-tmpl/c... [dev_week],
Kyle Hall <=