summaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authoreinhverfr <einhverfr@4979c152-3d1c-0410-bac9-87ea11338e46>2008-07-21 22:49:29 +0000
committereinhverfr <einhverfr@4979c152-3d1c-0410-bac9-87ea11338e46>2008-07-21 22:49:29 +0000
commita20d2b30dc18da7146d2fd877b50ca063fc54868 (patch)
tree580499236902ed5c7d73a096f562f5acc9c565db /scripts
parent0b90e3ba5dcf65df66ddd75f036a133beae2c317 (diff)
Adding max numbers of invoices to check template
git-svn-id: https://ledger-smb.svn.sourceforge.net/svnroot/ledger-smb/trunk@2217 4979c152-3d1c-0410-bac9-87ea11338e46
Diffstat (limited to 'scripts')
-rw-r--r--scripts/payment.pl30
1 files changed, 26 insertions, 4 deletions
diff --git a/scripts/payment.pl b/scripts/payment.pl
index 52142119..7da4fc2c 100644
--- a/scripts/payment.pl
+++ b/scripts/payment.pl
@@ -10,7 +10,7 @@ Defines the controller functions and workflow logic for payment processing.
=head1 COPYRIGHT
-Copyright (c) 2007, David Mora R and Christian Ceballos B.
+Portions Copyright (c) 2007, David Mora R and Christian Ceballos B.
Licensed to the public under the terms of the GNU GPL version 2 or later.
@@ -48,6 +48,7 @@ Original copyright notice below.
package LedgerSMB::Scripts::payment;
use LedgerSMB::Template;
+use LedgerSMB::Sysconfig;
use LedgerSMB::DBObject::Payment;
use LedgerSMB::DBObject::Date;
use Error::Simple;
@@ -83,9 +84,6 @@ sub payments {
$template->render($payment);
}
-sub print {
-}
-
sub get_search_criteria {
my ($request) = @_;
my $payment = LedgerSMB::DBObject::Payment->new({'base' => $request});
@@ -265,6 +263,19 @@ sub print {
my $template;
+ # To be committed tonight separately -- CT
+ #
+ #if ($payment->{batch_id}){
+ # my $batch = LedgerSMB::Batch->new(
+ # {base => $payment,
+ # copy => 'base' }
+ # );
+ # $batch->{id} = $payment->{batch_id};
+ # $batch->get;
+ # $payment->{batch_description} = $batch->{description};
+ # $payment->{batch_control_code} = $batch->{control_code};
+ #}
+
if ($payment->{multiple}){
$payment->{checks} = [];
print "Multiple checks printing";
@@ -280,6 +291,17 @@ sub print {
$check->{amount} = $check->parse_amount(amount => '0');
$check->{invoices} = [];
$check->{source} = $payment->{"source_$id"};
+
+ my $inv_count;
+
+ if ($LedgerSMB::Sysconfig::check_max_invoices >
+ $payment->{"invoice_count_$id"})
+ {
+ $inv_count = $payment->{"invoice_count_$id"};
+ } else {
+ $inv_count = $LedgerSMB::Sysconfig::check_max_invoices;
+ }
+
for my $inv (1 .. $payment->{"invoice_count_$id"}){
print STDERR "Invoice $inv of " .$payment->{"invoice_count_$id"} . "\n";
my $invhash = {};