Das zur-Verfügung-Stellen von %::myconfig in JavaScript und die darauf
basierende vereinfachte Initialisierung in
4ec753d erfordert, dass
%::myconfig immer numberformat und dateformat enthält. Andernfalls gibt
es JavaScript-Fehler, wenn noch kein User angemeldet ist.
use SL::Helper::DateTime;
use SL::InstanceConfiguration;
use SL::Template::Plugin::HTMLFixes;
+use SL::User;
# Trailing new line is added so that Perl will not add the line
# number 'die' was called in.
$::lxdebug = LXDebug->new;
$::auth = SL::Auth->new;
$::form = undef;
- %::myconfig = ();
$::request = undef;
+ %::myconfig = User->get_default_myconfig;
}
$SIG{__WARN__} = sub {
sub handle {
my ($self, %params) = @_;
- %::myconfig = ();
+ %::myconfig = User->get_default_myconfig;
my $ok = $::auth->is_api_token_cookie_valid;
$ok ||= $::form->{'{AUTH}admin_password'} && ($::auth->authenticate_root($::form->{'{AUTH}admin_password'}) == $::auth->OK());
use parent qw(Rose::Object);
sub handle {
- %::myconfig = ();
+ %::myconfig = User->get_default_myconfig;
return 1;
}
my $client_id = $::form->{'{AUTH}client_id'} || $::auth->get_session_value('client_id');
return $self->_error(%param) if !$client_id || !$::auth->set_client($client_id);
- %::myconfig = $::auth->read_user(login => $login);
+ %::myconfig = User->get_default_myconfig($::auth->read_user(login => $login));
return $self->_error(%param) unless $::myconfig{login};
} else {
$css_path = "$css_path/kivitendo";
}
- $::myconfig{css_path} = $css_path; # needed for menunew, FIXME: don't do this here
return $css_path;
}
+{ %{ $_[0] } }
}
+sub get_default_myconfig {
+ my ($self_or_class, %user_config) = @_;
+
+ return (
+ countrycode => 'de',
+ css_path => 'css', # Needed for menunew, see SL::Layout::Base::get_stylesheet_for_user
+ dateformat => 'dd.mm.yy',
+ numberformat => '1.000,00',
+ stylesheet => 'kivitendo.css',
+ timeformat => 'hh:mm',
+ %user_config,
+ );
+}
+
1;