/users/datev-export*
/users/templates-cache/
/users/pid/
-/config/task_server.conf
-/config/periodic_invoices.conf
+/config/lx_office.conf
sub _send_email {
my ($posted_invoices, $printed_invoices) = @_;
- read_config 'config/periodic_invoices.conf' => my %config;
+ read_config 'config/lx_office.conf' => my %config;
return if !$config{periodic_invoices} || !$config{periodic_invoices}->{send_email_to} || !scalar @{ $posted_invoices };
}
use CGI qw( -no_xhtml);
+use Config::Std;
use DateTime;
+use Encode;
use English qw(-no_match_vars);
use SL::Auth;
use SL::LXDebug;
$::form = undef;
%::myconfig = ();
%::called_subs = (); # currently used for recursion detection
+
+ read_config 'config/lx_office.conf' => %::lx_office_conf if -f "config/lx_office.conf";
+ _decode_recursively(\%::lx_office_conf);
}
$SIG{__WARN__} = sub {
return $self->{interface} =~ m/f(?:ast)cgi/i ? $self->{request}->GetHandles() : (\*STDIN, \*STDOUT, \*STDERR);
}
+sub _decode_recursively {
+ my ($obj) = @_;
+
+ while (my ($key, $value) = each %{ $obj }) {
+ if (ref($value) eq 'HASH') {
+ _decode_recursively($value);
+ } else {
+ $obj->{$key} = decode('UTF-8', $value);
+ }
+ }
+}
+
package main;
use strict;
+++ /dev/null
-[Console]
-
-# autologin to use if none is given
-login = demo
-
-# autorun lines will be executed after autologin.
-# be warned that loading huge libraries will noticably lengthen startup time.
-#autorun = use SL::Module
-# = use SL::Other::Module
-
-# location of history file for permanent history
-history_file = users/console_history
-
--- /dev/null
+[task_server]
+# User name to use for database access
+login = mb
+# Set to 1 for debug messages in /tmp/lx-office-debug.log
+debug = 1
+# Chose a system user the daemon should run under when started as root.
+run_as =
+
+[periodic_invoices]
+# The user name a report about the posted and printed invoices is sent
+# to.
+send_email_to = login
+# The "From:" header for said email.
+email_from = Lx-Office Daemon <root@localhost>
+# The subject for said email.
+email_subject = Benachrichtigung: automatisch erstellte Rechnungen
+# The template file used for the email's body.
+email_template = templates/webpages/oe/periodic_invoices_email.txt
+
+[Console]
+# autologin to use if none is given
+login = demo
+
+# autorun lines will be executed after autologin.
+# be warned that loading huge libraries will noticably lengthen startup time.
+#autorun = use SL::Module
+# = use SL::Other::Module
+
+# location of history file for permanent history
+history_file = users/console_history
+++ /dev/null
-[periodic_invoices]
-# The user name a report about the posted and printed invoices is sent
-# to.
-send_email_to = login
-# The "From:" header for said email.
-email_from = Lx-Office Daemon <root@localhost>
-# The subject for said email.
-email_subject = Benachrichtigung: automatisch erstellte Rechnungen
-# The template file used for the email's body.
-email_template = templates/webpages/oe/periodic_invoices_email.txt
+++ /dev/null
-[task_server]
-# User name to use for database access
-login =
-# Set to 1 for debug messages in /tmp/lx-office-debug.log
-debug = 0
-# Chose a system user the daemon should run under when started as root.
-run_as = www
use Devel::REPL 1.002001;
use Term::ReadLine::Perl::Bind; # use sane key binding for rxvt users
-read_config 'config/console.conf' => my %config;# if -f 'config/console.conf';
+read_config 'config/lx_office.conf' => my %config;
my $login = shift || $config{Console}{login} || 'demo';
my $history_file = $config{Console}{history_file} || '/tmp/lxoffice_console_history.log'; # fallback if users is not writable
use CGI qw( -no_xhtml);
use DateTime;
use SL::Auth;
+use SL::Dispatcher;
use SL::Form;
use SL::Helper::DateTime;
use SL::Locale;
$::form = Form->new;
$::auth = SL::Auth->new;
+ read_config 'config/lx_office.conf' => %::lx_office_conf;
+ SL::Dispatcher::_decode_recursively(\%::lx_office_conf);
+
die 'cannot reach auth db' unless $::auth->session_tables_present;
$::auth->restore_session;
Configuration of this script is located in:
- config/console.conf
- config/console.conf.default
+ config/lx_office.conf
+ config/lx_office.conf.default
See there for interesting options.
mkdir($pidbase) if !-d $pidbase;
-newdaemon(configfile => "${cwd}/config/task_server.conf",
+newdaemon(configfile => "${cwd}/config/lx_office.conf",
progname => 'lx-office-task-server',
pidbase => "${pidbase}/",
);