+sub setup_edit_action_bar {
+ my ($self, %params) = @_;
+
+ my $deletion_allowed = (any { $self->type eq $_ } (sales_quotation_type(), request_quotation_type()))
+ || (($self->type eq sales_order_type()) && $::instance_conf->get_sales_order_show_delete)
+ || (($self->type eq purchase_order_type()) && $::instance_conf->get_purchase_order_show_delete);
+
+ for my $bar ($::request->layout->get('actionbar')) {
+ $bar->add(
+ combobox => [
+ action => [
+ t8('Save'),
+ call => [ 'kivi.Order.save', 'save', $::instance_conf->get_order_warn_duplicate_parts,
+ $::instance_conf->get_order_warn_no_deliverydate,
+ ],
+ checks => [ 'kivi.Order.check_save_active_periodic_invoices', ['kivi.validate_form','#order_form'] ],
+ ],
+ action => [
+ t8('Save as new'),
+ call => [ 'kivi.Order.save', 'save_as_new', $::instance_conf->get_order_warn_duplicate_parts ],
+ checks => [ 'kivi.Order.check_save_active_periodic_invoices' ],
+ disabled => !$self->order->id ? t8('This object has not been saved yet.') : undef,
+ ],
+ ], # end of combobox "Save"
+
+ combobox => [
+ action => [
+ t8('Workflow'),
+ ],
+ action => [
+ t8('Save and Sales Order'),
+ submit => [ '#order_form', { action => "Order/sales_order" } ],
+ only_if => (any { $self->type eq $_ } (sales_quotation_type(), purchase_order_type())),
+ ],
+ action => [
+ t8('Save and Purchase Order'),
+ call => [ 'kivi.Order.purchase_order_check_for_direct_delivery' ],
+ only_if => (any { $self->type eq $_ } (sales_order_type(), request_quotation_type())),
+ ],
+ action => [
+ t8('Save and Delivery Order'),
+ call => [ 'kivi.Order.save', 'save_and_delivery_order', $::instance_conf->get_order_warn_duplicate_parts,
+ $::instance_conf->get_order_warn_no_deliverydate,
+ ],
+ checks => [ 'kivi.Order.check_save_active_periodic_invoices' ],
+ only_if => (any { $self->type eq $_ } (sales_order_type(), purchase_order_type()))
+ ],
+ action => [
+ t8('Save and Invoice'),
+ call => [ 'kivi.Order.save', 'save_and_invoice', $::instance_conf->get_order_warn_duplicate_parts ],
+ checks => [ 'kivi.Order.check_save_active_periodic_invoices' ],
+ ],
+ action => [
+ t8('Save and AP Transaction'),
+ call => [ 'kivi.Order.save', 'save_and_ap_transaction', $::instance_conf->get_order_warn_duplicate_parts ],
+ only_if => (any { $self->type eq $_ } (purchase_order_type()))
+ ],
+
+ ], # end of combobox "Workflow"
+
+ combobox => [
+ action => [
+ t8('Export'),
+ ],
+ action => [
+ t8('Save and print'),
+ call => [ 'kivi.Order.show_print_options', $::instance_conf->get_order_warn_duplicate_parts ],
+ ],
+ action => [
+ t8('Save and E-mail'),
+ call => [ 'kivi.Order.save', 'save_and_show_email_dialog', $::instance_conf->get_order_warn_duplicate_parts ],
+ disabled => !$self->order->id ? t8('This object has not been saved yet.') : undef,
+ ],
+ action => [
+ t8('Download attachments of all parts'),
+ call => [ 'kivi.File.downloadOrderitemsFiles', $::form->{type}, $::form->{id} ],
+ disabled => !$self->order->id ? t8('This object has not been saved yet.') : undef,
+ only_if => $::instance_conf->get_doc_storage,
+ ],
+ ], # 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,
+ ],
+
+ combobox => [
+ action => [
+ t8('more')
+ ],
+ action => [
+ t8('Follow-Up'),
+ call => [ 'kivi.Order.follow_up_window' ],
+ disabled => !$self->order->id ? t8('This object has not been saved yet.') : undef,
+ only_if => $::auth->assert('productivity', 1),
+ ],
+ ], # end of combobox "more"
+ );
+ }
+}
+
+sub generate_pdf {