From: Moritz Bunkus Date: Tue, 1 Feb 2011 14:58:53 +0000 (+0100) Subject: Merge branch 'rb-wiederkehrende-rechnungen' into after-262 X-Git-Tag: release-2.6.3~61^2~9^2~3^2 X-Git-Url: http://wagnertech.de/gitweb/gitweb.cgi/mfinanz.git/commitdiff_plain/d18df453f55190d4807af324725ea82a8835d7fc?hp=f1bfb69b13865d0a0d336d19364e2684ec76a181 Merge branch 'rb-wiederkehrende-rechnungen' into after-262 --- diff --git a/DEBIAN/DEBIAN/conffiles b/DEBIAN/DEBIAN/conffiles index 4cb0a3b35..1a88f8fcf 100644 --- a/DEBIAN/DEBIAN/conffiles +++ b/DEBIAN/DEBIAN/conffiles @@ -1,3 +1,6 @@ /etc/lx-office-erp/lx-office-erp.apache2.conf /etc/lx-office-erp/lx-office-erp.cherokee /etc/lx-office-erp/lx-office-erp.cherokee.handler +/etc/lx-office-erp/lx-erp.conf.default +/etc/lx-office-erp/console.conf.default +/etc/lx-office-erp/authentication.pl.default diff --git a/DEBIAN/DEBIAN/control b/DEBIAN/DEBIAN/control index 0c3a7b464..f47766de3 100644 --- a/DEBIAN/DEBIAN/control +++ b/DEBIAN/DEBIAN/control @@ -5,8 +5,8 @@ Section: universe/web Priority: optional Installed-Size: 0 Maintainer: Holger Lindemann , Adrian Weibel -Depends: patch, apache2 | apache | lighttpd, postgresql | postgresql-7.4 | postgresql-8.0 | postgresql-8.1 | postgresql-8.2 | postgresql-8.3 | postgresql-8.4, libdbi-perl, libdbd-pg-perl, libpg-perl, libarchive-zip-perl, libyaml-perl, libio-stringy-perl, libtemplate-perl, libpdf-api2-perl, libcgi-ajax-perl, liblist-moreutils-perl, libxml-writer-perl, libtext-csv-xs-perl | libtext-csv-perl, liburi-perl, libdatetime-perl, libtext-iconv-perl, libclass-accessor-perl,libemail-address-perl,libparent-perl -Suggests: tetex-base, tetex-bin, tetex-extra, xpdf | evince | okular, libfcgi-perl, libapache2-mod-fastcgi +Depends: patch, apache2 | apache | lighttpd, postgresql-8.2 | postgresql-8.3 | postgresql-8.4, libdbi-perl, libdbd-pg-perl, libpg-perl, libarchive-zip-perl, libyaml-perl, libio-stringy-perl, libtemplate-perl, libpdf-api2-perl, libcgi-ajax-perl, liblist-moreutils-perl, libxml-writer-perl, libtext-csv-xs-perl | libtext-csv-perl, liburi-perl, libdatetime-perl, libtext-iconv-perl, libclass-accessor-perl,libemail-address-perl,libparent-perl, librose-object-perl, librose-db-perl, librose-db-object-perl +Suggests: tetex-base | texlive-latex-base, tetex-bin | texlive-base-bin , tetex-extra | texlive-latex-extra, xpdf | evince | okular, libfcgi-perl, libapache2-mod-fastcgi Homepage: http://www.lx-office.org Description: Extended double entry accounting system for the german market. Lx-Office is derived from sql-ledger and rewritten @@ -21,5 +21,5 @@ Description: Extended double entry accounting system for the german market. data format to a tax consultant. Most of the documents are printable in html or pdf format. Further information about Lx-Office is available at http://www.lx-office.org . - Revision: + Revision: diff --git a/DEBIAN/DEBIAN/postinst b/DEBIAN/DEBIAN/postinst index 54b53e5da..02f5ac927 100755 --- a/DEBIAN/DEBIAN/postinst +++ b/DEBIAN/DEBIAN/postinst @@ -81,17 +81,12 @@ set_lx_office_erp_web_admin_password() { db_get lx-office-erp/admin-password ADMINPASSWORD="$RET" - #cat /usr/lib/lx-office-erp/config/authentication.pl.default | \ cat /etc/lx-office-erp/authentication.pl.default | \ sed --expression "s/\$self->{admin_password} = 'admin';/\$self->{admin_password} = '$ADMINPASSWORD';/g" \ > /tmp/1.txt - #mv /tmp/1.txt /usr/lib/lx-office-erp/config/authentication.pl mv /tmp/1.txt /etc/lx-office-erp/authentication.pl - #chmod 0600 /usr/lib/lx-office-erp/config/authentication.pl - #chown www-data:www-data /usr/lib/lx-office-erp/config/authentication.pl - } @@ -99,12 +94,10 @@ set_lx_office_erp_authentication_db_password() { db_get lx-office-erp/lx-office-erp-user-postgresql-password PASSWORD="$RET" - #cat /usr/lib/lx-office-erp/config/authentication.pl | \ cat /etc/lx-office-erp/authentication.pl | \ sed --expression "s/'password' => '',/'password' => '$PASSWORD',/g" \ > /tmp/1.txt - #mv /tmp/1.txt /usr/lib/lx-office-erp/config/authentication.pl mv /tmp/1.txt /etc/lx-office-erp/authentication.pl } @@ -112,23 +105,21 @@ set_lx_office_erp_authentication_db_password() { set_lx_office_erp_authentication_db_user() { USER="lxoffice" - #cat /usr/lib/lx-office-erp/config/authentication.pl | \ cat /etc/lx-office-erp/authentication.pl | \ sed --expression "s/'user' => 'postgres',/'user' => '$USER',/g" \ > /tmp/1.txt - #mv /tmp/1.txt /usr/lib/lx-office-erp/config/authentication.pl mv /tmp/1.txt /etc/lx-office-erp/authentication.pl } set_user_rights() { chown -R www-data:www-data /usr/lib/lx-office-erp/users chown -R www-data:www-data /usr/lib/lx-office-erp/templates - chown www-data:www-data /etc/lx-office-erp/lx-erp.conf - chown www-data:www-data /usr/lib/lx-office-erp/menu.ini - chown www-data:www-data /etc/lx-office-erp/authentication.pl - chmod 0600 /etc/lx-office-erp/lx-erp.conf - chmod 0600 /etc/lx-office-erp/authentication.pl + chown www-data:www-data /etc/lx-office-erp/lx_office.conf + chown www-data:www-data /usr/lib/lx-office-erp/menu.ini + chown www-data:www-data /etc/lx-office-erp/authentication.pl + chmod 0600 /etc/lx-office-erp/lx_office.conf + chmod 0600 /etc/lx-office-erp/authentication.pl } disable_ipv6_on_lo_interface() { @@ -144,36 +135,36 @@ disable_ipv6_on_lo_interface() { } mk_new_menu() { - if [ -e /usr/lib/lx-office-crm ] ; then + if [ -e /usr/lib/lx-office-crm ] ; then #crm vorhanden, dann die menu.ini mit der höchsten VersNr nehmen - for i in `ls -1 /usr/lib/lx-office-crm/update/menu*ini` ; do + for i in `ls -1 /usr/lib/lx-office-crm/update/menu*ini` ; do cat $i > /usr/lib/lx-office-erp/menu.ini done; cat /usr/lib/lx-office-erp/menu.default >> /usr/lib/lx-office-erp/menu.ini else cp /usr/lib/lx-office-erp/menu.default /usr/lib/lx-office-erp/menu.ini fi -} +} mk_new_config() { - if ! [ -f /etc/lx-office-erp/lx-erp.conf ] ; then - cp /etc/lx-office-erp/lx-erp.conf.default /etc/lx-office-erp/lx-erp.conf + if ! [ -f /etc/lx-office-erp/lx_office.conf ] ; then + cp /etc/lx-office-erp/lx_office.conf.default /etc/lx-office-erp/lx_office.conf fi -} +} mk_links() { if ! [ -f /usr/lib/lx-office-erp/config/authentication.pl ] ; then ln -s /etc/lx-office-erp/authentication.pl /usr/lib/lx-office-erp/config/authentication.pl fi; - if ! [ -f /usr/lib/lx-office-erp/config/lx-erp.conf ] ; then - ln -s /etc/lx-office-erp/lx-erp.conf /usr/lib/lx-office-erp/config/lx-erp.conf + if ! [ -f /usr/lib/lx-office-erp/config/lx_office.conf ] ; then + ln -s /etc/lx-office-erp/lx_office.conf /usr/lib/lx-office-erp/config/lx_office.conf fi; - if [ -e /etc/apache2 ] ; then + if [ -e /etc/apache2 ] ; then if ! [ -f /etc/apache2/conf.d/lx-office-erp.apache2.conf ] ; then ln -s /etc/lx-office-erp/lx-office-erp.apache2.conf /etc/apache2/conf.d/lx-office-erp.apache2.conf fi; fi; - if [ -e /etc/cherokee/sites-available ] ; then + if [ -e /etc/cherokee/sites-available ] ; then if ! [ -f /etc/cherokee/sites-available/lx-office-erp.cherokee ] ; then cat /etc/lx-office-erp/lx-office-erp.cherokee.handler >> /etc/cherokee/sites-available/default ln -s /etc/lx-office-erp/lx-office-erp.cherokee /etc/cherokee/sites-available/lx-office-erp.cherokee @@ -181,10 +172,10 @@ mk_links() { fi; } reload_web_server() { - if [ -f /etc/init.d/apache* ] ; then + if [ -f /etc/init.d/apache* ] ; then /etc/init.d/apache* reload fi - if [ -f /etc/init.d/cherokee ] ; then + if [ -f /etc/init.d/cherokee ] ; then /etc/init.d/cherokee reload fi } @@ -215,7 +206,7 @@ case "$1" in install|configure) echo " ! "`date`" $1 !" >> /tmp/lxo-erp.log - + mk_new_menu mk_new_config config_postgresql_factory_script diff --git a/DEBIAN/DEBIAN/preinst b/DEBIAN/DEBIAN/preinst index 03b19fa40..66dd4e3a3 100755 --- a/DEBIAN/DEBIAN/preinst +++ b/DEBIAN/DEBIAN/preinst @@ -1,11 +1,22 @@ #!/bin/sh #Nur für das Update von einer 2.6.0 nötig, da hier gnadenlos gelöscht wird -set -e +#set -x + +( echo " ! "`date`" Preinst $1 !" >> /tmp/lxo-erp.log +) + if [ "$1" = "upgrade" ]; then - echo "#!/bin/sh" > /var/lib/dpkg/info/lx-office-erp.postrm - echo "set -e" >> /var/lib/dpkg/info/lx-office-erp.postrm - echo "echo ' ! '`date`' postrm2 $1 !'" >> /var/lib/dpkg/info/lx-office-erp.postrm - chmod +x /var/lib/dpkg/info/lx-office-erp.postrm + echo " ! upgrade !" >> /tmp/lxo-erp.log + cnt=`grep -c '\-e /usr/lib/lx-office-erp' /var/lib/dpkg/info/lx-office-erp.postrm` + echo " ! $cnt !" >> /tmp/lxo-erp.log + if [ $cnt -gt 0 ]; then + echo "#!/bin/sh" > /var/lib/dpkg/info/lx-office-erp.postrm + echo "set -e" >> /var/lib/dpkg/info/lx-office-erp.postrm + echo "echo ' ! '`date`' postrm2 $1 !'" >> /var/lib/dpkg/info/lx-office-erp.postrm + chmod +x /var/lib/dpkg/info/lx-office-erp.postrm + else + echo " ! ok !" >> /tmp/lxo-erp.log + fi fi diff --git a/DEBIAN/files/lx-office-erp b/DEBIAN/files/lx-office-erp deleted file mode 100755 index 7f41914ea..000000000 --- a/DEBIAN/files/lx-office-erp +++ /dev/null @@ -1,9 +0,0 @@ -#!/bin/sh -# -## shell script for lx-office-erp to start the login manager in a browser - -set -e - -/usr/bin/sensible-browser http://localhost/lx-office-erp/login.pl - - diff --git a/DEBIAN/files/lx-office-erp.1.gz b/DEBIAN/files/lx-office-erp.1.gz deleted file mode 100644 index d68e3a64a..000000000 Binary files a/DEBIAN/files/lx-office-erp.1.gz and /dev/null differ diff --git a/DEBIAN/files/lx-office-erp.apache2.conf b/DEBIAN/files/lx-office-erp.apache2.conf deleted file mode 100644 index b9a4aaf9b..000000000 --- a/DEBIAN/files/lx-office-erp.apache2.conf +++ /dev/null @@ -1,14 +0,0 @@ -AddHandler cgi-script .pl -Alias /lx-office /usr/lib/lx-office-erp/ -Alias /lx-office-erp /usr/lib/lx-office-erp/ - - - Options ExecCGI Includes FollowSymlinks - DirectoryIndex login.pl - AddDefaultCharset UTF-8 - - - - Order Deny,Allow - Deny from All - \ No newline at end of file diff --git a/DEBIAN/files/lx-office-erp.cherokee b/DEBIAN/files/lx-office-erp.cherokee deleted file mode 100644 index 6ea1e95be..000000000 --- a/DEBIAN/files/lx-office-erp.cherokee +++ /dev/null @@ -1,25 +0,0 @@ -## -## Virtual server for lx-office-erp -## -Directory /lx-office-erp { - Handler common - DocumentRoot /usr/lib/lx-office-erp/ -} -Directory /lx-office-erp/image { - DocumentRoot /usr/share/lx-office-erp/ -} -Directory /lx-office-erp/css{ - DocumentRoot /var/lib/lx-office-erp/css -} -Directory /lx-office-erp/templates{ - DocumentRoot /var/lib/lx-office-erp/templates -} -Directory /lx-office-erp/users{ - DocumentRoot /var/lib/lx-office-erp/users -} -Directory /lx-office-erp/webdav{ - DocumentRoot /var/lib/lx-office-erp/webdav -} -Directory /lx-office-erp/spool{ - DocumentRoot /var/lib/lx-office-erp/spool -} diff --git a/DEBIAN/files/lx-office-erp.cherokee.handler b/DEBIAN/files/lx-office-erp.cherokee.handler deleted file mode 100644 index c932e3c12..000000000 --- a/DEBIAN/files/lx-office-erp.cherokee.handler +++ /dev/null @@ -1,3 +0,0 @@ -Extension pl { - Handler cgi -} diff --git a/DEBIAN/mk_erp_deb.sh b/DEBIAN/mk_erp_deb.sh index 60fe00ef7..786534218 100755 --- a/DEBIAN/mk_erp_deb.sh +++ b/DEBIAN/mk_erp_deb.sh @@ -4,10 +4,10 @@ NR="0" #hier wurde das Git-Paket entpakt: -SRC=/tmp/deb_test/unstable +SRC=/tmp/lx-office-erp #hier wird das Debian-Paket gebaut: -DST=/tmp/deb_test/package +DST=/tmp/package ################################################ @@ -17,70 +17,13 @@ DST=/tmp/deb_test/package VER=`cat VERSION` DEST=$DST/lx-office-erp_$VER-$NR-all -FILES=' -usr/lib/lx-office-erp/ -usr/share/lx-office-erp/ -usr/share/doc/lx-office-erp/ -var/lib/lx-office-erp/spool/ -var/lib/lx-office-erp/users/ -var/lib/lx-office-erp/css/ -var/lib/lx-office-erp/xslt/ -var/lib/lx-office-erp/templates/ -var/lib/lx-office-erp/webdav/lieferantenbestellungen/ -var/lib/lx-office-erp/webdav/anfragen/ -var/lib/lx-office-erp/webdav/gutschriften/ -var/lib/lx-office-erp/webdav/einkaufsrechnungen/ -var/lib/lx-office-erp/webdav/rechnungen/ -var/lib/lx-office-erp/webdav/bestellungen/ -var/lib/lx-office-erp/webdav/angebote/ -usr/lib/lx-office-erp/ -usr/share/lx-office-erp/ -usr/share/doc/lx-office-erp/ -usr/share/man/man1/:lx-office-erp.1.gz -etc/lx-office-erp/:lx-office-erp.cherokee.handler -etc/lx-office-erp/:lx-office-erp.apache2.conf -etc/lx-office-erp/:lx-office-erp.cherokee -usr/bin/:lx-office-erp -' - -for filespec in $FILES; do - set - `echo $filespec | sed -e 's/:/ /g'` - dir=$1 - file=$2 - mkdir -p $SRC/DEBIAN/$dir - if [ -f $SRC/DEBIAN/files/$file ]; then - cp $SRC/DEBIAN/files/$file $SRC/DEBIAN/$dir/$file - else - echo '1' > $SRC/DEBIAN/$dir/.dummy - fi -done - -SYMLINKS=' -css:/var/lib/lx-office-erp/css -doc:/usr/share/doc/lx-office-erp/ -image:/usr/share/lx-office-erp -spool:/var/lib/lx-office-erp/spool -templates:/var/lib/lx-office-erp/templates -users:/var/lib/lx-office-erp/users/ -webdav:/var/lib/lx-office-erp/webdav -xslt:/var/lib/lx-office-erp/xslt -' - -for symspec in $SYMLINKS; do - set - `echo $symspec | sed -e 's/:/ /g'` - src=$1 - tar=$2 - - ln -s $tar $SRC/DEBIAN/usr/lib/lx-office-erp/$src -done -#fertig mkdir -p $DEST cd $DEST #Struktur anlegen: -cp -a $SRC/DEBIAN/* . -rm ./mk*.sh +cp -a $SRC/DEBIAN/DEBIAN . +tar xzf $SRC/DEBIAN/struktur.tgz #Dateien kopieren: #aber keine fertigen Konfigurationen, nur *.default @@ -96,7 +39,7 @@ cp -a $SRC/t usr/lib/lx-office-erp cp -a $SRC/*.pl usr/lib/lx-office-erp cp $SRC/VERSION usr/lib/lx-office-erp cp $SRC/index.html usr/lib/lx-office-erp -cp $SRC/config/lx-erp.conf etc/lx-office-erp/lx-erp.conf.default +cp $SRC/config/lx_office.conf.default etc/lx-office-erp/lx_office.conf.default cp $SRC/config/authentication.pl.default etc/lx-office-erp/ cp $SRC/menu.ini usr/lib/lx-office-erp/menu.default cp -a $SRC/css var/lib/lx-office-erp diff --git a/DEBIAN/struktur.tgz b/DEBIAN/struktur.tgz new file mode 100644 index 000000000..a1b01c240 Binary files /dev/null and b/DEBIAN/struktur.tgz differ diff --git a/SL/AM.pm b/SL/AM.pm index df7d9d2c0..bf5c97d0c 100644 --- a/SL/AM.pm +++ b/SL/AM.pm @@ -1410,7 +1410,7 @@ sub save_defaults { sub save_preferences { $main::lxdebug->enter_sub(); - my ($self, $myconfig, $form, $webdav) = @_; + my ($self, $myconfig, $form) = @_; my $dbh = $form->get_standard_dbh($myconfig); @@ -1434,20 +1434,10 @@ sub save_preferences { $myconfig->{$item} = $form->{$item}; } - $myconfig->save_member($main::memberfile); + $myconfig->save_member; my $auth = $main::auth; - if ($auth->can_change_password() - && defined $form->{new_password} - && ($form->{new_password} ne '********')) { - $auth->change_password($form->{login}, $form->{new_password}); - - $form->{password} = $form->{new_password}; - $auth->set_session_value('password', $form->{password}); - $auth->create_or_refresh_session(); - } - $main::lxdebug->leave_sub(); return $rc; diff --git a/SL/AP.pm b/SL/AP.pm index 39a68a44f..e4ff230c2 100644 --- a/SL/AP.pm +++ b/SL/AP.pm @@ -360,7 +360,7 @@ sub post_transaction { sub delete_transaction { $main::lxdebug->enter_sub(); - my ($self, $myconfig, $form, $spool) = @_; + my ($self, $myconfig, $form) = @_; # connect to database my $dbh = $form->dbconnect_noauto($myconfig); diff --git a/SL/Auth.pm b/SL/Auth.pm index 087301a5e..f2d15a8c7 100644 --- a/SL/Auth.pm +++ b/SL/Auth.pm @@ -257,7 +257,7 @@ sub create_database { $main::lxdebug->message(LXDebug->DEBUG1(), "Auth::create_database DSN: $dsn"); - my $charset = $main::dbcharset; + my $charset = $::lx_office_conf{system}->{dbcharset}; $charset ||= Common::DEFAULT_CHARSET; my $encoding = $Common::charset_to_db_encoding{$charset}; $encoding ||= 'UNICODE'; @@ -300,7 +300,7 @@ sub create_tables { my $self = shift; my $dbh = $self->dbconnect(); - my $charset = $main::dbcharset; + my $charset = $::lx_office_conf{system}->{dbcharset}; $charset ||= Common::DEFAULT_CHARSET; $dbh->rollback(); diff --git a/SL/Auth/Constants.pm b/SL/Auth/Constants.pm index 4fe520a45..852271338 100644 --- a/SL/Auth/Constants.pm +++ b/SL/Auth/Constants.pm @@ -40,6 +40,8 @@ use constant SESSION_EXPIRED => 2; __END__ +=encoding utf8 + =head1 NAME SL::Auth::Constants - COnstants for Auth module @@ -54,10 +56,12 @@ SL::Auth::Constants - COnstants for Auth module This module provides status constants for authentication handling -=head1 FUNCTIONS - =head1 BUGS +none yet. + =head1 AUTHOR +Sven Schöling Es.schoeling@linet-services.deE + =cut diff --git a/SL/Auth/PasswordPolicy.pm b/SL/Auth/PasswordPolicy.pm new file mode 100644 index 000000000..3cf5c149b --- /dev/null +++ b/SL/Auth/PasswordPolicy.pm @@ -0,0 +1,179 @@ +package SL::Auth::PasswordPolicy; + +use strict; + +use parent qw(Rose::Object); + +use constant OK => 0; +use constant TOO_SHORT => 1; +use constant TOO_LONG => 2; +use constant MISSING_LOWERCASE => 4; +use constant MISSING_UPPERCASE => 8; +use constant MISSING_DIGIT => 16; +use constant MISSING_SPECIAL_CHAR => 32; +use constant INVALID_CHAR => 64; +use constant WEAK => 128; + +use Rose::Object::MakeMethods::Generic +( + 'scalar --get_set_init' => 'config', +); + +sub verify { + my ($self, $password, $is_admin) = @_; + + my $cfg = $self->config; + return OK() unless $cfg && %{ $cfg }; + return OK() if $is_admin && $cfg->{disable_policy_for_admin}; + + my $result = OK(); + $result |= TOO_SHORT() if $cfg->{min_length} && (length($password) < $cfg->{min_length}); + $result |= TOO_LONG() if $cfg->{max_length} && (length($password) > $cfg->{max_length}); + $result |= MISSING_LOWERCASE() if $cfg->{require_lowercase} && $password !~ m/[a-z]/; + $result |= MISSING_UPPERCASE() if $cfg->{require_uppercase} && $password !~ m/[A-Z]/; + $result |= MISSING_DIGIT() if $cfg->{require_digit} && $password !~ m/[0-9]/; + $result |= MISSING_SPECIAL_CHAR() if $cfg->{require_special_character} && $password !~ $cfg->{special_characters_re}; + $result |= INVALID_CHAR() if $cfg->{invalid_characters_re} && $password =~ $cfg->{invalid_characters_re}; + + if ($cfg->{use_cracklib}) { + require Crypt::Cracklib; + $result |= WEAK() if !Crypt::Cracklib::check($password); + } + + return $result; +} + +sub errors { + my ($self, $result) = @_; + + my @errors; + + push @errors, $::locale->text('The password is too short (minimum length: #1).', $self->config->{min_length}) if $result & TOO_SHORT(); + push @errors, $::locale->text('The password is too long (maximum length: #1).', $self->config->{max_length}) if $result & TOO_LONG(); + push @errors, $::locale->text('A lower-case character is required.') if $result & MISSING_LOWERCASE(); + push @errors, $::locale->text('An upper-case character is required.') if $result & MISSING_UPPERCASE(); + push @errors, $::locale->text('A digit is required.') if $result & MISSING_DIGIT(); + push @errors, $::locale->text('The password is weak (e.g. it can be found in a dictionary).') if $result & WEAK(); + + if ($result & MISSING_SPECIAL_CHAR()) { + my $char_list = join ' ', sort split(m//, $self->config->{special_characters}); + push @errors, $::locale->text('A special character is required (valid characters: #1).', $char_list); + } + + if (($result & INVALID_CHAR())) { + my $char_list = join ' ', sort split(m//, $self->config->{ $self->config->{invalid_characters} ? 'invalid_characters' : 'valid_characters' }); + push @errors, $::locale->text('An invalid character was used (invalid characters: #1).', $char_list) if $self->config->{invalid_characters}; + push @errors, $::locale->text('An invalid character was used (valid characters: #1).', $char_list) if $self->config->{valid_characters}; + } + + return @errors; +} + + +sub init_config { + my ($self) = @_; + + my %cfg = %{ $::emmvee_conf{password_policy} || {} }; + + $cfg{valid_characters} =~ s/[ \n\r]//g if $cfg{valid_characters}; + $cfg{invalid_characters} =~ s/[ \n\r]//g if $cfg{invalid_characters}; + $cfg{invalid_characters_re} = '[^' . quotemeta($cfg{valid_characters}) . ']' if $cfg{valid_characters}; + $cfg{invalid_characters_re} = '[' . quotemeta($cfg{invalid_characters}) . ']' if $cfg{invalid_characters}; + $cfg{special_characters} = '!@#$%^&*()_+=[]{}<>\'"|\\,;.:?-'; + $cfg{special_characters_re} = '[' . quotemeta($cfg{special_characters}) . ']'; + + map { $cfg{"require_${_}"} = $cfg{"require_${_}"} =~ m/^(?:1|true|t|yes|y)$/i } qw(lowercase uppercase digit special_char); + + $self->config(\%cfg); +} + +1; +__END__ + +=pod + +=encoding utf8 + +=head1 NAME + +SL::Auth::PasswordPolicy - Verify a given password against the policy +set in the configuration file + +=head1 SYNOPSIS + + my $verifier = SL::Auth::PasswordPolicy->new; + my $result = $verifier->verify($password); + if ($result != SL::Auth::PasswordPolicy->OK()) { + print "Errors: " . join(' ', $verifier->errors($result)) . "\n"; + } + +=head1 CONSTANTS + +=over 4 + +=item C + +Password is OK. + +=item C + +The password is too short. + +=item C + +The password is too long. + +=item C + +The password is missing a lower-case character. + +=item C + +The password is missing an upper-case character. + +=item C + +The password is missing a digit. + +=item C + +The password is missing a special character. Special characters are +the following: ! " # $ % & ' ( ) * + , - . : ; E = E ? @ [ \ ] +^ _ { | } + +=item C + +The password contains an invalid character. + +=back + +=head1 FUNCTIONS + +=over 4 + +=item C + +Checks whether or not the password matches the policy. Returns C +if it does and an error code otherwise (binary or'ed of the error +constants). + +If C<$is_admin> is trueish and the configuration specifies that the +policy checks are disabled for the administrator then C will +always return C. + +=item C + +Returns an array of human-readable strings describing the issues set +in C<$code> which should be the result of L. + +=back + +=head1 BUGS + +Nothing here yet. + +=head1 AUTHOR + +Moritz Bunkus Em.bunkus@linet-services.deE + +=cut diff --git a/SL/BP.pm b/SL/BP.pm index e2b7a2a0d..f2d0201d7 100644 --- a/SL/BP.pm +++ b/SL/BP.pm @@ -221,7 +221,9 @@ sub get_spoolfiles { sub delete_spool { $main::lxdebug->enter_sub(); - my ($self, $myconfig, $form, $spool) = @_; + my ($self, $myconfig, $form) = @_; + + my $spool = $::lx_office_conf{paths}->{spool}; # connect to database, turn AutoCommit off my $dbh = $form->dbconnect_noauto($myconfig); @@ -264,7 +266,9 @@ sub delete_spool { sub print_spool { $main::lxdebug->enter_sub(); - my ($self, $myconfig, $form, $spool, $output) = @_; + my ($self, $myconfig, $form, $output) = @_; + + my $spool = $::lx_office_conf{paths}->{spool}; # connect to database my $dbh = $form->dbconnect($myconfig); diff --git a/SL/BackgroundJob/CreatePeriodicInvoices.pm b/SL/BackgroundJob/CreatePeriodicInvoices.pm index 1a2cf81f5..c725a6fec 100644 --- a/SL/BackgroundJob/CreatePeriodicInvoices.pm +++ b/SL/BackgroundJob/CreatePeriodicInvoices.pm @@ -184,7 +184,7 @@ sub _calculate_dates { sub _send_email { my ($posted_invoices, $printed_invoices) = @_; - read_config 'config/lx_office.conf' => my %config; + my %config = %::lx_office_conf; return if !$config{periodic_invoices} || !$config{periodic_invoices}->{send_email_to} || !scalar @{ $posted_invoices }; @@ -238,7 +238,7 @@ sub _print_invoice { $form->throw_on_error(sub { eval { - $form->parse_template(\%::myconfig, $::userspath); + $form->parse_template(\%::myconfig); 1; } || die $EVAL_ERROR->{error}; }); diff --git a/SL/CT.pm b/SL/CT.pm index 58a460039..b36cfa3e8 100644 --- a/SL/CT.pm +++ b/SL/CT.pm @@ -1156,7 +1156,7 @@ sub parse_excel_file { delete $form->{OUT}; - $form->parse_template($myconfig, $main::userspath); + $form->parse_template($myconfig); $main::lxdebug->leave_sub(); } diff --git a/SL/CVar.pm b/SL/CVar.pm index 0de9a4bcf..779bfc325 100644 --- a/SL/CVar.pm +++ b/SL/CVar.pm @@ -338,10 +338,13 @@ sub save_custom_variables { do_statement($form, $sth, $query, @values); - my $valid_index = "$params{name_prefix}cvar_$config->{name}$params{name_postfix}_valid"; - $self->save_custom_variables_validity(trans_id => $params{trans_id}, config_id => $config->{id}, - validity => ($params{variables}{$valid_index} || $params{always_valid} ? 1 : 0) - ); + if ($params{save_validity}) { + my $valid_index = "$params{name_prefix}cvar_$config->{name}$params{name_postfix}_valid"; + $self->save_custom_variables_validity(trans_id => $params{trans_id}, + config_id => $config->{id}, + validity => ($params{variables}{$valid_index} || $params{always_valid} ? 1 : 0) + ); + } } $sth->finish(); diff --git a/SL/Common.pm b/SL/Common.pm index e7bed372b..09f9468d8 100644 --- a/SL/Common.pm +++ b/SL/Common.pm @@ -336,7 +336,7 @@ sub webdav_folder { my ($form) = @_; return $main::lxdebug->leave_sub() - unless ($main::webdav && $form->{id}); + unless ($::lx_office_conf{system}->{webdav} && $form->{id}); my ($path, $number); diff --git a/SL/Controller/Base.pm b/SL/Controller/Base.pm index c79ceecac..fff11ca3a 100644 --- a/SL/Controller/Base.pm +++ b/SL/Controller/Base.pm @@ -55,7 +55,7 @@ sub render { my $content_type = $options->{type} eq 'js' ? 'text/javascript' : 'text/html'; print $::form->create_http_response(content_type => $content_type, - charset => $::dbcharset || Common::DEFAULT_CHARSET()); + charset => $::lx_office_conf{system}->{dbcharset} || Common::DEFAULT_CHARSET()); } else { $::form->{title} = $locals{title} if $locals{title}; @@ -67,14 +67,7 @@ sub render { AUTH => $::auth, FORM => $::form, LOCALE => $::locale, - LXCONFIG => { dbcharset => $::dbcharset, - webdav => $::webdav, - lizenzen => $::lizenzen, - latex_templates => $::latex, - opendocument_templates => $::opendocument_templates, - vertreter => $::vertreter, - show_best_before => $::show_best_before, - }, + LXCONFIG => \%::lx_office_conf, LXDEBUG => $::lxdebug, MYCONFIG => \%::myconfig, SELF => $self, @@ -179,7 +172,7 @@ sub _template_obj { PLUGIN_BASE => 'SL::Template::Plugin', INCLUDE_PATH => '.:templates/webpages', COMPILE_EXT => '.tcc', - COMPILE_DIR => $::userspath . '/templates-cache', + COMPILE_DIR => $::lx_office_conf{paths}->{userspath} . '/templates-cache', }) || croak; return $self->{__basepriv_template_obj}; @@ -336,9 +329,10 @@ The template itself has access to the following variables: =item * C -- C<$::locale> -=item * C -- all parameters from C with -the same name they appear in the file (e.g. C, C -etc) +=item * C -- all parameters from C +with the same name they appear in the file (first level is the +section, second the actual variable, e.g. C, +C etc) =item * C -- C<$::lxdebug> diff --git a/SL/DATEV.pm b/SL/DATEV.pm index 508ed958d..60eb97f90 100644 --- a/SL/DATEV.pm +++ b/SL/DATEV.pm @@ -58,7 +58,7 @@ sub get_path_for_download_token { my $path; if ($token =~ m|^(\d+)-(\d+)-(\d+)$|) { - $path = "${main::userspath}/datev-export-${1}-${2}-${3}"; + $path = $::lx_office_conf{paths}->{userspath} . "/datev-export-${1}-${2}-${3}"; } $main::lxdebug->leave_sub(); @@ -84,7 +84,7 @@ sub get_download_token_for_path { sub clean_temporary_directories { $main::lxdebug->enter_sub(); - foreach my $path (glob "${main::userspath}/datev-export-*") { + foreach my $path (glob($::lx_office_conf{paths}->{userspath} . "/datev-export-*")) { next unless (-d $path); my $mtime = (stat($path))[9]; diff --git a/SL/DB/Helper/Manager.pm b/SL/DB/Helper/Manager.pm index 529053338..8ebc362e2 100644 --- a/SL/DB/Helper/Manager.pm +++ b/SL/DB/Helper/Manager.pm @@ -20,6 +20,7 @@ sub find_by { sub get_first { shift->get_all( + @_, limit => 1, )->[0]; } diff --git a/SL/DB/Helper/PriceTaxCalculator.pm b/SL/DB/Helper/PriceTaxCalculator.pm index a2d338122..2988d14ee 100644 --- a/SL/DB/Helper/PriceTaxCalculator.pm +++ b/SL/DB/Helper/PriceTaxCalculator.pm @@ -167,7 +167,7 @@ sub _calculate_amounts { sub _calculate_assembly_item { my ($self, $data, $part, $total_qty, $base_factor) = @_; - return 0 if $::eur || !$data->{is_invoice}; + return 0 if $::lx_office_conf{system}->{eur} || !$data->{is_invoice}; foreach my $assembly_entry (@{ $part->assemblies }) { push @{ $data->{assembly_items}->[-1] }, { part => $assembly_entry->part, @@ -188,7 +188,7 @@ sub _calculate_part_item { _dbg("cpsi tq " . $total_qty); - return 0 if $::eur || !$data->{is_invoice} || !$total_qty; + return 0 if $::lx_office_conf{system}->{eur} || !$data->{is_invoice} || !$total_qty; my ($entry); $base_factor ||= 1; diff --git a/SL/DB/Invoice.pm b/SL/DB/Invoice.pm index fcace5981..758f91a61 100644 --- a/SL/DB/Invoice.pm +++ b/SL/DB/Invoice.pm @@ -302,7 +302,7 @@ and recorded in C. =item 6. Items in C are updated according to their allocation status (regarding for costs of goold sold). Will only be done if Lx-Office is not configured to use Einnahmenüberschussrechnungen -(C<$::eur>). +(see config/lx_office.conf, section "system", variable "eur"). =item 7. The invoice and its items are saved. diff --git a/SL/DB/Object.pm b/SL/DB/Object.pm index 9ac7644f9..71e0a3939 100644 --- a/SL/DB/Object.pm +++ b/SL/DB/Object.pm @@ -2,7 +2,6 @@ package SL::DB::Object; use strict; -use Readonly; use Rose::DB::Object; use List::MoreUtils qw(any); @@ -41,7 +40,7 @@ sub _get_manager_class { return $class->meta->convention_manager->auto_manager_class_name($class); } -Readonly my %text_column_types => (text => 1, char => 1, varchar => 1); +my %text_column_types = (text => 1, char => 1, varchar => 1); sub assign_attributes { my $self = shift; diff --git a/SL/DB/Shipto.pm b/SL/DB/Shipto.pm index 98b7ca139..eba1b6a6b 100644 --- a/SL/DB/Shipto.pm +++ b/SL/DB/Shipto.pm @@ -1,12 +1,11 @@ package SL::DB::Shipto; use strict; -use Readonly; use SL::DB::MetaSetup::Shipto; -Readonly our @SHIPTO_VARIABLES => qw(shiptoname shiptostreet shiptozipcode shiptocity shiptocountry shiptocontact - shiptophone shiptofax shiptoemail shiptodepartment_1 shiptodepartment_2); +our @SHIPTO_VARIABLES = qw(shiptoname shiptostreet shiptozipcode shiptocity shiptocountry shiptocontact + shiptophone shiptofax shiptoemail shiptodepartment_1 shiptodepartment_2); __PACKAGE__->meta->make_manager_class; diff --git a/SL/DBUpgrade2.pm b/SL/DBUpgrade2.pm index ca45510f0..af5037acc 100644 --- a/SL/DBUpgrade2.pm +++ b/SL/DBUpgrade2.pm @@ -353,7 +353,7 @@ sub apply_admin_dbupgrade_scripts { return 0 if !@unapplied_scripts; - my $db_charset = $main::dbcharset || Common::DEFAULT_CHARSET; + my $db_charset = $::lx_office_conf{system}->{dbcharset} || Common::DEFAULT_CHARSET; $self->{form}->{login} ||= 'admin'; map { $_->{description} = SL::Iconv::convert($_->{charset}, $db_charset, $_->{description}) } values %{ $self->{all_controls} }; diff --git a/SL/DN.pm b/SL/DN.pm index 2cc87df2c..cef36383d 100644 --- a/SL/DN.pm +++ b/SL/DN.pm @@ -269,7 +269,7 @@ sub create_invoice_for_fees { sub save_dunning { $main::lxdebug->enter_sub(); - my ($self, $myconfig, $form, $rows, $userspath, $spool) = @_; + my ($self, $myconfig, $form, $rows) = @_; # connect to database my $dbh = $form->dbconnect_noauto($myconfig); @@ -661,12 +661,13 @@ sub melt_pdfs { $copies *= 1; $copies = 1 unless $copies; - my $inputfiles = join " ", map { "${main::spool}/$_ " x $copies } @{ $form->{DUNNING_PDFS} }; + my $spool = $::lx_office_conf{paths}->{spool}; + my $inputfiles = join " ", map { "$spool/$_ " x $copies } @{ $form->{DUNNING_PDFS} }; my $dunning_id = $form->{dunning_id}; $dunning_id =~ s|[^\d]||g; - my $in = IO::File->new("gs -dBATCH -dNOPAUSE -q -sDEVICE=pdfwrite -sOutputFile=- $inputfiles |"); + my $in = IO::File->new($::lx_office_conf{applications}->{ghostscript} . " -dBATCH -dNOPAUSE -q -sDEVICE=pdfwrite -sOutputFile=- $inputfiles |"); $form->error($main::locale->text('Could not spawn ghostscript.')) unless $in; if ($form->{media} eq 'printer') { @@ -690,7 +691,7 @@ sub melt_pdfs { $in->close(); - map { unlink("${main::spool}/$_") } @{ $form->{DUNNING_PDFS} }; + map { unlink("$spool/$_") } @{ $form->{DUNNING_PDFS} }; $main::lxdebug->leave_sub(); } @@ -792,16 +793,17 @@ sub print_dunning { $self->set_template_options($myconfig, $form); my $filename = "dunning_${dunning_id}_" . Common::unique_id() . ".pdf"; - $form->{OUT} = ">${main::spool}/$filename"; + my $spool = $::lx_office_conf{paths}->{spool}; + $form->{OUT} = ">${spool}/$filename"; $form->{keep_tmpfile} = 1; delete $form->{tmpfile}; push @{ $form->{DUNNING_PDFS} }, $filename; - push @{ $form->{DUNNING_PDFS_EMAIL} }, { 'filename' => "${main::spool}/$filename", + push @{ $form->{DUNNING_PDFS_EMAIL} }, { 'filename' => "${spool}/$filename", 'name' => "dunning_${dunning_id}.pdf" }; - $form->parse_template($myconfig, $main::userspath); + $form->parse_template($myconfig); $dbh->disconnect() unless $provided_dbh; @@ -885,18 +887,19 @@ sub print_invoice_for_fees { my $filename = Common::unique_id() . "dunning_invoice_${dunning_id}.pdf"; - $form->{OUT} = ">$main::spool/$filename"; + my $spool = $::lx_office_conf{paths}->{spool}; + $form->{OUT} = ">$spool/$filename"; $form->{keep_tmpfile} = 1; delete $form->{tmpfile}; map { delete $form->{$_} } grep /^[a-z_]+_\d+$/, keys %{ $form }; - $form->parse_template($myconfig, $main::userspath); + $form->parse_template($myconfig); restore_form($saved_form); push @{ $form->{DUNNING_PDFS} }, $filename; - push @{ $form->{DUNNING_PDFS_EMAIL} }, { 'filename' => "${main::spool}/$filename", + push @{ $form->{DUNNING_PDFS_EMAIL} }, { 'filename' => "${spool}/$filename", 'name' => "dunning_invoice_${dunning_id}.pdf" }; $dbh->disconnect() unless $provided_dbh; diff --git a/SL/DO.pm b/SL/DO.pm index fe2318cc8..9099ba602 100644 --- a/SL/DO.pm +++ b/SL/DO.pm @@ -383,7 +383,7 @@ sub save { $form->{saved_donumber} = $form->{donumber}; - Common::webdav_folder($form) if ($main::webdav); + Common::webdav_folder($form); $main::lxdebug->leave_sub(); @@ -491,7 +491,7 @@ sub delete { my $myconfig = \%main::myconfig; my $form = $main::form; - my $spool = $main::spool; + my $spool = $::lx_office_conf{paths}->{spool}; # connect to database my $dbh = $form->get_standard_dbh($myconfig); @@ -712,7 +712,7 @@ sub retrieve { $sth->finish(); } - Common::webdav_folder($form) if ($main::webdav); + Common::webdav_folder($form); $main::lxdebug->leave_sub(); diff --git a/SL/Dispatcher.pm b/SL/Dispatcher.pm index 687c37306..f22cf0e9f 100644 --- a/SL/Dispatcher.pm +++ b/SL/Dispatcher.pm @@ -5,7 +5,6 @@ use strict; BEGIN { unshift @INC, "modules/override"; # Use our own versions of various modules (e.g. YAML). push @INC, "modules/fallback"; # Only use our own versions of modules if there's no system version. - push @INC, "SL"; # FCGI won't find modules that are not properly named. Help it by inclduging SL } use CGI qw( -no_xhtml); @@ -15,10 +14,11 @@ use Encode; use English qw(-no_match_vars); use SL::Auth; use SL::LXDebug; +use SL::LxOfficeConf; use SL::Locale; use SL::Common; +use SL::Form; use SL::Helper::DateTime; -use Form; use List::Util qw(first); use File::Basename; @@ -52,10 +52,10 @@ sub show_error { my $template = shift; my $error_type = shift || ''; - $::locale = Locale->new($::language); + $::locale = Locale->new($::lx_office_conf{system}->{language}); $::form->{error} = $::locale->text('The session is invalid or has expired.') if ($error_type eq 'session'); $::form->{error} = $::locale->text('Incorrect password!.') if ($error_type eq 'password'); - $::myconfig{countrycode} = $::language; + $::myconfig{countrycode} = $::lx_office_conf{system}->{language}; $::form->{stylesheet} = 'css/lx-office-erp.css'; $::form->header; @@ -66,14 +66,8 @@ sub show_error { } sub pre_startup_setup { - eval { - package main; - require "config/lx-erp.conf"; - }; - eval { - package main; - require "config/lx-erp-local.conf"; - } if -f "config/lx-erp-local.conf"; + SL::LxOfficeConf->read; + _init_environment(); eval { package main; @@ -84,19 +78,11 @@ sub pre_startup_setup { # canonial globals. if it's not here, chances are it will get refactored someday. { no warnings 'once'; - $::userspath = "users"; - $::templates = "templates"; - $::memberfile = "users/members"; - $::menufile = "menu.ini"; - $::sendmail = "| /usr/sbin/sendmail -t"; $::lxdebug = LXDebug->new; $::auth = SL::Auth->new; $::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 { @@ -167,7 +153,7 @@ sub handle_request { $self->unrequire_bin_mozilla; $::cgi = CGI->new(''); - $::locale = Locale->new($::language); + $::locale = Locale->new($::lx_office_conf{system}->{language}); $::form = Form->new; %::called_subs = (); @@ -193,7 +179,7 @@ sub handle_request { my $session_result = $::auth->restore_session; $::auth->create_or_refresh_session; - $::form->error($::locale->text('System currently down for maintenance!')) if -e "$::userspath/nologin" && $script ne 'admin'; + $::form->error($::locale->text('System currently down for maintenance!')) if -e ($::lx_office_conf{paths}->{userspath} . "/nologin") && $script ne 'admin'; if ($script eq 'login' or $script eq 'admin' or $script eq 'kopf') { $::form->{titlebar} = "Lx-Office " . $::locale->text('Version') . " $::form->{version}"; @@ -325,15 +311,24 @@ sub get_standard_filehandles { return $self->{interface} =~ m/f(?:ast)cgi/i ? $self->{request}->GetHandles() : (\*STDIN, \*STDOUT, \*STDERR); } -sub _decode_recursively { - my ($obj) = @_; +sub _init_environment { + my %key_map = ( lib => { name => 'PERL5LIB', append_path => 1 }, + path => { name => 'PATH', append_path => 1 }, + ); + my $cfg = $::lx_office_conf{environment} || {}; - while (my ($key, $value) = each %{ $obj }) { - if (ref($value) eq 'HASH') { - _decode_recursively($value); - } else { - $obj->{$key} = decode('UTF-8', $value); + while (my ($key, $value) = each %{ $cfg }) { + next unless $value; + + my $info = $key_map{$key} || {}; + $key = $info->{name} || $key; + + if ($info->{append_path}) { + $value = ':' . $value unless $value =~ m/^:/ || !$ENV{$key}; + $value = $ENV{$key} . $value; } + + $ENV{$key} = $value; } } diff --git a/SL/FCGIFixes.pm b/SL/FCGIFixes.pm index d341f4a97..6327ffcf1 100644 --- a/SL/FCGIFixes.pm +++ b/SL/FCGIFixes.pm @@ -25,7 +25,7 @@ use version; sub fix_print_and_internal_encoding_after_0_68 { return if version->new("$FCGI::VERSION")->numify <= version->new("0.68")->numify; - return if lc($::dbcharset) !~ m/^(?:utf-?8|unicode)$/; + return if lc($::lx_office_conf{system}->{dbcharset}) !~ m/^(?:utf-?8|unicode)$/; my $encoder = Encode::find_encoding('UTF-8'); my $original_fcgi_print = \&FCGI::Stream::PRINT; diff --git a/SL/Form.pm b/SL/Form.pm index 9d08e0ee8..0637e6ebb 100644 --- a/SL/Form.pm +++ b/SL/Form.pm @@ -262,7 +262,7 @@ sub new { $self->_request_to_hash($content); } - my $db_charset = $main::dbcharset; + my $db_charset = $::lx_office_conf{system}->{dbcharset}; $db_charset ||= Common::DEFAULT_CHARSET; my $encoding = $self->{INPUT_ENCODING} || $db_charset; @@ -636,7 +636,7 @@ sub header { # extra code is currently only used by menuv3 and menuv4 to set their css. # it is strongly deprecated, and will be changed in a future version. my ($self, $extra_code) = @_; - my $db_charset = $::dbcharset || Common::DEFAULT_CHARSET; + my $db_charset = $::lx_office_conf{system}->{dbcharset} || Common::DEFAULT_CHARSET; my @header; $::lxdebug->leave_sub and return if !$ENV{HTTP_USER_AGENT} || $self->{header}++; @@ -720,7 +720,7 @@ sub ajax_response_header { my ($self) = @_; - my $db_charset = $main::dbcharset ? $main::dbcharset : Common::DEFAULT_CHARSET; + my $db_charset = $::lx_office_conf{system}->{dbcharset} || Common::DEFAULT_CHARSET; my $cgi = $main::cgi || CGI->new(''); my $output = $cgi->header('-charset' => $db_charset); @@ -761,7 +761,7 @@ sub _prepare_html_template { my $language; if (!%::myconfig || !$::myconfig{"countrycode"}) { - $language = $main::language; + $language = $::lx_office_conf{system}->{language}; } else { $language = $main::myconfig{"countrycode"}; } @@ -802,16 +802,16 @@ sub _prepare_html_template { map { $additional_params->{"myconfig_${_}"} = $main::myconfig{$_}; } keys %::myconfig; } - $additional_params->{"conf_dbcharset"} = $::dbcharset; - $additional_params->{"conf_webdav"} = $::webdav; - $additional_params->{"conf_lizenzen"} = $::lizenzen; - $additional_params->{"conf_latex_templates"} = $::latex; - $additional_params->{"conf_opendocument_templates"} = $::opendocument_templates; - $additional_params->{"conf_vertreter"} = $::vertreter; - $additional_params->{"conf_show_best_before"} = $::show_best_before; - $additional_params->{"conf_parts_image_css"} = $::parts_image_css; - $additional_params->{"conf_parts_listing_images"} = $::parts_listing_images; - $additional_params->{"conf_parts_show_image"} = $::parts_show_image; + $additional_params->{"conf_dbcharset"} = $::lx_office_conf{system}->{dbcharset}; + $additional_params->{"conf_webdav"} = $::lx_office_conf{system}->{webdav}; + $additional_params->{"conf_lizenzen"} = $::lx_office_conf{system}->{lizenzen}; + $additional_params->{"conf_latex_templates"} = $::lx_office_conf{print_templates}->{latex}; + $additional_params->{"conf_opendocument_templates"} = $::lx_office_conf{print_templates}->{opendocument}; + $additional_params->{"conf_vertreter"} = $::lx_office_conf{system}->{vertreter}; + $additional_params->{"conf_show_best_before"} = $::lx_office_conf{system}->{show_best_before}; + $additional_params->{"conf_parts_image_css"} = $::lx_office_conf{features}->{parts_image_css}; + $additional_params->{"conf_parts_listing_images"} = $::lx_office_conf{features}->{parts_listing_images}; + $additional_params->{"conf_parts_show_image"} = $::lx_office_conf{features}->{parts_show_image}; if (%main::debug_options) { map { $additional_params->{'DEBUG_' . uc($_)} = $main::debug_options{$_} } keys %main::debug_options; @@ -861,7 +861,7 @@ sub init_template { 'PLUGIN_BASE' => 'SL::Template::Plugin', 'INCLUDE_PATH' => '.:templates/webpages', 'COMPILE_EXT' => '.tcc', - 'COMPILE_DIR' => $::userspath . '/templates-cache', + 'COMPILE_DIR' => $::lx_office_conf{paths}->{userspath} . '/templates-cache', })) || die; } @@ -1191,11 +1191,13 @@ sub round_amount { sub parse_template { $main::lxdebug->enter_sub(); - my ($self, $myconfig, $userspath) = @_; + my ($self, $myconfig) = @_; my $out; local (*IN, *OUT); + my $userspath = $::lx_office_conf{paths}->{userspath}; + $self->{"cwd"} = getcwd(); $self->{"tmpdir"} = $self->{cwd} . "/${userspath}"; @@ -1310,7 +1312,7 @@ sub parse_template { map { $mail->{$_} = $self->{$_} } qw(cc bcc subject message version format); - $mail->{charset} = $main::dbcharset ? $main::dbcharset : Common::DEFAULT_CHARSET; + $mail->{charset} = $::lx_office_conf{system}->{dbcharset} || Common::DEFAULT_CHARSET; $mail->{to} = $self->{EMAIL_RECIPIENT} ? $self->{EMAIL_RECIPIENT} : $self->{email}; $mail->{from} = qq|"$myconfig->{name}" <$myconfig->{email}>|; $mail->{fileid} = "$fileid."; @@ -1357,6 +1359,7 @@ sub parse_template { my $numbytes = (-s $self->{tmpfile}); open(IN, $self->{tmpfile}) or $self->error($self->cleanup . "$self->{tmpfile} : $!"); + binmode IN; $self->{copies} = 1 unless $self->{media} eq 'printer'; @@ -1505,7 +1508,7 @@ sub cleanup { close(FH); } - if ($self->{tmpfile} && ! $::keep_temp_files) { + if ($self->{tmpfile} && !($::lx_office_conf{debug} && $::lx_office_conf{debug}->{keep_temp_files})) { $self->{tmpfile} =~ s|.*/||g; # strip extension $self->{tmpfile} =~ s/\.\w+$//g; diff --git a/SL/Helper/DateTime.pm b/SL/Helper/DateTime.pm index fa035ebfe..58fe6f879 100644 --- a/SL/Helper/DateTime.pm +++ b/SL/Helper/DateTime.pm @@ -1,5 +1,7 @@ package DateTime; +use strict; + sub now_local { return shift->now(time_zone => $::locale->get_local_time_zone); } diff --git a/SL/IC.pm b/SL/IC.pm index ac3d6f281..b6007d9dc 100644 --- a/SL/IC.pm +++ b/SL/IC.pm @@ -583,10 +583,11 @@ sub save { } } - CVar->save_custom_variables('dbh' => $dbh, - 'module' => 'IC', - 'trans_id' => $form->{id}, - 'variables' => $form); + CVar->save_custom_variables(dbh => $dbh, + module => 'IC', + trans_id => $form->{id}, + variables => $form, + save_validity => 1); # commit my $rc = $dbh->commit; diff --git a/SL/IR.pm b/SL/IR.pm index 7fefd4117..850d6ada8 100644 --- a/SL/IR.pm +++ b/SL/IR.pm @@ -103,7 +103,7 @@ sub post_invoice { $form->{"qty_$i"} = $form->parse_amount($myconfig, $form->{"qty_$i"}); $form->{"qty_$i"} *= -1 if $form->{storno}; - $form->{"inventory_accno_$i"} = $form->{"expense_accno_$i"} if $main::eur; + $form->{"inventory_accno_$i"} = $form->{"expense_accno_$i"} if $::lx_office_conf{system}->{eur}; # get item baseunit if (!$item_units{$form->{"id_$i"}}) { @@ -577,7 +577,7 @@ sub post_invoice { # delete zero entries do_query($form, $dbh, qq|DELETE FROM acc_trans WHERE amount = 0|); - Common::webdav_folder($form) if ($main::webdav); + Common::webdav_folder($form); # Link this record to the records it was created from. RecordLinks->create_links('dbh' => $dbh, @@ -875,7 +875,7 @@ sub retrieve_invoice { } $sth->finish(); - Common::webdav_folder($form) if ($main::webdav); + Common::webdav_folder($form); $dbh->disconnect(); diff --git a/SL/IS.pm b/SL/IS.pm index 3556d4bb7..d91a36b8b 100644 --- a/SL/IS.pm +++ b/SL/IS.pm @@ -1045,7 +1045,7 @@ sub post_invoice { # save printed, emailed and queued $form->save_status($dbh); - Common::webdav_folder($form) if ($main::webdav); + Common::webdav_folder($form); # Link this record to the records it was created from. RecordLinks->create_links('dbh' => $dbh, @@ -1277,7 +1277,7 @@ sub cogs { # sellprice is the cost of the item my $linetotal = $form->round_amount(($ref->{sellprice} * $qty) / ( ($ref->{price_factor} || 1) * ( $basefactor || 1 )), 2); - if (!$main::eur) { + if (!$::lx_office_conf{system}->{eur}) { $ref->{expense_accno} = ($form->{"expense_accno_$row"}) ? $form->{"expense_accno_$row"} : $ref->{expense_accno}; # add to expense $form->{amount_cogs}{ $form->{id} }{ $ref->{expense_accno} } += -$linetotal; @@ -1362,7 +1362,7 @@ sub reverse_invoice { sub delete_invoice { $main::lxdebug->enter_sub(); - my ($self, $myconfig, $form, $spool) = @_; + my ($self, $myconfig, $form) = @_; # connect to database my $dbh = $form->dbconnect_noauto($myconfig); @@ -1398,6 +1398,7 @@ sub delete_invoice { $dbh->disconnect; if ($rc) { + my $spool = $::lx_office_conf{paths}->{spool}; map { unlink "$spool/$_" if -f "$spool/$_"; } @spoolfiles; } @@ -1583,7 +1584,7 @@ sub retrieve_invoice { } $sth->finish; - Common::webdav_folder($form) if ($main::webdav); + Common::webdav_folder($form); } my $rc = $dbh->commit; @@ -1991,6 +1992,10 @@ sub get_pricegroups_for_parts { my ($price, $selectedpricegroup_id) = split(/--/, $form->{"sellprice_pg_$i"}); my $pricegroup_old = $form->{"pricegroup_old_$i"}; + + # sellprice has format 13,0000 or 0,00000, can't check for 0 numerically + my $sellprice = $form->{"sellprice_$i"}; + my $pricegroup_id = $form->{"pricegroup_id_$i"}; $form->{"new_pricegroup_$i"} = $selectedpricegroup_id; $form->{"old_pricegroup_$i"} = $pricegroup_old; @@ -2069,10 +2074,27 @@ sub get_pricegroups_for_parts { $pkr->{price} = $form->format_amount($myconfig, $pkr->{price}, 5); if ($selectedpricegroup_id eq undef) { - if ($pkr->{pricegroup_id} eq $form->{customer_klass}) { + # new entries in article list, either old invoice was loaded (edit) or a new article was added + # Case A: open old invoice, no pricegroup selected + # Case B: add new article to invoice, no pricegroup selected + # to distinguish case A and B the variable pricegroup_id_$i is used + # for new articles this variable isn't defined, for loaded articles it is + # sellprice can't be used, as it already has 0,00 set + + if ($pkr->{pricegroup_id} eq $form->{"pricegroup_id_$i"} and defined $form->{"pricegroup_id_$i"}) { + # Case A $pkr->{selected} = ' selected'; + } elsif ($pkr->{pricegroup_id} eq $form->{customer_klass} + and not defined $form->{"pricegroup_id_$i"} + and $pkr->{price} != 0 # only use customer pricegroup price if it has a value, else use default_sellprice + # for the case where pricegroup prices haven't been set + ) { + # Case B: use default pricegroup of customer + + $pkr->{selected} = ' selected'; # unless $form->{selected}; + # no customer pricesgroup set if ($pkr->{price} == $pkr->{default_sellprice}) { @@ -2081,29 +2103,36 @@ sub get_pricegroups_for_parts { } else { # this sub should not set anything and only return. --sschoeling, 20090506 -# $form->{"sellprice_$i"} = $pkr->{price}; +# is this correct? put in again... -- grichardson 20110119 + $form->{"sellprice_$i"} = $pkr->{price}; } - } elsif ($pkr->{price} == $pkr->{default_sellprice}) { + } elsif ($pkr->{price} == $pkr->{default_sellprice} and $pkr->{default_sellprice} != 0) { $pkr->{price} = $form->{"sellprice_$i"}; $pkr->{selected} = ' selected'; } - } else { + } + + # existing article: pricegroup or price changed + if ($selectedpricegroup_id or $selectedpricegroup_id == 0) { if ($selectedpricegroup_id ne $pricegroup_old) { + # pricegroup has changed if ($pkr->{pricegroup_id} eq $selectedpricegroup_id) { $pkr->{selected} = ' selected'; } - } elsif ( ( $form->parse_amount($myconfig, $price_new) - != $form->parse_amount($myconfig, $form->{"sellprice_$i"})) - and ($price_new ne 0)) { + } elsif ( ($form->parse_amount($myconfig, $price_new) + != $form->parse_amount($myconfig, $form->{"sellprice_$i"})) + and ($price_new ne 0) and defined $price_new) { + # sellprice has changed + # when loading existing invoices $price_new is NULL if ($pkr->{pricegroup_id} == 0) { $pkr->{price} = $form->{"sellprice_$i"}; $pkr->{selected} = ' selected'; } } elsif ($pkr->{pricegroup_id} eq $selectedpricegroup_id) { + # neither sellprice nor pricegroup changed $pkr->{selected} = ' selected'; - if ( ($pkr->{pricegroup_id} == 0) - and ($pkr->{price} == $form->{"sellprice_$i"})) { + if ( ($pkr->{pricegroup_id} == 0) and ($pkr->{price} == $form->{"sellprice_$i"})) { # $pkr->{price} = $form->{"sellprice_$i"}; } else { $pkr->{price} = $form->{"sellprice_$i"}; diff --git a/SL/InstallationCheck.pm b/SL/InstallationCheck.pm index c395f1de5..0ed1d9384 100644 --- a/SL/InstallationCheck.pm +++ b/SL/InstallationCheck.pm @@ -9,27 +9,27 @@ use strict; BEGIN { @required_modules = ( - { name => "parent", url => "http://search.cpan.org/~corion/" }, - { name => "Archive::Zip", version => '1.16', url => "http://search.cpan.org/~adamk/" }, - { name => "Class::Accessor", version => '0.30', url => "http://search.cpan.org/~kasei/" }, - { name => "CGI::Ajax", version => '0.697', url => "http://search.cpan.org/~bct/" }, - { name => "DateTime", url => "http://search.cpan.org/~drolsky/" }, - { name => "DBI", version => '1.50', url => "http://search.cpan.org/~timb/" }, - { name => "DBD::Pg", version => '1.49', url => "http://search.cpan.org/~dbdpg/" }, - { name => "Email::Address", url => "http://search.cpan.org/~rjbs/" }, - { name => "FCGI", url => "http://search.cpan.org/~mstrout/" }, - { name => "List::MoreUtils", version => '0.21', url => "http://search.cpan.org/~vparseval/" }, - { name => "PDF::API2", version => '2.000', url => "http://search.cpan.org/~areibens/" }, - { name => "Readonly", url => "http://search.cpan.org/~roode/" }, - { name => "Rose::Object", url => "http://search.cpan.org/~jsiracusa/" }, - { name => "Rose::DB", url => "http://search.cpan.org/~jsiracusa/" }, - { name => "Rose::DB::Object", url => "http://search.cpan.org/~jsiracusa/" }, - { name => "Template", version => '2.18', url => "http://search.cpan.org/~abw/" }, - { name => "Text::CSV_XS", version => '0.23', url => "http://search.cpan.org/~hmbrand/" }, - { name => "Text::Iconv", version => '1.2', url => "http://search.cpan.org/~mpiotr/" }, - { name => "URI", version => '1.35', url => "http://search.cpan.org/~gaas/" }, - { name => "XML::Writer", version => '0.602', url => "http://search.cpan.org/~josephw/" }, - { name => "YAML", version => '0.62', url => "http://search.cpan.org/~ingy/" }, + { name => "parent", url => "http://search.cpan.org/~corion/", debian => 'libparent-perl' }, + { name => "Archive::Zip", version => '1.16', url => "http://search.cpan.org/~adamk/", debian => 'libarchive-zip-perl' }, + { name => "Class::Accessor", version => '0.30', url => "http://search.cpan.org/~kasei/", debian => 'libclass-accessor-perl' }, + { name => "CGI::Ajax", version => '0.697', url => "http://search.cpan.org/~bct/" }, # no debian package, ours contains bugfixes + { name => "DateTime", url => "http://search.cpan.org/~drolsky/", debian => 'libdatetime-perl' }, + { name => "DBI", version => '1.50', url => "http://search.cpan.org/~timb/", debian => 'libdbi-perl' }, + { name => "DBD::Pg", version => '1.49', url => "http://search.cpan.org/~dbdpg/", debian => 'libdbd-pg' }, + { name => "Email::Address", url => "http://search.cpan.org/~rjbs/", debian => 'libemail-address-perl' }, + { name => "FCGI", url => "http://search.cpan.org/~mstrout/", debian => 'libfcgi-perl' }, + { name => "List::MoreUtils", version => '0.21', url => "http://search.cpan.org/~vparseval/", debian => 'liblist-moreutils-perl' }, + { name => "PDF::API2", version => '2.000', url => "http://search.cpan.org/~areibens/", debian => 'libpdf-api2-perl' }, + { name => "Rose::Object", url => "http://search.cpan.org/~jsiracusa/", debian => 'librose-object-perl' }, + { name => "Rose::DB", url => "http://search.cpan.org/~jsiracusa/", debian => 'librose-db-perl' }, + { name => "Rose::DB::Object", url => "http://search.cpan.org/~jsiracusa/", debian => 'librose-db-object-perl' }, + { name => "Sort::Naturally", url => "http://search.cpan.org/~sburke/", debian => 'libsort-naturally-perl' }, + { name => "Template", version => '2.18', url => "http://search.cpan.org/~abw/", debian => 'libtemplate-perl' }, + { name => "Text::CSV_XS", version => '0.23', url => "http://search.cpan.org/~hmbrand/", debian => 'libtext-csv-xs-perl' }, + { name => "Text::Iconv", version => '1.2', url => "http://search.cpan.org/~mpiotr/", debian => 'libtext-iconv-perl' }, + { name => "URI", version => '1.35', url => "http://search.cpan.org/~gaas/", debian => 'liburi-perl' }, + { name => "XML::Writer", version => '0.602', url => "http://search.cpan.org/~josephw/", debian => 'libxml-writer-perl' }, + { name => "YAML", version => '0.62', url => "http://search.cpan.org/~ingy/", debian => 'libyaml-perl' }, ); @optional_modules = (); diff --git a/SL/LXDebug.pm b/SL/LXDebug.pm index 7d17aec6d..b24372445 100644 --- a/SL/LXDebug.pm +++ b/SL/LXDebug.pm @@ -39,6 +39,8 @@ sub new { my $type = shift; my $self = {}; + _init_globals_from_config(); + $self->{"calldepth"} = 0; $self->{"file"} = $file_name || "/tmp/lx-office-debug.log"; $self->{"target"} = FILE_TARGET; @@ -53,6 +55,22 @@ sub new { bless($self, $type); } +my $globals_inited_from_config; +sub _init_globals_from_config { + return if $globals_inited_from_config; + $globals_inited_from_config = 1; + + my $cfg = $::lx_office_conf{debug} || {}; + + $global_level = NONE() if $cfg->{global_level} =~ /NONE/; + foreach my $level (grep { $_} split(m/\s+/, $cfg->{global_level})) { + $global_level |= eval "${level}()"; + } + + $watch_form = $cfg->{watch_form}; + $file_name = $cfg->{file_name} || "/tmp/lx-office-debug.log"; +} + sub set_target { my ($self, $target, $file) = @_; diff --git a/SL/Locale.pm b/SL/Locale.pm index c45a1a1f1..3f7df7e82 100644 --- a/SL/Locale.pm +++ b/SL/Locale.pm @@ -55,7 +55,7 @@ sub new { my ($type, $country) = @_; - $country ||= $::language; + $country ||= $::lx_office_conf{system}->{language}; $country =~ s|.*/||; $country =~ s|\.||g; @@ -96,8 +96,8 @@ sub _init { } } - my $db_charset = $main::dbcharset || Common::DEFAULT_CHARSET; - $self->{is_utf8} = (any { lc($::dbcharset || '') eq $_ } qw(utf8 utf-8 unicode)) ? 1 : 0; + my $db_charset = $::lx_office_conf{system}->{dbcharset} || Common::DEFAULT_CHARSET; + $self->{is_utf8} = (any { lc($::lx_office_conf{system}->{dbcharset} || '') eq $_ } qw(utf8 utf-8 unicode)) ? 1 : 0; if ($self->{is_utf8}) { binmode STDOUT, ":utf8"; diff --git a/SL/LxOfficeConf.pm b/SL/LxOfficeConf.pm new file mode 100644 index 000000000..b0d801024 --- /dev/null +++ b/SL/LxOfficeConf.pm @@ -0,0 +1,26 @@ +package SL::LxOfficeConf; + +use strict; + +use Config::Std; +use Encode; + +sub read { + my $file = -f 'config/lx_office.conf' ? 'config/lx_office.conf' : 'config/lx_office.conf.default'; + read_config $file => %::lx_office_conf; + _decode_recursively(\%::lx_office_conf); +} + +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); + } + } +} + +1; diff --git a/SL/Mailer.pm b/SL/Mailer.pm index 17981331d..c4cea35f2 100644 --- a/SL/Mailer.pm +++ b/SL/Mailer.pm @@ -116,9 +116,9 @@ sub send { my %temp_form = ( %{ $form }, 'myconfig_email' => $email ); my $template = SL::Template::create(type => 'PlainText', form => \%temp_form); - my $sendmail = $template->parse_block($main::sendmail); + my $sendmail = $template->parse_block($::lx_office_conf{applications}->{sendmail}); - if (!open(OUT, $sendmail)) { + if (!open(OUT, "|$sendmail")) { $main::lxdebug->leave_sub(); return "$sendmail : $!"; } diff --git a/SL/OE.pm b/SL/OE.pm index 7f0c8e363..8adaf6af2 100644 --- a/SL/OE.pm +++ b/SL/OE.pm @@ -567,7 +567,7 @@ sub save { $form->{saved_xyznumber} = $form->{$form->{type} =~ /_quotation$/ ? "quonumber" : "ordnumber"}; - Common::webdav_folder($form) if ($main::webdav); + Common::webdav_folder($form); my $rc = $dbh->commit; @@ -655,7 +655,7 @@ sub _close_quotations_rfqs { sub delete { $main::lxdebug->enter_sub(); - my ($self, $myconfig, $form, $spool) = @_; + my ($self, $myconfig, $form) = @_; # connect to database my $dbh = $form->dbconnect_noauto($myconfig); @@ -705,6 +705,7 @@ sub delete { $dbh->disconnect; if ($rc) { + my $spool = $::lx_office_conf{paths}->{spool}; foreach $spoolfile (@spoolfiles) { unlink "$spool/$spoolfile" if $spoolfile; } @@ -992,7 +993,7 @@ sub retrieve { $form->{exchangerate} = $form->get_exchangerate($dbh, $form->{currency}, $form->{transdate}, ($form->{vc} eq 'customer') ? "buy" : "sell"); - Common::webdav_folder($form) if ($main::webdav); + Common::webdav_folder($form); $self->load_periodic_invoice_config($form); diff --git a/SL/ReportGenerator.pm b/SL/ReportGenerator.pm index f6095a8a0..441eb159d 100644 --- a/SL/ReportGenerator.pm +++ b/SL/ReportGenerator.pm @@ -428,7 +428,7 @@ sub generate_pdf_content { my $num_columns = scalar @visible_columns; my $num_header_rows = 1; - my $font_encoding = $main::dbcharset || 'ISO-8859-15'; + my $font_encoding = $::lx_office_conf{system}->{dbcharset} || 'ISO-8859-15'; foreach my $name (@visible_columns) { push @column_props, { 'justify' => $self->{columns}->{$name}->{align} eq 'right' ? 'right' : 'left' }; diff --git a/SL/Template.pm b/SL/Template.pm index 890e4b0be..df18e706e 100644 --- a/SL/Template.pm +++ b/SL/Template.pm @@ -22,7 +22,7 @@ sub create { my %params = @_; my $package = "SL::Template::" . $params{type}; - $package->new($params{file_name}, $params{form}, $params{myconfig} || \%::myconfig, $params{userspath} || $::userspath); + $package->new($params{file_name}, $params{form}, $params{myconfig} || \%::myconfig, $params{userspath} || $::lx_office_conf{paths}->{userspath}); } 1; diff --git a/SL/Template/HTML.pm b/SL/Template/HTML.pm index abca75c07..0ff939fd8 100644 --- a/SL/Template/HTML.pm +++ b/SL/Template/HTML.pm @@ -70,7 +70,7 @@ sub convert_to_postscript { $psfile .= ".ps"; } - system("html2ps -f html2ps-config < $form->{tmpfile} > $psfile"); + system($::lx_office_conf{applications}->{html2ps} . " -f html2ps-config < $form->{tmpfile} > $psfile"); if ($?) { $self->{"error"} = $form->cleanup(); $self->cleanup(); @@ -103,7 +103,7 @@ sub convert_to_pdf { $pdffile .= ".pdf"; } - system("html2ps -f html2ps-config < $form->{tmpfile} | ps2pdf - $pdffile"); + system($::lx_office_conf{applications}->{html2ps} . " -f html2ps-config < $form->{tmpfile} | ps2pdf - $pdffile"); if ($?) { $self->{"error"} = $form->cleanup(); $self->cleanup(); diff --git a/SL/Template/LaTeX.pm b/SL/Template/LaTeX.pm index d1c208018..b70e1522f 100644 --- a/SL/Template/LaTeX.pm +++ b/SL/Template/LaTeX.pm @@ -134,7 +134,7 @@ sub find_end { my $keyword_pos = $pos - 1 + $tag_start_len; - if ((substr($text, $keyword_pos, 2) eq 'if') || (substr($text, $keyword_pos, 3) eq 'foreach')) { + if ((substr($text, $keyword_pos, 2) eq 'if') || (substr($text, $keyword_pos, 7) eq 'foreach')) { $depth++; } elsif ((substr($text, $keyword_pos, 4) eq 'else') && (1 == $depth)) { @@ -447,7 +447,7 @@ sub convert_to_pdf { } sub _get_latex_path { - return $main::latex_bin || 'pdflatex'; + return $::lx_office_conf{applications}->{latex} || 'pdflatex'; } sub get_mime_type() { diff --git a/SL/Template/OpenDocument.pm b/SL/Template/OpenDocument.pm index 2ed3c60fa..552bc2f42 100644 --- a/SL/Template/OpenDocument.pm +++ b/SL/Template/OpenDocument.pm @@ -22,7 +22,7 @@ sub new { my $self = $type->SUPER::new(@_); $self->{"rnd"} = int(rand(1000000)); - $self->{"iconv"} = SL::Iconv->new($main::dbcharset, "UTF-8"); + $self->{"iconv"} = SL::Iconv->new($::lx_office_conf{system}->{dbcharset}, "UTF-8"); $self->set_tag_style('<%', '%>'); $self->{quot_re} = '"'; @@ -382,7 +382,7 @@ sub spawn_xvfb { my $pid = fork(); if (0 == $pid) { $main::lxdebug->message(LXDebug->DEBUG2(), " Child execing\n"); - exec($main::xvfb_bin, $display, "-screen", "0", "640x480x8", "-nolisten", "tcp"); + exec($::lx_office_conf{applications}->{xvfb}, $display, "-screen", "0", "640x480x8", "-nolisten", "tcp"); } sleep(3); $main::lxdebug->message(LXDebug->DEBUG2(), " parent dont sleeping\n"); @@ -419,7 +419,8 @@ sub spawn_xvfb { sub is_openoffice_running { $main::lxdebug->enter_sub(); - my $output = `./scripts/oo-uno-test-conn.py $main::openofficeorg_daemon_port 2> /dev/null`; + my $cmd = "./scripts/oo-uno-test-conn.py " . $::lx_office_conf{print_templates}->{openofficeorg_daemon_port} . " 2> /dev/null"; + my $output = `$cmd`; chomp $output; my $res = ($? == 0) || $output; @@ -457,11 +458,11 @@ sub spawn_openoffice { exit if ($new_pid); my $ssres = setsid(); $main::lxdebug->message(LXDebug->DEBUG2(), " Child execing\n"); - my @cmdline = ($main::openofficeorg_writer_bin, + my @cmdline = ($::lx_office_conf{applications}->{openofficeorg_writer}, "-minimized", "-norestore", "-nologo", "-nolockcheck", "-headless", "-accept=socket,host=localhost,port=" . - $main::openofficeorg_daemon_port . ";urp;"); + $::lx_office_conf{print_templates}->{openofficeorg_daemon_port} . ";urp;"); exec(@cmdline); } @@ -508,8 +509,8 @@ sub convert_to_pdf { } my @cmdline; - if (!$main::openofficeorg_daemon) { - @cmdline = ($main::openofficeorg_writer_bin, + if (!$::lx_office_conf{print_templates}->{openofficeorg_daemon}) { + @cmdline = ($::lx_office_conf{applications}->{openofficeorg_writer}, "-minimized", "-norestore", "-nologo", "-nolockcheck", "-headless", "file:${filename}.odt", @@ -522,7 +523,7 @@ sub convert_to_pdf { } @cmdline = ("./scripts/oo-uno-convert-pdf.py", - $main::openofficeorg_daemon_port, + $::lx_office_conf{print_templates}->{openofficeorg_daemon_port}, "${filename}.odt"); } diff --git a/SL/TransNumber.pm b/SL/TransNumber.pm index 9aed12655..0ba13a8ab 100644 --- a/SL/TransNumber.pm +++ b/SL/TransNumber.pm @@ -6,7 +6,6 @@ use parent qw(Rose::Object); use Carp; use List::MoreUtils qw(any none); -use Readonly; use SL::DBUtils; use Rose::Object::MakeMethods::Generic @@ -14,7 +13,7 @@ use Rose::Object::MakeMethods::Generic scalar => [ qw(type id number save dbh dbh_provided business_id) ], ); -Readonly my @SUPPORTED_TYPES => qw(invoice credit_note customer vendor sales_delivery_order purchase_delivery_order sales_order purchase_order sales_quotation request_quotation); +my @SUPPORTED_TYPES = qw(invoice credit_note customer vendor sales_delivery_order purchase_delivery_order sales_order purchase_order sales_quotation request_quotation); sub new { my $class = shift; diff --git a/SL/User.pm b/SL/User.pm index 024a683db..520bf4229 100644 --- a/SL/User.pm +++ b/SL/User.pm @@ -145,10 +145,10 @@ sub login { } # update the tables - if (!open(FH, ">$main::userspath/nologin")) { + if (!open(FH, ">" . $::lx_office_conf{paths}->{userspath} . "/nologin")) { $form->show_generic_error($main::locale->text('A temporary file could not be created. ' . 'Please verify that the directory "#1" is writeable by the webserver.', - $main::userspath), + $::lx_office_conf{paths}->{userspath}), 'back_button' => 1); } @@ -166,7 +166,7 @@ sub login { close(FH); # remove lock file - unlink("$main::userspath/nologin"); + unlink($::lx_office_conf{paths}->{userspath} . "/nologin"); my $menufile = $self->{"menustyle"} eq "v3" ? "menuv3.pl" : @@ -581,7 +581,7 @@ sub dbupdate { closedir(SQLDIR); } - my $db_charset = $main::dbcharset; + my $db_charset = $::lx_office_conf{system}->{dbcharset}; $db_charset ||= Common::DEFAULT_CHARSET; my $dbupdater = SL::DBUpgrade2->new(form => $form, dbdriver => $form->{dbdriver}); @@ -648,7 +648,7 @@ sub dbupdate2 { $form->{sid} = $form->{dbdefault}; my $rc = -2; - my $db_charset = $main::dbcharset || Common::DEFAULT_CHARSET; + my $db_charset = $::lx_office_conf{system}->{dbcharset} || Common::DEFAULT_CHARSET; map { $_->{description} = SL::Iconv::convert($_->{charset}, $db_charset, $_->{description}) } values %{ $dbupdater->{all_controls} }; diff --git a/VERSION b/VERSION index 9ba2a8896..38745eb80 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -2.6.2-beta1 +2.6.2-beta2 diff --git a/bin/mozilla/admin.pl b/bin/mozilla/admin.pl index eac4d083e..cc0d463a6 100755 --- a/bin/mozilla/admin.pl +++ b/bin/mozilla/admin.pl @@ -42,6 +42,7 @@ use POSIX qw(strftime); use Sys::Hostname; use SL::Auth; +use SL::Auth::PasswordPolicy; use SL::Form; use SL::Iconv; use SL::Mailer; @@ -143,10 +144,11 @@ sub check_auth_db_and_tables { ::end_of_request(); } - if (-f $main::memberfile) { + my $memberfile = $::lx_office_conf{paths}->{memberfile}; + if (-f $memberfile) { my $memberdir = ""; - if ($main::memberfile =~ m|^.*/|) { + if ($memberfile =~ m|^.*/|) { $memberdir = $&; } @@ -154,7 +156,7 @@ sub check_auth_db_and_tables { $form->{title} = $locale->text('User data migration'); $form->header(); - print $form->parse_html_template('admin/user_migration', { 'memberfile' => $main::memberfile, + print $form->parse_html_template('admin/user_migration', { 'memberfile' => $memberfile, 'backupdir' => $backupdir }); ::end_of_request(); @@ -178,7 +180,8 @@ sub create_auth_tables { $main::auth->set_session_value('rpw', $form->{rpw}); $main::auth->create_or_refresh_session(); - if (!-f $main::memberfile) { + my $memberfile = $::lx_office_conf{paths}->{memberfile}; + if (!-f $memberfile) { # New installation -- create a standard group with full access my %members; my $group = { @@ -202,7 +205,8 @@ sub migrate_users { my $memberdir = ""; - if ($main::memberfile =~ m|^.*/|) { + my $memberfile = $::lx_office_conf{paths}->{memberfile}; + if ($memberfile =~ m|^.*/|) { $memberdir = $&; } @@ -212,9 +216,9 @@ sub migrate_users { $form->error(sprintf($locale->text('The directory "%s" could not be created:\n%s'), $backupdir, $!)); } - copy $main::memberfile, "users/member-file-migration/members"; + copy $memberfile, "users/member-file-migration/members"; - my $in = IO::File->new($main::memberfile, "r"); + my $in = IO::File->new($memberfile, "r"); $form->error($locale->text('Could not open the old memberfile.')) if (!$in); @@ -265,7 +269,7 @@ sub migrate_users { } } - unlink $main::memberfile; + unlink $memberfile; my @member_list = sort { lc $a->{login} cmp lc $b->{login} } values %members; @@ -340,7 +344,7 @@ sub list_users { map { $_->{templates} =~ s|.*/||; } values %members; $form->{title} = "Lx-Office ERP " . $locale->text('Administration'); - $form->{LOCKED} = -e "$main::userspath/nologin"; + $form->{LOCKED} = -e _nologin_file_name(); $form->{MEMBERS} = [ @members{sort { lc $a cmp lc $b } keys %members} ]; $form->header(); @@ -410,14 +414,14 @@ sub edit_user_form { } # is there a templates basedir - if (!-d "$main::templates") { - $form->error(sprintf($locale->text("The directory %s does not exist."), $main::templates)); + if (!-d $::lx_office_conf{paths}->{templates}) { + $form->error(sprintf($locale->text("The directory %s does not exist."), $::lx_office_conf{paths}->{templates})); } - opendir TEMPLATEDIR, "$main::templates/." or $form->error("$main::templates : $ERRNO"); + opendir TEMPLATEDIR, $::lx_office_conf{paths}->{templates} or $form->error($::lx_office_conf{paths}->{templates} . " : $ERRNO"); my @all = readdir(TEMPLATEDIR); - my @alldir = sort grep { -d "$main::templates/$_" && !/^\.\.?$/ } @all; - my @allhtml = sort grep { -f "$main::templates/$_" && /\.html$/ } @all; + my @alldir = sort grep { -d ($::lx_office_conf{paths}->{templates} . "/$_") && !/^\.\.?$/ } @all; + my @allhtml = sort grep { -f ($::lx_office_conf{paths}->{templates} . "/$_") && /\.html$/ } @all; closedir TEMPLATEDIR; @alldir = grep !/\.(html|tex|sty|odt|xml|txb)$/, @alldir; @@ -496,13 +500,13 @@ sub save_user { } # is there a basedir - if (!-d "$main::templates") { - $form->error(sprintf($locale->text("The directory %s does not exist."), $main::templates)); + if (!-d $::lx_office_conf{paths}->{templates}) { + $form->error(sprintf($locale->text("The directory %s does not exist."), $::lx_office_conf{paths}->{templates})); } # add base directory to $form->{templates} $form->{templates} =~ s|.*/||; - $form->{templates} = "$main::templates/$form->{templates}"; + $form->{templates} = $::lx_office_conf{paths}->{templates} . "/$form->{templates}"; my $myconfig = new User($form->{login}); @@ -520,14 +524,8 @@ sub save_user { $myconfig->save_member(); - if ($main::auth->can_change_password() - && defined $form->{new_password} - && ($form->{new_password} ne '********')) { - $main::auth->change_password($form->{login}, $form->{new_password}); - } - $form->{templates} =~ s|.*/||; - $form->{templates} = "$main::templates/$form->{templates}"; + $form->{templates} = $::lx_office_conf{paths}->{templates} . "/$form->{templates}"; $form->{mastertemplates} =~ s|.*/||; # create user template directory and copy master files @@ -539,14 +537,14 @@ sub save_user { umask(007); # copy templates to the directory - opendir TEMPLATEDIR, "$main::templates/." or $form->error("$main::templates : $ERRNO"); + opendir TEMPLATEDIR, $::lx_office_conf{paths}->{templates} or $form->error($::lx_office_conf{paths}->{templates} . " : $ERRNO"); my @templates = grep /$form->{mastertemplates}.*?\.(html|tex|sty|odt|xml|txb)$/, readdir TEMPLATEDIR; closedir TEMPLATEDIR; foreach my $file (@templates) { - open(TEMP, "$main::templates/$file") - or $form->error("$main::templates/$file : $ERRNO"); + open(TEMP, $::lx_office_conf{paths}->{templates} . "/$file") + or $form->error($::lx_office_conf{paths}->{templates} . "/$file : $ERRNO"); $file =~ s/\Q$form->{mastertemplates}\E-//; open(NEW, ">$form->{templates}/$file") @@ -578,8 +576,20 @@ sub save_user { } } - $form->redirect($locale->text('User saved!')); + if ($main::auth->can_change_password() + && defined $form->{new_password} + && ($form->{new_password} ne '********')) { + my $verifier = SL::Auth::PasswordPolicy->new; + my $result = $verifier->verify($form->{new_password}, 1); + + if ($result != SL::Auth::PasswordPolicy->OK()) { + $form->error($::locale->text('The settings were saved, but the password was not changed.') . ' ' . join(' ', $verifier->errors($result))); + } + $main::auth->change_password($form->{login}, $form->{new_password}); + } + + $form->redirect($locale->text('User saved!')); } sub save_user_as_new { @@ -757,12 +767,12 @@ sub create_dataset { } closedir SQLDIR; - my $default_charset = $main::dbcharset; + my $default_charset = $::lx_office_conf{system}->{dbcharset}; $default_charset ||= Common::DEFAULT_CHARSET; my $cluster_encoding = User->dbclusterencoding($form); if ($cluster_encoding && ($cluster_encoding =~ m/^(?:UTF-?8|UNICODE)$/i)) { - if ($main::dbcharset !~ m/^UTF-?8$/i) { + if ($::lx_office_conf{system}->{dbcharset} !~ m/^UTF-?8$/i) { $form->show_generic_error($locale->text('The selected PostgreSQL installation uses UTF-8 as its encoding. ' . 'Therefore you have to configure Lx-Office to use UTF-8 as well.'), 'back_button' => 1); @@ -835,8 +845,8 @@ sub backup_dataset { $form->{title} = "Lx-Office ERP " . $locale->text('Database Administration') . " / " . $locale->text('Backup Dataset'); - if ("$main::pg_dump_exe" eq "DISABLED") { - $form->error($locale->text('Database backups and restorations are disabled in lx-erp.conf.')); + if ($::lx_office_conf{applications}->{pg_dump} eq "DISABLED") { + $form->error($locale->text('Database backups and restorations are disabled in the configuration.')); } my @dbsources = sort User->dbsources($form); @@ -857,10 +867,10 @@ sub backup_dataset_start { $form->{title} = "Lx-Office ERP " . $locale->text('Database Administration') . " / " . $locale->text('Backup Dataset'); - $main::pg_dump_exe ||= "pg_dump"; + my $pg_dump_exe = $::lx_office_conf{applications}->{pg_dump} || "pg_dump"; - if ("$main::pg_dump_exe" eq "DISABLED") { - $form->error($locale->text('Database backups and restorations are disabled in lx-erp.conf.')); + if ("$pg_dump_exe" eq "DISABLED") { + $form->error($locale->text('Database backups and restorations are disabled in the configuration.')); } $form->isblank("dbname", $locale->text('The dataset name is missing.')); @@ -885,7 +895,7 @@ sub backup_dataset_start { push @args, ("-p", $form->{dbport}) if ($form->{dbport}); push @args, $form->{dbname}; - my $cmd = "$main::pg_dump_exe " . join(" ", map { s/\\/\\\\/g; s/\"/\\\"/g; $_ } @args); + my $cmd = "$pg_dump_exe " . join(" ", map { s/\\/\\\\/g; s/\"/\\\"/g; $_ } @args); my $name = "dataset_backup_$form->{dbname}_" . strftime("%Y%m%d", localtime()) . ".tar"; if ($form->{destination} ne "email") { @@ -924,7 +934,7 @@ sub backup_dataset_start { map { $mail->{$_} = $form->{$_} } qw(from to cc subject message); - $mail->{charset} = $main::dbcharset ? $main::dbcharset : Common::DEFAULT_CHARSET; + $mail->{charset} = $::lx_office_conf{system}->{dbcharset} || Common::DEFAULT_CHARSET; $mail->{attachments} = [ { "filename" => $tmp, "name" => $name } ]; $mail->send(); @@ -944,11 +954,11 @@ sub restore_dataset { $form->{title} = "Lx-Office ERP " . $locale->text('Database Administration') . " / " . $locale->text('Restore Dataset'); - if ("$main::pg_restore_exe" eq "DISABLED") { - $form->error($locale->text('Database backups and restorations are disabled in lx-erp.conf.')); + if ($::lx_office_conf{applications}->{pg_restore} eq "DISABLED") { + $form->error($locale->text('Database backups and restorations are disabled in the configuration.')); } - my $default_charset = $main::dbcharset; + my $default_charset = $::lx_office_conf{system}->{dbcharset}; $default_charset ||= Common::DEFAULT_CHARSET; $form->{DBENCODINGS} = []; @@ -969,10 +979,10 @@ sub restore_dataset_start { $form->{title} = "Lx-Office ERP " . $locale->text('Database Administration') . " / " . $locale->text('Restore Dataset'); - $main::pg_restore_exe ||= "pg_restore"; + my $pg_restore_exe = $::lx_office_conf{applications}->{pg_restore} || "pg_restore"; - if ("$main::pg_restore_exe" eq "DISABLED") { - $form->error($locale->text('Database backups and restorations are disabled in lx-erp.conf.')); + if ("$pg_restore_exe" eq "DISABLED") { + $form->error($locale->text('Database backups and restorations are disabled in the configuration.')); } $form->isblank("new_dbname", $locale->text('The dataset name is missing.')); @@ -1058,7 +1068,7 @@ sub restore_dataset_start { push @args, ("-p", $form->{dbport}) if ($form->{dbport}); push @args, $tmp; - my $cmd = "$main::pg_restore_exe " . join(" ", map { s/\\/\\\\/g; s/\"/\\\"/g; $_ } @args); + my $cmd = "$pg_restore_exe " . join(" ", map { s/\\/\\\\/g; s/\"/\\\"/g; $_ } @args); my $in = IO::File->new("$cmd 2>&1 |"); @@ -1090,7 +1100,7 @@ sub unlock_system { my $form = $main::form; my $locale = $main::locale; - unlink "$main::userspath/nologin"; + unlink _nologin_file_name();; $form->{callback} = "admin.pl?action=list_users"; @@ -1102,7 +1112,7 @@ sub lock_system { my $form = $main::form; my $locale = $main::locale; - open(FH, ">$main::userspath/nologin") + open(FH, ">" . _nologin_file_name()) or $form->error($locale->text('Cannot create Lock!')); close(FH); @@ -1173,4 +1183,8 @@ sub _apply_dbupgrade_scripts { ::end_of_request() if SL::DBUpgrade2->new(form => $::form, dbdriver => 'Pg', auth => 1)->apply_admin_dbupgrade_scripts(1); } +sub _nologin_file_name { + return $::lx_office_conf{paths}->{userspath} . '/nologin'; +} + 1; diff --git a/bin/mozilla/am.pl b/bin/mozilla/am.pl index b7c980c9e..bcf934ed1 100644 --- a/bin/mozilla/am.pl +++ b/bin/mozilla/am.pl @@ -34,6 +34,7 @@ use utf8; use SL::Auth; +use SL::Auth::PasswordPolicy; use SL::AM; use SL::CA; use SL::Form; @@ -1110,7 +1111,7 @@ sub list_business { $form->{title} = $locale->text('Type of Business'); my @column_index = qw(description discount customernumberinit); - push @column_index, 'salesman' if $::vertreter; + push @column_index, 'salesman' if $::lx_office_conf{system}->{vertreter}; my %column_header; $column_header{description} = qq|| @@ -1223,7 +1224,7 @@ sub business_header { $form->format_amount(\%myconfig, $form->{discount} * 100); my $salesman_code; - if ($::vertreter) { + if ($::lx_office_conf{system}->{vertreter}) { $salesman_code = qq| | . $locale->text('Representative') . qq| @@ -1872,7 +1873,7 @@ sub buchungsgruppe_header { } my $linkaccounts; - if (!$main::eur) { + if (!$::lx_office_conf{system}->{eur}) { $linkaccounts = qq| | . $locale->text('Inventory') . qq| @@ -2456,20 +2457,21 @@ sub config { _build_cfg_options('numberformat', ('1,000.00', '1000.00', '1.000,00', '1000,00')); my @formats = (); - if ($main::opendocument_templates && $main::openofficeorg_writer_bin && - $main::xvfb_bin && (-x $main::openofficeorg_writer_bin) && (-x $main::xvfb_bin)) { + if ($::lx_office_conf{print_templates}->{opendocument} + && $::lx_office_conf{applications}->{openofficeorg_writer} && (-x $::lx_office_conf{applications}->{openofficeorg_writer}) + && $::lx_office_conf{applications}->{xvfb} && (-x $::lx_office_conf{applications}->{xvfb})) { push(@formats, { "name" => $locale->text("PDF (OpenDocument/OASIS)"), "value" => "opendocument_pdf" }); } - if ($main::latex_templates) { + if ($::lx_office_conf{print_templates}->{latex}) { push(@formats, { "name" => $locale->text("PDF"), "value" => "pdf" }); } push(@formats, { "name" => "HTML", "value" => "html" }); - if ($main::latex_templates) { + if ($::lx_office_conf{print_templates}->{latex}) { push(@formats, { "name" => $locale->text("Postscript"), "value" => "postscript" }); } - if ($main::opendocument_templates) { + if ($::lx_office_conf{print_templates}->{opendocument}) { push(@formats, { "name" => $locale->text("OpenDocument/OASIS"), "value" => "opendocument" }); } @@ -2549,7 +2551,27 @@ sub save_preferences { TODO->save_user_config('login' => $form->{login}, %{ $form->{todo_cfg} || { } }); - $form->redirect($locale->text('Preferences saved!')) if (AM->save_preferences(\%myconfig, \%$form, 0)); + if (AM->save_preferences(\%myconfig, $form)) { + if ($::auth->can_change_password() + && defined $form->{new_password} + && ($form->{new_password} ne '********')) { + my $verifier = SL::Auth::PasswordPolicy->new; + my $result = $verifier->verify($form->{new_password}); + + if ($result != SL::Auth::PasswordPolicy->OK()) { + $form->error($::locale->text('The settings were saved, but the password was not changed.') . ' ' . join(' ', $verifier->errors($result))); + } + + $::auth->change_password($form->{login}, $form->{new_password}); + + $form->{password} = $form->{new_password}; + $::auth->set_session_value('password', $form->{password}); + $::auth->create_or_refresh_session(); + } + + $form->redirect($locale->text('Preferences saved!')); + } + $form->error($locale->text('Cannot save preferences!')); $main::lxdebug->leave_sub(); diff --git a/bin/mozilla/ap.pl b/bin/mozilla/ap.pl index 74285e73e..ae5d9d85d 100644 --- a/bin/mozilla/ap.pl +++ b/bin/mozilla/ap.pl @@ -1178,7 +1178,7 @@ sub yes { $main::auth->assert('general_ledger'); - if (AP->delete_transaction(\%myconfig, \%$form, $main::spool)) { + if (AP->delete_transaction(\%myconfig, \%$form)) { # saving the history if(!exists $form->{addition}) { $form->{snumbers} = qq|invnumber_| . $form->{invnumber}; diff --git a/bin/mozilla/ar.pl b/bin/mozilla/ar.pl index 585301c25..3d4fe2664 100644 --- a/bin/mozilla/ar.pl +++ b/bin/mozilla/ar.pl @@ -271,17 +271,9 @@ sub form_header { $form->{exchangerate} = $form->{forex} if $form->{forex}; # format amounts - $form->{exchangerate} = - $form->format_amount(\%myconfig, $form->{exchangerate}); - - if ($form->{exchangerate} == 0) { - $form->{exchangerate} = ""; - } - - $form->{creditlimit} = - $form->format_amount(\%myconfig, $form->{creditlimit}, 0, "0"); - $form->{creditremaining} = - $form->format_amount(\%myconfig, $form->{creditremaining}, 0, "0"); + $form->{exchangerate} = $form->{exchangerate} ? $form->format_amount(\%myconfig, $form->{exchangerate}) : ''; + $form->{creditlimit} = $form->format_amount(\%myconfig, $form->{creditlimit}, 0, "0"); + $form->{creditremaining} = $form->format_amount(\%myconfig, $form->{creditremaining}, 0, "0"); $exchangerate = qq| {forex}> diff --git a/bin/mozilla/arap.pl b/bin/mozilla/arap.pl index 03dd6e895..fa2dd4239 100644 --- a/bin/mozilla/arap.pl +++ b/bin/mozilla/arap.pl @@ -500,17 +500,6 @@ __END__ =head1 NAME -<<<<<<< HEAD:bin/mozilla/arap.pl -bin/mozilla/arap.pl - helper routines for invoiceing frontend. - -=head1 SYNOPSIS - -nothing yet - -=head1 DESCRIPTION - -nothing yet -======= arap.pl - helper functions or customer/vendor retrieval =head1 SYNOPSIS @@ -523,13 +512,11 @@ arap.pl - helper functions or customer/vendor retrieval Don't use anyting in this file without extreme care, and even then be prepared for massive headaches. It's a collection of helper routines that wrap the customer/vendor dropdown/textfield duality into something even complexer. ->>>>>>> 88f5a78... check_name erweitert um ein no_select flag. siehe perldoc bin/mozilla/arap.pl:bin/mozilla/arap.pl =head1 FUNCTIONS =head2 check_name customer|vendor -<<<<<<< HEAD:bin/mozilla/arap.pl check_name was originally meant to update the selected customer or vendor. The way it does that has generted more hate than almost any other part of this software. @@ -538,69 +525,69 @@ What it does is: =over 4 -=item +=item * It checks if a vendor or customer is given. No failsafe, vendor fallback if $_[0] is something fancy. -=item +=item * It assumes, that there is a field named customer or vendor in $form. -=item +=item * It assumes, that this field is filled with name--id, and tries to split that. sql ledger uses that combination to get ids into the select keys. -=item +=item * It looks for a field selectcustomer or selectvendor in $form. sql ledger used to store a copy of the html select in there. (again, don't ask) -=item +=item * If this field exists, it looks for a field called oldcustomer or oldvendor, in which the old name--id string was stored in sql ledger, and compares those. -=item +=item * if they don't match, it will set customer_id or vendor_id in $form, load the entry (which will clobber everything in $form named like a column in customer oder vendor) and return. -=item +=item * If there was no select* entry, it assumes that vclimit was lower than the number of entries, and that an input field was generated. In that case the splitting is omitted (since users don't generally include ids in entered names) -=item +=item * It looks for a *_id field, and combines it with the given input into a name--id entry and compares it to the old* entry. (Missing any of these will instantly break check_namea. -=item +=item * If those do not match, $form->get_name is called to get matching results. get_name only matches by *number and name, not by id, don't try to get it to do so. -=item +=item * The results are stored in $form>{name_list} but a count is returned, and checked. -=item +=item * If only one result was found, *_id, * and old* are copied into $form, the entry is loaded (like above, clobbering) -=item +=item * If there is more than one, a selection dialog is rendered -=item +=item * If none is found, an error is generated. @@ -616,13 +603,12 @@ are necessary in all steps and branches. Since get_customer and get_vendor clobber a lot of fields, make sure what changes exactly. -======= -This function will take the contents of $form->{vendor} or $form->{customer}, try to guess if there was a selectbox or not, and search for matching customer/vendors. -This mostly works great, except for the case when there is more than one match. -In that case check_name will display a select form, that will redirect to the -original C. Unfortunately any hidden vars or input fields will be lost -in the process unless saved before in a callback. +=head3 select- version works fine, but things go awry when I use a textbox, any idea? + +If there is more than one match, check_name will display a select form, that +will redirect to the original C. Unfortunately any hidden vars or +input fields will be lost in the process unless saved before in a callback. If you still want to use it, you can disable this feature, like this: @@ -630,9 +616,6 @@ If you still want to use it, you can disable this feature, like this: In that case multiple matches will trigger an error. -=head1 BUGS - -=head1 AUTHOR ->>>>>>> 88f5a78... check_name erweitert um ein no_select flag. siehe perldoc bin/mozilla/arap.pl:bin/mozilla/arap.pl +Otherwise you'll have to care to include a complete state in callback. =cut diff --git a/bin/mozilla/bp.pl b/bin/mozilla/bp.pl index 173f8b6c1..9ce49155a 100644 --- a/bin/mozilla/bp.pl +++ b/bin/mozilla/bp.pl @@ -341,7 +341,7 @@ sub yes { $form->{callback} .= "&header=1" if $form->{callback}; $form->redirect($locale->text('Removed spoolfiles!')) - if (BP->delete_spool(\%myconfig, \%$form, $main::spool)); + if (BP->delete_spool(\%myconfig, \%$form)); $form->error($locale->text('Cannot remove files!')); $main::lxdebug->leave_sub(); @@ -373,7 +373,7 @@ sub print { if ($form->{"checked_$i"}) { $form->info($locale->text('Printing ... ')); - if (BP->print_spool(\%myconfig, \%$form, $main::spool, "| $selected_printer")) { + if (BP->print_spool(\%myconfig, \%$form, "| $selected_printer")) { print $locale->text('done'); $form->redirect($locale->text('Marked entries printed!')); } @@ -537,6 +537,7 @@ sub list_spool { my $i = 0; my $j = 0; my $spoolfile; + my $spool = $::lx_office_conf{paths}->{spool}; foreach my $ref (@{ $form->{SPOOL} }) { @@ -566,7 +567,7 @@ sub list_spool { "{id}&type=$form->{type}&callback=$callback>$ref->{quonumber}"; $column_data{name} = "$ref->{name}"; $column_data{spoolfile} = - qq|{spoolfile}>$ref->{spoolfile} + qq|{spoolfile}>$ref->{spoolfile} {spoolfile}> |; diff --git a/bin/mozilla/ca.pl b/bin/mozilla/ca.pl index 31c77da10..dd157e0a9 100644 --- a/bin/mozilla/ca.pl +++ b/bin/mozilla/ca.pl @@ -84,7 +84,7 @@ sub chart_of_accounts { $form->{title} = $locale->text('Chart of Accounts'); - if ($main::eur) { + if ($::lx_office_conf{system}->{eur}) { $form->{method} = "cash"; } @@ -177,8 +177,8 @@ sub list { | if $form->{selectdepartment}; - my $accrual = ($main::eur) ? "" : "checked"; - my $cash = ($main::eur) ? "checked" : ""; + my $accrual = $::lx_office_conf{system}->{eur} ? "" : "checked"; + my $cash = $::lx_office_conf{system}->{eur} ? "checked" : ""; my $name_1 = "fromdate"; my $id_1 = "fromdate"; @@ -246,6 +246,8 @@ sub list { $form->{description} =~ s/\"/"/g; + my $eur = $::lx_office_conf{system}->{eur}; + print qq| @@ -254,7 +256,7 @@ sub list { {accno}> - + {accounttype}> diff --git a/bin/mozilla/common.pl b/bin/mozilla/common.pl index 540877299..cef7fcab8 100644 --- a/bin/mozilla/common.pl +++ b/bin/mozilla/common.pl @@ -11,6 +11,7 @@ use Carp; use SL::Common; +use SL::DB::Helper::Mappings; use SL::DBUtils; use SL::Form; use SL::MoreCommon; @@ -613,13 +614,8 @@ sub gl_transaction { $main::lxdebug->leave_sub(); } -if ($::use_rdbo) { - eval { - require SL::DB::Helper::Mappings; - sub db { - goto &SL::DB::Helper::Mappings::db; - } - } or die $@; +sub db { + goto &SL::DB::Helper::Mappings::db; } 1; diff --git a/bin/mozilla/ct.pl b/bin/mozilla/ct.pl index b6e8c7b78..a05158289 100644 --- a/bin/mozilla/ct.pl +++ b/bin/mozilla/ct.pl @@ -300,7 +300,7 @@ sub form_header { taxzones => "ALL_TAXZONES"); $form->get_pricegroup(\%myconfig, { all => 1 }); - $form->get_lists(customers => { key => "ALL_SALESMAN_CUSTOMERS", business_is_salesman => 1 }) if $::vertreter; + $form->get_lists(customers => { key => "ALL_SALESMAN_CUSTOMERS", business_is_salesman => 1 }) if $::lx_office_conf{system}->{vertreter}; $form->{ALL_SALESMEN} = $form->{ALL_EMPLOYEES}; $form->{taxincluded} = ($form->{taxincluded}) ? "checked" : ""; @@ -354,7 +354,7 @@ sub _do_save { $::form->isblank("name", $::locale->text("Name missing!")); - if ($::form->{new_salesman_id} && $::vertreter) { + if ($::form->{new_salesman_id} && $::lx_office_conf{system}->{vertreter}) { $::form->{salesman_id} = $::form->{new_salesman_id}; delete $::form->{new_salesman_id}; } diff --git a/bin/mozilla/dn.pl b/bin/mozilla/dn.pl index 6c918fe58..063f9da4f 100644 --- a/bin/mozilla/dn.pl +++ b/bin/mozilla/dn.pl @@ -222,7 +222,7 @@ sub save_dunning { foreach my $level (values %{ $levels }) { next unless scalar @{ $level }; - DN->save_dunning(\%myconfig, $form, $level, $main::userspath, $main::spool); + DN->save_dunning(\%myconfig, $form, $level); } } @@ -235,7 +235,7 @@ sub save_dunning { "customer_id" => $form->{"customer_id_$i"}, "next_dunning_config_id" => $form->{"next_dunning_config_id_$i"}, "email" => $form->{"email_$i"}, } ]; - DN->save_dunning(\%myconfig, $form, $level, $main::userspath, $main::spool); + DN->save_dunning(\%myconfig, $form, $level); } } diff --git a/bin/mozilla/do.pl b/bin/mozilla/do.pl index 796118a12..d6e594f5b 100644 --- a/bin/mozilla/do.pl +++ b/bin/mozilla/do.pl @@ -165,7 +165,7 @@ sub order_links { $form->all_vc(\%myconfig, $form->{vc}, ($form->{vc} eq 'customer') ? "AR" : "AP"); # retrieve order/quotation - $form->{webdav} = $main::webdav; + $form->{webdav} = $::lx_office_conf{system}->{webdav}; $form->{jsscript} = 1; my $editing = $form->{id}; @@ -751,6 +751,15 @@ sub invoice { my $currency = $form->{currency}; invoice_links(); + if ($form->{ordnumber}) { + require SL::DB::Order; + if (my $order = SL::DB::Manager::Order->find_by(ordnumber => $form->{ordnumber})) { + $order->load; + $form->{orddate} = $order->transdate_as_date; + $form->{$_} = $order->$_ for qw(payment_id salesman_id taxzone_id quonumber); + } + } + $form->{currency} = $currency; $form->{exchangerate} = ""; $form->{forex} = $form->check_exchangerate(\%myconfig, $form->{currency}, $form->{invdate}, $buysell); @@ -865,7 +874,7 @@ sub invoice_multi { map { $form->{"${_}_$form->{rowcount}"} = $ref->{$_} } keys %{ $ref }; map { $form->{"${_}_$form->{rowcount}"} = $form->format_amount(\%myconfig, $ref->{$_}) } qw(qty sellprice lastcost); - if ($vc_discount){ # falls wir einen Lieferanten/Kundenrabatt haben + if ($vc_discount){ # falls wir einen Lieferanten/Kundenrabatt haben # und keinen anderen discount wert an $i ... $form->{"discount_$form->{rowcount}"} ||= $vc_discount; # ... nehmen wir diesen Rabatt } @@ -1310,7 +1319,7 @@ sub transfer_out { foreach my $request (@{ DO->unpack_stock_information('packed' => $form->{"stock_out_$i"}) }) { $request->{parts_id} = $form->{"id_$i"}; $request->{base_qty} = $request->{qty} * $units->{$request->{unit}}->{factor} / $base_unit_factor; - $request->{project_id} = $form->{"project_id_$i"} ? $form->{"project_id_$i"} : $form->{globalproject_id}; + $request->{project_id} = $form->{"project_id_$i"} ? $form->{"project_id_$i"} : $form->{globalproject_id}; my $map_key = join '--', ($form->{"id_$i"}, @{$request}{qw(warehouse_id bin_id chargenumber bestbefore)}); @@ -1352,7 +1361,7 @@ sub transfer_out { my $pinfo = $part_info_map{$request->{parts_id}}; my $binfo = $bin_info_map{$request->{bin_id}}; - if ($main::show_best_before) { + if ($::lx_office_conf{system}->{show_best_before}) { push @{ $form->{ERRORS} }, $locale->text("There is not enough available of '#1' at warehouse '#2', bin '#3', #4, #5, for the transfer of #6.", $pinfo->{description}, $binfo->{warehouse_description}, diff --git a/bin/mozilla/ic.pl b/bin/mozilla/ic.pl index d83d40942..b5588be3b 100644 --- a/bin/mozilla/ic.pl +++ b/bin/mozilla/ic.pl @@ -1526,7 +1526,7 @@ sub form_header { $auth->assert('part_service_assembly_edit'); - $form->{eur} = $main::eur; # config dumps into namespace - yuck + $form->{eur} = $::lx_office_conf{system}->{eur}; # config dumps into namespace - yuck $form->{pg_keys} = sub { "$_[0]->{partsgroup}--$_[0]->{id}" }; $form->{description_area} = ($form->{rows} = $form->numtextrows($form->{description}, 40)) > 1; $form->{notes_rows} = max 4, $form->numtextrows($form->{notes}, 40), $form->numtextrows($form->{formel}, 40); diff --git a/bin/mozilla/installationcheck.pl b/bin/mozilla/installationcheck.pl index ce6022b1d..ca8c7895a 100644 --- a/bin/mozilla/installationcheck.pl +++ b/bin/mozilla/installationcheck.pl @@ -16,7 +16,8 @@ sub verify_installation { return if (scalar(@missing_modules) == 0); use SL::Locale; - my $locale = new Locale($main::language, "installationcheck"); + + my $locale = new Locale($::lx_office_conf{system}->{language}, "installationcheck"); print(qq|content-type: text/html diff --git a/bin/mozilla/invoice_io.pl b/bin/mozilla/invoice_io.pl index 8c803fb4d..c8097e325 100644 --- a/bin/mozilla/invoice_io.pl +++ b/bin/mozilla/invoice_io.pl @@ -126,7 +126,8 @@ sub set_pricegroup { if ($item->{selected} && ($pricegroup_id != 0)) { $form->{"pricegroup_old_$j"} = $pricegroup_id; $form->{"price_new_$j"} = $price; - $form->{"sellprice_$j"} = $price; + # edit: don't change the sellprice here + # $form->{"sellprice_$j"} = $price; # this must only be updated for existing articles, not new ones } if ($pricegroup_id == 0) { $form->{"price_new_$j"} = $form->{"sellprice_$j"}; @@ -162,7 +163,7 @@ sub display_form { ::end_of_request(); } - Common::webdav_folder($form) if ($main::webdav); + Common::webdav_folder($form); # if ( $form->{print_and_post} # && $form->{second_run} diff --git a/bin/mozilla/io.pl b/bin/mozilla/io.pl index 926098188..af69e4488 100644 --- a/bin/mozilla/io.pl +++ b/bin/mozilla/io.pl @@ -288,9 +288,11 @@ sub display_row { # for last row and report # set pricegroup drop down list from report menu if ($form->{"sellprice_$i"} != 0) { + # remember the pricegroup_id in pricegroup_old + # but don't overwrite it $form->{"pricegroup_old_$i"} = $form->{"pricegroup_id_$i"}; my $default_option = $form->{"sellprice_$i"}.'--'.$form->{"pricegroup_id_$i"}; - $column_data{sellprice_pg} = NTI($cgi->popup_menu("sellpricepg_$i", [ $default_option ], $default_option, { $default_option => $form->{"pricegroup_$i"} || '' })); + $column_data{sellprice_pg} = NTI($cgi->popup_menu("sellprice_pg_$i", [ $default_option ], $default_option, { $default_option => $form->{"pricegroup_$i"} || '' })); } else { $column_data{sellprice_pg} = qq| |; } @@ -487,7 +489,7 @@ sub select_item { qw(bin listprice inventory_accno income_accno expense_accno unit weight assembly taxaccounts partsgroup formel longdescription not_discountable part_payment_id partnotes id lastcost price_factor_id price_factor); - push @new_fields, "lizenzen" if ($main::lizenzen); + push @new_fields, "lizenzen" if $::lx_office_conf{system}->{lizenzen}; push @new_fields, grep { m/^ic_cvar_/ } keys %{ $form->{item_list}->[0] }; my $i = 0; @@ -495,7 +497,7 @@ sub select_item { foreach my $ref (@{ $form->{item_list} }) { my $checked = ($i++) ? "" : "checked"; - if ($main::lizenzen) { + if ($::lx_office_conf{system}->{lizenzen}) { if ($ref->{inventory_accno} > 0) { $ref->{"lizenzen"} = qq||; foreach my $item (@{ $form->{LIZENZEN}{ $ref->{"id"} } }) { @@ -620,7 +622,7 @@ sub item_selected { $form->{payment_id} = $form->{"part_payment_id_$i"}; } - if ($main::lizenzen) { + if ($::lx_office_conf{system}->{lizenzen}) { map { $form->{"${_}_$i"} = $form->{"new_${_}_$j"} } qw(lizenzen); } @@ -935,7 +937,7 @@ sub order { my $script = $form->{"script"}; $script =~ s|.*/||; $script =~ s|.pl$||; - $locale = new Locale($main::language, $script); + $locale = new Locale($::lx_office_conf{system}->{language}, $script); map { $form->{"select$_"} = "" } ($form->{vc}, "currency"); @@ -1164,26 +1166,26 @@ sub print_options { push @MEDIA, grep $_, opthash("screen", $form->{OP}{screen}, $locale->text('Screen')), - ($form->{printers} && scalar @{ $form->{printers} } && $main::latex_templates) ? + ($form->{printers} && scalar @{ $form->{printers} } && $::lx_office_conf{print_templates}->{latex}) ? opthash("printer", $form->{OP}{printer}, $locale->text('Printer')) : undef, - ($main::latex_templates && !$options{no_queue}) ? + ($::lx_office_conf{print_templates}->{latex} && !$options{no_queue}) ? opthash("queue", $form->{OP}{queue}, $locale->text('Queue')) : undef if ($form->{media} ne 'email'); push @FORMAT, grep $_, - ($main::opendocument_templates && $main::openofficeorg_writer_bin && $main::xvfb_bin - && (-x $main::openofficeorg_writer_bin) && (-x $main::xvfb_bin) + ($::lx_office_conf{print_templates}->{opendocument} && $::lx_office_conf{applications}->{openofficeorg_writer} && $::lx_office_conf{applications}->{xvfb} + && (-x $::lx_office_conf{applications}->{openofficeorg_writer}) && (-x $::lx_office_conf{applications}->{xvfb}) && !$options{no_opendocument_pdf}) ? opthash("opendocument_pdf", $form->{DF}{"opendocument_pdf"}, $locale->text("PDF (OpenDocument/OASIS)")) : undef, - ($main::latex_templates) ? + ($::lx_office_conf{print_templates}->{latex}) ? opthash("pdf", $form->{DF}{pdf}, $locale->text('PDF')) : undef, - ($main::latex_templates && !$options{no_postscript}) ? + ($::lx_office_conf{print_templates}->{latex} && !$options{no_postscript}) ? opthash("postscript", $form->{DF}{postscript}, $locale->text('Postscript')) : undef, (!$options{no_html}) ? opthash("html", $form->{DF}{html}, "HTML") : undef, - ($main::opendocument_templates && !$options{no_opendocument}) ? + ($::lx_office_conf{print_templates}->{opendocument} && !$options{no_opendocument}) ? opthash("opendocument", $form->{DF}{opendocument}, $locale->text("OpenDocument/OASIS")) : undef, - ($main::excel_templates && !$options{no_excel}) ? + ($::lx_office_conf{print_templates}->{excel} && !$options{no_excel}) ? opthash("excel", $form->{DF}{excel}, $locale->text("Excel")) : undef; push @LANGUAGE_ID, @@ -1211,7 +1213,7 @@ sub print_options { ); my %template_vars = ( - display_copies => scalar @{ $form->{printers} || [] } && $main::latex_templates && $form->{media} ne 'email', + display_copies => scalar @{ $form->{printers} || [] } && $::lx_office_conf{print_templates}->{latex} && $form->{media} ne 'email', display_remove_draft => (!$form->{id} && $form->{draft_id}), display_groupitems => !$dont_display_groupitems{$form->{type}}, groupitems_checked => $form->{groupitems} ? "checked" : '', @@ -1609,7 +1611,7 @@ sub print_form { my $filename; if ($filename = $queued{ $form->{formname} }) { $form->{queued} =~ s/\Q$form->{formname} $filename\E//; - unlink "$main::spool/$filename"; + unlink $::lx_office_conf{paths}->{spool} . "/$filename"; $filename =~ s/\..*$//g; } else { $filename = time; @@ -1617,7 +1619,7 @@ sub print_form { } $filename .= ($form->{postscript}) ? '.ps' : '.pdf'; - $form->{OUT} = ">$main::spool/$filename"; + $form->{OUT} = ">" . $::lx_office_conf{paths}->{spool} . "/$filename"; # add type $form->{queued} .= " $form->{formname} $filename"; @@ -1645,7 +1647,7 @@ sub print_form { } # /saving the history - $form->parse_template(\%myconfig, $main::userspath); + $form->parse_template(\%myconfig); $form->{callback} = ""; diff --git a/bin/mozilla/ir.pl b/bin/mozilla/ir.pl index ced248f48..4ef488626 100644 --- a/bin/mozilla/ir.pl +++ b/bin/mozilla/ir.pl @@ -100,7 +100,7 @@ sub invoice_links { $form->{vc} = 'vendor'; # create links - $form->{webdav} = $main::webdav; + $form->{webdav} = $::lx_office_conf{system}->{webdav}; $form->{jsscript} = 1; $form->create_links("AP", \%myconfig, "vendor"); diff --git a/bin/mozilla/is.pl b/bin/mozilla/is.pl index aeba18777..07b40d4d5 100644 --- a/bin/mozilla/is.pl +++ b/bin/mozilla/is.pl @@ -132,8 +132,8 @@ sub invoice_links { $form->{vc} = 'customer'; # create links - $form->{webdav} = $main::webdav; - $form->{lizenzen} = $main::lizenzen; + $form->{webdav} = $::lx_office_conf{system}->{webdav}; + $form->{lizenzen} = $::lx_office_conf{system}->{lizenzen}; $form->create_links("AR", \%myconfig, "customer"); @@ -266,7 +266,13 @@ sub prepare_invoice { # get pricegroups for parts IS->get_pricegroups_for_parts(\%myconfig, \%$form); - set_pricegroup($_) for 1 .. $form->{rowcount}; + + # Problem: set_pricegroup resets the sellprice of old invoices to the price + # currently defined in the pricegroup, which is a problem if the price has + # changed, as the old invoice gets the new price + # set_pricegroup must never be called, when an old invoice is initially loaded + + # set_pricegroup($_) for 1 .. $form->{rowcount}; } $main::lxdebug->leave_sub(); } @@ -555,7 +561,7 @@ sub update { $form->{"qty_$i"} = $form->format_amount(\%myconfig, $form->{"qty_$i"}); - if ($main::lizenzen) { + if ($::lx_office_conf{system}->{lizenzen}) { if ($form->{"inventory_accno_$i"} ne "") { $form->{"lizenzen_$i"} = qq||; foreach my $item (@{ $form->{LIZENZEN}{ $form->{"id_$i"} } }) { @@ -780,6 +786,11 @@ sub use_as_template { $form->{paidaccounts} = 1; $form->{rowcount}--; $form->{invdate} = $form->current_date(\%myconfig); + + # remember pricegroups for "use as template" + IS->get_pricegroups_for_parts(\%myconfig, \%$form); + set_pricegroup($_) for 1 .. $form->{rowcount}; + &display_form; $main::lxdebug->leave_sub(); @@ -953,7 +964,7 @@ sub yes { $main::auth->assert('invoice_edit'); - if (IS->delete_invoice(\%myconfig, \%$form, $main::spool)) { + if (IS->delete_invoice(\%myconfig, \%$form)) { # saving the history if(!exists $form->{addition}) { $form->{snumbers} = qq|invnumber_| . $form->{invnumber}; diff --git a/bin/mozilla/licenses.pl b/bin/mozilla/licenses.pl index 95f520ff9..5aee28b5d 100644 --- a/bin/mozilla/licenses.pl +++ b/bin/mozilla/licenses.pl @@ -325,10 +325,10 @@ sub add { $form->{title} = $locale->text('Add License'); - if (!$main::lizenzen) { + if (!$::lx_office_conf{system}->{lizenzen}) { $form->error( $locale->text( - 'The licensing module has been deactivated in lx-erp.conf.') + 'The licensing module has been deactivated in the configuration.') ); } @@ -518,10 +518,10 @@ sub search { $form->{title} = $locale->text('Licenses'); - if (!$main::lizenzen) { + if (!$::lx_office_conf{system}->{lizenzen}) { $form->error( $locale->text( - 'The licensing module has been deactivated in lx-erp.conf.') + 'The licensing module has been deactivated in the configuration.') ); } diff --git a/bin/mozilla/login.pl b/bin/mozilla/login.pl index 5d71b7686..49cb6c613 100644 --- a/bin/mozilla/login.pl +++ b/bin/mozilla/login.pl @@ -175,7 +175,7 @@ sub company_logo { sub show_error { my $template = shift; my %myconfig = %main::myconfig; - $myconfig{countrycode} = $main::language; + $myconfig{countrycode} = $::lx_office_conf{system}->{language}; $form->{stylesheet} = 'css/lx-office-erp.css'; $form->header(); diff --git a/bin/mozilla/menu.pl b/bin/mozilla/menu.pl index 36bdadc3f..cd0ca0d91 100644 --- a/bin/mozilla/menu.pl +++ b/bin/mozilla/menu.pl @@ -82,7 +82,7 @@ sub acc_menu { $::lxdebug->enter_sub; my $framesize = _calc_framesize() - 2; - my $menu = Menu->new($::menufile); + my $menu = Menu->new("menu.ini"); $mainlevel = $::form->{level}; $::form->{title} = $::locale->text('Lx-Office'); $::form->header; diff --git a/bin/mozilla/menuXML.pl b/bin/mozilla/menuXML.pl index 245afa137..1eed4edeb 100644 --- a/bin/mozilla/menuXML.pl +++ b/bin/mozilla/menuXML.pl @@ -54,7 +54,7 @@ sub display { my $form = $main::form; my %myconfig = %main::myconfig; - my $charset = $main::dbcharset || 'ISO-8859-1'; + my $charset = $::lx_office_conf{system}->{dbcharset} || 'ISO-8859-1'; my $callback = $form->unescape($form->{callback}); $callback = URI->new($callback)->rel($callback) if $callback; $callback = "login.pl?action=company_logo" if $callback =~ /^(\.\/)?$/; @@ -99,7 +99,7 @@ sub acc_menu { my $mainlevel = $form->{level}; $mainlevel =~ s/$mainlevel--//g; - my $menu = Menu->new($::menufile); + my $menu = Menu->new("menu.ini"); $| = 1; diff --git a/bin/mozilla/menujs.pl b/bin/mozilla/menujs.pl index 3ab3cf738..54637216c 100644 --- a/bin/mozilla/menujs.pl +++ b/bin/mozilla/menujs.pl @@ -136,7 +136,7 @@ sub acc_menu { my $mainlevel = $form->{level}; $mainlevel =~ s/$mainlevel--//g; - my $menu = Menu->new($::menufile); + my $menu = Menu->new("menu.ini"); $| = 1; diff --git a/bin/mozilla/menuv3.pl b/bin/mozilla/menuv3.pl index e35a51e07..d444b759e 100644 --- a/bin/mozilla/menuv3.pl +++ b/bin/mozilla/menuv3.pl @@ -85,7 +85,7 @@ sub acc_menu { my $mainlevel = $form->{level}; $mainlevel =~ s/\Q$mainlevel\E--//g; - my $menu = Menu->new($::menufile); + my $menu = Menu->new("menu.ini"); $| = 1; diff --git a/bin/mozilla/menuv4.pl b/bin/mozilla/menuv4.pl index 56d734728..ae82d45f8 100644 --- a/bin/mozilla/menuv4.pl +++ b/bin/mozilla/menuv4.pl @@ -87,7 +87,7 @@ sub acc_menu { my $mainlevel = $form->{level}; $mainlevel =~ s/\Q$mainlevel\E--//g; - my $menu = Menu->new($::menufile); + my $menu = Menu->new("menu.ini"); $| = 1; diff --git a/bin/mozilla/oe.pl b/bin/mozilla/oe.pl index 2f63157c9..caf6749c1 100644 --- a/bin/mozilla/oe.pl +++ b/bin/mozilla/oe.pl @@ -222,7 +222,7 @@ sub order_links { $form->all_vc(\%myconfig, $form->{vc}, ($form->{vc} eq 'customer') ? "AR" : "AP"); # retrieve order/quotation - $form->{webdav} = $main::webdav; + $form->{webdav} = $::lx_office_conf{system}->{webdav}; $form->{jsscript} = 1; my $editing = $form->{id}; @@ -498,7 +498,7 @@ sub form_footer { print $form->parse_html_template("oe/form_footer", { %TMPL_VAR, - webdav => $main::webdav, + webdav => $::lx_office_conf{system}->{webdav}, print_options => print_options(inline => 1), label_edit => $locale->text("Edit the $form->{type}"), label_workflow => $locale->text("Workflow $form->{type}"), @@ -1271,7 +1271,7 @@ sub delete_order_quotation { $msg = $locale->text('Quotation deleted!'); $err = $locale->text('Cannot delete quotation!'); } - if (OE->delete(\%myconfig, \%$form, $main::spool)){ + if (OE->delete(\%myconfig, \%$form)){ # saving the history if(!exists $form->{addition}) { $form->{snumbers} = qq|ordnumber_| . $form->{ordnumber}; @@ -1435,6 +1435,10 @@ sub invoice { } + # show pricegroup in newly loaded invoice when creating invoice from quotation/order + IS->get_pricegroups_for_parts(\%myconfig, \%$form); + set_pricegroup($_) for 1 .. $form->{rowcount}; + &display_form; $main::lxdebug->leave_sub(); @@ -1920,7 +1924,7 @@ sub display_form { $form->language_payment(\%myconfig); - Common::webdav_folder($form) if ($main::webdav); + Common::webdav_folder($form); &form_header; diff --git a/bin/mozilla/rp.pl b/bin/mozilla/rp.pl index 25e62594e..1d8446966 100644 --- a/bin/mozilla/rp.pl +++ b/bin/mozilla/rp.pl @@ -146,8 +146,8 @@ sub report { $form->{title} = $locale->text($title{ $form->{report} }); - my $accrual = ($main::eur) ? "" : "checked"; - my $cash = ($main::eur) ? "checked" : ""; + my $accrual = $::lx_office_conf{system}->{eur} ? "" : "checked"; + my $cash = $::lx_office_conf{system}->{eur} ? "checked" : ""; my $year = (localtime)[5] + 1900; @@ -2071,7 +2071,7 @@ sub print_form { $form->{attachment_filename} = $locale->quote_special_chars('filenames', $locale->text("Statement") . "_$form->{todate}.$attachment_suffix"); $form->{attachment_filename} =~ s/\s+/_/g; - $form->parse_template(\%myconfig, $main::userspath); + $form->parse_template(\%myconfig); } } @@ -2542,14 +2542,14 @@ sub print_options { } else { $media = qq| |; - if ($myconfig{printer} && $main::latex_templates && $form->{media} ne 'email') { + if ($myconfig{printer} && $::lx_office_conf{print_templates}->{latex} && $form->{media} ne 'email') { $output .= qq| diff --git a/bin/mozilla/sepa.pl b/bin/mozilla/sepa.pl index fd45f80a1..9f9f31a22 100755 --- a/bin/mozilla/sepa.pl +++ b/bin/mozilla/sepa.pl @@ -481,7 +481,7 @@ sub bank_transfer_download_sepa_xml { my $sepa_xml = SL::SEPA::XML->new('company' => $myconfig->{company}, 'creditor_id' => $myconfig->{sepa_creditor_id}, - 'src_charset' => $main::dbcharset || 'ISO-8859-15', + 'src_charset' => $::lx_office_conf{system}->{dbcharset} || 'ISO-8859-15', 'message_id' => $message_id, 'grouped' => 1, 'collection' => $vc eq 'customer', diff --git a/bin/mozilla/wh.pl b/bin/mozilla/wh.pl index fc34ba6e7..f49710785 100644 --- a/bin/mozilla/wh.pl +++ b/bin/mozilla/wh.pl @@ -176,7 +176,9 @@ sub transfer_or_removal_prepare_contents { "ean" => $form->{ean}, "description" => $form->{description}); - $form->show_generic_error($locale->text("The selected warehouse is empty.")) if (0 == scalar(@contents)); + if (0 == scalar(@contents)) { + $form->show_generic_error($locale->text("The selected warehouse is empty, or no stocked items where found that match the filter settings.")); + } my $all_units = AM->retrieve_units(\%myconfig, $form); @@ -436,7 +438,7 @@ sub create_assembly { $form->error($locale->text('The warehouse or the bin is missing.')); } - if (!$main::show_best_before) { + if (!$::lx_office_conf{system}->{show_best_before}) { $form->{bestbefore} = ''; } diff --git a/config/lx-erp.conf b/config/lx-erp.conf deleted file mode 100644 index b647a5f6f..000000000 --- a/config/lx-erp.conf +++ /dev/null @@ -1,139 +0,0 @@ -use Cwd; - -use vars qw( -$dbcharset $eur $ghostscript_bin $html2ps_bin $language $latex_bin -$latex_templates $lizenzen $memberfile $opendocument_templates -$openofficeorg_daemon $openofficeorg_daemon_port $openofficeorg_writer_bin -$pg_dump_exe $pg_restore_exe $sendmail $show_best_before $sid $spool $templates -$use_rdbo $userspath $vertreter $webdav $xvfb_bin -); - -# path to user configuration files -$userspath = "users"; - -# spool directory for batch printing -$spool = "spool"; - -# templates base directory -$templates = "templates"; - -# member file -$memberfile = "users/members"; - -# Wenn Einnahmen-Überschussrechnung, dann auf 1 setzen -# Wenn Bilanzierung (z.B. GmbH), dann auf 0 setzen -$eur = 1; - -# location of sendmail -$sendmail = '| /usr/sbin/sendmail -t<%if myconfig_email%> -f <%myconfig_email%><%end%>'; - -# set language for login and admin -# currently "de" (German), "de_DE" (new German) and "en" (English, not perfect) are available -$language = "de"; - -# Oracle -$sid = "T80509"; -$ENV{"ORACLE_HOME"} = "/usr/local/oracle"; - -# if you have latex installed set to 1 -$latex_templates = 1; - -# if the server can't find gzip, latex, dvips or pdflatex, add the path -$ENV{PATH} .= ":/usr/local/bin"; - -# on mac os X using Fink's Perl libs, add the path -$ENV{PERL5LIB} .= ":/sw/lib/perl5"; - -# Aktivierung der verschiedenen Spezialmodule -$webdav = 0; -$lizenzen = 1; -$vertreter = 0; -$excel_templates = 0; # Minimalunterstützung für Excel-Druckvorlagen - -# Zeige Felder für Mindesthaltbarkeitsdatum -$show_best_before = 0; - -## Support fuer OpenDocument-Vorlagen -# Diese Option legt fest, ob OpenDocument-Vorlagen generell verfuegbar sind. -$opendocument_templates = 1; - -# Die folgenden zwei Variablen legen Pfade zu Programmen fest, die benoetigt -# werden, um OpenDocument-Vorlagen in PDFs umzuwandeln. - -# Pfad zu OpenOffice.org writer -$openofficeorg_writer_bin = "/usr/bin/oowriter"; - -# Soll OpenOffice dauerhaft gestartet bleiben? Die Konvertierung nachfolgender -# Dokumente geht dann schneller. Allerdings wird auf dem System ein -# installiertes Python mit den Python-UNO-Bindings benoetigt, die Bestandteil -# von OpenOffice sind. -$openofficeorg_daemon = 1; -$openofficeorg_daemon_port = 2002; - -# Pfad zum "X virtual frame buffer", unter dem OpenOffice gestartet wird. -# Zusaetzlich muessen die Programme "xauth" und "mcookie" gefunden werden -# koennen, was eine Aenderung an PATH bedeuten kann. -$ENV{"PATH"} = $ENV{"PATH"} . ":/usr/X11R6/bin:/usr/X11/bin"; -$xvfb_bin = "/usr/bin/Xvfb"; - -# Das charset, in dem die Daten in der Datenbank abgelegt sind. -$dbcharset = 'UTF-8'; # Für UNICODE UTF-8 -# $dbcharset = "ISO-8859-15"; - - -# Pfad zu 'html2ps' zum Export von Listenansichten als PDF -$html2ps_bin = "/usr/bin/html2ps"; -$ghostscript_bin = "/usr/bin/gs"; - -# Name von bzw. Pfad zu 'pdflatex' oder einer anderen kompatiblen Version -# wie z.B. 'xetex' -$latex_bin = 'pdflatex'; - -# Datenbankbackups werden mit dem externen Programm "pg_dump" erledigt. -# Wenn es nicht im aktuellen Pfad vorhanden ist, so muss hier der vollständige -# Pfad eingetragen werden. Wenn die Variable auf "DISABLED" gesetzt wird, -# so wird der Menüpunkt zum Backup von Datenbanken im Administrationsfrontend -# nicht angeboten. -# Das gleiche gilt analog für das Wiederherstellen mittels "pg_restore". -$pg_dump_exe = "pg_dump"; -$pg_restore_exe = "pg_restore"; - -# Rose::DB::Object Environment laden. -# Die RDBO Klassen bieten für Addon Schreiber sehr einfache Interfaces zu den -# bestehenden Klassen, haben aber den Nachteil, dass der Start des Programms -# etwa 2s mehr dauert. Damit fällt die Möglichkeit Lx-Office über CGI zu -# betreiben weg. -$use_rdbo = 1; - -# Globale Debug-Ausgaben (de-)aktivieren? Moegliche Werte sind -# LXDebug::NONE - keine Debugausgaben -# LXDebug::INFO -# LXDebug::DEBUG1 -# LXDebug::DEBUG2 -# LXDebug::QUERY - SQL Queries -# LXDebug::TRACE - Tracing von Funktionsaufrufen -# LXDebug::BACKTRACE_ON_ERROR - Vollständiger Aufrufpfad, wenn $form->error() aufgerufen wird -# LXDebug::REQUEST_TIMER - Timing von Requests loggen -# LXDebug::WARN - warnings -# LXDebug::ALL - alle Debugausgaben -# -# LXDebug::DEVEL - wie INFO | QUERY | TRACE | BACKTRACE_ON_ERROR -# -# Beipiel: -# $LXDebug::global_level = LXDebug::TRACE | LXDebug::QUERY; -$LXDebug::global_level = LXDebug->NONE; - -# Überwachung der Inhalte von $form aktiviert oder nicht? Wenn ja, -# dann können einzelne Variablen mit -# $form->{"Watchdog::"} = 1; -# überwacht werden. Bedeutet aber auch einen Geschwindigkeitsverlust, -# weshalb sie normalerweise deaktiviert ist. -$LXDebug::watch_form = 0; - -# Zum debuggen von Latexausgaben. Wenn diese Option auf 1 gesetzt wird, werden -# temporäre Dateien, die bei der Erstellung von PDFs aus Latex erzeugt werden, -# nach Abschluß der Erstellung oder im Fehlerfall nicht gelöscht, damit man sie -# untersuchen kann. -$::keep_temp_files = 0; - -1; diff --git a/config/lx-erp.conf.default b/config/lx-erp.conf.default deleted file mode 100644 index 41d833f1f..000000000 --- a/config/lx-erp.conf.default +++ /dev/null @@ -1,138 +0,0 @@ -use Cwd; - -use vars qw( - $dbcharset $eur $ghostscript_bin $html2ps_bin $language $latex_bin - $latex_templates $lizenzen $memberfile $opendocument_templates - $openofficeorg_daemon $openofficeorg_daemon_port $openofficeorg_writer_bin - $parts_image_css $parts_listing_images $parts_show_image $pg_dump_exe - $pg_restore_exe $sendmail $show_best_before $sid $spool $templates $userspath - $vertreter $webdav $xvfb_bin -); - - -# path to user configuration files -$userspath = "users"; - -# spool directory for batch printing -$spool = "spool"; - -# templates base directory -$templates = "templates"; - -# member file -$memberfile = "users/members"; - -# Wenn nicht Bilanzierung dann auf 1 setzen -$eur = 1; - -# location of sendmail -$sendmail = '| /usr/sbin/sendmail -t<%if myconfig_email%> -f <%myconfig_email%><%end%>'; - -# set language for login and admin -$language = "de"; - -# Oracle -$sid = "T80509"; -$ENV{"ORACLE_HOME"} = "/usr/local/oracle"; - -# if you have latex installed set to 1 -$latex_templates = 1; - -# if the server can't find gzip, latex, dvips or pdflatex, add the path -$ENV{PATH} .= ":/usr/local/bin"; - -# on mac os X using Fink's Perl libs, add the path -$ENV{PERL5LIB} .= ":/sw/lib/perl5"; - -# Aktivierung der verschiedenen Spezialmodule -$webdav = 0; -$lizenzen = 1; -$vertreter = 0; - -# Zeige Felder für Mindesthaltbarkeitsdatum -$show_best_before = 0; - -## Artikelbilder anzeigen -# Artikelbild in der Detailansicht anzeigen -$parts_show_image = 1; # [0|1] -$parts_image_css = 'border:0;float:left;max-width:250px;margin-top:20px:margin-right:10px;margin-left:10px;'; # [belibige valide css definiton] -# Artikelbilder per default in den Suchergebnissen anzeigen -$parts_listing_images = 0; # [0|1] - -## Support fuer OpenDocument-Vorlagen -# Diese Option legt fest, ob OpenDocument-Vorlagen generell verfuegbar sind. -$opendocument_templates = 1; - -# Die folgenden zwei Variablen legen Pfade zu Programmen fest, die benoetigt -# werden, um OpenDocument-Vorlagen in PDFs umzuwandeln. - -# Pfad zu OpenOffice.org writer -$openofficeorg_writer_bin = "/usr/bin/oowriter"; - -# Soll OpenOffice dauerhaft gestartet bleiben? Die Konvertierung nachfolgender -# Dokumente geht dann schneller. Allerdings wird auf dem System ein -# installiertes Python mit den Python-UNO-Bindings benoetigt, die Bestandteil -# von OpenOffice sind. -$openofficeorg_daemon = 1; -$openofficeorg_daemon_port = 2002; - -# Pfad zum "X virtual frame buffer", unter dem OpenOffice gestartet wird. -# Zusaetzlich muessen die Programme "xauth" und "mcookie" gefunden werden -# koennen, was eine Aenderung an PATH bedeuten kann. -$ENV{"PATH"} = $ENV{"PATH"} . ":/usr/X11R6/bin:/usr/X11/bin"; -$xvfb_bin = "/usr/bin/Xvfb"; - -# Das charset, in dem die Daten in der Datenbank abgelegt sind. -$dbcharset = 'UTF-8'; # Für UNICODE UTF-8 -# $dbcharset = "ISO-8859-15"; - - -# Pfad zu 'html2ps' zum Export von Listenansichten als PDF -$html2ps_bin = "/usr/bin/html2ps"; -$ghostscript_bin = "/usr/bin/gs"; - -# Name von bzw. Pfad zu 'pdflatex' oder einer anderen kompatiblen Version -# wie z.B. 'xetex' -$latex_bin = 'pdflatex'; - -# Datenbankbackups werden mit dem externen Programm "pg_dump" erledigt. -# Wenn es nicht im aktuellen Pfad vorhanden ist, so muss hier der vollständige -# Pfad eingetragen werden. Wenn die Variable auf "DISABLED" gesetzt wird, -# so wird der Menüpunkt zum Backup von Datenbanken im Administrationsfrontend -# nicht angeboten. -# Das gleiche gilt analog für das Wiederherstellen mittels "pg_restore". -$pg_dump_exe = "pg_dump"; -$pg_restore_exe = "pg_restore"; - -# Globale Debug-Ausgaben (de-)aktivieren? Moegliche Werte sind -# LXDebug::NONE - keine Debugausgaben -# LXDebug::INFO -# LXDebug::DEBUG1 -# LXDebug::DEBUG2 -# LXDebug::QUERY - SQL Queries -# LXDebug::TRACE - Tracing von Funktionsaufrufen -# LXDebug::BACKTRACE_ON_ERROR - Vollständiger Aufrufpfad, wenn $form->error() aufgerufen wird -# LXDebug::REQUEST_TIMER - Timing von Requests loggen -# LXDebug::WARN - warnings -# LXDebug::ALL - alle Debugausgaben -# -# LXDebug::DEVEL - wie INFO | QUERY | TRACE | BACKTRACE_ON_ERROR -# -# Beipiel: -# $LXDebug::global_level = LXDebug::TRACE | LXDebug::QUERY; -$LXDebug::global_level = LXDebug::NONE; - -# Überwachung der Inhalte von $form aktiviert oder nicht? Wenn ja, -# dann können einzelne Variablen mit -# $form->{"Watchdog::"} = 1; -# überwacht werden. Bedeutet aber auch einen Geschwindigkeitsverlust, -# weshalb sie normalerweise deaktiviert ist. -$LXDebug::watch_form = 0; - -# Zum debuggen von Latexausgaben. Wenn diese Option auf 1 gesetzt wird, werden -# temporäre Dateien, die bei der Erstellung von PDFs aus Latex erzeugt werden, -# nach Abschluß der Erstellung oder im Fehlerfall nicht gelöscht, damit man sie -# untersuchen kann. -$::keep_temp_files = 0; - -1; diff --git a/config/lx_office.conf.default b/config/lx_office.conf.default index cd230d223..d843ec27a 100644 --- a/config/lx_office.conf.default +++ b/config/lx_office.conf.default @@ -1,3 +1,85 @@ +[system] +# EUR: Einnahmen-Überschussrechnung (net income method). Set this to 1 +# if your company uses the net income method and to 0 for balacing. +eur = 1 + +# Set language for login and admin forms. Currently "de" (German), +# "de_DE" (new German) and "en" (English, not perfect) are available. +language = de + +# The database charset. Must match the database cluster you want to +# connect to. +dbcharset = UTF-8 + +[features] +# Activate certain optional features and modules. +webdav = 0 +lizenzen = 1 +vertreter = 0 + +# Show fields used for the best before date +show_best_before = 0 + +## Pictures for parts +# Show the picture in the part form +parts_show_image = 1 +# Style the picture with the following CSS code: +parts_image_css = border:0;float:left;max-width:250px;margin-top:20px:margin-right:10px;margin-left:10px; +# Show the picture in the results when you search for parts +parts_listing_images = 0 + +[paths] +# path to temporary files (must be writeable by the web server) +userspath = users +# spool directory for batch printing +spool = spool +# templates base directory +templates = templates +# Path to the old memberfile (ignored on new installations) +memberfile = users/members + +[applications] +# Location of sendmail +sendmail = /usr/sbin/sendmail -t<%if myconfig_email%> -f <%myconfig_email%><%end%> +# Location of OpenOffice.org writer +openofficeorg_writer = oowriter +# Location of the X virtual frame buffer used for OpenOffice +xvfb = Xvfb +# Location of the html2ps binary +html2ps = html2ps +# Location of the Ghostscript binary +ghostscript = gs +# Location of the pdflatex (or compatible, e.g. xetex) binary +latex = pdflatex +# Location of the two executables "pg_dump" and "pg_restore" used for +# database backup and restoration from the admin section. If +# "pg_dump" or "pg_restore" is set to "DISABLED" then the +# corresponding option (backup/restoration) will be hidden from the +# admin section. +pg_dump = pg_dump +pg_restore = pg_restore + +[environment] +# Add the following paths to the PATH environment variable. +path = /usr/local/bin:/usr/X11R6/bin:/usr/X11/bin +# Add the following paths to the PERL5LIB environment variable. +# "/sw/lib/perl5" is for Mac OS X with Fink's Perl. +lib = /sw/lib/perl5 + +[print_templates] +# If you have LaTeX installed set to 1 +latex = 1 +# Minimal support for Excel print templates +excel = 0 +# Enable or disable support for OpenDocument print templates +opendocument = 1 +# Chose whether or not OpenOffice should remain running after a +# conversion. If yes then the conversion of subsequent documents will +# be a lot faster. You need to have Python and the Python UNO bindings +# (part of OpenOffice) installed. +openofficeorg_daemon = 1 +openofficeorg_daemon_port = 2002 + [task_server] # User name to use for database access login = mb @@ -9,7 +91,7 @@ run_as = [periodic_invoices] # The user name a report about the posted and printed invoices is sent # to. -send_email_to = login +send_email_to = mb # The "From:" header for said email. email_from = Lx-Office Daemon # The subject for said email. @@ -17,14 +99,16 @@ 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] +[console] # autologin to use if none is given -login = demo +login = mb # 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 +#autorun = require "bin/mozilla/common.pl"; +# = use English qw(-no_match_vars); +# = use List::Util qw(min max); +# = sub take { my $max = shift; my $r = ref($_[0]) eq 'ARRAY' ? $_[0] : \@_; return @{$r}[0..List::Util::min($max, scalar(@{$r})) - 1]; } # location of history file for permanent history history_file = users/console_history @@ -46,3 +130,40 @@ dbix_log4perl_config = log4perl.logger = FATAL, LOGFILE = log4perl.appender.A1.mode=append = log4perl.appender.A1.layout=Log::Log4perl::Layout::PatternLayout = log4perl.appender.A1.layout.ConversionPattern=%d %p> %F{1}:%L %M - %m%n + +# Activate certain global debug messages. If you want to combine +# several options then list them seperated by spaces. +# +# Possible values include: +# NONE - no debug output (default) +# INFO +# DEBUG1 +# DEBUG2 +# QUERY - Dump SQL queries (only in legacy code; see also "dbix_log4perl" above) +# TRACE - Track function calls and returns +# BACKTRACE_ON_ERROR - Print a function call backtrace when $form->error() is called +# REQUEST_TIMER - Log timing of HTTP requests +# WARN - warnings +# ALL - all possible debug messages +# +# DEVEL - sames as "INFO QUERY TRACE BACKTRACE_ON_ERROR REQUEST_TIMER" +# +# Example: +# global_level = TRACE QUERY +global_level = NONE + +# Activate monitoring of the content of $form. If it is active then +# monitoring can be turned on for certain variables with the +# following: +# $form->{"Watchdog::"} = 1; +# Monitoring has a performance cost and is therefore deactivated by +# default. +watch_form = 0 + +# If you want to debug the creation of LaTeX files then set this to 1. +# That way the temporary LaTeX files created during PDF creation are +# not removed and remain in the "users" directory. +keep_temp_files = 0 + +# The file name where the debug messages are written to. +file_name = /tmp/mb-lxdebug.log diff --git a/doc/INSTALL.fcgi b/doc/INSTALL.fcgi index 4dbe994cc..186ca33cb 100644 --- a/doc/INSTALL.fcgi +++ b/doc/INSTALL.fcgi @@ -5,6 +5,8 @@ Diese Datei ist in Plain Old Documentation geschrieben. Mit ist sie deutlich leichter zu lesen. +=encoding utf8 + =head1 FastCGI für Lx-Office =head2 Was ist FastCGI? @@ -37,8 +39,8 @@ eigentliche Programmlogik ausgeführt. Folgende Kombinationen sind getestet: + * Apache 2.2.11 (Ubuntu) und mod_fcgid. * Apache 2.2.11 (Ubuntu) und mod_fastcgi. - * Apache 2.2.11 (Ubuntu) und mod_fcgid: Als Perl Backend wird das Modul FCGI.pm verwendet. Vorsicht: FCGI 0.69 und höher ist extrem strict in der Behandlung von Unicode, und verweigert bestimmte @@ -59,11 +61,11 @@ können. Sollte die Installation schon funktionieren, lesen Sie weiter. Zuerst muss das FastCGI-Modul aktiviert werden. Dies kann unter Debian/Ubuntu z.B. mit folgendem Befehl geschehen: - a2enmod fastcgi + a2enmod fcgid bzw. - a2enmod fcgid + a2enmod fastcgi Die Konfiguration für die Verwendung von Lx-Office mit FastCGI erfolgt durch Anpassung der vorhandenen Alias- und Directory-Direktiven. Dabei @@ -71,14 +73,13 @@ wird zwischen dem Installationspfad von Lx-Office im Dateisystem ("/path/to/lx-office-erp") und der URL unterschieden, unter der Lx-Office im Webbrowser erreichbar ist ("/web/path/to/lx-office-erp"). -Folgendes Template funktioniert mit mod_fastcgi: +Folgendes Template funktioniert mit mod_fcgid: - AliasMatch ^/web/path/to/lx-office-erp/[^/]+\.pl /path/to/lx-office-erp/dispatcher.fpl + AliasMatch ^/web/path/to/lx-office-erp/[^/]+\.pl /path/to/lx-office-erp/dispatcher.fcgi Alias /web/path/to/lx-office-erp/ /path/to/lx-office-erp/ AllowOverride All - AddHandler fastcgi-script .fpl Options ExecCGI Includes FollowSymlinks Order Allow,Deny Allow from All @@ -89,10 +90,28 @@ Folgendes Template funktioniert mit mod_fastcgi: Deny from All -...und für mod_fcgid muss die erste Zeile geändert werden in: +Für mod_fastcgi muss ein AddHandler ergänzt werden und die erste Zeile geändert werden: - AliasMatch ^/web/path/to/lx-office-erp/[^/]+\.pl /path/to/lx-office-erp/dispatcher.fcgi + AddHandler fastcgi-script .fpl + AliasMatch ^/web/path/to/lx-office-erp/[^/]+\.pl /path/to/lx-office-erp/dispatcher.fpl + +Das ganze sollte dann so aussehen: + AddHandler fastcgi-script .fpl + AliasMatch ^/web/path/to/lx-office-erp/[^/]+\.pl /path/to/lx-office-erp/dispatcher.fpl + Alias /web/path/to/lx-office-erp/ /path/to/lx-office-erp/ + + + AllowOverride All + Options ExecCGI Includes FollowSymlinks + Order Allow,Deny + Allow from All + + + + Order Deny,Allow + Deny from All + Hierdurch wird nur ein zentraler Dispatcher gestartet. Alle Zugriffe auf die einzelnen Scripte werden auf diesen umgeleitet. Dadurch, dass @@ -102,18 +121,23 @@ Benutzung von "AddHandler fastcgi-script .pl" vorzuziehen. Es ist möglich die gleiche Lx-Office Version parallel unter cgi und fastcgi zu -betreiben. Dafür bleiben Directorydirektiven bleiben wie oben beschrieben, die -URLs werden aber umgeleitet: +betreiben. Dafür bleiben die Directorydirektiven wie oben beschrieben, die URLs +werden aber umgeleitet: - # Zugriff ohne FastCGI + # Zugriff über cgi Alias /web/path/to/lx-office-erp /path/to/lx-office-erp - # Zugriff mit FastCGI: - AliasMatch ^/web/path/to/lx-office-erp-fcgi/[^/]+\.pl /path/to/lx-office-erp/dispatcher.fpl - Alias /web/path/to/lx-office-erp-fcgi/ /path/to/lx-office-erp/ + # Zugriff mit mod_fastcgi: + AliasMatch ^/web/path/to/lx-office-erp-fcgid/[^/]+\.pl /path/to/lx-office-erp/dispatcher.fcgi + Alias /web/path/to/lx-office-erp-fcgid/ /path/to/lx-office-erp/ + + # Zugriff mit mod_fastcgi: + AliasMatch ^/web/path/to/lx-office-erp-fastcgi/[^/]+\.pl /path/to/lx-office-erp/dispatcher.fpl + Alias /web/path/to/lx-office-erp-fastcgi/ /path/to/lx-office-erp/ Dann ist unter C die normale Version erreichbar, -und unter C die FastCGI Version. +und unter C bzw. +C die FastCGI Version. Achtung: diff --git a/doc/INSTALL.texi b/doc/INSTALL.texi index 2f7437dd5..6fa2e2bed 100644 --- a/doc/INSTALL.texi +++ b/doc/INSTALL.texi @@ -1,7 +1,7 @@ \input texinfo @c -*-texinfo-*- @c %**start of header -@documentencoding UTF-8 @setfilename INSTALL.info +@documentencoding UTF-8 @settitle Lx-Office Installationsanleitung @c %**end of header @@ -24,7 +24,7 @@ @menu * Aktuelle Hinweise:: Andere Informationsquellen als diese Anleitung * Benötigte Software und Pakete:: Vorraussetzungen zum Betrieb von Lx-Office -* Installation des Programmpaketes:: Installationsort, Berechtigungen +* Manuelle Installation des Programmpaketes:: Installationsort, Berechtigungen * Anpassung der PostgreSQL-Konfiguration:: Verschiedene Aspekte der Datenbankkonfiguration * Apache-Konfiguration:: Einrichtung eines Aliases und Optionen für das Ausführen von CGI-Scripten * Benutzerauthentifizierung und Administratorpasswort:: Einrichtung der Authentifizierungsdatenbank und der Passwortüberprüfung @@ -56,12 +56,79 @@ im Lx-Office-Forum: @uref{http://www.lx-office.org/forum/} @node Benötigte Software und Pakete @chapter Benötigte Software und Pakete -Zum Betrieb von Lx-Office werden zwingend ein Webserver (meist Apache) und ein Datenbankserver (PostgreSQL) benötigt. +@menu +* Betriebssystem:: Unterstützte Betriebsysteme und Hinweise für ältere Systeme +* Pakete:: Benötigte Software und Perlpakete sowie deren Quellen +@end menu + +@node Betriebssystem +@section Betriebssystem -Zusätzlich benötigt Lx-Office die folgenden Perl-Pakete, die nicht Bestandteil einer Standard-Perl-Installation sind: +Lx-Office ist für Linux konzipiert, und sollte auf jedem unixoiden +Betriebssystem zum Laufen zu kriegen sein. Getestet ist diese Version im +speziellen auf Debian und Ubuntu, grundsätzlich wurde bei der Auswahl der +Pakete aber darauf Rücksicht genommen, dass es ohne große Probleme auf den +derzeit aktuellen verbreiteten Distributionen läuft. + +Anfang 2011 sind das folgende Systeme: @itemize @item +Ubuntu 8.04 LTS Hardy Heron +@item +Ubuntu 9.10 Karmic Koala +@item +Ubuntu 10.04 Lucid Lynx +@item +Ubuntu 10.10 Maverick Meerkat +@item +Debian 5.0 Lenny +@item +Debian 6.0 Squeeze +@item +openSUSE 11.2 +@item +openSUSE 11.3 +@item +SuSE Linux Enterprice Server 11 +@item +Fedora 13 +@item +Fedora 14 +@end itemize + +Für die debianoiden Betriebssysteme existiert ein .deb, das deutlich einfacher +zu installieren ist. + +Ubuntu 8.04 LTS hat zusätzlich die Schwierigkeit, dass die Module im Archiv +recht alt sind, und das viele der benötigten Module nicht einfach zu +installieren sind. Dafür sollte es kurz nach dem Release ein eigenes .deb +geben. + +Alternativ dazu kann die normale Installation durchgeführt werden +(@pxref{Manuelle Installation des Programmpaketes}), wenn vorher ein +Kompatibilitätspaket installiert wird, das die fehlenden Pakete bereitstellt. +Das Paket ist auf @uref{https://sourceforge.net/projects/lx-office/files/Lx-Office%20ERP/2.6.2/, Sourceforge} unter dem Namen @code{lx-erp-perl-libs-compat-v2.tar.gz} hinterlegt. + +Zur Installation das Paket in das entpackte Lx-Office Verzeichnis entpacken: + +@code{tar xzf lx-erp-perl-libs-compat-v2.tar.gz /path/to/lx-office/} + +Danach sollte der Installationscheck (@pxref{Pakete}) die enthaltenen Pakete erkennen. + +@node Pakete +@section Pakete + +Zum Betrieb von Lx-Office werden zwingend ein Webserver (meist Apache) +und ein Datenbankserver (PostgreSQL, mindestens v8.2) benötigt. + +Zusätzlich benötigt Lx-Office die folgenden Perl-Pakete, die nicht Bestandteil +einer Standard-Perl-Installation sind: + +@itemize +@item +parent +@item Archive::Zip @item Class::Accessor @@ -80,8 +147,6 @@ List::MoreUtils @item PDF::API2 @item -Readonly (benötigt) und Readonly::XS (optional) -@item Rose::Object @item Rose::DB @@ -104,6 +169,10 @@ YAML Gegenüber Version 2.6.0 sind zu dieser Liste 2 Pakete hinzugekommen, @code{URI} und @code{XML::Writer} sind notwendig. Ohne startet Lx-Office nicht. +Gegenüber Version 2.6.1 sind @code{parent}, @code{DateTime}, +@code{Rose::Object}, @code{Rose::DB} und @code{Rose::DB::Object} neu +hinzugekommen. @code{IO::Wrap} wurde entfernt. + @code{Email::Address} und @code{List::MoreUtils} sind schon länger feste Abhängigkeiten, wurden aber bisher mit Lx-Office mitgeliefert. Beide sind auch in 2.6.1 weiterhin mit ausgeliefert, wurden in einer zukünftigen Version aber @@ -117,15 +186,17 @@ Die zu installierenden Pakete können in den verschiedenen Distributionen unters Für Debian oder Ubuntu benötigen Sie diese Pakete: -@code{apache2 postgresql libarchive-zip-perl libclass-accessor-perl libdatetime-perl libdbi-perl libdbd-pg-perl libpg-perl libemail-address-perl libio-stringy-perl liblist-moreutils-perl libpdf-api2-perl libtemplate-perl libtext-csv-xs-perl libtext-iconv-perl liburi-perl libxml-writer-perl libyaml-perl} +@code{apache2 postgresql libparent-perl libarchive-zip-perl libclass-accessor-perl libdatetime-perl libdbi-perl libdbd-pg-perl libpg-perl libemail-address-perl liblist-moreutils-perl libpdf-api2-perl librose-object-perl librose-db-perl librose-db-object-perl libtemplate-perl libtext-csv-xs-perl libtext-iconv-perl liburi-perl libxml-writer-perl libyaml-perl} Für Fedora Core benötigen Sie diese Pakete: -@code{httpd postgresql-server perl-Class-Accessor perl-DateTime perl-DBI perl-DBD-Pg perl-Email-Address perl-IO-stringy perl-List-MoreUtils perl-PDF-API2 perl-Template-Toolkit perl-Text-CSV_XS perl-Text-Iconv perl-URI perl-XML-Writer perl-YAML} +@code{httpd postgresql-server perl-parent perl-Class-Accessor perl-DateTime perl-DBI perl-DBD-Pg perl-Email-Address perl-List-MoreUtils perl-PDF-API2 perl-Rose-Object perl-Rose-DB perl-Rose-DB-Object perl-Template-Toolkit perl-Text-CSV_XS perl-Text-Iconv perl-URI perl-XML-Writer perl-YAML} Für OpenSuSE benötigen Sie diese Pakete: -@code{apache2 postgresql-server perl-Archive-Zip perl-Class-Accessor perl-DateTime perl-DBI perl-DBD-Pg perl-MailTools perl-IO-stringy perl-List-MoreUtils perl-PDF-API2 perl-Template-Toolkit perl-Text-CSV_XS perl-Text-Iconv perl-URI perl-XML-Writer perl-YAML} +@code{apache2 postgresql-server perl-Archive-Zip perl-Class-Accessor perl-DateTime perl-DBI perl-DBD-Pg perl-MailTools perl-List-MoreUtils perl-PDF-API2 perl-Template-Toolkit perl-Text-CSV_XS perl-Text-Iconv perl-URI perl-XML-Writer perl-YAML} + +Bei openSuSE 11 ist @code{parent} bereits enthalten, und braucht nicht nachinstalliert werden. Die @code{Rose::*} Pakete sind derzeit nicht für SuSE gepackt, und müssen anderweitig nachinstalliert werden. Lx-Office enthält ein Script, mit dem überprüft werden kann, ob alle benötigten Perl-Module installiert sind. Der Aufruf lautet wie folgt: @@ -134,16 +205,16 @@ benötigten Perl-Module installiert sind. Der Aufruf lautet wie folgt: @c --------------------------------------------------------------- -@node Installation des Programmpaketes -@chapter Installation des Programmpaketes +@node Manuelle Installation des Programmpaketes +@chapter Manuelle Installation des Programmpaketes -Die Lx-Office ERP Installationsdatei (lxoffice-erp-2.6.1.tgz) wird im +Die Lx-Office ERP Installationsdatei (lxoffice-erp-2.6.2.tgz) wird im Dokumentenverzeichnis des Webservers (z.B. @code{/var/www/html/}, @code{/srv/www/htdocs} oder @code{/var/www/}) entpackt: @code{cd /var/www @* -tar xvzf lxoffice-erp-2.6.1.tgz} +tar xvzf lxoffice-erp-2.6.2.tgz} Verändern Sie evtl. noch den Namen des Verzeichnisses mit @@ -219,16 +290,12 @@ Das Encoding einer Datenbank kann in @code{psql} mit @code{\l} geprüft werden. In der Datei @code{postgresql.conf}, die je nach Distribution in verschiedenen Verzeichnissen liegen kann (z.B. @code{/var/lib/pgsql/data/} oder @code{/etc/postgresql/}, muss -sichergestellt werden, dass TCP/IP-Verbindungen aktiviert sind. Für -PostgreSQL vor Version v8.0 lautete dieser Parameter - -@code{TCPIP_SOCKET = 1} - -Ab v8.0 wird das Verhalten hingegen über den neuen Parameter -@code{listen_address} gesteuert. Laufen PostgreSQL und Lx-Office auf -demselben Rechner, so kann dort der Wert @code{localhost} verwendet -werden. Andernfalls müssen Datenbankverbindungen auch von anderen -Rechnern aus zugelassen werden, was mit dem Wert \@code{*} geschieht. +sichergestellt werden, dass TCP/IP-Verbindungen aktiviert sind. Das +Verhalten wird über den Parameter @code{listen_address} +gesteuert. Laufen PostgreSQL und Lx-Office auf demselben Rechner, so +kann dort der Wert @code{localhost} verwendet werden. Andernfalls +müssen Datenbankverbindungen auch von anderen Rechnern aus zugelassen +werden, was mit dem Wert \@code{*} geschieht. In der Datei @code{pg_hba.conf}, die im gleichen Verzeichnis wie die @code{postgresql.conf} zu finden sein sollte, müssen die @@ -252,21 +319,23 @@ host all lxoffice 127.0.0.1 255.255.255.255 password} @node Erweiterung für servergespeicherte Prozeduren @section Erweiterung für servergespeicherte Prozeduren -In der Datenbank @code{template1} muss die Unterstützung für -servergespeicherte Prozeduren eingerichet werden. Melden Sie sich -dafür als Benutzer ``postgres'' an der Datenbank an, und führen Sie -die folgenden Kommandos aus: +In der Datenbank @code{template1} muss die Unterstützung für servergespeicherte +Prozeduren eingerichet werden. Melden Sie sich dafür als Benutzer ``postgres'' +an der Datenbank an, und führen Sie die folgenden Kommandos aus: + +@code{create language 'plpgsql';} + +Achtung: In älteren Postgresversionen (vor 8.0) muss der Handler für die +Sprache manuell anlelegt werden, diese Versionen werden aber nicht mehr +offiziell von Lx-Office unterstützt. Dafür dann die folgenden Kommandos: @code{create function plpgsql_call_handler () returns opaque as '/usr/lib/pgsql/plpgsql.so' language 'c'; @* -create language 'plpgsql' handler plpgsql_call_handler -lancompiler 'pl/pgsql';} - -Bitte beachten Sie, dass der Pfad zur Datei @code{plpgsql.so} von -Distribution zu Distribution verschiedlich sein kann. Bei -Debian/Ubuntu befindet sie sich unter -@code{/usr/lib/postgresql/lib/plpgsql.so}, bei Ubuntu 9.10 unter @code{/usr/lib/postgresql/8.4/lib/plpgsql.so}. +create language 'plpgsql' handler plpgsql_call_handler lancompiler 'pl/pgsql';} +Bitte beachten Sie, dass der Pfad zur Datei @code{plpgsql.so} von Distribution +zu Distribution verschiedlich sein kann. Bei Debian/Ubuntu befindet sie sich +unter @code{/usr/lib/postgresql/lib/plpgsql.so}. @c --------------------------------------------------------------- @@ -290,6 +359,10 @@ bzw. den hier gewählten Benutzernamen. @node Apache-Konfiguration @chapter Apache-Konfiguration +Hinweis: Für einen deutlichen Performanceschub sorgt die Ausführung +mittels FCGI. Die Einrichtung wird ausführlich in der Datei +@code{INSTALL.fcgi} beschrieben. + Der Zugriff auf das Programmverzeichnis muss in der Apache Webserverkonfigurationsdatei @code{httpd.conf} eingestellt werden. Fügen Sie den folgenden Abschnitt dieser Datei oder einer @@ -547,9 +620,10 @@ ist dies @samp{lxoffice}). Wenn Sie für die Lx-Office-Installation nicht den europäischen Schriftsatz ISO-8859-15 sondern UTF-8 (Unicode) benutzen wollen, so müssen Sie vor dem Anlegen der Datenbank in der Datei -@code{config/lx-erp.conf} die Variable @code{$dbcharset} auf den Wert -@samp{UTF-8} setzen. Zusätzlich muss beim Anlegen der Datenbank -@samp{UTF-8 Unicode} als Schriftsatz ausgewählt werden. +@code{config/lx_office.conf} die Variable @code{dbcharset} im +Abschnitt @code{system} auf den Wert @samp{UTF-8} setzen. Zusätzlich +muss beim Anlegen der Datenbank @samp{UTF-8 Unicode} als Schriftsatz +ausgewählt werden. Bitte beachten Sie, dass alle Datenbanken den selben Zeichensatz verwenden müssen, da diese Einstellungen momentan global in Lx-Office @@ -606,7 +680,7 @@ ausgewählten Spalte hinzugefügt. @node Migration alter Installationen @section Migration alter Installationen -Wenn Lx-Office 2.6.1 über eine ältere Version installiert wird, in der +Wenn Lx-Office 2.6.2 über eine ältere Version installiert wird, in der die Benutzerdaten noch im Dateisystem im Verzeichnis @code{users} verwaltet wurden, so bietet Lx-Office die Möglichkeit, diese Benutzerdaten automatisch in die Authentifizierungsdatenbank zu @@ -634,13 +708,14 @@ OpenDocument-Format, wie es OpenOffice.org ab Version 2 erzeugt. Lx-Office kann dabei sowohl neue OpenDocument-Dokumente als auch aus diesen direkt PDF-Dateien erzeugen. Um die Unterstützung von OpenDocument-Vorlagen zu aktivieren muss in der Datei -@code{config/lx-erp.conf} die Variable @code{$opendocument_templates} -auf @samp{1} stehen. Dieses ist die Standardeinstellung. +@code{config/lx_office.conf} die Variable @code{opendocument} im +Abschnitt @code{print_templates} auf @samp{1} stehen. Dieses ist die +Standardeinstellung. -Weiterhin muss in der Datei @code{config/lx-erp.conf} die Variable -@code{$dbcharset} auf die Zeichenkodierung gesetzt werden, die auch -bei der Speicherung der Daten in der Datenbank verwendet wird. Diese -ist in den meisten Fällen "UTF-8". +Weiterhin muss in der Datei @code{config/lx_office.conf} die Variable +@code{dbcharset} im Abschnitt @code{system} auf die Zeichenkodierung +gesetzt werden, die auch bei der Speicherung der Daten in der +Datenbank verwendet wird. Diese ist in den meisten Fällen "UTF-8". Während die Erzeugung von reinen OpenDocument-Dateien keinerlei weitere Software benötigt, wird zur Umwandlung dieser Dateien in PDF @@ -649,11 +724,11 @@ neben OpenOffice.org ab Version 2 auch der ``X virtual frame buffer'' (xvfb) installiert werden. Bei Debian ist er im Paket ``xvfb'' enthalten. Andere Distributionen enthalten ihn in anderen Paketen. -Nach der Installation müssen in der Datei @code{config/lx-erp.conf} -zwei weitere Variablen angepasst werden: -@code{$openofficeorg_writer_bin} muss den vollständigen Pfad zur -OpenOffice.org Writer-Anwendung enthalten. @code{$xvfb_bin} muss den -Pfad zum ``X virtual frame buffer'' enthalten. +Nach der Installation müssen in der Datei @code{config/lx_config.conf} +zwei weitere Variablen angepasst werden: @code{openofficeorg_writer} +muss den vollständigen Pfad zur OpenOffice.org Writer-Anwendung +enthalten. @code{xvfb} muss den Pfad zum ``X virtual frame buffer'' +enthalten. Beide stehen im Abschnitt @code{applications}. Zusätzlich gibt es zwei verschiedene Arten, wie Lx-Office mit OpenOffice kommuniziert. Die erste Variante, die benutzt wird, wenn @@ -683,11 +758,10 @@ folgender Befehl auszuführen: @code{mv users/.openoffice.org2 users/.openoffice} -Dieses Verzeichnis, wie auch das komplette @code{users}-Verzeichnis, -muss vom Webserver beschreibbar sein. Dieses wurde in Schritt -@code{Installation des Programmpakets} oben bereits erledigt, kann -aber erneut überprüft werden, wenn die Konvertierung nach PDF -fehlschlägt. +Dieses Verzeichnis, wie auch das komplette @code{users}-Verzeichnis, muss vom +Webserver beschreibbar sein. Dieses wurde bereits erledigt +(@pxref{Manuelle Installation des Programmpaketes}), kann aber erneut überprüft +werden, wenn die Konvertierung nach PDF fehlschlägt. @c --------------------------------------------------------------- diff --git a/doc/INSTALL.txt b/doc/INSTALL.txt index 89b8f15e0..200c35979 100644 --- a/doc/INSTALL.txt +++ b/doc/INSTALL.txt @@ -4,7 +4,9 @@ Table of Contents Inhalt der Anleitung 1 Aktuelle Hinweise 2 Benötigte Software und Pakete -3 Installation des Programmpaketes + 2.1 Betriebssystem + 2.2 Pakete +3 Manuelle Installation des Programmpaketes 4 Anpassung der PostgreSQL-Konfiguration 4.1 Zeichensätze/die Verwendung von UTF-8 4.2 Änderungen an Konfigurationsdateien @@ -48,12 +50,73 @@ Aktuelle Installations- und Konfigurationshinweise gibt es: 2 Benötigte Software und Pakete ******************************** +2.1 Betriebssystem +================== + +Lx-Office ist für Linux konzipiert, und sollte auf jedem unixoiden +Betriebssystem zum Laufen zu kriegen sein. Getestet ist diese Version im +speziellen auf Debian und Ubuntu, grundsätzlich wurde bei der Auswahl +der Pakete aber darauf Rücksicht genommen, dass es ohne große Probleme +auf den derzeit aktuellen verbreiteten Distributionen läuft. + + Anfang 2011 sind das folgende Systeme: + + * Ubuntu 8.04 LTS Hardy Heron + + * Ubuntu 9.10 Karmic Koala + + * Ubuntu 10.04 Lucid Lynx + + * Ubuntu 10.10 Maverick Meerkat + + * Debian 5.0 Lenny + + * Debian 6.0 Squeeze + + * openSUSE 11.2 + + * openSUSE 11.3 + + * SuSE Linux Enterprice Server 11 + + * Fedora 13 + + * Fedora 14 + + Für die debianoiden Betriebssysteme existiert ein .deb, das deutlich +einfacher zu installieren ist. + + Ubuntu 8.04 LTS hat zusätzlich die Schwierigkeit, dass die Module im +Archiv recht alt sind, und das viele der benötigten Module nicht +einfach zu installieren sind. Dafür sollte es kurz nach dem Release ein +eigenes .deb geben. + + Alternativ dazu kann die normale Installation durchgeführt werden +(*note Manuelle Installation des Programmpaketes::), wenn vorher ein +Kompatibilitätspaket installiert wird, das die fehlenden Pakete +bereitstellt. Das Paket ist auf Sourceforge +(https://sourceforge.net/projects/lx-office/files/Lx-Office%20ERP/2.6.2/) +unter dem Namen `lx-erp-perl-libs-compat-v2.tar.gz' hinterlegt. + + Zur Installation das Paket in das entpackte Lx-Office Verzeichnis +entpacken: + + `tar xzf lx-erp-perl-libs-compat-v2.tar.gz /path/to/lx-office/' + + Danach sollte der Installationscheck (*note Pakete::) die +enthaltenen Pakete erkennen. + +2.2 Pakete +========== + Zum Betrieb von Lx-Office werden zwingend ein Webserver (meist Apache) -und ein Datenbankserver (PostgreSQL) benötigt. +und ein Datenbankserver (PostgreSQL, mindestens v8.2) benötigt. Zusätzlich benötigt Lx-Office die folgenden Perl-Pakete, die nicht Bestandteil einer Standard-Perl-Installation sind: + * parent + * Archive::Zip * Class::Accessor @@ -72,8 +135,6 @@ Bestandteil einer Standard-Perl-Installation sind: * PDF::API2 - * Readonly (benötigt) und Readonly::XS (optional) - * Rose::Object * Rose::DB @@ -95,6 +156,10 @@ Bestandteil einer Standard-Perl-Installation sind: Gegenüber Version 2.6.0 sind zu dieser Liste 2 Pakete hinzugekommen, `URI' und `XML::Writer' sind notwendig. Ohne startet Lx-Office nicht. + Gegenüber Version 2.6.1 sind `parent', `DateTime', `Rose::Object', +`Rose::DB' und `Rose::DB::Object' neu hinzugekommen. `IO::Wrap' wurde +entfernt. + `Email::Address' und `List::MoreUtils' sind schon länger feste Abhängigkeiten, wurden aber bisher mit Lx-Office mitgeliefert. Beide sind auch in 2.6.1 weiterhin mit ausgeliefert, wurden in einer @@ -110,42 +175,46 @@ Distributionen unterschiedlich heißen. Für Debian oder Ubuntu benötigen Sie diese Pakete: - `apache2 postgresql libarchive-zip-perl libclass-accessor-perl -libdatetime-perl libdbi-perl libdbd-pg-perl libpg-perl -libemail-address-perl libio-stringy-perl liblist-moreutils-perl -libpdf-api2-perl libtemplate-perl libtext-csv-xs-perl -libtext-iconv-perl liburi-perl libxml-writer-perl libyaml-perl -librose-object-perl librose-db-perl librose-db-object-perl -libreadonly-xs-perl' + `apache2 postgresql libparent-perl libarchive-zip-perl +libclass-accessor-perl libdatetime-perl libdbi-perl libdbd-pg-perl +libpg-perl libemail-address-perl liblist-moreutils-perl +libpdf-api2-perl librose-object-perl librose-db-perl +librose-db-object-perl libtemplate-perl libtext-csv-xs-perl +libtext-iconv-perl liburi-perl libxml-writer-perl libyaml-perl' Für Fedora Core benötigen Sie diese Pakete: - `httpd postgresql-server perl-Class-Accessor perl-DateTime perl-DBI -perl-DBD-Pg perl-Email-Address perl-IO-stringy perl-List-MoreUtils -perl-PDF-API2 perl-Template-Toolkit perl-Text-CSV_XS perl-Text-Iconv -perl-URI perl-XML-Writer perl-YAML' + `httpd postgresql-server perl-parent perl-Class-Accessor +perl-DateTime perl-DBI perl-DBD-Pg perl-Email-Address +perl-List-MoreUtils perl-PDF-API2 perl-Rose-Object perl-Rose-DB +perl-Rose-DB-Object perl-Template-Toolkit perl-Text-CSV_XS +perl-Text-Iconv perl-URI perl-XML-Writer perl-YAML' Für OpenSuSE benötigen Sie diese Pakete: `apache2 postgresql-server perl-Archive-Zip perl-Class-Accessor -perl-DateTime perl-DBI perl-DBD-Pg perl-MailTools perl-IO-stringy -perl-List-MoreUtils perl-PDF-API2 perl-Template-Toolkit -perl-Text-CSV_XS perl-Text-Iconv perl-URI perl-XML-Writer perl-YAML' +perl-DateTime perl-DBI perl-DBD-Pg perl-MailTools perl-List-MoreUtils +perl-PDF-API2 perl-Template-Toolkit perl-Text-CSV_XS perl-Text-Iconv +perl-URI perl-XML-Writer perl-YAML' + + Bei openSuSE 11 ist `parent' bereits enthalten, und braucht nicht +nachinstalliert werden. Die `Rose::*' Pakete sind derzeit nicht für +SuSE gepackt, und müssen anderweitig nachinstalliert werden. Lx-Office enthält ein Script, mit dem überprüft werden kann, ob alle benötigten Perl-Module installiert sind. Der Aufruf lautet wie folgt: `./scripts/installation_check.pl' -3 Installation des Programmpaketes -********************************** +3 Manuelle Installation des Programmpaketes +******************************************* -Die Lx-Office ERP Installationsdatei (lxoffice-erp-2.6.1.tgz) wird im +Die Lx-Office ERP Installationsdatei (lxoffice-erp-2.6.2.tgz) wird im Dokumentenverzeichnis des Webservers (z.B. `/var/www/html/', `/srv/www/htdocs' oder `/var/www/') entpackt: `cd /var/www -tar xvzf lxoffice-erp-2.6.1.tgz' +tar xvzf lxoffice-erp-2.6.2.tgz' Verändern Sie evtl. noch den Namen des Verzeichnisses mit @@ -213,16 +282,11 @@ mit ISO-8859-15 als Encoding betrieben werden. In der Datei `postgresql.conf', die je nach Distribution in verschiedenen Verzeichnissen liegen kann (z.B. `/var/lib/pgsql/data/' oder `/etc/postgresql/', muss sichergestellt werden, dass -TCP/IP-Verbindungen aktiviert sind. Für PostgreSQL vor Version v8.0 -lautete dieser Parameter - - `TCPIP_SOCKET = 1' - - Ab v8.0 wird das Verhalten hingegen über den neuen Parameter -`listen_address' gesteuert. Laufen PostgreSQL und Lx-Office auf -demselben Rechner, so kann dort der Wert `localhost' verwendet werden. -Andernfalls müssen Datenbankverbindungen auch von anderen Rechnern aus -zugelassen werden, was mit dem Wert \`*' geschieht. +TCP/IP-Verbindungen aktiviert sind. Das Verhalten wird über den +Parameter `listen_address' gesteuert. Laufen PostgreSQL und Lx-Office +auf demselben Rechner, so kann dort der Wert `localhost' verwendet +werden. Andernfalls müssen Datenbankverbindungen auch von anderen +Rechnern aus zugelassen werden, was mit dem Wert \`*' geschieht. In der Datei `pg_hba.conf', die im gleichen Verzeichnis wie die `postgresql.conf' zu finden sein sollte, müssen die Berichtigungen für @@ -248,6 +312,13 @@ servergespeicherte Prozeduren eingerichet werden. Melden Sie sich dafür als Benutzer "postgres" an der Datenbank an, und führen Sie die folgenden Kommandos aus: + `create language 'plpgsql';' + + Achtung: In älteren Postgresversionen (vor 8.0) muss der Handler für +die Sprache manuell anlelegt werden, diese Versionen werden aber nicht +mehr offiziell von Lx-Office unterstützt. Dafür dann die folgenden +Kommandos: + `create function plpgsql_call_handler () returns opaque as '/usr/lib/pgsql/plpgsql.so' language 'c'; create language 'plpgsql' handler plpgsql_call_handler lancompiler @@ -255,8 +326,7 @@ create language 'plpgsql' handler plpgsql_call_handler lancompiler Bitte beachten Sie, dass der Pfad zur Datei `plpgsql.so' von Distribution zu Distribution verschiedlich sein kann. Bei Debian/Ubuntu -befindet sie sich unter `/usr/lib/postgresql/lib/plpgsql.so', bei -Ubuntu 9.10 unter `/usr/lib/postgresql/8.4/lib/plpgsql.so'. +befindet sie sich unter `/usr/lib/postgresql/lib/plpgsql.so'. 4.4 Datenbankbenutzer anlegen ============================= @@ -275,7 +345,11 @@ hier gewählten Benutzernamen. 5 Apache-Konfiguration ********************** -Der Zugriff auf das Programmverzeichnis muss in der Apache +Hinweis: Für einen deutlichen Performanceschub sorgt die Ausführung +mittels FCGI. Die Einrichtung wird ausführlich in der Datei +`INSTALL.fcgi' beschrieben. + + Der Zugriff auf das Programmverzeichnis muss in der Apache Webserverkonfigurationsdatei `httpd.conf' eingestellt werden. Fügen Sie den folgenden Abschnitt dieser Datei oder einer anderen Datei hinzu, die beim Starten des Webservers eingelesen wird: @@ -498,9 +572,9 @@ ist dies `lxoffice'). Wenn Sie für die Lx-Office-Installation nicht den europäischen Schriftsatz ISO-8859-15 sondern UTF-8 (Unicode) benutzen wollen, so müssen Sie vor dem Anlegen der Datenbank in der Datei -`config/lx-erp.conf' die Variable `$dbcharset' auf den Wert `UTF-8' -setzen. Zusätzlich muss beim Anlegen der Datenbank `UTF-8 Unicode' als -Schriftsatz ausgewählt werden. +`config/lx_office.conf' die Variable `dbcharset' im Abschnitt `system' +auf den Wert `UTF-8' setzen. Zusätzlich muss beim Anlegen der Datenbank +`UTF-8 Unicode' als Schriftsatz ausgewählt werden. Bitte beachten Sie, dass alle Datenbanken den selben Zeichensatz verwenden müssen, da diese Einstellungen momentan global in Lx-Office @@ -554,7 +628,7 @@ zugewiesen werden. Dazu gibt es zwei Möglichkeiten: 7.6 Migration alter Installationen ================================== -Wenn Lx-Office 2.6.1 über eine ältere Version installiert wird, in der +Wenn Lx-Office 2.6.2 über eine ältere Version installiert wird, in der die Benutzerdaten noch im Dateisystem im Verzeichnis `users' verwaltet wurden, so bietet Lx-Office die Möglichkeit, diese Benutzerdaten automatisch in die Authentifizierungsdatenbank zu übernehmen. Dies @@ -579,13 +653,13 @@ OpenDocument-Format, wie es OpenOffice.org ab Version 2 erzeugt. Lx-Office kann dabei sowohl neue OpenDocument-Dokumente als auch aus diesen direkt PDF-Dateien erzeugen. Um die Unterstützung von OpenDocument-Vorlagen zu aktivieren muss in der Datei -`config/lx-erp.conf' die Variable `$opendocument_templates' auf `1' -stehen. Dieses ist die Standardeinstellung. +`config/lx_office.conf' die Variable `opendocument' im Abschnitt +`print_templates' auf `1' stehen. Dieses ist die Standardeinstellung. - Weiterhin muss in der Datei `config/lx-erp.conf' die Variable -`$dbcharset' auf die Zeichenkodierung gesetzt werden, die auch bei der -Speicherung der Daten in der Datenbank verwendet wird. Diese ist in den -meisten Fällen "UTF-8". + Weiterhin muss in der Datei `config/lx_office.conf' die Variable +`dbcharset' im Abschnitt `system' auf die Zeichenkodierung gesetzt +werden, die auch bei der Speicherung der Daten in der Datenbank +verwendet wird. Diese ist in den meisten Fällen "UTF-8". Während die Erzeugung von reinen OpenDocument-Dateien keinerlei weitere Software benötigt, wird zur Umwandlung dieser Dateien in PDF @@ -594,10 +668,11 @@ neben OpenOffice.org ab Version 2 auch der "X virtual frame buffer" (xvfb) installiert werden. Bei Debian ist er im Paket "xvfb" enthalten. Andere Distributionen enthalten ihn in anderen Paketen. - Nach der Installation müssen in der Datei `config/lx-erp.conf' zwei -weitere Variablen angepasst werden: `$openofficeorg_writer_bin' muss + Nach der Installation müssen in der Datei `config/lx_config.conf' +zwei weitere Variablen angepasst werden: `openofficeorg_writer' muss den vollständigen Pfad zur OpenOffice.org Writer-Anwendung enthalten. -`$xvfb_bin' muss den Pfad zum "X virtual frame buffer" enthalten. +`xvfb' muss den Pfad zum "X virtual frame buffer" enthalten. Beide +stehen im Abschnitt `applications'. Zusätzlich gibt es zwei verschiedene Arten, wie Lx-Office mit OpenOffice kommuniziert. Die erste Variante, die benutzt wird, wenn die @@ -627,8 +702,8 @@ z.B. einfach nur `.openoffice', so wäre folgender Befehl auszuführen: `mv users/.openoffice.org2 users/.openoffice' Dieses Verzeichnis, wie auch das komplette `users'-Verzeichnis, muss -vom Webserver beschreibbar sein. Dieses wurde in Schritt `Installation -des Programmpakets' oben bereits erledigt, kann aber erneut überprüft +vom Webserver beschreibbar sein. Dieses wurde bereits erledigt (*note +Manuelle Installation des Programmpaketes::), kann aber erneut überprüft werden, wenn die Konvertierung nach PDF fehlschlägt. 9 Lx-Office ERP verwenden @@ -643,3 +718,8 @@ URL erreichbar: `http://localhost/lx-office-erp/admin.pl' + + +Local Variables: +coding: utf-8 +End: diff --git a/doc/INSTALL/Administratorpasswort.html b/doc/INSTALL/Administratorpasswort.html index e9f49e98f..ddbffa094 100644 --- a/doc/INSTALL/Administratorpasswort.html +++ b/doc/INSTALL/Administratorpasswort.html @@ -1,9 +1,9 @@ Administratorpasswort - Lx-Office Installationsanleitung - + - + @@ -24,11 +24,11 @@ diff --git a/doc/INSTALL/Aktuelle-Hinweise.html b/doc/INSTALL/Aktuelle-Hinweise.html index 3a6218a64..b73c6d354 100644 --- a/doc/INSTALL/Aktuelle-Hinweise.html +++ b/doc/INSTALL/Aktuelle-Hinweise.html @@ -1,9 +1,9 @@ Aktuelle Hinweise - Lx-Office Installationsanleitung - + - + @@ -23,11 +23,11 @@
-

