X-Git-Url: http://wagnertech.de/gitweb/gitweb.cgi/mfinanz.git/blobdiff_plain/62726dfdf4f763efa65c25fcfe8658d98649c8a8..28dd76dfcb4480d8224cb4a6e95894467844de67:/SL/Controller/Draft.pm diff --git a/SL/Controller/Draft.pm b/SL/Controller/Draft.pm index 33da3bd1a..131ed6b23 100644 --- a/SL/Controller/Draft.pm +++ b/SL/Controller/Draft.pm @@ -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 @@ -82,10 +82,17 @@ sub action_load { 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->{transdate} = DateTime->today_local->to_kivitendo if !$::form->{transdate}; + $::form->{gldate} = $::form->{transdate} if !$::form->{gldate}; $::form->{script} = $self->draft->module . '.pl'; ::update(); } @@ -158,7 +165,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;