+ $form->error($locale->text('Cannot delete delivery order!') . $ret);
+
+ $main::lxdebug->leave_sub();
+}
+sub delete_transfers {
+ $main::lxdebug->enter_sub();
+
+ check_do_access_for_edit();
+
+ my $form = $main::form;
+ my %myconfig = %main::myconfig;
+ my $locale = $main::locale;
+ my $ret;
+
+ die "Invalid form type" unless $form->{type} =~ m/^(sales|purchase)_delivery_order$/;
+
+ if ($ret = DO->delete_transfers()) {
+ # saving the history
+ if(!exists $form->{addition}) {
+ $form->{snumbers} = qq|donumber_| . $form->{donumber};
+ $form->{addition} = "UNDO TRANSFER";
+ $form->save_history;
+ }
+ # /saving the history
+
+ flash_later('info', $locale->text("Transfer undone."));
+
+ $form->{callback} = 'do.pl?action=edit&type=' . $form->{type} . '&id=' . $form->escape($form->{id});
+ $form->redirect;
+ }
+
+ $form->error($locale->text('Cannot undo delivery order transfer!') . $ret);