$form->{id} = 0 if $form->{postasnew};
+ # get new invnumber in sequence if no invnumber is given or if posasnew was requested
+ if (!$form->{invnumber} || $form->{postasnew}) {
+ $form->{invnumber} = $form->update_defaults(\%myconfig, "invnumber");
+ }
+
$form->redirect( $locale->text('Invoice')
. " $form->{invnumber} "
. $locale->text('posted!'))
}
- $form->{$ordnumber} = $form->update_defaults(\%myconfig, $numberfld)
- unless $form->{$ordnumber};
+ # get new number in sequence if no number is given or if saveasnew was requested
+ if (!$form->{$ordumber} || $form->{saveasnew}) {
+ $form->{$ordnumber} = $form->update_defaults(\%myconfig, $numberfld);
+ }
$form->redirect(
$form->{label} . " $form->{$ordnumber} " . $locale->text('saved!'))