From 7d020076fcfe27c34c9a68e97df7d969f33c08e2 Mon Sep 17 00:00:00 2001 From: Moritz Bunkus Date: Fri, 13 Jan 2017 10:38:28 +0100 Subject: [PATCH] ActionBar: Verwendung im neuen Auftrags-Controller --- SL/Controller/Order.pm | 48 ++++++++++++++++++++++++++++++ templates/webpages/order/form.html | 16 ---------- 2 files changed, 48 insertions(+), 16 deletions(-) diff --git a/SL/Controller/Order.pm b/SL/Controller/Order.pm index fce6e236a..bb34a4655 100644 --- a/SL/Controller/Order.pm +++ b/SL/Controller/Order.pm @@ -1097,6 +1097,54 @@ sub _pre_render { } $::request->{layout}->use_javascript("${_}.js") for qw(kivi.SalesPurchase kivi.Order kivi.File ckeditor/ckeditor ckeditor/adapters/jquery); + $self->_setup_edit_action_bar; +} + +sub _setup_edit_action_bar { + my ($self, %params) = @_; + + my $deletion_allowed = (($self->cv eq 'customer') && $::instance_conf->get_sales_order_show_delete) + || (($self->cv eq 'vendor') && $::instance_conf->get_purchase_order_show_delete); + + for my $bar ($::request->layout->get('actionbar')) { + $bar->add( + combobox => [ + action => [ + t8('Save'), + call => [ 'kivi.Order.save', $::instance_conf->get_order_warn_duplicate_parts ], + accesskey => 'enter', + ], + action => [ + t8('Save and Delivery Order'), + call => [ 'kivi.Order.save_and_delivery_order', $::instance_conf->get_order_warn_duplicate_parts ], + accesskey => 'enter', + ], + + ], # end of combobox "Save" + + combobox => [ + action => [ + t8('Export'), + ], + action => [ + t8('Print'), + call => [ 'kivi.Order.show_print_options' ], + ], + action => [ + t8('E-mail'), + call => [ 'kivi.Order.email' ], + ], + ], # end of combobox "Export" + + action => [ + t8('Delete'), + call => [ 'kivi.Order.delete_order' ], + confirm => $::locale->text('Do you really want to delete this object?'), + disabled => !$self->order->id ? t8('This object has not been saved yet.') : undef, + only_if => $deletion_allowed, + ], + ); + } } sub _create_pdf { diff --git a/templates/webpages/order/form.html b/templates/webpages/order/form.html index 9f8c4c68e..f36dff2b0 100644 --- a/templates/webpages/order/form.html +++ b/templates/webpages/order/form.html @@ -41,20 +41,4 @@ [%- LxERP.t8("Loading...") %] - -
- - [% L.hidden_tag('action', 'Order/dispatch') %] - - [% L.button_tag('kivi.Order.save(' _ INSTANCE_CONF.get_order_warn_duplicate_parts _ ')', LxERP.t8('Save')) %] - [% L.button_tag('kivi.Order.show_print_options()', LxERP.t8('Print')) %] - [% L.button_tag('kivi.Order.email()', LxERP.t8('E-mail')) %] - [% L.button_tag('kivi.Order.save_and_delivery_order(' _ INSTANCE_CONF.get_order_warn_duplicate_parts _ ')', LxERP.t8('Save and Delivery Order')) %] -[%- IF SELF.order.id && ( (SELF.cv == 'customer' && INSTANCE_CONF.get_sales_order_show_delete) || (SELF.cv == 'vendor' && INSTANCE_CONF.get_purchase_order_show_delete) ) %] - [% L.button_tag('kivi.Order.delete_order()', LxERP.t8('Delete'), confirm=LxERP.t8("Are you sure?")) %] -[%- END %] -[%- IF SELF.order.id && INSTANCE_CONF.get_doc_storage %] - [% L.button_tag('kivi.File.downloadOrderitemsFiles(\'' _ SELF.order.type _'\',' _ SELF.order.id _')',LxERP.t8('Download all Attachments')) %] -[%- END %] - -- 2.20.1