+ $::lxdebug->enter_sub;
+
+ $::auth->assert('customer_vendor_edit');
+ $::auth->assert('sales_all_edit');
+
+ CT->get_delivery(\%::myconfig, $::form );
+
+ print $::form->ajax_response_header,
+ $::form->parse_html_template('ct/get_delivery', {
+ is_customer => $::form->{db} eq 'customer',
+ });
+
+ $::lxdebug->leave_sub;
+}
+
+sub delete_shipto {
+ $main::lxdebug->enter_sub();
+
+ $main::auth->assert('customer_vendor_edit');
+
+ my $form = $main::form;
+ my %myconfig = %main::myconfig;
+
+ CT->get_shipto(\%myconfig, \%$form);
+
+ unless ($form->{shiptoused}) {
+ CT->delete_shipto($form->{shipto_id});
+ @$form{ grep /^shipto/, keys %$form } = undef;
+ }
+
+ edit();
+
+ $main::lxdebug->leave_sub();
+}
+
+sub delete_contact {
+ $main::lxdebug->enter_sub();
+
+ $main::auth->assert('customer_vendor_edit');
+
+ my $form = $main::form;
+ my %myconfig = %main::myconfig;
+
+ CT->get_contact(\%myconfig, \%$form);
+
+ unless ($form->{cp_used}) {
+ CT->delete_shipto($form->{cp_id});
+ @$form{ grep /^cp_/, keys %$form } = undef;
+ }
+
+ edit();
+
+ $main::lxdebug->leave_sub();
+}
+
+sub ajax_autocomplete {
+ $main::lxdebug->enter_sub();
+
+ my $form = $main::form;
+ my %myconfig = %main::myconfig;
+
+ $form->{column} = 'name' unless $form->{column} =~ /^name$/;
+ $form->{vc} = 'customer' unless $form->{vc} =~ /^customer|vendor$/;
+ $form->{db} = $form->{vc}; # CT expects this
+ $form->{$form->{column}} = $form->{q} || '';
+ $form->{limit} = ($form->{limit} * 1) || 10;
+ $form->{searchitems} ||= '';
+
+ CT->search(\%myconfig, $form);