my $debitcount = 0;
my $creditcount = 0;
my $debitcredit;
+ my %split_safety = ();
my @flds = qw(accno debit credit projectnumber fx_transaction source memo tax taxchart);
push @a, {};
$debitcredit = ($form->{"debit_$i"} == 0) ? "0" : "1";
+ $split_safety{ $form->{"debit_$i"} <=> 0 }++;
+ $split_safety{ - $form->{"credit_$i"} <=> 0 }++;
+
if ($debitcredit) {
$debitcount++;
} else {
$count++;
}
+ if ($split_safety{-1} > 1 && $split_safety{1} > 1) {
+ $::form->error($::locale->text("Split entry detected. The values you have entered will result in an entry with more than one position on both debit and credit. Due to known problems involving accounting software Lx-Office does not allow these."));
+ }
+
for my $i (1 .. $count) {
my $j = $i - 1;
for (@flds) { $form->{"${_}_$i"} = $a[$j]->{$_} }