use SL::DB::RecordTemplate;
use SL::DB::SepaExportItem;
use SL::DBUtils qw(like);
-use SL::Presenter;
use List::MoreUtils qw(any);
use List::Util qw(max);
$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
$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
$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();
}