-Next: , -Previous: Top, -Up: Top + +nächstes: , +voriges: Top, +aufwärts: Top


diff --git a/doc/INSTALL/Anlegen-der-Authentifizierungsdatenbank.html b/doc/INSTALL/Anlegen-der-Authentifizierungsdatenbank.html index a7be98ac3..f3aa5b96e 100644 --- a/doc/INSTALL/Anlegen-der-Authentifizierungsdatenbank.html +++ b/doc/INSTALL/Anlegen-der-Authentifizierungsdatenbank.html @@ -1,9 +1,9 @@ Anlegen der Authentifizierungsdatenbank - Lx-Office Installationsanleitung - + - + @@ -23,10 +23,10 @@ diff --git a/doc/INSTALL/Anpassung-der-PostgreSQL_002dKonfiguration.html b/doc/INSTALL/Anpassung-der-PostgreSQL_002dKonfiguration.html index 5a45146d3..a3cb96d3e 100644 --- a/doc/INSTALL/Anpassung-der-PostgreSQL_002dKonfiguration.html +++ b/doc/INSTALL/Anpassung-der-PostgreSQL_002dKonfiguration.html @@ -1,11 +1,11 @@ Anpassung der PostgreSQL-Konfiguration - Lx-Office Installationsanleitung - + - + - + @@ -23,12 +23,12 @@ diff --git a/doc/INSTALL/Apache_002dKonfiguration.html b/doc/INSTALL/Apache_002dKonfiguration.html index 807f78dee..13e084c78 100644 --- a/doc/INSTALL/Apache_002dKonfiguration.html +++ b/doc/INSTALL/Apache_002dKonfiguration.html @@ -1,9 +1,9 @@ Apache-Konfiguration - Lx-Office Installationsanleitung - + - + @@ -23,18 +23,22 @@

