Revision 98aafe29
Von Moritz Bunkus vor fast 8 Jahren hinzugefügt
bin/mozilla/is.pl | ||
---|---|---|
360 | 360 |
$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}; |
361 | 361 |
|
362 | 362 |
my @req_trans_desc = qw(kivi.SalesPurchase.check_transaction_description) x!!$::instance_conf->get_require_transaction_description_ps; |
363 |
my $show_delete = ($::instance_conf->get_is_changeable == 2 && $form->current_date(\%myconfig) eq $form->{gldate}) |
|
364 |
|| $::instance_conf->get_is_changeable == 1; |
|
363 |
|
|
364 |
my $change_never = $::instance_conf->get_is_changeable == 0; |
|
365 |
my $change_on_same_day_only = $::instance_conf->get_is_changeable == 2 && ($form->current_date(\%myconfig) ne $form->{gldate}); |
|
365 | 366 |
|
366 | 367 |
for my $bar ($::request->layout->get('actionbar')) { |
367 | 368 |
$bar->add_actions([ t8('Update'), |
368 | 369 |
submit => [ '#form', { action_update => 1 } ], |
369 |
disabled => !$::form->{id} && $::form->{locked},
|
|
370 |
disabled => $form->{locked} ? t8('The billing period has already been locked.') : undef,
|
|
370 | 371 |
id => 'update_button', |
371 | 372 |
accesskey => '13', |
372 | 373 |
]); |
... | ... | |
374 | 375 |
$bar->actions->[-1]->add_actions([ t8('Post'), |
375 | 376 |
submit => [ '#form', { action_post => 1 } ], |
376 | 377 |
checks => [ @req_trans_desc ], |
377 |
disabled => (!$::form->{id} && $::form->{locked}) || !$show_delete || $::form->{storno}, |
|
378 |
disabled => $form->{locked} ? t8('The billing period has already been locked.') |
|
379 |
: $form->{storno} ? t8('A canceled invoice cannot be posted.') |
|
380 |
: ($form->{id} && $change_never) ? t8('Changing invoices has been disabled in the configuration.') |
|
381 |
: ($form->{id} && $change_on_same_day_only) ? t8('Invoices can only be changed on the day they are posted.') |
|
382 |
: undef, |
|
378 | 383 |
]); |
379 | 384 |
$bar->actions->[-1]->add_actions([ t8('Post Payment'), |
380 | 385 |
submit => [ '#form', { action_post_payment => 1 } ], |
381 | 386 |
checks => [ @req_trans_desc ], |
382 |
disabled => !$::form->{id},
|
|
387 |
disabled => !$form->{id} ? t8('This invoice has not been posted yet.') : undef,
|
|
383 | 388 |
]); |
384 | 389 |
$bar->actions->[-1]->add_actions([ t8('mark as paid'), |
385 | 390 |
submit => [ '#form', { action_mark_as_paid => 1 } ], |
386 | 391 |
confirm => t8('This will remove the invoice from showing as unpaid even if the unpaid amount does not match the amount. Proceed?'), |
387 |
disabled => !$::form->{id},
|
|
392 |
disabled => !$form->{id} ? t8('This invoice has not been posted yet.') : undef,
|
|
388 | 393 |
]) if $::instance_conf->get_is_show_mark_as_paid; |
389 | 394 |
|
390 | 395 |
$bar->add_actions("combobox"); |
... | ... | |
392 | 397 |
submit => [ '#form', { action_storno => 1 } ], |
393 | 398 |
confirm => t8('Do you really want to cancel this invoice?'), |
394 | 399 |
checks => [ @req_trans_desc ], |
395 |
disabled => !$::form->{id},
|
|
400 |
disabled => !$form->{id} ? t8('This invoice has not been posted yet.') : undef,
|
|
396 | 401 |
]); |
397 | 402 |
$bar->actions->[-1]->add_actions([ t8('Delete'), |
398 | 403 |
submit => [ '#form', { action_delete => 1 } ], |
399 | 404 |
confirm => t8('Do you really want to delete this object?'), |
400 | 405 |
checks => [ @req_trans_desc ], |
401 |
disabled => !$::form->{id}, |
|
402 |
]) if $show_delete; |
|
406 |
disabled => !$form->{id} ? t8('This invoice has not been posted yet.') |
|
407 |
: $form->{locked} ? t8('The billing period has already been locked.') |
|
408 |
: $change_never ? t8('Changing invoices has been disabled in the configuration.') |
|
409 |
: $change_on_same_day_only ? t8('Invoices can only be changed on the day they are posted.') |
|
410 |
: undef, |
|
411 |
]); |
|
403 | 412 |
$bar->add_actions('separator'); |
404 | 413 |
|
405 | 414 |
$bar->add_actions('combobox'); |
... | ... | |
408 | 417 |
]); |
409 | 418 |
$bar->actions->[-1]->add_actions([ t8('Use As New'), |
410 | 419 |
submit => [ '#form', { action_use_as_new => 1 } ], |
411 |
disabled => !$::form->{id},
|
|
420 |
disabled => !$form->{id} ? t8('This invoice has not been posted yet.') : undef,
|
|
412 | 421 |
]); |
413 | 422 |
$bar->actions->[-1]->add_actions([ t8('Credit Note'), |
414 | 423 |
submit => [ '#form', { action_credit_note => 1 } ], |
415 | 424 |
checks => [ @req_trans_desc ], |
416 |
disabled => !$::form->{id} || $form->{type} eq "credit_note", |
|
425 |
disabled => $form->{type} eq "credit_note" ? t8('Credit notes cannot be converted into other credit notes.') |
|
426 |
: !$form->{id} ? t8('This invoice has not been posted yet.') |
|
427 |
: undef, |
|
417 | 428 |
]); |
418 | 429 |
$bar->actions->[-1]->add_actions([ t8('Sales Order'), |
419 | 430 |
submit => [ '#form', { action_sales_order => 1 } ], |
420 |
disabled => !$::form->{id},
|
|
431 |
disabled => !$form->{id} ? t8('This invoice has not been posted yet.') : undef,
|
|
421 | 432 |
]); |
422 | 433 |
|
423 | 434 |
$bar->add_actions('combobox'); |
424 | 435 |
$bar->actions->[-1]->add_actions([ t8('Export'), |
425 | 436 |
disabled => 1, |
426 | 437 |
]); |
427 |
$bar->actions->[-1]->add_actions([ ($::form->{id} ? t8('Print') : t8('Preview')),
|
|
438 |
$bar->actions->[-1]->add_actions([ ($form->{id} ? t8('Print') : t8('Preview')), |
|
428 | 439 |
submit => [ '#form', { action_print => 1 } ], |
429 | 440 |
checks => [ @req_trans_desc ], |
430 |
disabled => !$::form->{id} && $::form->{locked},
|
|
441 |
disabled => !$form->{id} && $form->{locked} ? t8('The billing period has already been locked.') : undef,
|
|
431 | 442 |
]); |
432 | 443 |
$bar->actions->[-1]->add_actions([ t8('E Mail'), |
433 | 444 |
submit => [ '#form', { action_print => 1 } ], |
434 | 445 |
checks => [ @req_trans_desc ], |
435 |
disabled => !$::form->{id},
|
|
446 |
disabled => !$form->{id} ? t8('This invoice has not been posted yet.') : undef,
|
|
436 | 447 |
]); |
437 | 448 |
$bar->add_actions('combobox'); |
438 | 449 |
$bar->actions->[-1]->add_actions([ t8('more'), |
439 | 450 |
disabled => 1, |
440 | 451 |
]); |
441 | 452 |
$bar->actions->[-1]->add_actions([ t8('History'), |
442 |
call => [ 'set_history_window', $::form->{id} * 1, 'id' ],
|
|
443 |
disabled => !$::form->{id},
|
|
453 |
call => [ 'set_history_window', $form->{id} * 1, 'id' ], |
|
454 |
disabled => !$form->{id} ? t8('This invoice has not been posted yet.') : undef,
|
|
444 | 455 |
]); |
445 | 456 |
$bar->actions->[-1]->add_actions([ t8('Follow-Up'), |
446 | 457 |
call => [ 'follow_up_window' ], |
447 |
disabled => !$::form->{id},
|
|
458 |
disabled => !$form->{id} ? t8('This invoice has not been posted yet.') : undef,
|
|
448 | 459 |
]); |
449 | 460 |
$bar->actions->[-1]->add_actions([ t8('Drafts'), |
450 |
call => [ 'kivi.Draft.popup', 'is', 'invoice', $::form->{draft_id}, $::form->{draft_description} ], |
|
451 |
disabled => $::form->{id} || $::form->{locked}, |
|
461 |
call => [ 'kivi.Draft.popup', 'is', 'invoice', $form->{draft_id}, $form->{draft_description} ], |
|
462 |
disabled => $form->{id} ? t8('This invoice has already been posted.') |
|
463 |
: $form->{locked} ? t8('The billing period has already been locked.') |
|
464 |
: undef, |
|
452 | 465 |
]); |
453 | 466 |
|
454 | 467 |
} |
Auch abrufbar als: Unified diff
ActionBar: Tooltips für deaktivierte Aktionen in is.pl