use strict;
+use SL::DB::Buchungsgruppe;
use SL::DB::CsvImportProfile;
use SL::Helper::Flash;
use Rose::Object::MakeMethods::Generic
(
- scalar => [ qw(type profile all_profiles all_charsets sep_char all_sep_chars quote_char all_quote_chars escape_char all_escape_chars) ],
+ scalar => [ qw(type profile all_profiles all_charsets sep_char all_sep_chars quote_char all_quote_chars escape_char all_escape_chars all_buchungsgruppen) ],
);
__PACKAGE__->run_before('check_auth');
my $title = $self->type eq 'customers_vendors' ? $::locale->text('CSV import: customers and vendors')
: $self->type eq 'addresses' ? $::locale->text('CSV import: shipping addresses')
: $self->type eq 'contacts' ? $::locale->text('CSV import: contacts')
- : $self->type eq 'parts' ? $::locale->text('CSV import: parts, services and assemblies')
+ : $self->type eq 'parts' ? $::locale->text('CSV import: parts and services')
: die;
+ $self->all_buchungsgruppen(SL::DB::Manager::Buchungsgruppe->get_all_sorted);
+
$self->render('csv_import/form', title => $title);
}
escape_char => '"',
charset => 'CP850',
numberformat => $::myconfig{numberformat},
+ duplicates => 'no_check',
);
if ($self->type eq 'parts') {
- my $bugru = SL::DB::Manager::Buchungsgruppe->find_by(name => { like => 'Standard%19%' });
+ 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_price',
- price_group_sep_char => '!',
- shoparticle_if_missing => 0,
+ article_number_policy => 'update_prices',
+ part_group_sep_char => '!',
+ shoparticle_if_missing => '0',
parts_type => 'part',
- default_buchungsgruppe => ($bugru ? $bugru->name : undef),
+ default_buchungsgruppe => ($bugru ? $bugru->description : undef),
+ apply_buchungsgruppe => 'all',
);
} else {
$self->_set_defaults(table => 'customer');
--- /dev/null
+<tr>
+ <th align="right">[%- LxERP.t8('Target table') %]:</th>
+ <td colspan="10">
+ [% opts = [ [ 'customer', LxERP.t8('Customers') ], [ 'vendor', LxERP.t8('Vendors') ] ] %]
+ [% L.select_tag('settings.table', L.options_for_select(opts, default => SELF.profile.get('table')), style => 'width: 300px') %]
+ </td>
+</tr>
--- /dev/null
+<tr>
+ <th align="right">[%- LxERP.t8('Parts with existing part numbers') %]:</th>
+ <td colspan="10">
+ [% opts = [ [ 'update_prices', LxERP.t8('Update prices of existing entries') ], [ 'insert_new', LxERP.t8('Insert with new part number') ] ] %]
+ [% L.select_tag('settings.article_number_policy', L.options_for_select(opts, default => SELF.profile.get('article_number_policy')), style => 'width: 300px') %]
+ </td>
+</tr>
+
+<tr>
+ <th align="right">[%- LxERP.t8('Sellprice significant places') %]:</th>
+ <td colspan="10">
+ [% L.select_tag('settings.sellprice_places', L.options_for_select([ 0, 1, 2, 3, 4, 5 ], default => SELF.profile.get('sellprice_places')), style => 'width: 300px') %]
+ </td>
+</tr>
+
+<tr>
+ <th align="right">[%- LxERP.t8('Sellprice adjustment') %]:</th>
+ <td colspan="10">
+ [% L.input_tag('settings.sellprice_adjustment', LxERP.format_amount(SELF.profile.get('sellprice_adjustment')), size => "5") %]
+ [% opts = [ [ 'percent', LxERP.t8('percental') ], [ 'absolute', LxERP.t8('absolute') ] ] %]
+ [% L.select_tag('settings.sellprice_adjustment_type', L.options_for_select(opts, default => SELF.profile.get('sellprice_adjustment_type'))) %]
+ </td>
+</tr>
+
+<tr>
+ <th align="right">[%- LxERP.t8('Separator for part groups') %]:</th>
+ <td colspan="10">
+ [% L.input_tag('settings.part_group_sep_char', SELF.profile.get('part_group_sep_char'), size => 5) %]
+ </td>
+</tr>
+
+<tr>
+ <th align="right">[%- LxERP.t8('Mark as shop article if column missing') %]:</th>
+ <td colspan="10">
+ [% opts = [ [ '1', LxERP.t8('yes') ], [ '0', LxERP.t8('no') ] ] %]
+ [% L.select_tag('settings.shoparticle_if_missing', L.options_for_select(opts, default => SELF.profile.get('shoparticle_if_missing')), style => 'width: 300px') %]
+ </td>
+</tr>
+
+<tr>
+ <th align="right">[%- LxERP.t8('Type') %]:</th>
+ <td colspan="10">
+ [% opts = [ [ 'part', LxERP.t8('Parts') ], [ 'service', LxERP.t8('Services') ], [ 'mixed', LxERP.t8('Mixed (requires column "type")') ] ] %]
+ [% L.select_tag('settings.parts_type', L.options_for_select(opts, default => SELF.profile.get('parts_type')), style => 'width: 300px') %]
+ </td>
+</tr>
+
+<tr>
+ <th align="right" valign="top">[%- LxERP.t8('Default buchungsgruppe') %]:</th>
+ <td colspan="10" valign="top">
+ [% opts = L.options_for_select(SELF.all_buchungsgruppen, tilte => 'description', value => 'description', default => SELF.profile.get('default_buchungsgruppe')) %]
+ [% L.select_tag('settings.default_buchungsgruppe', opts, style => 'width: 300px') %]
+ <br>
+ [% opts = [ [ 'never', LxERP.t8('Do not set default buchungsgruppe') ], [ 'all', LxERP.t8('Apply to all parts') ], [ 'missing', LxERP.t8('Apply to parts without buchungsgruppe') ] ] %]
+ [% L.select_tag('settings.apply_buchungsgruppe', L.options_for_select(opts, default => SELF.profile.get('apply_buchungsgruppe')), style => 'width: 300px') %]
+ </td>
+</tr>
</td>
</tr>
+ <tr>
+ <th align="right">[%- LxERP.t8('Check for duplicates') %]:</th>
+ <td colspan="10">
+ [% opts = [ [ 'no_check', LxERP.t8('Do not check for duplicates') ],
+ [ 'check_csv', LxERP.t8('Discard duplicate entries in CSV file') ],
+ [ 'check_db', LxERP.t8('Discard entries with duplicates in database and CSV file') ] ] %]
+ [% L.select_tag('settings.duplicates', L.options_for_select(opts, default => SELF.profile.get('duplicates')), style => 'width: 300px') %]
+ </td>
+ </tr>
+
+[%- IF SELF.type == 'parts' %]
+ [%- INCLUDE 'csv_import/_form_parts.html' %]
+[%- ELSIF SELF.type == 'customers_vendors' %]
+ [%- INCLUDE 'csv_import/_form_customers_vendors.html' %]
+[%- END %]
+
</table>
[% L.submit_tag('action_test', LxERP.t8('Gogogo')) %]