5 Apache-Konfiguration

-

Der Zugriff auf das Programmverzeichnis muss in der Apache +

Hinweis: Für einen deutlichen Performanceschub sorgt die Ausführung +mittels FCGI. Die Einrichtung wird ausführlich in der Datei +INSTALL.fcgi beschrieben. + +

Der Zugriff auf das Programmverzeichnis muss in der Apache Webserverkonfigurationsdatei httpd.conf eingestellt werden. Fügen Sie den folgenden Abschnitt dieser Datei oder einer anderen Datei hinzu, die beim Starten des Webservers eingelesen wird: diff --git a/doc/INSTALL/Authentifizierungsdatenbank.html b/doc/INSTALL/Authentifizierungsdatenbank.html index df88b07cc..a1c7204c8 100644 --- a/doc/INSTALL/Authentifizierungsdatenbank.html +++ b/doc/INSTALL/Authentifizierungsdatenbank.html @@ -1,9 +1,9 @@ Authentifizierungsdatenbank - Lx-Office Installationsanleitung - + - + @@ -24,11 +24,11 @@

diff --git a/doc/INSTALL/Ben_00c3_00b6tigte-Software-und-Pakete.html b/doc/INSTALL/Ben_00c3_00b6tigte-Software-und-Pakete.html index 90c9a2021..79205132a 100644 --- a/doc/INSTALL/Ben_00c3_00b6tigte-Software-und-Pakete.html +++ b/doc/INSTALL/Ben_00c3_00b6tigte-Software-und-Pakete.html @@ -1,12 +1,12 @@ Benötigte Software und Pakete - Lx-Office Installationsanleitung - + - + - + + + +
+

