- $form->redirect(
- $form->{label} . " $form->{invnumber} " . $locale->text('posted!'))
- if (IS->post_invoice(\%myconfig, \%$form));
+ if (IS->post_invoice(\%myconfig, \%$form)){
+ remove_draft() if $form->{remove_draft};
+ # saving the history
+ if(!exists $form->{addition}) {
+ if($form->{storno}) {
+ $form->{addition} = "STORNO";
+ }
+ else {
+ $form->{addition} = "POSTED";
+ }
+ $form->save_history($form->dbconnect(\%myconfig));
+ }
+ # /saving the history
+
+ $form->redirect(
+ $form->{label} . " $form->{invnumber} " . $locale->text('posted!'));
+ }