use SL::Controller::CsvImport::Order;
use SL::Controller::CsvImport::DeliveryOrder;
use SL::Controller::CsvImport::ARTransaction;
+use SL::Controller::CsvImport::APTransaction;
use SL::JSON;
use SL::Controller::CsvImport::BankTransaction;
use SL::BackgroundJob::CsvImport;
$self->profile($profile);
if ($data->{errors} and my $first_error = $data->{errors}->[0]) {
- flash('error', $::locale->text('There was an error parsing the csv file: #1 in line #2.', $first_error->[2], $first_error->[4]));
+ if ('ARRAY' eq ref $first_error) {
+ flash('error', $::locale->text('There was an error parsing the csv file: #1 in line #2.', $first_error->[2], $first_error->[4]));
+ } else {
+ flash('error', $::locale->text('There was an error parsing the csv file: #1', $first_error));
+ }
}
if ($data->{progress}{finished} || $data->{errors}) {
sub check_type {
my ($self) = @_;
- die "Invalid CSV import type" if none { $_ eq $::form->{profile}->{type} } qw(parts inventories customers_vendors billing_addresses addresses contacts projects orders delivery_orders bank_transactions ar_transactions);
+ die "Invalid CSV import type" if none { $_ eq $::form->{profile}->{type} } qw(parts inventories customers_vendors billing_addresses addresses contacts projects orders delivery_orders bank_transactions ar_transactions ap_transactions);
$self->type($::form->{profile}->{type});
}
: $self->type eq 'delivery_orders' ? $::locale->text('CSV import: delivery orders')
: $self->type eq 'bank_transactions' ? $::locale->text('CSV import: bank transactions')
: $self->type eq 'ar_transactions' ? $::locale->text('CSV import: ar transactions')
+ : $self->type eq 'ap_transactions' ? $::locale->text('CSV import: ap transactions')
: die;
- if ( any { $_ eq $self->{type} } qw(customers_vendors orders delivery_orders ar_transactions) ) {
+ if ( any { $_ eq $self->{type} } qw(customers_vendors orders delivery_orders ar_transactions ap_transactions) ) {
$self->all_taxzones(SL::DB::Manager::TaxZone->get_all_sorted(query => [ obsolete => 0 ]));
};
$::form->{settings}->{sellprice_adjustment} = $::form->parse_amount(\%::myconfig, $::form->{settings}->{sellprice_adjustment});
}
- if ($self->type eq 'orders' or $self->{type} eq 'ar_transactions') {
+ if ( any { $_ eq $self->{type} } qw(orders ar_transactions ap_transactions) ) {
$::form->{settings}->{max_amount_diff} = $::form->parse_amount(\%::myconfig, $::form->{settings}->{max_amount_diff});
}
: $self->{type} eq 'delivery_orders' ? SL::Controller::CsvImport::DeliveryOrder->new(@args)
: $self->{type} eq 'bank_transactions' ? SL::Controller::CsvImport::BankTransaction->new(@args)
: $self->{type} eq 'ar_transactions' ? SL::Controller::CsvImport::ARTransaction->new(@args)
+ : $self->{type} eq 'ap_transactions' ? SL::Controller::CsvImport::APTransaction->new(@args)
: die "Program logic error";
}