+ +nächstes: , +aufwärts: Benötigte Software und Pakete +


+
+ +

2.1 Betriebssystem

+ +

Lx-Office ist für Linux konzipiert, und sollte auf jedem unixoiden +Betriebssystem zum Laufen zu kriegen sein. Getestet ist diese Version im +speziellen auf Debian und Ubuntu, grundsätzlich wurde bei der Auswahl der +Pakete aber darauf Rücksicht genommen, dass es ohne große Probleme auf den +derzeit aktuellen verbreiteten Distributionen läuft. + +

Anfang 2011 sind das folgende Systeme: + +

    +
  • Ubuntu 8.04 LTS Hardy Heron +
  • Ubuntu 9.10 Karmic Koala +
  • Ubuntu 10.04 Lucid Lynx +
  • Ubuntu 10.10 Maverick Meerkat +
  • Debian 5.0 Lenny +
  • Debian 6.0 Squeeze +
  • openSUSE 11.2 +
  • openSUSE 11.3 +
  • SuSE Linux Enterprice Server 11 +
  • Fedora 13 +
  • Fedora 14 +
+ +

Für die debianoiden Betriebssysteme existiert ein .deb, das deutlich einfacher +zu installieren ist. + +

Ubuntu 8.04 LTS hat zusätzlich die Schwierigkeit, dass die Module im Archiv +recht alt sind, und das viele der benötigten Module nicht einfach zu +installieren sind. Dafür sollte es kurz nach dem Release ein eigenes .deb +geben. + +

