- $bar->add_actions('combobox');
- $bar->actions->[-1]->add_actions([ t8('Export') ]);
- $bar->actions->[-1]->add_actions([ ($form->{id} ? t8('Print') : t8('Preview')),
- submit => [ '#form', { action_print => 1 } ],
- checks => [ @req_trans_desc ],
- disabled => !$form->{id} && $form->{locked} ? t8('The billing period has already been locked.') : undef,
- ]);
- $bar->actions->[-1]->add_actions([ t8('E Mail'),
- submit => [ '#form', { action_print => 1 } ],
- checks => [ @req_trans_desc ],
- disabled => !$form->{id} ? t8('This invoice has not been posted yet.') : undef,
- ]);
- $bar->add_actions('combobox');
- $bar->actions->[-1]->add_actions([ t8('more') ]);
- $bar->actions->[-1]->add_actions([ t8('History'),
- call => [ 'set_history_window', $form->{id} * 1, 'id' ],
- disabled => !$form->{id} ? t8('This invoice has not been posted yet.') : undef,
- ]);
- $bar->actions->[-1]->add_actions([ t8('Follow-Up'),
- call => [ 'follow_up_window' ],
- disabled => !$form->{id} ? t8('This invoice has not been posted yet.') : undef,
- ]);
- $bar->actions->[-1]->add_actions([ t8('Drafts'),
- call => [ 'kivi.Draft.popup', 'is', 'invoice', $form->{draft_id}, $form->{draft_description} ],
- disabled => $form->{id} ? t8('This invoice has already been posted.')
- : $form->{locked} ? t8('The billing period has already been locked.')
- : undef,
- ]);
+ for my $bar ($::request->layout->get('actionbar')) {
+ $bar->add(
+ action => [
+ t8('Update'),
+ submit => [ '#form', { action => "update" } ],
+ disabled => !$may_edit_create ? t8('You must not change this invoice.')
+ : $form->{locked} ? t8('The billing period has already been locked.')
+ : undef,
+ id => 'update_button',
+ accesskey => 'enter',
+ ],
+
+ combobox => [
+ action => [
+ t8('Post'),
+ submit => [ '#form', { action => "post" } ],
+ checks => [ 'kivi.validate_form' ],
+ confirm => t8('The invoice is not linked with a sales delivery order. Post anyway?') x !!$warn_unlinked_delivery_order,
+ disabled => !$may_edit_create ? t8('You must not change this invoice.')
+ : $form->{locked} ? t8('The billing period has already been locked.')
+ : $form->{storno} ? t8('A canceled invoice cannot be posted.')
+ : ($form->{id} && $change_never) ? t8('Changing invoices has been disabled in the configuration.')
+ : ($form->{id} && $change_on_same_day_only) ? t8('Invoices can only be changed on the day they are posted.')
+ : $is_linked_bank_transaction ? t8('This transaction is linked with a bank transaction. Please undo and redo the bank transaction booking if needed.')
+ : undef,
+ ],
+ action => [
+ t8('Post Payment'),
+ submit => [ '#form', { action => "post_payment" } ],
+ checks => [ 'kivi.validate_form' ],
+ disabled => !$may_edit_create ? t8('You must not change this invoice.')
+ : !$form->{id} ? t8('This invoice has not been posted yet.')
+ : $is_linked_bank_transaction ? t8('This transaction is linked with a bank transaction. Please undo and redo the bank transaction booking if needed.')
+ : undef,
+ only_if => $form->{type} ne "invoice_for_advance_payment",
+ ],
+ action => [ t8('Mark as paid'),
+ submit => [ '#form', { action => "mark_as_paid" } ],
+ confirm => t8('This will remove the invoice from showing as unpaid even if the unpaid amount does not match the amount. Proceed?'),
+ disabled => !$may_edit_create ? t8('You must not change this invoice.')
+ : !$form->{id} ? t8('This invoice has not been posted yet.')
+ : undef,
+ only_if => $::instance_conf->get_is_show_mark_as_paid && $form->{type} ne "invoice_for_advance_payment",
+ ],
+ ], # end of combobox "Post"
+
+ combobox => [
+ action => [ t8('Storno'),
+ submit => [ '#form', { action => "storno" } ],
+ confirm => t8('Do you really want to cancel this invoice?'),
+ checks => [ 'kivi.validate_form' ],
+ disabled => !$may_edit_create ? t8('You must not change this invoice.')
+ : !$form->{id} ? t8('This invoice has not been posted yet.')
+ : $form->{storno} ? t8('Cannot storno storno invoice!')
+ : $form->{locked} ? t8('The billing period has already been locked.')
+ : !$payments_balanced ? t8('Cancelling is disallowed. Either undo or balance the current payments until the open amount matches the invoice amount')
+ : undef,
+ ],
+ action => [ t8('Delete'),
+ submit => [ '#form', { action => "delete" } ],
+ confirm => t8('Do you really want to delete this object?'),
+ checks => [ 'kivi.validate_form' ],
+ disabled => !$may_edit_create ? t8('You must not change this invoice.')
+ : !$form->{id} ? t8('This invoice has not been posted yet.')
+ : $form->{locked} ? t8('The billing period has already been locked.')
+ : $change_never ? t8('Changing invoices has been disabled in the configuration.')
+ : $change_on_same_day_only ? t8('Invoices can only be changed on the day they are posted.')
+ : $has_storno ? t8('Can only delete the "Storno zu" part of the cancellation pair.')
+ : undef,
+ ],
+ ], # end of combobox "Storno"
+
+ 'separator',
+
+ combobox => [
+ action => [ t8('Workflow') ],
+ action => [
+ t8('Use As New'),
+ submit => [ '#form', { action => "use_as_new" } ],
+ checks => [ 'kivi.validate_form' ],
+ disabled => !$may_edit_create ? t8('You must not change this invoice.')
+ : !$form->{id} ? t8('This invoice has not been posted yet.')
+ : undef,
+ ],
+ action => [
+ t8('Further Invoice for Advance Payment'),
+ submit => [ '#form', { action => "further_invoice_for_advance_payment" } ],
+ checks => [ 'kivi.validate_form' ],
+ disabled => !$may_edit_create ? t8('You must not change this invoice.')
+ : !$form->{id} ? t8('This invoice has not been posted yet.')
+ : $has_further_invoice_for_advance_payment ? t8('This invoice has already a further invoice for advanced payment.')
+ : $has_final_invoice ? t8('This invoice has already a final invoice.')
+ : $is_invoice_for_advance_payment_from_order ? t8('This invoice was added from an order. See there.')
+ : undef,
+ only_if => $form->{type} eq "invoice_for_advance_payment",
+ ],
+ action => [
+ t8('Final Invoice'),
+ submit => [ '#form', { action => "final_invoice" } ],
+ checks => [ 'kivi.validate_form' ],
+ disabled => !$may_edit_create ? t8('You must not change this invoice.')
+ : !$form->{id} ? t8('This invoice has not been posted yet.')
+ : $has_further_invoice_for_advance_payment ? t8('This invoice has a further invoice for advanced payment.')
+ : $has_final_invoice ? t8('This invoice has already a final invoice.')
+ : $is_invoice_for_advance_payment_from_order ? t8('This invoice was added from an order. See there.')
+ : undef,
+ only_if => $form->{type} eq "invoice_for_advance_payment",
+ ],
+ action => [
+ t8('Credit Note'),
+ submit => [ '#form', { action => "credit_note" } ],
+ checks => [ 'kivi.validate_form' ],
+ disabled => !$may_edit_create ? t8('You must not change this invoice.')
+ : $form->{type} eq "credit_note" ? t8('Credit notes cannot be converted into other credit notes.')
+ : !$form->{id} ? t8('This invoice has not been posted yet.')
+ : $form->{storno} ? t8('A canceled invoice cannot be used. Please undo the cancellation first.')
+ : undef,
+ ],
+ action => [
+ t8('Sales Order'),
+ submit => [ '#form', { action => "order" } ],
+ checks => [ 'kivi.validate_form' ],
+ disabled => !$form->{id} ? t8('This invoice has not been posted yet.') : undef,
+ ],
+ ], # end of combobox "Workflow"
+
+ combobox => [
+ action => [ t8('Export') ],
+ action => [
+ ($form->{id} ? t8('Print') : t8('Preview')),
+ call => [ 'kivi.SalesPurchase.show_print_dialog', $form->{id} ? 'print' : 'preview' ],
+ checks => [ 'kivi.validate_form' ],
+ disabled => !$may_edit_create ? t8('You must not print this invoice.')
+ : !$form->{id} && $form->{locked} ? t8('The billing period has already been locked.')
+ : undef,
+ ],
+ action => [ t8('Print and Post'),
+ call => [ 'kivi.SalesPurchase.show_print_dialog', 'print_and_post' ],
+ checks => [ 'kivi.validate_form' ],
+ confirm => t8('The invoice is not linked with a sales delivery order. Post anyway?') x !!$warn_unlinked_delivery_order,
+ disabled => !$may_edit_create ? t8('You must not change this invoice.')
+ : $form->{locked} ? t8('The billing period has already been locked.')
+ : $form->{storno} ? t8('A canceled invoice cannot be posted.')
+ : ($form->{id} && $change_never) ? t8('Changing invoices has been disabled in the configuration.')
+ : ($form->{id} && $change_on_same_day_only) ? t8('Invoices can only be changed on the day they are posted.')
+ : $is_linked_bank_transaction ? t8('This transaction is linked with a bank transaction. Please undo and redo the bank transaction booking if needed.')
+ : undef,
+ ],
+ action => [ t8('E Mail'),
+ call => [ 'kivi.SalesPurchase.show_email_dialog' ],
+ checks => [ 'kivi.validate_form' ],
+ disabled => !$may_edit_create ? t8('You must not print this invoice.')
+ : !$form->{id} ? t8('This invoice has not been posted yet.')
+ : $form->{postal_invoice} ? t8('This customer wants a postal invoices.')
+ : undef,
+ ],
+ action => [ t8('Factur-X/ZUGFeRD'),
+ submit => [ '#form', { action => "download_factur_x_xml" } ],
+ checks => [ 'kivi.validate_form' ],
+ disabled => !$may_edit_create ? t8('You must not print this invoice.')
+ : !$form->{id} ? t8('This invoice has not been posted yet.')
+ : !$factur_x_enabled ? t8('Creating Factur-X/ZUGFeRD invoices is not enabled for this customer.')
+ : undef,
+ ],
+ ], # end of combobox "Export"
+
+ combobox => [
+ action => [ t8('more') ],
+ action => [
+ t8('History'),
+ call => [ 'set_history_window', $form->{id} * 1, 'glid' ],
+ disabled => !$form->{id} ? t8('This invoice has not been posted yet.') : undef,
+ ],
+ action => [
+ t8('Follow-Up'),
+ call => [ 'follow_up_window' ],
+ disabled => !$form->{id} ? t8('This invoice has not been posted yet.') : undef,
+ ],
+ action => [
+ t8('Drafts'),
+ call => [ 'kivi.Draft.popup', 'is', 'invoice', $form->{draft_id}, $form->{draft_description} ],
+ disabled => !$may_edit_create ? t8('You must not change this invoice.')
+ : $form->{id} ? t8('This invoice has already been posted.')
+ : $form->{locked} ? t8('The billing period has already been locked.')
+ : undef,
+ ],
+ ], # end of combobox "more"
+ );