+sub _do_save {
+ $main::auth->assert('customer_vendor_edit & ' .
+ '(general_ledger | invoice_edit | vendor_invoice_edit | ' .
+ ' request_quotation_edit | sales_quotation_edit | sales_order_edit | purchase_order_edit)');
+
+ $::form->isblank("name", $::locale->text("Name missing!"));
+
+ if ($::form->{new_salesman_id} && $::lx_office_conf{features}->{vertreter}) {
+ $::form->{salesman_id} = $::form->{new_salesman_id};
+ delete $::form->{new_salesman_id};
+ }
+
+ my $res = $::form->{db} eq 'customer' ? CT->save_customer(\%::myconfig, $::form) : CT->save_vendor(\%::myconfig, $::form);
+
+ if (3 == $res) {
+ if ($::form->{"db"} eq "customer") {
+ $::form->error($::locale->text('This customer number is already in use.'));
+ } else {
+ $::form->error($::locale->text('This vendor number is already in use.'));
+ }
+ }
+}
+