use CGI;
use CGI::Ajax;
use Cwd;
+use IO::File;
use SL::Auth;
use SL::Auth::DB;
use SL::Auth::LDAP;
my ($self, $name, $msg) = @_;
my $curr = $self;
- foreach my $part (split /\./, $name) {
+ foreach my $part (split m/\./, $name) {
if (!$curr->{$part} || ($curr->{$part} =~ /^\s*$/)) {
$self->error($msg);
}
'charset' => $db_charset,);
print qq|${doctype}<html>
<head>
+ <META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=${db_charset}">
<title>$self->{titlebar}</title>
$stylesheet
$pagelayout
$favicon
- <META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=${db_charset}">
$jsscript
$ajax
$main::lxdebug->leave_sub();
}
+sub ajax_response_header {
+ $main::lxdebug->enter_sub();
+
+ my ($self) = @_;
+
+ my $db_charset = $main::dbcharset ? $main::dbcharset : Common::DEFAULT_CHARSET;
+ my $cgi = $main::cgi || CGI->new('');
+ my $output = $cgi->header('-charset' => $db_charset);
+
+ $main::lxdebug->leave_sub();
+
+ return $output;
+}
+
sub _prepare_html_template {
$main::lxdebug->enter_sub();
$additional_params->{"myconfig_jsc_dateformat"} = $jsc_dateformat;
}
+ $additional_params->{"conf_dbcharset"} = $main::dbcharset;
$additional_params->{"conf_webdav"} = $main::webdav;
$additional_params->{"conf_lizenzen"} = $main::lizenzen;
$additional_params->{"conf_latex_templates"} = $main::latex;
map { $additional_params->{$_} ||= $self->{$_} } keys %{ $self };
+ my $in = IO::File->new($file, 'r');
+
+ if (!$in) {
+ print STDERR "Error opening template file: $!";
+ $main::lxdebug->leave_sub();
+ return '';
+ }
+
+ my $input = join('', <$in>);
+ $in->close();
+
+ if ($main::locale) {
+ $input = $main::locale->{iconv}->convert($input);
+ }
+
my $output;
- if (!$template->process($file, $additional_params, \$output)) {
+ if (!$template->process(\$input, $additional_params, \$output)) {
print STDERR $template->error();
}
- $output = $main::locale->{iconv}->convert($output) if ($main::locale);
-
$main::lxdebug->leave_sub();
return $output;
my $self = shift;
my %params = @_;
- Common::check_params(\%params, qw(amount part_unit));
-
my $myconfig = \%main::myconfig;
- my $amount = $params{amount};
+ my $amount = $params{amount} * 1;
my $places = $params{places};
my $part_unit_name = $params{part_unit};
my $amount_unit_name = $params{amount_unit};
my $conv_units = $params{conv_units};
my $max_places = $params{max_places};
+ if (!$part_unit_name) {
+ $main::lxdebug->leave_sub();
+ return '';
+ }
+
AM->retrieve_all_units();
my $all_units = $main::all_units;
$main::lxdebug->leave_sub() and return unless $salesman_id;
- my $dbh = $self->get_standard_dbh($myconfig);
-
- my ($login) =
- selectrow_query($self, $dbh, qq|SELECT login FROM employee WHERE id = ?|,
- $salesman_id);
+ my $dbh = $self->get_standard_dbh($myconfig);
+ my ($login) = selectrow_query($self, $dbh, qq|SELECT login FROM employee WHERE id = ?|, $salesman_id);
if ($login) {
- my $user = new User($main::memberfile, $login);
- map({ $self->{"salesman_$_"} = $user->{$_}; }
- qw(address businessnumber co_ustid company duns email fax name
- taxnumber tel));
- $self->{salesman_login} = $login;
-
- $self->{salesman_name} = $login
- if ($self->{salesman_name} eq "");
+ my $user = User->new($login);
+ map { $self->{"salesman_$_"} = $user->{$_}; } qw(address businessnumber co_ustid company duns email fax name signature taxnumber tel);
+
+ $self->{salesman_login} = $login;
+ $self->{salesman_name} ||= $login;
}
$main::lxdebug->leave_sub();