[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

SF.net SVN: ledger-smb:[2217] trunk/scripts/payment.pl



Revision: 2217
          http://ledger-smb.svn.sourceforge.net/ledger-smb/?rev=2217&view=rev
Author:   einhverfr
Date:     2008-07-21 22:49:29 +0000 (Mon, 21 Jul 2008)

Log Message:
-----------
Adding max numbers of invoices to check template

Modified Paths:
--------------
    trunk/scripts/payment.pl

Modified: trunk/scripts/payment.pl
===================================================================
--- trunk/scripts/payment.pl	2008-07-21 21:57:54 UTC (rev 2216)
+++ trunk/scripts/payment.pl	2008-07-21 22:49:29 UTC (rev 2217)
@@ -10,7 +10,7 @@
 
 =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 @@
 
 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 @@
     $template->render($payment);
 }
 
-sub print {
-}
-
 sub get_search_criteria {
     my ($request) = @_;
     my $payment =  LedgerSMB::DBObject::Payment->new({'base' => $request});
@@ -265,6 +263,19 @@
 
     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 @@
             $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 = {};


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.