From: Bernd Bleßmann Date: Wed, 23 Sep 2015 11:44:38 +0000 (+0200) Subject: Auftrags-Controller: Funktion "Speichern und Lieferschein". X-Git-Url: http://wagnertech.de/git?a=commitdiff_plain;h=fea94894ccc1fd4ee626f686ade761b83a1e4ebb;p=kivitendo-erp.git Auftrags-Controller: Funktion "Speichern und Lieferschein". --- diff --git a/SL/Controller/Order.pm b/SL/Controller/Order.pm index 17e1d7d31..8c3ca5427 100644 --- a/SL/Controller/Order.pm +++ b/SL/Controller/Order.pm @@ -36,7 +36,7 @@ use Rose::Object::MakeMethods::Generic __PACKAGE__->run_before('_check_auth'); __PACKAGE__->run_before('_recalc', - only => [ qw(edit update save create_pdf send_email) ]); + only => [ qw(edit update save save_and_delivery_order create_pdf send_email) ]); # @@ -212,6 +212,29 @@ sub action_send_email { ->render($self); } +sub action_save_and_delivery_order { + my ($self) = @_; + + my $errors = $self->_save(); + + if (scalar @{ $errors }) { + $self->js->flash('error', $_) foreach @{ $errors }; + return $self->js->render($self); + } + + my $delivery_order = $self->order->convert_to_delivery_order($self->order); + + flash_later('info', $::locale->text('The order has been saved')); + my @redirect_params = ( + controller => 'do.pl', + action => 'edit', + type => $delivery_order->type, + id => $delivery_order->id, + vc => $delivery_order->is_sales ? 'customer' : 'vendor', + ); + + $self->redirect_to(@redirect_params); +} sub action_customer_vendor_changed { my ($self) = @_; diff --git a/templates/webpages/order/form.html b/templates/webpages/order/form.html index ae226b030..a1d90e172 100644 --- a/templates/webpages/order/form.html +++ b/templates/webpages/order/form.html @@ -33,6 +33,7 @@ [% L.button_tag('save()', LxERP.t8('Save')) %] [% L.button_tag('create_pdf()', LxERP.t8('Create PDF')) %] [% L.button_tag('email()', LxERP.t8('E-mail')) %] + [% L.button_tag('save_and_delivery_order()', LxERP.t8('Save and Delivery Order')) %] @@ -68,4 +69,11 @@ function email() { $.post("controller.pl", data, kivi.eval_json_result); } +function save_and_delivery_order() { + var data = $('#order_form').serialize(); + data += '&action=Order/save_and_delivery_order'; + + $.post("controller.pl", data, kivi.eval_json_result); +} +