$profile ||= SL::DB::CsvImportProfile->new(type => $self->{type}, login => $::myconfig{login});
$self->profile($profile);
+ $self->worker->set_profile_defaults;
$self->profile->set_defaults;
}
'scalar --get_set_init' => [ qw(bank_accounts_by) ],
);
+sub set_profile_defaults {
+ my ($self) = @_;
+
+ $self->controller->profile->_set_defaults(
+ charset => 'UTF8', # override charset from defaults
+ update_policy => 'skip',
+ );
+};
+
sub init_class {
my ($self) = @_;
$self->class('SL::DB::BankTransaction');
scalar => [ qw(table) ],
);
+sub set_profile_defaults {
+};
+
sub init_class {
my ($self) = @_;
$self->class('SL::DB::Contact');
'scalar --get_set_init' => [ qw(table languages_by businesses_by) ],
);
+sub set_profile_defaults {
+ my ($self) = @_;
+ $self->controller->profile->_set_defaults(table => 'customer');
+};
+
sub init_table {
my ($self) = @_;
$self->table($self->controller->profile->get('table') eq 'customer' ? 'customer' : 'vendor');
$self->class('SL::DB::Inventory');
}
+sub set_profile_defaults {
+};
+
sub init_profile {
my ($self) = @_;
$self->class(['SL::DB::Order', 'SL::DB::OrderItem']);
}
+sub set_profile_defaults {
+ my ($self) = @_;
+
+ $self->controller->profile->_set_defaults(
+ order_column => $::locale->text('Order'),
+ item_column => $::locale->text('OrderItem'),
+ max_amount_diff => 0.02,
+ );
+};
+
sub init_settings {
my ($self) = @_;
translation_columns all_pricegroups) ],
);
+sub set_profile_defaults {
+ my ($self) = @_;
+
+ my $bugru = SL::DB::Manager::Buchungsgruppe->find_by(description => { like => 'Standard%19%' });
+
+ $self->controller->profile->_set_defaults(
+ sellprice_places => 2,
+ sellprice_adjustment => 0,
+ sellprice_adjustment_type => 'percent',
+ article_number_policy => 'update_prices',
+ shoparticle_if_missing => '0',
+ parts_type => 'part',
+ default_buchungsgruppe => ($bugru ? $bugru->id : undef),
+ apply_buchungsgruppe => 'all',
+ );
+};
+
+
sub init_class {
my ($self) = @_;
$self->class('SL::DB::Part');
$self->class('SL::DB::Project');
}
+sub set_profile_defaults {
+};
+
sub init_all_cvar_configs {
my ($self) = @_;
scalar => [ qw(table) ],
);
+sub set_profile_defaults {
+};
+
sub init_class {
my ($self) = @_;
$self->class('SL::DB::Shipto');
sub set_defaults {
my ($self) = @_;
-
- if ($self->type eq 'parts') {
- my $bugru = SL::DB::Manager::Buchungsgruppe->find_by(description => { like => 'Standard%19%' });
-
- $self->_set_defaults(sellprice_places => 2,
- sellprice_adjustment => 0,
- sellprice_adjustment_type => 'percent',
- article_number_policy => 'update_prices',
- shoparticle_if_missing => '0',
- parts_type => 'part',
- default_buchungsgruppe => ($bugru ? $bugru->id : undef),
- apply_buchungsgruppe => 'all',
- );
- } elsif ($self->type eq 'orders') {
- $self->_set_defaults(order_column => $::locale->text('Order'),
- item_column => $::locale->text('OrderItem'),
- max_amount_diff => 0.02,
- );
- } elsif ($self->type eq 'mt940') {
- $self->_set_defaults(charset => 'UTF8',
- sep_char => ';',
- numberformat => '1000.00',
- update_policy => 'skip',
- );
- } elsif ($self->type eq 'bank_transactions') {
- $self->_set_defaults(charset => 'UTF8',
- update_policy => 'skip',
- );
- } else {
- $self->_set_defaults(table => 'customer');
- }
-
- # TODO: move the defaults into their own controller
- # defaults can only be set once, so use these values as default if they
- # haven't already been set above for one of the special import types
- # If the values have been set above they won't be overwritten here:
-
$self->_set_defaults(sep_char => ',',
quote_char => '"',
escape_char => '"',