+ $::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 {
+ $::lxdebug->enter_sub;
+ $::auth->assert('customer_vendor_edit');
+
+ if (!$::form->{shipto_id}) {
+ flash('error', $::locale->text('No shipto selected to delete'));
+ } else {
+
+ CT->get_shipto(\%::myconfig, $::form);
+
+ my $shipto = SL::DB::Manager::Shipto->find_by(shipto_id => $::form->{shipto_id});
+
+ if ($shipto->used) {
+ $shipto->detach->save;
+ flash('info', $::locale->text('Shipto is in use and was flagged invalid.'));
+ } else {
+ $shipto->delete;
+ flash('info', $::locale->text('Shipto deleted.'));
+ }
+ delete $::form->{$_} for grep /^shipto/, keys %$::form;
+ }
+
+ edit();
+
+ $::lxdebug->leave_sub;
+}
+
+sub delete_contact {
+ $::lxdebug->enter_sub;
+ $::auth->assert('customer_vendor_edit');
+
+ if (!$::form->{cp_id}) {
+ flash('error', $::locale->text('No contact selected to delete'));
+ } else {
+
+ CT->get_contact(\%::myconfig, $::form);
+
+ my $contact = SL::DB::Manager::Contact->find_by(cp_id => $::form->{cp_id});
+
+ if ($contact->used) {
+ $contact->detach->save;
+ flash('info', $::locale->text('Contact is in use and was flagged invalid.'));
+ } else {
+ $contact->delete;
+ flash('info', $::locale->text('Contact deleted.'));
+ }
+ delete $::form->{$_} for grep /^cp_/, keys %$::form;
+ }
+
+ edit();
+
+ $::lxdebug->leave_sub;
+}
+
+sub ajax_autocomplete {
+ $main::lxdebug->enter_sub();
+
+ my $form = $main::form;
+ my %myconfig = %main::myconfig;