__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) ]);
#
->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) = @_;
[% 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')) %]
</form>
$.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);
+}
+
</script>