use SL::IR;
use SL::IS;
use SL::PE;
+use SL::DB::Default;
use List::Util qw(max sum);
require "bin/mozilla/io.pl";
$form->{vc} = 'vendor';
# create links
- $form->{webdav} = $::lx_office_conf{features}->{webdav};
- $form->{jsscript} = 1;
+ $form->{webdav} = $::instance_conf->get_webdav;
$form->create_links("AP", \%myconfig, "vendor");
}
}
- my ($payment_id, $language_id, $taxzone_id, $currency);
+ my ($payment_id, $language_id, $taxzone_id, $currency, $delivery_term_id);
if ($form->{payment_id}) {
$payment_id = $form->{payment_id};
}
if ($form->{currency}) {
$currency = $form->{currency};
}
+ if ($form->{delivery_term_id}) {
+ $delivery_term_id = $form->{delivery_term_id};
+ }
my $cp_id = $form->{cp_id};
IR->get_vendor(\%myconfig, \%$form);
if ($currency) {
$form->{currency} = $currency;
}
+ if ($delivery_term_id) {
+ $form->{delivery_term_id} = $delivery_term_id;
+ }
- my @curr = split(/:/, $form->{currencies}); #seems to be missing
+ my @curr = $form->get_all_currencies();
map { $form->{selectcurrency} .= "<option>$_\n" } @curr;
$form->{oldvendor} = "$form->{vendor}--$form->{vendor_id}";
$TMPL_VAR{creditwarning} = ($form->{creditlimit} != 0) && ($form->{creditremaining} < 0) && !$form->{update};
$TMPL_VAR{is_credit_remaining_negativ} = $form->{creditremaining} =~ /-/;
- $form->{fokus} = "invoice.vendor";
-
my $follow_up_vc = $form->{vendor};
$follow_up_vc =~ s/--\d*\s*$//;
$TMPL_VAR{vendor_name} = $follow_up_vc;
), @custom_hiddens,
map { $_.'_rate', $_.'_description', $_.'_taxnumber' } split / /, $form->{taxaccounts}];
- $form->{jsscript} = 1;
$form->header();
print $form->parse_html_template("ir/form_header", \%TMPL_VAR);
for my $i (1 .. $form->{paidaccounts}) {
$form->{"changeable_$i"} = 1;
- if ($::lx_office_conf{features}->{payments_changeable} == 0) {
+ if (SL::DB::Default->get->payments_changeable == 0) {
# never
$form->{"changeable_$i"} = ($form->{"acc_trans_id_$i"})? 0 : 1;
- } elsif ($::lx_office_conf{features}->{payments_changeable} == 2) {
+ } elsif (SL::DB::Default->get->payments_changeable == 2) {
# on the same day
$form->{"changeable_$i"} = (($form->{"gldate_$i"} eq '') ||
($form->current_date(\%myconfig) eq $form->{"gldate_$i"}));
$totalpaid += $form->{"paid_$i"};
}
+ $form->{ALL_DELIVERY_TERMS} = SL::DB::Manager::DeliveryTerm->get_all_sorted();
+
print $form->parse_html_template('ir/form_footer', {
is_type_credit_note => ($form->{type} eq "credit_note"),
totalpaid => $totalpaid,
paid_missing => $form->{invtotal} - $totalpaid,
show_storno => $form->{id} && !$form->{storno} && !IS->has_storno(\%myconfig, $form, "ap") && !$totalpaid,
- show_delete => ($form->current_date(\%myconfig) eq $form->{gldate}),
+ show_delete => ($::instance_conf->get_ir_changeable == 2)
+ ? ($form->current_date(\%myconfig) eq $form->{gldate})
+ : ($::instance_conf->get_ir_changeable == 1),
});
##print $form->parse_html_template('ir/_payments'); # parser
##print $form->parse_html_template('webdav/_list'); # parser
$form->error($locale->text("Invoice has already been storno'd!"));
}
+ $form->error($locale->text('Cannot post storno for a closed period!'))
+ if ( $form->date_closed($form->{invdate}, \%myconfig));
+
my $employee_id = $form->{employee_id};
invoice_links();
prepare_invoice();
}
-sub use_as_template {
+sub use_as_new {
$main::lxdebug->enter_sub();
my $form = $main::form;
my $invdate = $form->datetonum($form->{invdate}, \%myconfig);
my $max_datepaid = _max_datepaid();
+ $form->error($locale->text('Cannot post transaction above the maximum future booking date!'))
+ if ($form->date_max_future($invdate, \%myconfig));
$form->error($locale->text('Cannot post invoice for a closed period!')) if $max_datepaid && $form->date_closed($max_datepaid, \%myconfig);
$form->isblank("exchangerate", $locale->text('Exchangerate missing!'))
$form->header;
print qq|
-<body>
-
<form method=post action=$form->{script}>
|;