Alternativ dazu kann die normale Installation durchgeführt werden +(siehe Manuelle Installation des Programmpaketes), wenn vorher ein +Kompatibilitätspaket installiert wird, das die fehlenden Pakete bereitstellt. +Das Paket ist auf Sourceforge unter dem Namen lx-erp-perl-libs-compat-v2.tar.gz hinterlegt. + +

Zur Installation das Paket in das entpackte Lx-Office Verzeichnis entpacken: + +

tar xzf lx-erp-perl-libs-compat-v2.tar.gz /path/to/lx-office/ + +

Danach sollte der Installationscheck (siehe Pakete) die enthaltenen Pakete erkennen. + + + diff --git a/doc/INSTALL/Datenbankbenutzer-anlegen.html b/doc/INSTALL/Datenbankbenutzer-anlegen.html index b4b3af39e..d25d81dca 100644 --- a/doc/INSTALL/Datenbankbenutzer-anlegen.html +++ b/doc/INSTALL/Datenbankbenutzer-anlegen.html @@ -1,9 +1,9 @@ Datenbankbenutzer anlegen - Lx-Office Installationsanleitung - + - + @@ -23,10 +23,10 @@

diff --git a/doc/INSTALL/Datenbanken-anlegen.html b/doc/INSTALL/Datenbanken-anlegen.html index ce91f4010..6b943419c 100644 --- a/doc/INSTALL/Datenbanken-anlegen.html +++ b/doc/INSTALL/Datenbanken-anlegen.html @@ -1,9 +1,9 @@ Datenbanken anlegen - Lx-Office Installationsanleitung - + - + @@ -24,11 +24,11 @@ @@ -41,9 +41,10 @@ ist dies ‘lxoffice’).

