Revision 6532a6e8
Von Bernd Bleßmann vor mehr als 3 Jahren hinzugefügt
SL/Controller/CustomerVendor.pm | ||
---|---|---|
185 | 185 |
} |
186 | 186 |
} |
187 | 187 |
|
188 |
$self->{cv}->ustid( trim($self->{cv}->ustid)) if $self->{cv}->ustid; |
|
189 |
$self->{cv}->taxnumber(trim($self->{cv}->taxnumber)) if $self->{cv}->taxnumber; |
|
190 |
|
|
191 |
if ( $self->is_vendor() && $::instance_conf->get_vendor_ustid_taxnummer_unique) { |
|
192 |
$::form->error(t8('VAT ID and/or taxnumber must be given.')) if !($self->{cv}->ustid || $self->{cv}->taxnumber); |
|
193 |
|
|
194 |
my $count; |
|
195 |
$count += SL::DB::Manager::Vendor->get_all_count(query => ['!id' => $self->{cv}->id, ustid => $self->{cv}->ustid]) if $self->{cv}->ustid; |
|
196 |
$count += SL::DB::Manager::Vendor->get_all_count(query => ['!id' => $self->{cv}->id, taxnumber => $self->{cv}->taxnumber]) if $self->{cv}->taxnumber; |
|
197 |
|
|
198 |
$::form->error(t8('A vendor with the same VAT ID or taxnumber already exists.')) if $count; |
|
199 |
} |
|
200 |
if ($self->is_customer() && $::instance_conf->get_customer_ustid_taxnummer_unique) { |
|
201 |
$::form->error(t8('VAT ID and/or taxnumber must be given.')) if !($self->{cv}->ustid || $self->{cv}->taxnumber); |
|
202 |
|
|
203 |
my $count; |
|
204 |
$count += SL::DB::Manager::Customer->get_all_count(query => ['!id' => $self->{cv}->id, ustid => $self->{cv}->ustid]) if $self->{cv}->ustid; |
|
205 |
$count += SL::DB::Manager::Customer->get_all_count(query => ['!id' => $self->{cv}->id, taxnumber => $self->{cv}->taxnumber]) if $self->{cv}->taxnumber; |
|
206 |
|
|
207 |
$::form->error(t8('A customer with the same VAT ID or taxnumber already exists.')) if $count; |
|
208 |
} |
|
209 |
|
|
188 | 210 |
$self->{cv}->save(cascade => 1); |
189 | 211 |
|
190 | 212 |
SL::DB::Greeting->new(description => $self->{cv}->greeting)->save if $save_greeting; |
Auch abrufbar als: Unified diff
Kunden/Lieferanten: UStId/Steuernr. eindeutig: Prüfung im Controller