]> wagnertech.de Git - mfinanz.git/blobdiff - SL/Controller/Draft.pm
BUGFIX: Kreditorenbuchungen: Fehler beim Nutzen von Drafts(2)
[mfinanz.git] / SL / Controller / Draft.pm
index 33da3bd1aa9d8b5cf4712596985a0ea521e2d5c5..a450e2c9f58375a44e0af26f7458969004342e8f 100644 (file)
@@ -19,7 +19,7 @@ use Rose::Object::MakeMethods::Generic (
 
 __PACKAGE__->run_before('check_auth');
 
-my %allowed_modules = map { $_ => "bin/mozilla/$_.pl" } qw(is ir ar ap);
+my %allowed_modules = map { $_ => "bin/mozilla/$_.pl" } qw(is ir ar ap gl);
 
 #
 # actions
@@ -81,13 +81,16 @@ sub action_load {
     package main;
     require $allowed_modules{ $self->draft->module };
   }
-
+  my $params = delete $::form->{form};
   my $new_form = YAML::Load($self->draft->form);
   $::form->{$_} = $new_form->{$_} for keys %$new_form;
   $::form->{"draft_$_"} = $self->draft->$_ for qw(id description);
 
+  if ($params && 'HASH' eq ref $params) {
+    $::form->{$_} = $params->{$_} for keys %$params;
+  }
   $::form->{script} = $self->draft->module . '.pl';
-  ::update();
+  ::show_draft();
 }
 
 sub action_delete {
@@ -158,7 +161,7 @@ sub init_draft {
 }
 
 sub check_auth {
-  $::auth->assert('vendor_invoice_edit | invoice_edit | general_ledger');
+  $::auth->assert('vendor_invoice_edit | invoice_edit | ap_transactions | ar_transactions');
 }
 
 1;