X-Git-Url: http://wagnertech.de/gitweb/gitweb.cgi/mfinanz.git/blobdiff_plain/a97574b881103cc09a48152a4f29f8a2cc1c38a3..7ff8f33c49bc503d16ddda159c9848f88b80d5ad:/SL/Controller/BankTransaction.pm diff --git a/SL/Controller/BankTransaction.pm b/SL/Controller/BankTransaction.pm index 692fb701b..c220f3c1c 100644 --- a/SL/Controller/BankTransaction.pm +++ b/SL/Controller/BankTransaction.pm @@ -153,6 +153,7 @@ sub action_list { $bt->{remote_name} .= $bt->{remote_name_1} if $bt->{remote_name_1}; if ( $bt->is_batch_transaction ) { + my $found=0; foreach ( keys %sepa_exports) { if ( abs(($sepa_exports{$_}->{amount} * 1) - ($bt->amount * 1)) < 0.01 ) { ## jupp @@ -160,9 +161,11 @@ sub action_list { $bt->{sepa_export_ok} = 1; $sepa_exports{$_}->{proposed}=1; push(@proposals, $bt); - next; + $found=1; + last; } } + next if $found; # batch transaction has no remotename !! } else { next unless $bt->{remote_name}; # bank has no name, usually fees, use create invoice to assign @@ -502,17 +505,22 @@ sub save_invoices { $count += scalar( @{$invoice_ids} ); } } + my $max_count = $count; foreach (@{ $self->problems }) { $count-- if $_->{result} eq 'error'; } - return $count; + return ($count, $max_count); } sub action_save_invoices { my ($self) = @_; - my $count = $self->save_invoices(); + my ($success_count, $max_count) = $self->save_invoices(); - flash('ok', t8('#1 invoice(s) saved.', $count)); + if ($success_count == $max_count) { + flash('ok', t8('#1 invoice(s) saved.', $success_count)); + } else { + flash('error', t8('At least #1 invoice(s) not saved', $max_count - $success_count)); + } $self->action_list(); }