X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;ds=sidebyside;f=bin%2Fmozilla%2Fap.pl;h=18924979618cdc15c056fadb24d48b3102857b87;hb=5e59cc54dd5e2d69f71828541795a29ed51a96f0;hp=f5c6609528d4a8c8ad853c9b4040aa8bee6aeeb7;hpb=dacb62eb0109209f6c56d25d84c252c506fa25d1;p=kivitendo-erp.git
diff --git a/bin/mozilla/ap.pl b/bin/mozilla/ap.pl
index f5c660952..189249796 100644
--- a/bin/mozilla/ap.pl
+++ b/bin/mozilla/ap.pl
@@ -37,6 +37,7 @@ use SL::PE;
require "$form->{path}/arap.pl";
require "bin/mozilla/common.pl";
+require "bin/mozilla/drafts.pl";
1;
@@ -73,6 +74,8 @@ require "bin/mozilla/common.pl";
sub add {
$lxdebug->enter_sub();
+ return $lxdebug->leave_sub() if (load_draft_maybe());
+
$form->{title} = "Add";
$form->{callback} =
@@ -459,6 +462,8 @@ sub form_header {
{locked}>
+| . ($form->{saved_message} ? qq|
$form->{saved_message}
| : "") . qq|
+
$form->{title} |
@@ -757,6 +762,10 @@ sub form_footer {
{path}>
{login}>
{password}>
+|
+. $cgi->hidden('-name' => 'draft_id', '-default' => [$form->{draft_id}])
+. $cgi->hidden('-name' => 'draft_description', '-default' => [$form->{draft_description}])
+. qq|
|;
@@ -789,7 +798,9 @@ sub form_footer {
} elsif (($transdate > $closedto) && !$form->{id}) {
print qq|
|;
+ . $locale->text('Post') . qq|"> | .
+ NTI($cgi->submit('-name' => 'action', '-value' => $locale->text('Save draft'),
+ '-class' => 'submit'));
}
# button for saving history
if($form->{id} ne "") {
@@ -1000,15 +1011,17 @@ sub post {
$form->{taxkey} = $taxkey;
$form->{id} = 0 if $form->{postasnew};
- # saving the history
- if(!exists $form->{addition} && $form->{id} ne "") {
- $form->{addition} = "POSTED";
- $form->save_history($form->dbconnect(\%myconfig));
- }
- # /saving the history
- $form->redirect($locale->text('Transaction posted!'))
- if (AP->post_transaction(\%myconfig, \%$form));
+ if (AP->post_transaction(\%myconfig, \%$form)) {
+ # saving the history
+ if(!exists $form->{addition} && $form->{id} ne "") {
+ $form->{addition} = "POSTED";
+ $form->save_history($form->dbconnect(\%myconfig));
+ }
+ # /saving the history
+ remove_draft() if $form->{remove_draft};
+ $form->redirect($locale->text('Transaction posted!'));
+ }
$form->error($locale->text('Cannot post transaction!'));
$lxdebug->leave_sub();