Revision cd8b56f2
Von Kivitendo Admin vor etwa 10 Jahren hinzugefügt
SL/Controller/CsvImport.pm | ||
---|---|---|
$profile ||= SL::DB::CsvImportProfile->new(type => $self->{type}, login => $::myconfig{login});
|
||
|
||
$self->profile($profile);
|
||
$self->worker->set_profile_defaults;
|
||
$self->profile->set_defaults;
|
||
}
|
||
|
SL/Controller/CsvImport/BankTransaction.pm | ||
---|---|---|
'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');
|
SL/Controller/CsvImport/Contact.pm | ||
---|---|---|
scalar => [ qw(table) ],
|
||
);
|
||
|
||
sub set_profile_defaults {
|
||
};
|
||
|
||
sub init_class {
|
||
my ($self) = @_;
|
||
$self->class('SL::DB::Contact');
|
SL/Controller/CsvImport/CustomerVendor.pm | ||
---|---|---|
'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');
|
SL/Controller/CsvImport/Inventory.pm | ||
---|---|---|
$self->class('SL::DB::Inventory');
|
||
}
|
||
|
||
sub set_profile_defaults {
|
||
};
|
||
|
||
sub init_profile {
|
||
my ($self) = @_;
|
||
|
SL/Controller/CsvImport/Order.pm | ||
---|---|---|
$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) = @_;
|
SL/Controller/CsvImport/Part.pm | ||
---|---|---|
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');
|
SL/Controller/CsvImport/Project.pm | ||
---|---|---|
$self->class('SL::DB::Project');
|
||
}
|
||
|
||
sub set_profile_defaults {
|
||
};
|
||
|
||
sub init_all_cvar_configs {
|
||
my ($self) = @_;
|
||
|
SL/Controller/CsvImport/Shipto.pm | ||
---|---|---|
scalar => [ qw(table) ],
|
||
);
|
||
|
||
sub set_profile_defaults {
|
||
};
|
||
|
||
sub init_class {
|
||
my ($self) = @_;
|
||
$self->class('SL::DB::Shipto');
|
SL/DB/CsvImportProfile.pm | ||
---|---|---|
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 => '"',
|
Auch abrufbar als: Unified diff
CSV Import Defaults in die Worker ausgelagert
Neben den Standard-Defaults, die für alle gelten (charset, numberformat,
...)