Wenn Sie für die Lx-Office-Installation nicht den europäischen Schriftsatz ISO-8859-15 sondern UTF-8 (Unicode) benutzen wollen, so müssen Sie vor dem Anlegen der Datenbank in der Datei -config/lx-erp.conf die Variable $dbcharset auf den Wert -‘UTF-8’ setzen. Zusätzlich muss beim Anlegen der Datenbank -‘UTF-8 Unicode’ als Schriftsatz ausgewählt werden. +config/lx_office.conf die Variable dbcharset im +Abschnitt system auf den Wert ‘UTF-8’ setzen. Zusätzlich +muss beim Anlegen der Datenbank ‘UTF-8 Unicode’ als Schriftsatz +ausgewählt werden.

Bitte beachten Sie, dass alle Datenbanken den selben Zeichensatz verwenden müssen, da diese Einstellungen momentan global in Lx-Office diff --git a/doc/INSTALL/Erweiterung-f_00c3_00bcr-servergespeicherte-Prozeduren.html b/doc/INSTALL/Erweiterung-f_00c3_00bcr-servergespeicherte-Prozeduren.html index 49bb62e7a..ecf809e4d 100644 --- a/doc/INSTALL/Erweiterung-f_00c3_00bcr-servergespeicherte-Prozeduren.html +++ b/doc/INSTALL/Erweiterung-f_00c3_00bcr-servergespeicherte-Prozeduren.html @@ -1,9 +1,9 @@ Erweiterung für servergespeicherte Prozeduren - Lx-Office Installationsanleitung - + - + @@ -24,31 +24,34 @@

