308 |
308 |
&& $params{obj}->periodic_invoices_config->get_previous_billed_period_start_date;
|
309 |
309 |
}
|
310 |
310 |
|
311 |
|
my $allow_invoice = $params{is_req_quo}
|
312 |
|
|| $params{is_pur_ord}
|
313 |
|
|| ($params{is_sales_quo} && $::instance_conf->get_allow_sales_invoice_from_sales_quotation)
|
314 |
|
|| ($params{is_sales_ord} && $::instance_conf->get_allow_sales_invoice_from_sales_order);
|
315 |
|
my @req_trans_desc = qw(kivi.SalesPurchase.check_transaction_description) x!!$::instance_conf->get_require_transaction_description_ps;
|
316 |
|
my @warn_p_invoice = qw(kivi.SalesPurchase.oe_warn_save_active_periodic_invoice) x!!$has_active_periodic_invoice;
|
317 |
|
|
318 |
|
my $tpca_remainder = 0;
|
|
311 |
my $allow_invoice = $params{is_req_quo}
|
|
312 |
|| $params{is_pur_ord}
|
|
313 |
|| ($params{is_sales_quo} && $::instance_conf->get_allow_sales_invoice_from_sales_quotation)
|
|
314 |
|| ($params{is_sales_ord} && $::instance_conf->get_allow_sales_invoice_from_sales_order);
|
|
315 |
my @req_trans_desc = qw(kivi.SalesPurchase.check_transaction_description) x!!$::instance_conf->get_require_transaction_description_ps;
|
|
316 |
my @req_trans_cost_art = qw(kivi.SalesPurchase.check_transport_cost_article_presence) x!!$::instance_conf->get_transport_cost_reminder_article_number_id;
|
|
317 |
my @warn_p_invoice = qw(kivi.SalesPurchase.oe_warn_save_active_periodic_invoice) x!!$has_active_periodic_invoice;
|
319 |
318 |
|
320 |
319 |
for my $bar ($::request->layout->get('actionbar')) {
|
321 |
320 |
$bar->add_actions([ t8('Update'),
|
... | ... | |
327 |
326 |
$bar->add_actions("combobox");
|
328 |
327 |
$bar->actions->[-1]->add_actions([ t8('Save'),
|
329 |
328 |
submit => [ '#form', { action_save => 1 } ],
|
330 |
|
checks => [ @req_trans_desc, @warn_p_invoice ],
|
331 |
|
confirm => t8('Missing transport cost: #1 Are you sure?', $tpca_remainder),
|
|
329 |
checks => [ @req_trans_desc, @req_trans_cost_art, @warn_p_invoice ],
|
332 |
330 |
]);
|
333 |
331 |
$bar->actions->[-1]->add_actions([ t8('Save as new'),
|
334 |
332 |
submit => [ '#form', { action_save_as_new => 1 } ],
|
335 |
|
checks => [ @req_trans_desc ],
|
|
333 |
checks => [ @req_trans_desc, @req_trans_cost_art ],
|
336 |
334 |
disabled => !$form->{id} ? t8('This record has not been saved yet.') : undef,
|
337 |
335 |
]);
|
338 |
336 |
$bar->actions->[-1]->add_actions([ t8('Save and Close'),
|
339 |
337 |
submit => [ '#form', { action_save_and_close => 1 } ],
|
340 |
|
checks => [ @req_trans_desc, @warn_p_invoice ],
|
341 |
|
confirm => t8('Missing transport cost: #1 Are you sure?', $tpca_remainder),
|
|
338 |
checks => [ @req_trans_desc, @req_trans_cost_art, @warn_p_invoice ],
|
342 |
339 |
]);
|
343 |
340 |
$bar->add_actions([ t8('Delete'),
|
344 |
341 |
submit => [ '#form', { action_delete => 1 } ],
|
... | ... | |
574 |
571 |
|
575 |
572 |
$TMPL_VAR{ORDER_PROBABILITIES} = [ map { { title => ($_ * 10) . '%', id => $_ * 10 } } (0..10) ];
|
576 |
573 |
|
|
574 |
if ($type_check_vars{is_sales} && $::instance_conf->get_transport_cost_reminder_article_number_id) {
|
|
575 |
$TMPL_VAR{transport_cost_reminder_article} = SL::DB::Part->new(id => $::instance_conf->get_transport_cost_reminder_article_number_id)->load;
|
|
576 |
}
|
|
577 |
|
577 |
578 |
print $form->parse_html_template("oe/form_header", { %TMPL_VAR });
|
578 |
579 |
|
579 |
580 |
$main::lxdebug->leave_sub();
|
... | ... | |
645 |
646 |
|
646 |
647 |
$TMPL_VAR{ALL_DELIVERY_TERMS} = SL::DB::Manager::DeliveryTerm->get_all_sorted();
|
647 |
648 |
|
648 |
|
my $tpca_reminder;
|
649 |
|
$tpca_reminder = check_transport_cost_reminder_article_number() if $::instance_conf->get_transport_cost_reminder_article_number_id;
|
650 |
649 |
print $form->parse_html_template("oe/form_footer", {
|
651 |
650 |
%TMPL_VAR,
|
652 |
|
tpca_reminder => $tpca_reminder,
|
653 |
651 |
print_options => print_options(inline => 1),
|
654 |
652 |
is_sales => scalar ($form->{type} =~ /^sales_/), # these vars are exported, so that the template
|
655 |
653 |
is_order => scalar ($form->{type} =~ /_order$/), # may determine what to show
|
... | ... | |
2198 |
2196 |
_remove_billed_or_delivered_rows(quantities => \%handled_base_qtys);
|
2199 |
2197 |
}
|
2200 |
2198 |
|
2201 |
|
# iterate all positions and match articlenumber
|
2202 |
|
sub check_transport_cost_reminder_article_number {
|
2203 |
|
$main::lxdebug->enter_sub();
|
2204 |
|
|
2205 |
|
my $form = $main::form;
|
2206 |
|
|
2207 |
|
check_oe_access();
|
2208 |
|
|
2209 |
|
my $transport_article_id = $::instance_conf->get_transport_cost_reminder_article_number_id;
|
2210 |
|
for my $i (1 .. $form->{rowcount}) {
|
2211 |
|
return if $form->{"id_${i}"} eq $transport_article_id;
|
2212 |
|
}
|
2213 |
|
|
2214 |
|
# simply return the name of the part
|
2215 |
|
return SL::DB::Part->new(id => $transport_article_id)->load()->partnumber;
|
2216 |
|
|
2217 |
|
$main::lxdebug->leave_sub();
|
2218 |
|
}
|
2219 |
2199 |
sub dispatcher {
|
2220 |
2200 |
foreach my $action (qw(delete delivery_order e_mail invoice print purchase_order quotation
|
2221 |
2201 |
request_for_quotation sales_order save save_and_close save_as_new ship_to update)) {
|
ActionBar: Prüfung auf Transportkostenartikel in JavaScript implementiert