my $checkedclosed = $form->{"closed"} ? "checked" : "";
my $checkeddelivered = $form->{"delivered"} ? "checked" : "";
+ if ($form->{old_employee_id}) {
+ $form->{employee_id} = $form->{old_employee_id};
+ }
+ if ($form->{old_salesman_id}) {
+ $form->{salesman_id} = $form->{old_salesman_id};
+ }
+
map { $form->{$_} =~ s/\"/"/g }
qw(ordnumber quonumber shippingpoint shipvia notes intnotes shiptoname
shiptostreet shiptozipcode shiptocity shiptocountry shiptocontact
$form->get_lists("projects" => { "key" => "ALL_PROJECTS",
"all" => 1 },
- "employees" => "ALL_EMPLOYEES",
+ "employees" => "ALL_EMPLOYEES",
$vc => "ALL_" . uc($vc));
my %labels = ();
#employees
%labels = ();
- @values = ();
+ @values = ("");
foreach my $item (@{ $form->{"ALL_EMPLOYEES"} }) {
push(@values, $item->{"id"});
$labels{$item->{"id"}} = $item->{"name"} ne "" ? $item->{"name"} : $item->{"login"};
}
- my $employee = qq|
+ my $employee_block = qq|
<tr>
<th align="right">| . $locale->text('Employee') . qq|</th>
<td>| .
- NTI($cgi->popup_menu('-name' => 'employee_id', '-default' => $form->{"employee_id"},
- '-values' => \@values, '-labels' => \%labels)) . qq|
+ NTI($cgi->popup_menu('-name' => 'employee_id',
+ '-values' => \@values,
+ '-labels' => \%labels)) . qq|
</td>
</tr>|;
<th align=right>$ordlabel</th>
<td colspan=3><input name="$ordnumber" size=20></td>
</tr>
- $employee
+ $employee_block
<tr>
<th align="right">| . $locale->text('Transaction description') . qq|</th>
<td colspan="3"><input name="transaction_description" size=20></td>
. $locale->text('Required by') . qq|</td>
</tr>
<tr>
- <td><input name="l_name" class=checkbox type=checkbox value=Y checked> ucfirst($form->{vc})</td>
+ <td><input name="l_name" class=checkbox type=checkbox value=Y checked> $vc_label</td>
<td><input name="l_employee" class=checkbox type=checkbox value=Y checked> $employee</td>
<td><input name="l_shipvia" class=checkbox type=checkbox value=Y> |
. $locale->text('Ship via') . qq|</td>
sub invoice {
$lxdebug->enter_sub();
+ $form->{old_employee_id} = $form->{employee_id};
+ $form->{old_salesman_id} = $form->{salesman_id};
+
if ($form->{type} =~ /_order$/) {
# these checks only apply if the items don't bring their own ordnumbers/transdates.
$exchangerate =
$form->check_exchangerate(\%myconfig, $form->{currency}, $orddate,
$buysell);
+ print(STDERR "CURRENCY $form->{currency} DEFAULT: $form->{defaultcurrency} EXCHANGE $exchangerate\n");
if (!$exchangerate) {
&backorder_exchangerate($orddate, $buysell);
$form->{closed} = 0;
+ $form->{old_employee_id} = $form->{employee_id};
+ $form->{old_salesman_id} = $form->{salesman_id};
+
# reset
map { delete $form->{$_} }
qw(id subject message cc bcc printed emailed queued customer vendor creditlimit creditremaining discount tradediscount oldinvtotal);