+ $::form->{is_sales} ? $::auth->assert('sales_letter_report')
+ : $::auth->assert('purchase_letter_report');
+}
+
+sub setup_load_letter_draft_action_bar {
+ my ($self, %params) = @_;
+
+ for my $bar ($::request->layout->get('actionbar')) {
+ $bar->add(
+ link => [
+ t8('Skip'),
+ link => $self->url_for(action => 'skip_draft', is_sales => $self->is_sales),
+ accesskey => 'enter',
+ ],
+ action => [
+ t8('Delete'),
+ submit => [ '#form', { action => 'delete_drafts' } ],
+ checks => [ [ 'kivi.check_if_entries_selected', '[name="ids[+]"]' ] ],
+ confirm => t8('Do you really want to delete this draft?'),
+ ],
+ );
+ }
+}
+
+sub setup_display_action_bar {
+ my ($self, %params) = @_;
+
+ for my $bar ($::request->layout->get('actionbar')) {
+ $bar->add(
+ action => [
+ t8('Update'),
+ submit => [ '#form', { action => 'Letter/update' } ],
+ accesskey => 'enter',
+ ],
+
+ combobox => [
+ action => [
+ t8('Save'),
+ submit => [ '#form', { action => 'Letter/save' } ],
+ ],
+ action => [
+ t8('Save Draft'),
+ submit => [ '#form', { action => 'Letter/save_letter_draft' } ],
+ ],
+ ], # end of combobox "Save"
+
+ action => [
+ t8('Delete'),
+ submit => [ '#form', { action => 'Letter/delete' } ],
+ confirm => t8('Are you sure you want to delete this letter?'),
+ disabled => !$self->letter->id ? t8('The object has not been saved yet.') : undef,
+ ],
+
+ combobox => [
+ action => [ t8('Export') ],
+ action => [
+ t8('Print'),
+ call => [ 'kivi.SalesPurchase.show_print_dialog', 'Letter/print_letter' ],
+ disabled => !$self->letter->id ? t8('The object has not been saved yet.') : undef,
+ ],
+ action => [
+ t8('E-mail'),
+ call => [ 'kivi.SalesPurchase.show_email_dialog', 'Letter/send_email' ],
+ disabled => !$self->letter->id ? t8('The object has not been saved yet.') : undef,
+ ],
+ ],
+ );
+ }
+}
+
+sub setup_list_action_bar {
+ my ($self, %params) = @_;
+
+ for my $bar ($::request->layout->get('actionbar')) {
+ $bar->add(
+ action => [
+ t8('Update'),
+ submit => [ '#search_form', { action => 'Letter/list' } ],
+ accesskey => 'enter',
+ ],
+ );
+ }