X-Git-Url: http://wagnertech.de/gitweb/gitweb.cgi/mfinanz.git/blobdiff_plain/61b62e3c8c98aa1de965cc91927ad421afe1d192..53593baa211863fbf66540cf1bcc36c8fb37257f:/SL/Controller/Part.pm diff --git a/SL/Controller/Part.pm b/SL/Controller/Part.pm index d2638fb7e..aae4e531e 100644 --- a/SL/Controller/Part.pm +++ b/SL/Controller/Part.pm @@ -160,6 +160,26 @@ sub action_save { } } +sub action_save_and_purchase_order { + my ($self) = @_; + + my $session_value; + if (1 == scalar @{$self->part->makemodels}) { + my $prepared_form = Form->new(''); + $prepared_form->{vendor_id} = $self->part->makemodels->[0]->make; + $session_value = $::auth->save_form_in_session(form => $prepared_form); + } + + $::form->{callback} = $self->url_for( + controller => 'Order', + action => 'return_from_create_part', + type => 'purchase_order', + previousform => $session_value, + ); + + $self->_run_action('save'); +} + sub action_abort { my ($self) = @_; @@ -1346,10 +1366,24 @@ sub _setup_form_action_bar { ], ], # end of combobox "Save" + combobox => [ + action => [ t8('Workflow') ], + action => [ + t8('Save and Purchase Order'), + submit => [ '#ic', { action => "Part/save_and_purchase_order" } ], + checks => ['kivi.validate_form'], + disabled => !$self->part->id ? t8('The object has not been saved yet.') + : !$may_edit ? t8('You do not have the permissions to access this function.') + : !$::auth->assert('purchase_order_edit', 'may fail') ? t8('You do not have the permissions to access this function.') + : undef, + only_if => !$::form->{inline_create}, + ], + ], + action => [ t8('Abort'), submit => [ '#ic', { action => "Part/abort" } ], - only_if => !!$::form->{show_abort}, + only_if => !!$::form->{inline_create}, ], action => [