7 |
7 |
use SL::DB::Business;
|
8 |
8 |
use SL::DB::CustomVariable;
|
9 |
9 |
use SL::DB::CustomVariableConfig;
|
|
10 |
use SL::DB::Employee;
|
10 |
11 |
use SL::DB::PaymentTerm;
|
11 |
12 |
use SL::TransNumber;
|
12 |
13 |
|
... | ... | |
53 |
54 |
sub init_salesmen_by {
|
54 |
55 |
my ($self) = @_;
|
55 |
56 |
|
56 |
|
return { map { my $col = $_; ( $col => { map { ( $_->$col => $_ ) } @{ SL::DB::Manager::Employee->get_all } } ) } qw(id name) };
|
|
57 |
return { map { my $col = $_; ( $col => { map { ( lc($_->$col) => $_ ) } @{ SL::DB::Manager::Employee->get_all } } ) } qw(id name login) };
|
57 |
58 |
}
|
58 |
59 |
|
59 |
60 |
sub check_objects {
|
... | ... | |
218 |
219 |
}
|
219 |
220 |
|
220 |
221 |
# Map name to ID if given.
|
221 |
|
if (!$object->salesman_id && $entry->{raw_data}->{salesman}) {
|
222 |
|
my $salesman = $self->salesmen_by->{name}->{ $entry->{raw_data}->{salesman} };
|
|
222 |
if (!$object->salesman_id && ($entry->{raw_data}->{salesman} || $entry->{raw_data}->{salesman_login})) {
|
|
223 |
my $salesman = $self->salesmen_by->{name} ->{ lc($entry->{raw_data}->{salesman}) }
|
|
224 |
// $self->salesmen_by->{login}->{ lc($entry->{raw_data}->{salesman_login}) };
|
223 |
225 |
|
224 |
226 |
if (!$salesman) {
|
225 |
227 |
push @{ $entry->{errors} }, $::locale->text('Error: Invalid salesman');
|
... | ... | |
264 |
266 |
|
265 |
267 |
my $profile = $self->SUPER::init_profile;
|
266 |
268 |
delete @{$profile}{qw(business datevexport language payment delivery_term taxincluded terms)};
|
267 |
|
delete @{$profile}{qw(salesman salesman_id)} if $::instance_conf->get_vertreter;
|
|
269 |
delete @{$profile}{qw(salesman salesman_id salesman_login)} if $::instance_conf->get_vertreter;
|
268 |
270 |
|
269 |
271 |
return $profile;
|
270 |
272 |
}
|
... | ... | |
323 |
325 |
);
|
324 |
326 |
|
325 |
327 |
if (!$::instance_conf->get_vertreter) {
|
326 |
|
$self->add_displayable_columns({ name => 'salesman_id', description => $::locale->text('Salesman (database ID)') });
|
327 |
|
$self->add_displayable_columns({ name => 'salesman', description => $::locale->text('Salesman') });
|
|
328 |
$self->add_displayable_columns({ name => 'salesman', description => $::locale->text('Salesman') },
|
|
329 |
{ name => 'salesman_id', description => $::locale->text('Salesman (database ID)') },
|
|
330 |
{ name => 'salesman_login', description => $::locale->text('Salesman (login)') });
|
328 |
331 |
}
|
329 |
|
|
330 |
332 |
}
|
331 |
333 |
|
332 |
334 |
# TODO:
|
CSV-Import Kunden: Verkäufer über Login setzen können
Bei Verkäufernamen und
logins (Spalten »salesman« undund»salesman_login«) wird absichtlich nicht zwischen Groß
Kleinschreibung unterschieden. Technisch betrachtet unterscheidet
kivitendo zwar bei Loginnamen zwischen Groß- und Kleinschreibung, aber
in der Praxis legt niemand zwei Benutzer*innen an, deren Login sich
nur in der Groß-/Kleinschreibung unterscheidet.
Sie zu ignorieren macht die Interaktion mit anderen Systemen leichter
und erspart einen Zwischenschritt an Bearbeitung.