@@ -1871,8 +1871,7 @@ sub post_overpayment {
18711871 # let's store all unused invoice in entity_unused_ovp, it will be
18721872
18731873 # lets see which invoice do we have, and reorganize them by vendor/customer
1874- my $count =1;
1875- while ($request -> {" entity_id_$count " })
1874+ for my $count (1 .. $request -> {count })
18761875 {
18771876
18781877 if ($request -> {" checkbox_$count " } or !$request -> {" amount_$count " })
@@ -1966,11 +1965,11 @@ sub post_overpayment {
19661965
19671966 # Let's fill all our entity invoice info, if it has a discount, store it into the discount accno
19681967 if ($list_key -> {" optional_discount_$count " } && $list_key -> {" amount_$count " } == $list_key -> {" due_$count " }) {
1969- push @{$list_key -> {array_amount }}, $list_key -> {" discount_$count " };
1970- push @{$list_key -> {array_cash_account_id }}, $list_key -> {" vc_discount_accno_$count " };
1971- push @{$list_key -> {array_source }}, undef ;
1972- push @{$list_key -> {array_transaction_id }}, $list_key -> {" invoice_id_$count " };
1973- push @{$list_key -> {array_memo }}, $locale -> text(' Applied discount by an overpayment' );
1968+ push @{$list_key -> {amount }}, $list_key -> {" discount_$count " };
1969+ push @{$list_key -> {cash_account_id }}, $list_key -> {" vc_discount_accno_$count " };
1970+ push @{$list_key -> {source }}, undef ;
1971+ push @{$list_key -> {transaction_id }}, $list_key -> {" invoice_id_$count " };
1972+ push @{$list_key -> {memo }}, $locale -> text(' Applied discount by an overpayment' );
19741973 push @{$list_key -> {ovp_payment_id }}, undef ;
19751974 }
19761975
@@ -1989,13 +1988,13 @@ sub post_overpayment {
19891988 }
19901989 if (@{$entity_unused_ovp {$ovp_chart_id }-> {unused_overpayment }}[$unused_ovp_index ]-> {available } >= $tmp_ovp_amount )
19911990 {
1992- push @{$list_key -> {array_amount }}, $tmp_ovp_amount ;
1993- push @{$list_key -> {array_cash_account_id }}, $ovp_chart_id ;
1994- push @{$list_key -> {array_source }},
1991+ push @{$list_key -> {amount }}, $tmp_ovp_amount ;
1992+ push @{$list_key -> {cash_account_id }}, $ovp_chart_id ;
1993+ push @{$list_key -> {source }},
19951994 $locale -> text(' use of an overpayment' );
1996- push @{$list_key -> {array_transaction_id }},
1995+ push @{$list_key -> {transaction_id }},
19971996 $list_key -> {" invoice_id_$count " };
1998- push @{$list_key -> {array_memo }}, undef ;
1997+ push @{$list_key -> {memo }}, undef ;
19991998 push @{$list_key -> {ovp_payment_id }},
20001999 @{$entity_unused_ovp {$ovp_chart_id }-> {unused_overpayment }}[$unused_ovp_index ]-> {payment_id };
20012000
@@ -2009,11 +2008,11 @@ sub post_overpayment {
20092008 } else {
20102009 $tmp_ovp_amount -= @{$entity_unused_ovp {$ovp_chart_id }-> {unused_overpayment }}[$unused_ovp_index ]-> {available };
20112010
2012- push @{$list_key -> {array_amount }}, @{$entity_unused_ovp {$ovp_chart_id }-> {unused_overpayment }}[$unused_ovp_index ]-> {available };
2013- push @{$list_key -> {array_cash_account_id }}, $ovp_chart_id ;
2014- push @{$list_key -> {array_source }}, $locale -> text(' use of an overpayment' );
2015- push @{$list_key -> {array_transaction_id }}, $list_key -> {" invoice_id_$count " };
2016- push @{$list_key -> {array_memo }}, undef ;
2011+ push @{$list_key -> {amount }}, @{$entity_unused_ovp {$ovp_chart_id }-> {unused_overpayment }}[$unused_ovp_index ]-> {available };
2012+ push @{$list_key -> {cash_account_id }}, $ovp_chart_id ;
2013+ push @{$list_key -> {source }}, $locale -> text(' use of an overpayment' );
2014+ push @{$list_key -> {transaction_id }}, $list_key -> {" invoice_id_$count " };
2015+ push @{$list_key -> {memo }}, undef ;
20172016 push @{$list_key -> {ovp_payment_id }}, @{$entity_unused_ovp {$ovp_chart_id }-> {unused_overpayment }}[$unused_ovp_index ]-> {payment_id };
20182017
20192018 $unused_ovp_index = $entity_unused_ovp {$ovp_chart_id }-> {unused_ovp_index }++;
@@ -2029,11 +2028,6 @@ sub post_overpayment {
20292028 for my $key (keys %entity_list )
20302029 {
20312030 my $list_key = $entity_list {$key };
2032- # CT: This logic should be eliminated once fixes are in master and 1.12
2033- for my $field (qw( amount cash_account_id source memo transaction_id) ) {
2034- $list_key -> {$field } =
2035- $list_key -> {" array_$field " };
2036- }
20372031
20382032 $entity_list {$key }-> post_payment();
20392033 }
0 commit comments