my $form = $main::form;
my %myconfig = %main::myconfig;
my $locale = $main::locale;
- my $cgi = $main::cgi;
+ my $cgi = $::request->{cgi};
$main::auth->assert('vendor_invoice_edit');
$form->{defaultcurrency} = $form->get_default_currency(\%myconfig);
- my $set_duedate_url = "$form->{script}?action=set_duedate";
-
- push @ { $form->{AJAX} }, new CGI::Ajax( 'set_duedate' => $set_duedate_url );
-
my @old_project_ids = ($form->{"globalproject_id"});
map { push @old_project_ids, $form->{"project_id_$_"} if $form->{"project_id_$_"}; } 1..$form->{"rowcount"};
$form->{"changeable_$i"} = ($form->{"acc_trans_id_$i"})? 0 : 1;
} elsif ($::lx_office_conf{features}->{payments_changeable} == 2) {
# on the same day
- $form->{"changeable_$i"} = (($form->{"gldate_$i"} eq '') ||
+ $form->{"changeable_$i"} = (($form->{"gldate_$i"} eq '') ||
($form->current_date(\%myconfig) eq $form->{"gldate_$i"}));
}
$main::lxdebug->leave_sub();
}
-sub set_duedate_vendor {
- $main::lxdebug->enter_sub();
-
- my $form = $main::form;
+sub get_duedate_vendor {
+ $::lxdebug->enter_sub;
- print $form->ajax_response_header(), IR->get_duedate('vendor_id' => $form->{vendor_id},
- 'invdate' => $form->{invdate},
- 'default' => $form->{old_duedate});
+ my $result = IR->get_duedate(
+ vendor_id => $::form->{vendor_id},
+ invdate => $::form->{invdate},
+ default => $::form->{old_duedate},
+ );
- $main::lxdebug->leave_sub();
+ print $::form->ajax_response_header, $result;
+ $::lxdebug->leave_sub;
}