use Carp;
use CGI;
-use CGI::Ajax;
use List::Util qw(min max first);
use SL::CVar;
my $form = $main::form;
my %myconfig = %main::myconfig;
my $locale = $main::locale;
- my $cgi = $main::cgi;
+ my $cgi = $::request->{cgi};
my $numrows = shift;
# calculate onhand
if ($form->{"id_$i"}) {
my $part = IC->get_basic_part_info(id => $form->{"id_$i"});
- my $onhand_color = 'color="#ff0000"' if $part->{onhand} < $part->{rop};
+ my $onhand_color = $part->{onhand} < $part->{rop} ? 'color="#ff0000"' : '';
push @ROW2, { value => sprintf "<b>%s</b> <font %s>%s %s</font>",
$locale->text('On Hand'),
$onhand_color,
my $form = $main::form;
my $locale = $main::locale;
- my $cgi = $main::cgi;
+ my $cgi = $::request->{cgi};
_check_io_auth();
subject => $subject,
print_options => print_options('inline' => 1),
HIDDEN => [ map +{ name => $_, value => $form->{$_} }, @hidden_keys ],
- SHOW_BCC => $myconfig{role} eq 'admin' });
+ SHOW_BCC => $::auth->assert('email_bcc', 'may fail') });
$main::lxdebug->leave_sub();
}
$output_longdates = 1;
}
+ # Store the output number format so that the template modules know
+ # how to parse the amounts back if requested.
+ $myconfig{output_numberformat} = $output_numberformat || $myconfig{numberformat};
+
($form->{employee}) = split /--/, $form->{employee};
# create the form variables
$extension = 'xls';
}
- my $email_extension = '_email' if (($form->{media} eq 'email') && (-f "$myconfig{templates}/$form->{formname}_email$form->{language}${printer_code}.${extension}"));
+ my $email_extension = (($form->{media} eq 'email') && (-f "$myconfig{templates}/$form->{formname}_email$form->{language}${printer_code}.${extension}")) ? '_email' : '';
$form->{IN} = "$form->{formname}${email_extension}$form->{language}${printer_code}.${extension}";
$description = $cvar->{description} . ' ';
}
+ my $form_key = "ic_cvar_" . $cvar->{name} . "_$params{row}";
+
push @{ $params{ROW2} }, {
line_break => $num_visible_cvars == 1,
description => $description,
name_prefix => 'ic_',
name_postfix => "_$params{row}",
valid => $cvar->{valid},
- value => $form->{"ic_cvar_" . $cvar->{name} . "_$params{row}"},
+ value => CVar->parse($::form->{$form_key}, $cvar),
}
};
}