4.3 Erweiterung für servergespeicherte Prozeduren

-

In der Datenbank template1 muss die Unterstützung für -servergespeicherte Prozeduren eingerichet werden. Melden Sie sich -dafür als Benutzer “postgres” an der Datenbank an, und führen Sie -die folgenden Kommandos aus: +

In der Datenbank template1 muss die Unterstützung für servergespeicherte +Prozeduren eingerichet werden. Melden Sie sich dafür als Benutzer “postgres” +an der Datenbank an, und führen Sie die folgenden Kommandos aus: + +

create language 'plpgsql'; + +

Achtung: In älteren Postgresversionen (vor 8.0) muss der Handler für die +Sprache manuell anlelegt werden, diese Versionen werden aber nicht mehr +offiziell von Lx-Office unterstützt. Dafür dann die folgenden Kommandos:

create function plpgsql_call_handler () returns opaque as '/usr/lib/pgsql/plpgsql.so' language 'c';
-create language 'plpgsql' handler plpgsql_call_handler -lancompiler 'pl/pgsql';
+create language 'plpgsql' handler plpgsql_call_handler lancompiler 'pl/pgsql'; -

Bitte beachten Sie, dass der Pfad zur Datei plpgsql.so von -Distribution zu Distribution verschiedlich sein kann. Bei -Debian/Ubuntu befindet sie sich unter -/usr/lib/postgresql/lib/plpgsql.so, bei Ubuntu 9.10 unter /usr/lib/postgresql/8.4/lib/plpgsql.so. +

