From a20d2b30dc18da7146d2fd877b50ca063fc54868 Mon Sep 17 00:00:00 2001 From: einhverfr Date: Mon, 21 Jul 2008 22:49:29 +0000 Subject: 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 --- scripts/payment.pl | 30 ++++++++++++++++++++++++++---- 1 file changed, 26 insertions(+), 4 deletions(-) (limited to 'scripts') 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 = {}; -- cgit v1.2.3