Revision d70e6870
Von Moritz Bunkus vor mehr als 11 Jahren hinzugefügt
SL/Controller/CsvImport/Base.pm | ||
---|---|---|
5 | 5 |
use List::MoreUtils qw(pairwise); |
6 | 6 |
|
7 | 7 |
use SL::Helper::Csv; |
8 |
use SL::DB::Currency; |
|
8 | 9 |
use SL::DB::Customer; |
9 | 10 |
use SL::DB::Language; |
10 | 11 |
use SL::DB::PaymentTerm; |
... | ... | |
16 | 17 |
use Rose::Object::MakeMethods::Generic |
17 | 18 |
( |
18 | 19 |
scalar => [ qw(controller file csv test_run save_with_cascade) ], |
19 |
'scalar --get_set_init' => [ qw(profile displayable_columns existing_objects class manager_class cvar_columns all_cvar_configs all_languages payment_terms_by all_vc vc_by) ], |
|
20 |
'scalar --get_set_init' => [ qw(profile displayable_columns existing_objects class manager_class cvar_columns all_cvar_configs all_languages payment_terms_by all_currencies default_currency_id all_vc vc_by) ],
|
|
20 | 21 |
); |
21 | 22 |
|
22 | 23 |
sub run { |
... | ... | |
139 | 140 |
return SL::DB::Manager::Language->get_all; |
140 | 141 |
} |
141 | 142 |
|
143 |
sub init_all_currencies { |
|
144 |
my ($self) = @_; |
|
145 |
|
|
146 |
return SL::DB::Manager::Currency->get_all; |
|
147 |
} |
|
148 |
|
|
149 |
sub init_default_currency_id { |
|
150 |
my ($self) = @_; |
|
151 |
|
|
152 |
return SL::DB::Default->get->currency_id; |
|
153 |
} |
|
154 |
|
|
142 | 155 |
sub init_payment_terms_by { |
143 | 156 |
my ($self) = @_; |
144 | 157 |
|
SL/Controller/CsvImport/CustomerVendor.pm | ||
---|---|---|
13 | 13 |
|
14 | 14 |
use Rose::Object::MakeMethods::Generic |
15 | 15 |
( |
16 |
'scalar --get_set_init' => [ qw(table languages_by businesses_by) ], |
|
16 |
'scalar --get_set_init' => [ qw(table languages_by businesses_by currencies_by) ],
|
|
17 | 17 |
); |
18 | 18 |
|
19 | 19 |
sub init_table { |
... | ... | |
44 | 44 |
return { map { my $col = $_; ( $col => { map { ( $_->$col => $_ ) } @{ $self->all_languages } } ) } qw(id description article_code) }; |
45 | 45 |
} |
46 | 46 |
|
47 |
sub init_currencies_by { |
|
48 |
my ($self) = @_; |
|
49 |
|
|
50 |
return { map { my $col = $_; ( $col => { map { ( $_->$col => $_ ) } @{ $self->all_currencies } } ) } qw(id name) }; |
|
51 |
} |
|
52 |
|
|
47 | 53 |
sub check_objects { |
48 | 54 |
my ($self) = @_; |
49 | 55 |
|
... | ... | |
65 | 71 |
$self->check_language($entry); |
66 | 72 |
$self->check_business($entry); |
67 | 73 |
$self->check_payment($entry); |
74 |
$self->check_currency($entry); |
|
68 | 75 |
$self->handle_cvars($entry); |
69 | 76 |
|
70 | 77 |
next if @{ $entry->{errors} }; |
... | ... | |
155 | 162 |
return 1; |
156 | 163 |
} |
157 | 164 |
|
165 |
sub check_currency { |
|
166 |
my ($self, $entry) = @_; |
|
167 |
|
|
168 |
my $object = $entry->{object}; |
|
169 |
|
|
170 |
# Check whether or not currency ID is valid. |
|
171 |
if ($object->currency_id && !$self->currencies_by->{id}->{ $object->currency_id }) { |
|
172 |
push @{ $entry->{errors} }, $::locale->text('Error: Invalid currency'); |
|
173 |
return 0; |
|
174 |
} |
|
175 |
|
|
176 |
# Map name to ID if given. |
|
177 |
if (!$object->currency_id && $entry->{raw_data}->{currency}) { |
|
178 |
my $currency = $self->currencies_by->{name}->{ $entry->{raw_data}->{currency} }; |
|
179 |
if (!$currency) { |
|
180 |
push @{ $entry->{errors} }, $::locale->text('Error: Invalid currency'); |
|
181 |
return 0; |
|
182 |
} |
|
183 |
|
|
184 |
$object->currency_id($currency->id); |
|
185 |
} |
|
186 |
|
|
187 |
# Set default currency if none was given. |
|
188 |
$object->currency_id($self->default_currency_id) if !$object->currency_id; |
|
189 |
|
|
190 |
$entry->{raw_data}->{currency_id} = $object->currency_id; |
|
191 |
|
|
192 |
return 1; |
|
193 |
} |
|
194 |
|
|
158 | 195 |
sub check_business { |
159 | 196 |
my ($self, $entry) = @_; |
160 | 197 |
|
... | ... | |
253 | 290 |
{ name => 'contact', description => $::locale->text('Contact') }, |
254 | 291 |
{ name => 'country', description => $::locale->text('Country') }, |
255 | 292 |
{ name => 'creditlimit', description => $::locale->text('Credit Limit') }, |
293 |
{ name => 'currency', description => $::locale->text('Currency') }, |
|
294 |
{ name => 'currency_id', description => $::locale->text('Currency (database ID)') }, |
|
256 | 295 |
{ name => 'customernumber', description => $::locale->text('Customer Number') }, |
257 | 296 |
{ name => 'department_1', description => $::locale->text('Department 1') }, |
258 | 297 |
{ name => 'department_2', description => $::locale->text('Department 2') }, |
locale/de/all | ||
---|---|---|
298 | 298 |
'Billing/shipping address (street)' => 'Rechnungsadresse (Straße)', |
299 | 299 |
'Billing/shipping address (zipcode)' => 'Rechnungsadresse (PLZ)', |
300 | 300 |
'Bin' => 'Lagerplatz', |
301 |
'Bin 2' => '', |
|
302 | 301 |
'Bin From' => 'Quelllagerplatz', |
303 | 302 |
'Bin List' => 'Lagerliste', |
304 | 303 |
'Bin To' => 'Ziellagerplatz', |
... | ... | |
528 | 527 |
'Curr' => 'Währung', |
529 | 528 |
'Currencies' => 'Währungen', |
530 | 529 |
'Currency' => 'Währung', |
530 |
'Currency (database ID)' => 'Währung (Datenbank-ID)', |
|
531 | 531 |
'Current / Next Level' => 'Aktuelles / Nächstes Mahnlevel', |
532 | 532 |
'Current Earnings' => 'Gewinn', |
533 | 533 |
'Current assets account' => 'Konto für Umlaufvermögen', |
... | ... | |
608 | 608 |
'Decrease' => 'Verringern', |
609 | 609 |
'Default (no language selected)' => 'Standard (keine Sprache ausgewählt)', |
610 | 610 |
'Default Accounts' => 'Standardkonten', |
611 |
'Default Bin' => '', |
|
612 | 611 |
'Default Customer/Vendor Language' => 'Standard-Kunden-/Lieferantensprache', |
613 |
'Default Warehouse' => '', |
|
614 | 612 |
'Default buchungsgruppe' => 'Standardbuchungsgruppe', |
615 | 613 |
'Default currency' => 'Standardwährung', |
616 | 614 |
'Default currency missing!' => 'Standardwährung fehlt!', |
... | ... | |
835 | 833 |
'Error: Customer/vendor not found' => 'Fehler: Kunde/Lieferant nicht gefunden', |
836 | 834 |
'Error: Gender (cp_gender) missing or invalid' => 'Fehler: Geschlecht (cp_gender) fehlt oder ungültig', |
837 | 835 |
'Error: Invalid business' => 'Fehler: Kunden-/Lieferantentyp ungültig', |
836 |
'Error: Invalid currency' => 'Fehler: ungültige Währung', |
|
838 | 837 |
'Error: Invalid language' => 'Fehler: Sprache ungültig', |
839 | 838 |
'Error: Invalid part type' => 'Fehler: Artikeltyp ungültig', |
840 | 839 |
'Error: Invalid parts group' => 'Fehler: Warengruppe ungültig', |
... | ... | |
937 | 936 |
'Fristsetzung' => 'Fristsetzung', |
938 | 937 |
'From' => 'Von', |
939 | 938 |
'From Date' => 'Von', |
940 |
'From this version on it is necessary to name a default value.' => 'Ab dieser Version benötigt kivitendo eine Standardwährung.', |
|
941 | 939 |
'From this version on a new feature is available.' => 'Ab dieser Version ist ein neues Feature verfügbar.', |
940 |
'From this version on it is necessary to name a default value.' => 'Ab dieser Version benötigt kivitendo eine Standardwährung.', |
|
942 | 941 |
'From this version on the partnumber of services, articles and assemblies have to be unique.' => 'Ab dieser Version müssen Artikelnummern eindeutig vergeben werden.', |
943 | 942 |
'From this version on the taxkey 0 must have a tax rate of 0 (for DATEV compatibility).' => 'Ab dieser Version muss der Steuerschlüssel 0 einen Steuersatz von 0% haben (auf Grund der DATEV-Kompatibilität).', |
944 | 943 |
'Full Access' => 'Vollzugriff', |
Auch abrufbar als: Unified diff
Währung beim CSV-Import Kunden/Lieferanten unterstützen
Fixt #2282.