Bitte beachten Sie, dass der Pfad zur Datei plpgsql.so von Distribution +zu Distribution verschiedlich sein kann. Bei Debian/Ubuntu befindet sie sich +unter /usr/lib/postgresql/lib/plpgsql.so. diff --git a/doc/INSTALL/Grundlagen-zur-Benutzerauthentifizierung.html b/doc/INSTALL/Grundlagen-zur-Benutzerauthentifizierung.html index 083b70bfa..59787fa43 100644 --- a/doc/INSTALL/Grundlagen-zur-Benutzerauthentifizierung.html +++ b/doc/INSTALL/Grundlagen-zur-Benutzerauthentifizierung.html @@ -1,9 +1,9 @@ Grundlagen zur Benutzerauthentifizierung - Lx-Office Installationsanleitung - + - + @@ -23,10 +23,10 @@

diff --git a/doc/INSTALL/Gruppen-anlegen.html b/doc/INSTALL/Gruppen-anlegen.html index fb259ae7a..a8e36d1d2 100644 --- a/doc/INSTALL/Gruppen-anlegen.html +++ b/doc/INSTALL/Gruppen-anlegen.html @@ -1,9 +1,9 @@ Gruppen anlegen - Lx-Office Installationsanleitung - + - + @@ -24,11 +24,11 @@ diff --git a/doc/INSTALL/Gruppenmitgliedschaften-verwalten.html b/doc/INSTALL/Gruppenmitgliedschaften-verwalten.html index 8b987fc0b..a8be5f938 100644 --- a/doc/INSTALL/Gruppenmitgliedschaften-verwalten.html +++ b/doc/INSTALL/Gruppenmitgliedschaften-verwalten.html @@ -1,9 +1,9 @@ Gruppenmitgliedschaften verwalten - Lx-Office Installationsanleitung - + - + @@ -24,11 +24,11 @@ diff --git a/doc/INSTALL/Installation-des-Programmpaketes.html b/doc/INSTALL/Installation-des-Programmpaketes.html deleted file mode 100644 index 0f4eaecf7..000000000 --- a/doc/INSTALL/Installation-des-Programmpaketes.html +++ /dev/null @@ -1,71 +0,0 @@ - - -Installation des Programmpaketes - Lx-Office Installationsanleitung - - - - - - - - - - - - - -

3 Installation des Programmpaketes

- -

Die Lx-Office ERP Installationsdatei (lxoffice-erp-2.6.1.tgz) wird im -Dokumentenverzeichnis des Webservers (z.B. /var/www/html/, -/srv/www/htdocs oder /var/www/) entpackt: - -

cd /var/www -
-tar xvzf lxoffice-erp-2.6.1.tgz
- -

Verändern Sie evtl. noch den Namen des Verzeichnisses mit - -

mv lxoffice-erp/ lx-erp/ - -

Alternativ können Sie auch einen Alias in der Webserverkonfiguration -benutzen, um auf das tatsächliche Installationsverzeichnis zu -verweisen. - -

Die Verzeichnisse users, spool und webdav müssen -für den Benutzer beschreibbar sein, unter dem der Webserver läuft. Die -restlichen Dateien müssen für diesen Benutzer lesbar sein. Der -Benutzername ist bei verschiedenen Distributionen unterschiedlich -(z.B. bei Debian/Ubuntu www-data, bei Fedora core apache -oder bei OpenSuSE wwwrun). - -

Der folgende Befehl ändert den Besitzer für die oben genannten -Verzeichnisse auf einem Debian/Ubuntu-System: - -

chown -R www-data lx-office-erp/users lx-office-erp/spool lx-office-erp/webdav - -

Weiterhin muss der Webserver-Benutzer im Verzeichnis templates Verzeichnisse für -jeden neuen Benutzer, der in lx-office angelegt wird, anlegen dürfen: - -

chgrp www-data lx-office-erp/templates; chmod g+w lx-office-erp/templates - - - - diff --git a/doc/INSTALL/Lx_002dOffice-ERP-verwenden.html b/doc/INSTALL/Lx_002dOffice-ERP-verwenden.html index 14d3fd300..d0a11d8f7 100644 --- a/doc/INSTALL/Lx_002dOffice-ERP-verwenden.html +++ b/doc/INSTALL/Lx_002dOffice-ERP-verwenden.html @@ -1,9 +1,9 @@ Lx-Office ERP verwenden - Lx-Office Installationsanleitung - + - + @@ -22,11 +22,11 @@

+

-

-Previous: OpenDocument-Vorlagen, -Up: Top +voriges: OpenDocument-Vorlagen, +aufwärts: Top


diff --git a/doc/INSTALL/Manuelle-Installation-des-Programmpaketes.html b/doc/INSTALL/Manuelle-Installation-des-Programmpaketes.html new file mode 100644 index 000000000..e3f64d512 --- /dev/null +++ b/doc/INSTALL/Manuelle-Installation-des-Programmpaketes.html @@ -0,0 +1,71 @@ + + +Manuelle Installation des Programmpaketes - Lx-Office Installationsanleitung + + + + + + + + + + + +
+

+ +nächstes: , +voriges: Benötigte Software und Pakete, +aufwärts: Top +


+
+ +

3 Manuelle Installation des Programmpaketes

+ +

Die Lx-Office ERP Installationsdatei (lxoffice-erp-2.6.2.tgz) wird im +Dokumentenverzeichnis des Webservers (z.B. /var/www/html/, +/srv/www/htdocs oder /var/www/) entpackt: + +

cd /var/www +
+tar xvzf lxoffice-erp-2.6.2.tgz
+ +

Verändern Sie evtl. noch den Namen des Verzeichnisses mit + +

mv lxoffice-erp/ lx-erp/ + +

Alternativ können Sie auch einen Alias in der Webserverkonfiguration +benutzen, um auf das tatsächliche Installationsverzeichnis zu +verweisen. + +

Die Verzeichnisse users, spool und webdav müssen +für den Benutzer beschreibbar sein, unter dem der Webserver läuft. Die +restlichen Dateien müssen für diesen Benutzer lesbar sein. Der +Benutzername ist bei verschiedenen Distributionen unterschiedlich +(z.B. bei Debian/Ubuntu www-data, bei Fedora core apache +oder bei OpenSuSE wwwrun). + +

Der folgende Befehl ändert den Besitzer für die oben genannten +Verzeichnisse auf einem Debian/Ubuntu-System: + +

chown -R www-data lx-office-erp/users lx-office-erp/spool lx-office-erp/webdav + +

Weiterhin muss der Webserver-Benutzer im Verzeichnis templates Verzeichnisse für +jeden neuen Benutzer, der in lx-office angelegt wird, anlegen dürfen: + +

chgrp www-data lx-office-erp/templates; chmod g+w lx-office-erp/templates + + + + diff --git a/doc/INSTALL/Migration-alter-Installationen.html b/doc/INSTALL/Migration-alter-Installationen.html index ef676b335..5cd695206 100644 --- a/doc/INSTALL/Migration-alter-Installationen.html +++ b/doc/INSTALL/Migration-alter-Installationen.html @@ -1,9 +1,9 @@ Migration alter Installationen - Lx-Office Installationsanleitung - + - + @@ -23,16 +23,16 @@

7.6 Migration alter Installationen

-

Wenn Lx-Office 2.6.1 über eine ältere Version installiert wird, in der +

Wenn Lx-Office 2.6.2 über eine ältere Version installiert wird, in der die Benutzerdaten noch im Dateisystem im Verzeichnis users verwaltet wurden, so bietet Lx-Office die Möglichkeit, diese Benutzerdaten automatisch in die Authentifizierungsdatenbank zu diff --git a/doc/INSTALL/Name-des-Session_002dCookies.html b/doc/INSTALL/Name-des-Session_002dCookies.html index 925e7c5c6..4809b7539 100644 --- a/doc/INSTALL/Name-des-Session_002dCookies.html +++ b/doc/INSTALL/Name-des-Session_002dCookies.html @@ -1,9 +1,9 @@ Name des Session-Cookies - Lx-Office Installationsanleitung - + - + @@ -24,12 +24,12 @@

diff --git a/doc/INSTALL/OpenDocument_002dVorlagen.html b/doc/INSTALL/OpenDocument_002dVorlagen.html index a5f4ebe73..654f3314f 100644 --- a/doc/INSTALL/OpenDocument_002dVorlagen.html +++ b/doc/INSTALL/OpenDocument_002dVorlagen.html @@ -1,9 +1,9 @@ OpenDocument-Vorlagen - Lx-Office Installationsanleitung - + - + @@ -23,12 +23,12 @@
+

-

-Next: , -Previous: Benutzer- und Gruppenverwaltung, -Up: Top +nächstes: , +voriges: Benutzer- und Gruppenverwaltung, +aufwärts: Top


@@ -39,13 +39,14 @@ OpenDocument-Format, wie es OpenOffice.org ab Version 2 erzeugt. Lx-Office kann dabei sowohl neue OpenDocument-Dokumente als auch aus diesen direkt PDF-Dateien erzeugen. Um die Unterstützung von OpenDocument-Vorlagen zu aktivieren muss in der Datei -config/lx-erp.conf die Variable $opendocument_templates -auf ‘1’ stehen. Dieses ist die Standardeinstellung. +config/lx_office.conf die Variable opendocument im +Abschnitt print_templates auf ‘1’ stehen. Dieses ist die +Standardeinstellung. -

Weiterhin muss in der Datei config/lx-erp.conf die Variable -$dbcharset auf die Zeichenkodierung gesetzt werden, die auch -bei der Speicherung der Daten in der Datenbank verwendet wird. Diese -ist in den meisten Fällen "UTF-8". +

Weiterhin muss in der Datei config/lx_office.conf die Variable +dbcharset im Abschnitt system auf die Zeichenkodierung +gesetzt werden, die auch bei der Speicherung der Daten in der +Datenbank verwendet wird. Diese ist in den meisten Fällen "UTF-8".

Während die Erzeugung von reinen OpenDocument-Dateien keinerlei weitere Software benötigt, wird zur Umwandlung dieser Dateien in PDF @@ -54,11 +55,11 @@ neben OpenOffice.org ab Version 2 auch der “X virtual frame buffer” (xvfb) installiert werden. Bei Debian ist er im Paket “xvfb” enthalten. Andere Distributionen enthalten ihn in anderen Paketen. -

Nach der Installation müssen in der Datei config/lx-erp.conf -zwei weitere Variablen angepasst werden: -$openofficeorg_writer_bin muss den vollständigen Pfad zur -OpenOffice.org Writer-Anwendung enthalten. $xvfb_bin muss den -Pfad zum “X virtual frame buffer” enthalten. +

Nach der Installation müssen in der Datei config/lx_config.conf +zwei weitere Variablen angepasst werden: openofficeorg_writer +muss den vollständigen Pfad zur OpenOffice.org Writer-Anwendung +enthalten. xvfb muss den Pfad zum “X virtual frame buffer” +enthalten. Beide stehen im Abschnitt applications.

Zusätzlich gibt es zwei verschiedene Arten, wie Lx-Office mit OpenOffice kommuniziert. Die erste Variante, die benutzt wird, wenn @@ -88,11 +89,10 @@ folgender Befehl auszuführen:

mv users/.openoffice.org2 users/.openoffice -

Dieses Verzeichnis, wie auch das komplette users-Verzeichnis, -muss vom Webserver beschreibbar sein. Dieses wurde in Schritt -Installation des Programmpakets oben bereits erledigt, kann -aber erneut überprüft werden, wenn die Konvertierung nach PDF -fehlschlägt. +

Dieses Verzeichnis, wie auch das komplette users-Verzeichnis, muss vom +Webserver beschreibbar sein. Dieses wurde bereits erledigt +(siehe Manuelle Installation des Programmpaketes), kann aber erneut überprüft +werden, wenn die Konvertierung nach PDF fehlschlägt. diff --git a/doc/INSTALL/Pakete.html b/doc/INSTALL/Pakete.html new file mode 100644 index 000000000..267b2ac7f --- /dev/null +++ b/doc/INSTALL/Pakete.html @@ -0,0 +1,102 @@ + + +Pakete - Lx-Office Installationsanleitung + + + + + + + + + + + +

+

+ +voriges: Betriebssystem, +aufwärts: Benötigte Software und Pakete +


+
+ +

2.2 Pakete

+ +

Zum Betrieb von Lx-Office werden zwingend ein Webserver (meist Apache) +und ein Datenbankserver (PostgreSQL, mindestens v8.2) benötigt. + +

Zusätzlich benötigt Lx-Office die folgenden Perl-Pakete, die nicht Bestandteil +einer Standard-Perl-Installation sind: + +

    +
  • parent +
  • Archive::Zip +
  • Class::Accessor +
  • CGI::Ajax +
  • DateTime +
  • DBI +
  • DBD::Pg +
  • Email::Address +
  • List::MoreUtils +
  • PDF::API2 +
  • Rose::Object +
  • Rose::DB +
  • Rose::DB::Object +
  • Template +
  • Text::CSV_XS +
  • Text::Iconv +
  • URI +
  • XML::Writer +
  • YAML +
+ +

Gegenüber Version 2.6.0 sind zu dieser Liste 2 Pakete hinzugekommen, URI +und XML::Writer sind notwendig. Ohne startet Lx-Office nicht. + +

Gegenüber Version 2.6.1 sind parent, DateTime, +Rose::Object, Rose::DB und Rose::DB::Object neu +hinzugekommen. IO::Wrap wurde entfernt. + +

Email::Address und List::MoreUtils sind schon länger feste +Abhängigkeiten, wurden aber bisher mit Lx-Office mitgeliefert. Beide sind auch +in 2.6.1 weiterhin mit ausgeliefert, wurden in einer zukünftigen Version aber +aus dem Paket entfernt werden. Es wird empfohlen diese Module zusammen mit den +anderen als Bibliotheken zu installieren. + +

CGI::Ajax ist nach wie vor in einer modifizierten Version mitgeliefert +und braucht nicht nachinstalliert werden. + +

Die zu installierenden Pakete können in den verschiedenen Distributionen unterschiedlich heißen. + +

Für Debian oder Ubuntu benötigen Sie diese Pakete: + +

apache2 postgresql libparent-perl libarchive-zip-perl libclass-accessor-perl libdatetime-perl libdbi-perl libdbd-pg-perl libpg-perl libemail-address-perl liblist-moreutils-perl libpdf-api2-perl librose-object-perl librose-db-perl librose-db-object-perl libtemplate-perl libtext-csv-xs-perl libtext-iconv-perl liburi-perl libxml-writer-perl libyaml-perl + +

Für Fedora Core benötigen Sie diese Pakete: + +

httpd postgresql-server perl-parent perl-Class-Accessor perl-DateTime perl-DBI perl-DBD-Pg perl-Email-Address perl-List-MoreUtils perl-PDF-API2 perl-Rose-Object perl-Rose-DB perl-Rose-DB-Object perl-Template-Toolkit perl-Text-CSV_XS perl-Text-Iconv perl-URI perl-XML-Writer perl-YAML + +

Für OpenSuSE benötigen Sie diese Pakete: + +

apache2 postgresql-server perl-Archive-Zip perl-Class-Accessor perl-DateTime perl-DBI perl-DBD-Pg perl-MailTools perl-List-MoreUtils perl-PDF-API2 perl-Template-Toolkit perl-Text-CSV_XS perl-Text-Iconv perl-URI perl-XML-Writer perl-YAML + +

Bei openSuSE 11 ist parent bereits enthalten, und braucht nicht nachinstalliert werden. Die Rose::* Pakete sind derzeit nicht für SuSE gepackt, und müssen anderweitig nachinstalliert werden. + +

Lx-Office enthält ein Script, mit dem überprüft werden kann, ob alle +benötigten Perl-Module installiert sind. Der Aufruf lautet wie folgt: + +

./scripts/installation_check.pl + + + + diff --git a/doc/INSTALL/Passwort_00c3_00bcberpr_00c3_00bcfung.html b/doc/INSTALL/Passwort_00c3_00bcberpr_00c3_00bcfung.html index b7cafa137..858c04721 100644 --- a/doc/INSTALL/Passwort_00c3_00bcberpr_00c3_00bcfung.html +++ b/doc/INSTALL/Passwort_00c3_00bcberpr_00c3_00bcfung.html @@ -1,9 +1,9 @@ Passwortüberprüfung - Lx-Office Installationsanleitung - + - + @@ -24,12 +24,12 @@

diff --git a/doc/INSTALL/Zeichens_00c3_00a4tze_002fdie-Verwendung-von-UTF_002d8.html b/doc/INSTALL/Zeichens_00c3_00a4tze_002fdie-Verwendung-von-UTF_002d8.html index 494b4b776..fc2c61a71 100644 --- a/doc/INSTALL/Zeichens_00c3_00a4tze_002fdie-Verwendung-von-UTF_002d8.html +++ b/doc/INSTALL/Zeichens_00c3_00a4tze_002fdie-Verwendung-von-UTF_002d8.html @@ -1,9 +1,9 @@ Zeichensätze/die Verwendung von UTF-8 - Lx-Office Installationsanleitung - + - + @@ -23,11 +23,11 @@ diff --git a/doc/INSTALL/Zusammenh_00c3_00a4nge.html b/doc/INSTALL/Zusammenh_00c3_00a4nge.html index e3b97f50a..cead2741e 100644 --- a/doc/INSTALL/Zusammenh_00c3_00a4nge.html +++ b/doc/INSTALL/Zusammenh_00c3_00a4nge.html @@ -1,9 +1,9 @@ Zusammenhänge - Lx-Office Installationsanleitung - + - + @@ -23,11 +23,11 @@ diff --git a/doc/INSTALL/_00c3_0084nderungen-an-Konfigurationsdateien.html b/doc/INSTALL/_00c3_0084nderungen-an-Konfigurationsdateien.html index 2857fac65..8359b1e45 100644 --- a/doc/INSTALL/_00c3_0084nderungen-an-Konfigurationsdateien.html +++ b/doc/INSTALL/_00c3_0084nderungen-an-Konfigurationsdateien.html @@ -1,9 +1,9 @@ Änderungen an Konfigurationsdateien - Lx-Office Installationsanleitung - + - + @@ -24,12 +24,12 @@ @@ -38,16 +38,12 @@ Up:  Lx-Office Installationsanleitung - + - + @@ -27,7 +27,11 @@
  • Inhalt der Anleitung
  • 1 Aktuelle Hinweise
  • 2 Benötigte Software und Pakete -
  • 3 Installation des Programmpaketes + +
  • 3 Manuelle Installation des Programmpaketes
  • 4 Anpassung der PostgreSQL-Konfiguration
    • 4.1 Zeichensätze/die Verwendung von UTF-8 @@ -62,10 +66,10 @@
      -

      -Next: , -Up: (dir) + +nächstes: , +aufwärts: (dir)


      @@ -74,7 +78,7 @@ Up: (dir)
  • | . $locale->text('Copies') . qq| {copies}>
    diff --git a/templates/webpages/admin/delete_dataset.html b/templates/webpages/admin/delete_dataset.html index fef1cbd13..5db6ab37d 100644 --- a/templates/webpages/admin/delete_dataset.html +++ b/templates/webpages/admin/delete_dataset.html @@ -2,7 +2,7 @@ [% USE HTML %]

    [% title %]

    -

    +

    [% 'Back' | $T8 %]

    [% 'You can only delete datasets that are not in use.' | $T8 %] diff --git a/templates/webpages/admin/delete_group_confirm.html b/templates/webpages/admin/delete_group_confirm.html index 1b558c733..a6d8bf069 100644 --- a/templates/webpages/admin/delete_group_confirm.html +++ b/templates/webpages/admin/delete_group_confirm.html @@ -4,9 +4,7 @@

    [ [% name %] ] - [% 'Do you really want to delete this group?' | $T8 %]

    - - - + [% 'Back' | $T8 %] diff --git a/templates/webpages/admin/edit_group.html b/templates/webpages/admin/edit_group.html index 5b6846108..bacf5b3a2 100644 --- a/templates/webpages/admin/edit_group.html +++ b/templates/webpages/admin/edit_group.html @@ -10,7 +10,7 @@
    [% 'Edit group ' | $T8 %]: [% HTML.escape(name) %]
    -

    +

    [% 'Back' | $T8 %]


    diff --git a/templates/webpages/admin/edit_group_membership.html b/templates/webpages/admin/edit_group_membership.html index 103c06689..fe70347a5 100644 --- a/templates/webpages/admin/edit_group_membership.html +++ b/templates/webpages/admin/edit_group_membership.html @@ -3,7 +3,7 @@
    [% 'Edit group membership' | $T8 %]
    -

    +

    [% 'Back' | $T8 %]

    [% 'Select the checkboxes that match users to the groups they should belong to.' | $T8 %]

    diff --git a/templates/webpages/admin/edit_user.html b/templates/webpages/admin/edit_user.html index 161c5d2a9..ae2ed8005 100644 --- a/templates/webpages/admin/edit_user.html +++ b/templates/webpages/admin/edit_user.html @@ -24,7 +24,7 @@
    [% title %]
    -

    +

    [% 'Back' | $T8 %]

    @@ -259,7 +259,7 @@ - + [% 'Back' | $T8 %] diff --git a/templates/webpages/admin/update_dataset.html b/templates/webpages/admin/update_dataset.html index c337cab09..8a93f90dd 100644 --- a/templates/webpages/admin/update_dataset.html +++ b/templates/webpages/admin/update_dataset.html @@ -2,7 +2,7 @@ [% USE HTML %]

    [% title %]

    -

    +

    [% 'Back' | $T8 %]

    [% IF ALL_UPDATED %] [% 'All Datasets up to date!' | $T8 %]