use SL::DB::Business;
use SL::DB::CustomVariable;
use SL::DB::CustomVariableConfig;
+use SL::DB::Employee;
use SL::DB::PaymentTerm;
use SL::TransNumber;
sub init_salesmen_by {
my ($self) = @_;
- return { map { my $col = $_; ( $col => { map { ( $_->$col => $_ ) } @{ SL::DB::Manager::Employee->get_all } } ) } qw(id name) };
+ return { map { my $col = $_; ( $col => { map { ( lc($_->$col) => $_ ) } @{ SL::DB::Manager::Employee->get_all } } ) } qw(id name login) };
}
sub check_objects {
}
# Map name to ID if given.
- if (!$object->salesman_id && $entry->{raw_data}->{salesman}) {
- my $salesman = $self->salesmen_by->{name}->{ $entry->{raw_data}->{salesman} };
+ if (!$object->salesman_id && ($entry->{raw_data}->{salesman} || $entry->{raw_data}->{salesman_login})) {
+ my $salesman = $self->salesmen_by->{name} ->{ lc($entry->{raw_data}->{salesman}) }
+ // $self->salesmen_by->{login}->{ lc($entry->{raw_data}->{salesman_login}) };
if (!$salesman) {
push @{ $entry->{errors} }, $::locale->text('Error: Invalid salesman');
my $profile = $self->SUPER::init_profile;
delete @{$profile}{qw(business datevexport language payment delivery_term taxincluded terms)};
- delete @{$profile}{qw(salesman salesman_id)} if $::instance_conf->get_vertreter;
+ delete @{$profile}{qw(salesman salesman_id salesman_login)} if $::instance_conf->get_vertreter;
return $profile;
}
);
if (!$::instance_conf->get_vertreter) {
- $self->add_displayable_columns({ name => 'salesman_id', description => $::locale->text('Salesman (database ID)') });
- $self->add_displayable_columns({ name => 'salesman', description => $::locale->text('Salesman') });
+ $self->add_displayable_columns({ name => 'salesman', description => $::locale->text('Salesman') },
+ { name => 'salesman_id', description => $::locale->text('Salesman (database ID)') },
+ { name => 'salesman_login', description => $::locale->text('Salesman (login)') });
}
-
}
# TODO:
'Error: Invalid price factor' => 'Fehler: Preisfaktor ungültig',
'Error: Invalid price group' => 'Fehler: Preisgruppe ungültig',
'Error: Invalid project' => 'Fehler: Projekt ungültig',
- 'Error: Invalid salesman' => 'Fehler: Ungültiger Verkäufer',
+ 'Error: Invalid salesman' => 'Fehler: ungültige Verkäufer/in',
'Error: Invalid shipto' => 'Fehler: Lieferadresse ungültig',
'Error: Invalid tax zone' => 'Fehler: Steuerzone ungültig',
'Error: Invalid unit' => 'Fehler: Einheit ungültig',
'Sales quotation #1 has been deleted.' => 'Angebot #1 wurde gelöscht.',
'Sales quotation #1 has been updated.' => 'Angebot #1 wurde aktualisiert.',
'Salesman' => 'Verkäufer/in',
- 'Salesman (database ID)' => 'Verkäufer (Datenbank-ID)',
+ 'Salesman (ID)' => 'Verkäufer/in (ID)',
+ 'Salesman (database ID)' => 'Verkäufer/in (Datenbank-ID)',
+ 'Salesman (login)' => 'Verkäufer/in (Login)',
'Salesperson' => 'Verkäufer',
'Same Filename !' => 'unveränderter Dateiname !',
'Same as the quote character' => 'Wie Anführungszeichen',