Revision 36c8af52
Von Moritz Bunkus vor fast 8 Jahren hinzugefügt
SL/Layout/ActionBar/Action.pm | ||
---|---|---|
25 | 25 |
my ($class, $data) = @_; |
26 | 26 |
|
27 | 27 |
my ($text, %params) = @$data; |
28 |
return if exists($params{only_if}) && !$params{only_if}; |
|
29 |
return if exists($params{not_if}) && $params{not_if}; |
|
28 | 30 |
return SL::Layout::ActionBar::Submit->new(text => $text, params => \%params); |
29 | 31 |
} |
30 | 32 |
|
bin/mozilla/do.pl | ||
---|---|---|
239 | 239 |
sub setup_do_action_bar { |
240 | 240 |
my @transfer_qty = qw(kivi.SalesPurchase.delivery_order_check_transfer_qty); |
241 | 241 |
my @req_trans_desc = qw(kivi.SalesPurchase.check_transaction_description) x!!$::instance_conf->get_require_transaction_description_ps; |
242 |
my $is_customer = $::form->{vc} eq 'customer'; |
|
242 | 243 |
|
243 | 244 |
for my $bar ($::request->layout->get('actionbar')) { |
244 | 245 |
$bar->add( |
... | ... | |
284 | 285 |
], |
285 | 286 |
|
286 | 287 |
combobox => [ |
287 |
(action => [
|
|
288 |
action => [ |
|
288 | 289 |
t8('Transfer out'), |
289 | 290 |
submit => [ '#form', { action => "transfer_out" } ], |
290 | 291 |
checks => [ @req_trans_desc, @transfer_qty ], |
291 | 292 |
disabled => $::form->{delivered} ? t8('This record has already been delivered.') : undef, |
292 |
]) x ($::form->{vc} eq 'customer'), |
|
293 |
(action => [ |
|
293 |
only_if => $is_customer, |
|
294 |
], |
|
295 |
action => [ |
|
294 | 296 |
t8('Transfer out via default'), |
295 | 297 |
submit => [ '#form', { action => "transfer_out_default" } ], |
296 | 298 |
checks => [ @req_trans_desc, @transfer_qty ], |
297 | 299 |
disabled => $::form->{delivered} ? t8('This record has already been delivered.') : undef, |
298 |
]) x ($::form->{vc} eq 'customer' && $::instance_conf->get_transfer_default), |
|
299 |
(action => [ |
|
300 |
only_if => $is_customer && $::instance_conf->get_transfer_default, |
|
301 |
], |
|
302 |
action => [ |
|
300 | 303 |
t8('Transfer in'), |
301 | 304 |
submit => [ '#form', { action => "transfer_in"> 1 } ], |
302 | 305 |
checks => [ @req_trans_desc, @transfer_qty ], |
303 | 306 |
disabled => $::form->{delivered} ? t8('This record has already been delivered.') : undef, |
304 |
]) x ($::form->{vc} eq 'vendor'), |
|
305 |
(action => [ |
|
307 |
only_if => !$is_customer, |
|
308 |
], |
|
309 |
action => [ |
|
306 | 310 |
t8('Transfer in via default'), |
307 | 311 |
submit => [ '#form', { action => "transfer_in_default" } ], |
308 | 312 |
checks => [ @req_trans_desc, @transfer_qty ], |
309 | 313 |
disabled => $::form->{delivered} ? t8('This record has already been delivered.') : undef, |
310 |
]) x ($::form->{vc} eq 'vendor' && $::instance_conf->get_transfer_default), |
|
314 |
only_if => !$is_customer && $::instance_conf->get_transfer_default, |
|
315 |
], |
|
311 | 316 |
], # end of combobox "Transfer out" |
312 | 317 |
|
313 | 318 |
|
bin/mozilla/ir.pl | ||
---|---|---|
245 | 245 |
submit => [ '#form', { action => "post_payment" } ], |
246 | 246 |
disabled => !$form->{id} ? t8('This invoice has not been posted yet.') : undef, |
247 | 247 |
], |
248 |
(action => [
|
|
248 |
action => [ |
|
249 | 249 |
t8('Mark as paid'), |
250 | 250 |
submit => [ '#form', { action => "mark_as_paid" } ], |
251 | 251 |
confirm => t8('This will remove the invoice from showing as unpaid even if the unpaid amount does not match the amount. Proceed?'), |
252 | 252 |
disabled => !$form->{id} ? t8('This invoice has not been posted yet.') : undef, |
253 |
]) x !!$::instance_conf->get_ir_show_mark_as_paid, |
|
253 |
only_if => $::instance_conf->get_ir_show_mark_as_paid, |
|
254 |
], |
|
254 | 255 |
], # end of combobox "Post" |
255 | 256 |
|
256 | 257 |
combobox => [ |
bin/mozilla/is.pl | ||
---|---|---|
285 | 285 |
checks => [ @req_trans_desc ], |
286 | 286 |
disabled => !$form->{id} ? t8('This invoice has not been posted yet.') : undef, |
287 | 287 |
], |
288 |
(action => [ t8('Mark as paid'),
|
|
288 |
action => [ t8('Mark as paid'), |
|
289 | 289 |
submit => [ '#form', { action => "mark_as_paid" } ], |
290 | 290 |
confirm => t8('This will remove the invoice from showing as unpaid even if the unpaid amount does not match the amount. Proceed?'), |
291 | 291 |
disabled => !$form->{id} ? t8('This invoice has not been posted yet.') : undef, |
292 |
]) x !!$::instance_conf->get_is_show_mark_as_paid, |
|
292 |
only_if => $::instance_conf->get_is_show_mark_as_paid, |
|
293 |
], |
|
293 | 294 |
], # end of combobox "Post" |
294 | 295 |
|
295 | 296 |
combobox => [ |
bin/mozilla/oe.pl | ||
---|---|---|
358 | 358 |
|
359 | 359 |
combobox => [ |
360 | 360 |
action => [ t8('Workflow') ], |
361 |
(action => [
|
|
361 |
action => [ |
|
362 | 362 |
t8('Sales Order'), |
363 | 363 |
submit => [ '#form', { action => "sales_order" } ], |
364 | 364 |
disabled => !$form->{id} ? t8('This record has not been saved yet.') : undef, |
365 |
]) x !!$params{is_sales_quo}, |
|
366 |
(action => [ |
|
365 |
only_if => $params{is_sales_quo}, |
|
366 |
], |
|
367 |
action => [ |
|
367 | 368 |
t8('Purchase Order'), |
368 | 369 |
submit => [ '#form', { action => "sales_order" } ], |
369 | 370 |
disabled => !$form->{id} ? t8('This record has not been saved yet.') : undef, |
370 |
]) x !!$params{is_req_quo}, |
|
371 |
(action => [ |
|
371 |
only_if => $params{is_req_quo}, |
|
372 |
], |
|
373 |
action => [ |
|
372 | 374 |
t8('Delivery Order'), |
373 | 375 |
submit => [ '#form', { action => "delivery_order" } ], |
374 | 376 |
disabled => !$form->{id} ? t8('This record has not been saved yet.') : undef, |
375 |
]) x ($params{is_sales_ord} || $params{is_pur_ord}), |
|
376 |
(action => [ |
|
377 |
only_if => $params{is_sales_ord} || $params{is_pur_ord}, |
|
378 |
], |
|
379 |
action => [ |
|
377 | 380 |
t8('Invoice'), |
378 | 381 |
submit => [ '#form', { action => "invoice" } ], |
379 | 382 |
disabled => !$form->{id} ? t8('This record has not been saved yet.') : undef, |
380 |
]) x !!$allow_invoice, |
|
383 |
only_if => $allow_invoice, |
|
384 |
], |
|
381 | 385 |
action => [ |
382 | 386 |
t8('Quotation'), |
383 | 387 |
submit => [ '#form', { action => "quotation" } ], |
Auch abrufbar als: Unified diff
ActionBar: Auslassen von Actions über Parameter »only_if«/»not_if« steuern können
Gedacht für Buttons, die z.B. aufgrund der Mandantenkonfiguration nie
angezeigt werden können. Nicht gedacht für Buttons, die nur aufgrund des
Belegzustands nicht benutzt werden können (z.B. »Löschen« bei einem noch
nicht gespeicherten Beleg).