ActionBar: Verwendung im neuen Auftrags-Controller
authorMoritz Bunkus <m.bunkus@linet-services.de>
Fri, 13 Jan 2017 09:38:28 +0000 (10:38 +0100)
committerMoritz Bunkus <m.bunkus@linet-services.de>
Tue, 28 Feb 2017 09:43:59 +0000 (10:43 +0100)
SL/Controller/Order.pm
templates/webpages/order/form.html

index fce6e23..bb34a46 100644 (file)
@@ -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 {
index 9f8c4c6..f36dff2 100644 (file)
       [%- LxERP.t8("Loading...") %]
     </div>
   </div>
-
-  <br>
-
-  [% 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 %]
-
 </form>