X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;ds=sidebyside;f=bin%2Fmozilla%2Fir.pl;h=95ada94e52e410f16b8043c6f6c87b017cff8f73;hb=307f0b13b5d0b1068cb7eacad1601f4786b28353;hp=ad1c202534d0e57bb7e6a7765140bd5396952107;hpb=1ce68041a1923c60a6608a2ed6365f5915bacd9a;p=kivitendo-erp.git diff --git a/bin/mozilla/ir.pl b/bin/mozilla/ir.pl index ad1c20253..95ada94e5 100644 --- a/bin/mozilla/ir.pl +++ b/bin/mozilla/ir.pl @@ -216,6 +216,86 @@ sub prepare_invoice { $main::lxdebug->leave_sub(); } +sub setup_ir_action_bar { + my $form = $::form; + my $change_never = $::instance_conf->get_ir_changeable == 0; + my $change_on_same_day_only = $::instance_conf->get_ir_changeable == 2 && ($form->current_date(\%::myconfig) ne $form->{gldate}); + + for my $bar ($::request->layout->get('actionbar')) { + $bar->add( + action => [ + t8('Update'), + submit => [ '#form', { action_update => 1 } ], + id => 'update_button', + accesskey => 'enter', + ], + + combobox => [ + action => [ + t8('Post'), + submit => [ '#form', { action_post => 1 } ], + disabled => $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.') + : undef, + ], + action => [ + t8('Post Payment'), + submit => [ '#form', { action_post_payment => 1 } ], + disabled => !$form->{id} ? t8('This invoice has not been posted yet.') : undef, + ], + (action => [ + t8('Mark as paid'), + submit => [ '#form', { action_mark_as_paid => 1 } ], + confirm => t8('This will remove the invoice from showing as unpaid even if the unpaid amount does not match the amount. Proceed?'), + disabled => !$form->{id} ? t8('This invoice has not been posted yet.') : undef, + ]) x !!$::instance_conf->get_ir_show_mark_as_paid, + ], # end of combobox "Post" + + combobox => [ + action => [ t8('Storno'), + submit => [ '#form', { action_storno => 1 } ], + confirm => t8('Do you really want to cancel this invoice?'), + disabled => !$form->{id} ? t8('This invoice has not been posted yet.') : undef, + ], + action => [ t8('Delete'), + submit => [ '#form', { action_delete => 1 } ], + confirm => t8('Do you really want to delete this object?'), + disabled => !$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.') + : undef, + ], + ], # end of combobox "Storno" + + 'separator', + + combobox => [ + action => [ t8('more') ], + action => [ + t8('History'), + call => [ 'set_history_window', $::form->{id} * 1, 'id', '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', 'ir', '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, + ], + ], # end of combobox "more" + ); + } +} + sub form_header { $main::lxdebug->enter_sub(); @@ -294,9 +374,11 @@ sub form_header { map { $_.'_rate', $_.'_description', $_.'_taxnumber' } split / /, $form->{taxaccounts}]; $TMPL_VAR{payment_terms_obj} = get_payment_terms_for_invoice(); - $form->{duedate} = $TMPL_VAR{payment_terms_obj}->calc_date(reference_date => $form->{invdate}, due_date => $form->{due_due})->to_kivitendo if $TMPL_VAR{payment_terms_obj}; + $form->{duedate} = $TMPL_VAR{payment_terms_obj}->calc_date(reference_date => $form->{invdate}, due_date => $form->{duedate})->to_kivitendo if $TMPL_VAR{payment_terms_obj}; + + $::request->{layout}->use_javascript(map { "${_}.js" } qw(kivi.Draft kivi.File kivi.SalesPurchase kivi.Part ckeditor/ckeditor ckeditor/adapters/jquery kivi.io autocomplete_customer autocomplete_project client_js)); - $::request->{layout}->use_javascript(map { "${_}.js" } qw(kivi.Draft kivi.File kivi.SalesPurchase ckeditor/ckeditor ckeditor/adapters/jquery kivi.io autocomplete_customer autocomplete_part autocomplete_project client_js)); + setup_ir_action_bar(); $form->header();