sub send_email {
$lxdebug->enter_sub();
- $old_form = new Form;
+ my $callback = $form->{script} . "?action=edit";
+ map({ $callback .= "\&${_}=" . E($form->{$_}); }
+ qw(login password path type id));
- map { $old_form->{$_} = $form->{$_} } keys %$form;
- $old_form->{media} = $form->{oldmedia};
+ print_form("return");
- &print_form($old_form);
+ $form->{callback} = $callback;
+ $form->redirect();
$lxdebug->leave_sub();
}
$form->update_status(\%myconfig)
if ($form->{media} eq 'queue' && $form->{id});
+ return $lxdebug->leave_sub() if ($old_form eq "return");
+
if ($old_form) {
$old_form->{"${inv}number"} = $form->{"${inv}number"};
sub e_mail {
$lxdebug->enter_sub();
- $print_post = 1;
+ if (!$form->{id}) {
+ $print_post = 1;
- &post;
+ my $saved_form = save_form();
- &edit_e_mail;
+ post();
+
+ my %saved_vars;
+ map({ $saved_vars{$_} = $form->{$_}; } qw(id invnumber));
+ restore_form($saved_form);
+ map({ $form->{$_} = $saved_vars{$_}; } qw(id invnumber));
+ }
+
+ edit_e_mail();
$lxdebug->leave_sub();
}
$form->{print_and_save} = 1;
- &save;
+ if (!$form->{id}) {
+ $print_post = 1;
+
+ my $saved_form = save_form();
+
+ save();
+
+ my %saved_vars;
+ map({ $saved_vars{$_} = $form->{$_}; } qw(id ordnumber quonumber));
+ restore_form($saved_form);
+ map({ $form->{$_} = $saved_vars{$_}; } qw(id ordnumber quonumber));
+ }
- &edit_e_mail;
+ edit_e_mail();
$lxdebug->leave_sub();
}