From: Moritz Bunkus Date: Fri, 28 Jan 2011 12:15:19 +0000 (+0100) Subject: Merge branch 'rb-wiederkehrende-rechnungen' into 263 X-Git-Tag: release-2.6.3~61^2~9^2~3^2~4 X-Git-Url: http://wagnertech.de/gitweb/gitweb.cgi/mfinanz.git/commitdiff_plain/1072cd08c6f5b1905a34dcb3eeab3ddec98d6905?hp=2cbbdcc8d6bd92bc5a05b25b892cfde18c0a6611 Merge branch 'rb-wiederkehrende-rechnungen' into 263 --- diff --git a/DEBIAN/DEBIAN/postinst b/DEBIAN/DEBIAN/postinst index 54b53e5da..9d175361c 100755 --- a/DEBIAN/DEBIAN/postinst +++ b/DEBIAN/DEBIAN/postinst @@ -124,10 +124,10 @@ set_lx_office_erp_authentication_db_user() { 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 /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-erp.conf + chmod 0600 /etc/lx-office-erp/lx_office.conf chmod 0600 /etc/lx-office-erp/authentication.pl } @@ -144,36 +144,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 +181,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 +215,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/mk_erp_deb.sh b/DEBIAN/mk_erp_deb.sh index 60fe00ef7..a7dcc9f9b 100755 --- a/DEBIAN/mk_erp_deb.sh +++ b/DEBIAN/mk_erp_deb.sh @@ -96,7 +96,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/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/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/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..d31fa9b56 100644 --- a/SL/Dispatcher.pm +++ b/SL/Dispatcher.pm @@ -15,6 +15,7 @@ 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::Helper::DateTime; @@ -52,10 +53,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 +67,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 +79,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 +154,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 +180,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 +312,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..d1fdc8308 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."; @@ -1505,7 +1507,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/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..530334a05 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,34 @@ 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 (($price_new != $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/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..04c5f4b61 100644 --- a/SL/Template/LaTeX.pm +++ b/SL/Template/LaTeX.pm @@ -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/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/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/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..27b3fa17f 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}; @@ -865,7 +865,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 +1310,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 +1352,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..e33c2c204 100644 --- a/bin/mozilla/wh.pl +++ b/bin/mozilla/wh.pl @@ -436,7 +436,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..dfaf17c0f 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,18 @@ 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); + = use Sort::Naturally; + = my ($a, $b, $e, $f, @a1, @a2, %h); + = 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 +132,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.texi b/doc/INSTALL.texi index 2f7437dd5..b67727618 100644 --- a/doc/INSTALL.texi +++ b/doc/INSTALL.texi @@ -547,9 +547,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 @@ -634,13 +635,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 +651,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 diff --git a/doc/INSTALL.txt b/doc/INSTALL.txt index 89b8f15e0..45ae1f954 100644 --- a/doc/INSTALL.txt +++ b/doc/INSTALL.txt @@ -114,9 +114,7 @@ Distributionen unterschiedlich heißen. 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' +libtext-iconv-perl liburi-perl libxml-writer-perl libyaml-perl' Für Fedora Core benötigen Sie diese Pakete: @@ -498,9 +496,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 @@ -579,13 +577,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 +592,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 diff --git a/doc/INSTALL/Datenbanken-anlegen.html b/doc/INSTALL/Datenbanken-anlegen.html index ce91f4010..5ceaccc5c 100644 --- a/doc/INSTALL/Datenbanken-anlegen.html +++ b/doc/INSTALL/Datenbanken-anlegen.html @@ -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/OpenDocument_002dVorlagen.html b/doc/INSTALL/OpenDocument_002dVorlagen.html index a5f4ebe73..9840516c1 100644 --- a/doc/INSTALL/OpenDocument_002dVorlagen.html +++ b/doc/INSTALL/OpenDocument_002dVorlagen.html @@ -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 diff --git a/doc/UPGRADE b/doc/UPGRADE index 6f9a9ec5f..03bb3b6cd 100644 --- a/doc/UPGRADE +++ b/doc/UPGRADE @@ -27,6 +27,16 @@ Zumindest folgende Module sind neu benötigt: Distribution sollte für die automatische Installation der anderen zwei Pakete sorgen) + Neue Gruppenrechte + ------------------ + +Es wurde ein neues Recht "Druck" eingeführt. Dieses bestimmt, ob die +Benutzerin das Menü "Druck" zu Gesicht bekommt oder nicht, unabhängig +davon, wie die Rechte für die einzelnen Unterpunkte gesetzt sind. + +Für bereits bestehende Gruppen muss es sofern gewünscht vom +Administrator manuell gewährt werden. + Upgrade auf v2.6.1 ================== diff --git a/doc/changelog b/doc/changelog index a9ffd7d86..643eac48d 100644 --- a/doc/changelog +++ b/doc/changelog @@ -2,9 +2,7 @@ # Veränderungen von Lx-Office ERP # ################################### - - - +2011-02-?? - Release 2.6.2 Größere neue Features: @@ -13,6 +11,16 @@ Das Program läuft jetzt optional unter FastCGI, und damit etwa um Faktor 10 schneller. Siehe Dokumentation in doc INSTALL.fcgi. + - Neues Gruppenrecht "Druck" + + Es wurde ein neues Recht "Druck" eingeführt. Dieses bestimmt, ob + die Benutzerin das Menü "Druck" zu Gesicht bekommt oder nicht, + unabhängig davon, wie die Rechte für die einzelnen Unterpunkte + gesetzt sind. + + Für bereits bestehende Gruppen muss es sofern gewünscht vom + Administrator manuell gewährt werden. + Kleinere neue Features und Detailverbesserungen: - Druckvorlage optional auf Excel erweitert, um Variablen die sich nicht in foreach-Schleifen @@ -46,25 +54,92 @@ Liste gefixter Bugs aus dem Bugtracker: - - - Bug 1388 - Berichte sind defekt, wenn abweichendes Datumsformat (ISO) eingestellt ist - - Bug 1395 - Einlagern ueber Lieferschein: Einheiten entsprechen nicht den Standardeinheiten der Artikel - - Bug 1398 - Im Lagerjournal werden Projektnummern nicht erfasst - - Bug 1409 - Bei "Erzeugnis fertigen" wird nur der Bestand der letzten Komponente geprüft - - Bug 1412 - Wenn die Ware ausgewählt werden muss wird der Rabatt verworfen - - Bug 1421 - Stornorechnungen loeschen bereitet Probleme - - Bug 1484 - Das Ankreuzfeld 'alle' hat keine Funktion wenn man einen Auswahlliste (multibox) an Lieferanten hat - Es wird trotzdem nach der Auswahlliste gefiltert und die Option 'alle' wird - ignoriert auch wenn man auf Erneuern klickt. - Das Eingabefeld 'Betrag' im oberen Teil der Maske hat in Lx-Office - keinen Sinn mehr, da nur noch über die Auswahl der offenen - Kreditorenposten ein Zahlungsausgang veranlasst wird. - Neu-Aufbau Lx-Office Bildschirm - Nach einer erfolgreichen Buchung erscheint die Meldung: 'Zahlung gebucht.' und - die Startseite wird angezeigt. Wünschenwert wäre es, wenn man in - Zahlungsverkehr bleiben würde, optimalerweise mit vorbelegten Feldern. - - Bug 1502 - 2. Zahlung buchen, auch wenn die erste Zahlung in einen abgeschlossenen Zeitraum liegt - + - Bugfix 1131: Einkaufslieferscheine: Mengen muessen beim Auslagern manuell in die maske eingetragen werden + - Bugfix 1154: Debitoren und Kreditoren werden nicht korrekt gebucht + - Bugfix 1185: Preis überschreiben bei Preisgruppe + - Bugfix 1220: Zahlungsverkehr - Zahlungseingang: Aufteilung des Rechnungsbetrages + - Bugfix 1277: Fehler in der BWA Zuordnung in den SKR03 und dem daraus generierten skr04 + - Bugfix 1298: SKR04 überarbeitet + - Bugfix 1302: Inkonsistenz in Buchungsdaten: In Verkaufsrechnungen wird die Zahlung nicht angezeit, Gegenbuchung fehlt + - Bugfix 1367: Feature-Vorschlag: SEPA auch für Lastschriften von Debitoren unterstützen + - Bugfix 1370: Umlautfehler beim Erfassen einer Einkaufsrechnung + - Bugfix 1375: Übersetzungsdateien im Verzeichnis ""locale/de/"" immer noch in ISO-8859-15 kodiert statt UTF-8 + - Bugfix 1376: Benutzerdefinierte Variablen sollten auch im mahnsystem zur Verfuegung stehen + - Bugfix 1378: leere Buchungen (text, beschreibung und referenz) bei Splittbuchungen + - Bugfix 1381: missing files in package + - Bugfix 1383: Dienstleistungen in Stammdaten und Lager + - Bugfix 1384: Zinsen bei Mahnung falsch berechnet + - Bugfix 1387: Englische Eingabemaske bei Aufruf von Deb./Kred.-buchung aus Buchungsjournal + - Bugfix 1388: Berichte sind defekt, wenn abweichendes Datumsformat (ISO) eingestellt ist + - Bugfix 1389: Bilanz repariert + - Bugfix 1393: CSV-Export sollte ohne Tausender-Trenner erfolgen + - Bugfix 1395: Einlagern ueber Lieferschein: Einheiten entsprechen nicht den Standardeinheiten der Artikl + - Bugfix 1398: Im Lagerjournal werden Projektnummern nicht erfasst + - Bugfix 1399: Lieferdaten zu einzelnen Positionen ""verrutschen"" beim Loeschen hoeherer Positionszeilen + - Bugfix 1400: Lieferscheine: Usability bei Auslagerung - Positionsindikator + - Bugfix 1406: Kunde erfassen + - Bugfix 1410: Beschriftung bei Eingabe der Einkaufsrechnung falsch + - Bugfix 1412: Wenn die Ware ausgewählt werden muss wird der Rabatt verworfen + - Bugfix 1414: Einfügen der \usepackage{textcomp}-Zeile in TeX-Templates ungünstig + - Bugfix 1422: Loeschen von Stornos bereitet eine Reihe von Problemen: (3)Gutschriften aus Rechnungen, die einstmals storniert wurden + - Bugfix 1429: Debitorenbuchungen 1: Wechsel des Debitoren loescht Bemerkungsfeld nicht + - Bugfix 1432: Mahnläufe: Nach manuellem Zurücksetzen der Mahnstufen gibt es ein Chaos bei der weiteren Erzeugung + - Bugfix 1439: Sortierkriterium ""Strasse"" in Listenansicht der Lieferanten geht nicht + - Bugfix 1440: Eingrenzen der angelegten Waren nach Lieferant liefert immer kein Ergebnis + - Bugfix 1445: Kleines Chaos bei Vorlagenbezeichnungen zu Lieferscheinen: picklist, packing_list, sales_delivery_order + - Bugfix 1449: Konto 3170 langfristige Verbindlichkeiten SKR04 Aktiva + - Bugfix 1451: Menüsetup Alt (seitlich) wird nicht lokalisiert + - Bugfix 1452: Fehler bei Lokalisierung der Überschriften und weiterer Beschriftungen + - Bugfix 1454: mehrere Rechnungen mit gleicher Rechnungsnummer möglich + - Bugfix 1455: Feld wird nach Einlagerung nicht zurückgesetzt. + - Bugfix 1456: Lieferanschrift wird im Workflow nicht zuverlässig vom Auftrag in den Lieferschein übernommen + - Bugfix 1459: Gruppen bearbteien unter FCGI + - Bugfix 1467: System entsperren nicht möglich + - Bugfix 1468: Title Javascript setzt den Titel auch, wenn die Informationen nicht verfügbar sind. + - Bugfix 1469: Umlaute gehen auf der Startseite kaputt bei update von 2.6.1 auf unstable (August 2010) + - Bugfix 1470: Falsche Übersetzung für ""Expenses EU without UStId"" + - Bugfix 1471: System -> Historien Suchmaschinen gibt folgenden Fehler: + - Bugfix 1472: Bei fehlender config/authentication.pl -> Webserver Error 500 + - Bugfix 1475: Workflow Angebot -> Rechnung wird Angebotsnummer nicht übernommen + - Bugfix 1477: Sicherheitsloch bei 2.6er Versionen + - Bugfix 1479: Debian Paket bauen schlägt fehl + - Bugfix 1480: Filter für Abteilungen ohne Ergebnis + - Bugfix 1483: Formelberechnung und Zahlenformat + - Bugfix 1484: Zahlungsausgang diverses + - Bugfix 1485: Rechnung->neuer Artikel->Speichern->Fehler ""Can't use string ... as a HASH ref ... bin/mozilla/io.pl line 2075"" + - Bugfix 1487: Wechselkurs wird falsch ausgelesen + - Bugfix 1488: Ust-Voranmeldung - Elster-Export nach Taxbird + - Bugfix 1491: Nitpicking: Beim ersten Login in eine DB werden im Text HTML Formatierungen ausgegeben, nicht interpretiert + - Bugfix 1492: ""Korrekturen im Hauptbuch"" wirft Fehler + - Bugfix 1494: undokumentiert -- dependency parent.pm / Dokumentvariable ustid + - Bugfix 1495: Ansicht von Artikelbilderen (Suchergebnis/Artikelmaske) + - Bugfix 1496: Grad-Symbol (°) verursacht Latex-Fehler + - Bugfix 1498: (versehentlicher?) commit der menu.ini mit crm Spalte + - Bugfix 1499: Einstellungen ""Nicht rabattierfähig"" ist nicht für Dienstleistungen verfügbar (z.B. Versandkosten) + - Bugfix 1502: Bücherkontrolle prüft auch ALTE Zahlungseingänge + - Bugfix 1504: UStVa Modul SQL Fehler: ""text >= integer"" nicht erlaubt + - Bugfix 1506: Email-Formular: Mailadresse der Firma anstelle des Ansprechpartners + - Bugfix 1517: Kreditorrechnung: Wechselkurs bei gleichem Re.-Datum nicht vorhanden + - Bugfix 1520: Division-by-Zero-Fehler bei einigen Rechnungsbuchungen + - Bugfix 1521: Fix von Bug 1521 bringt neuen Fehler bei Login und Verkaufsmasken + - Bugfix 1523: Rabatt geht verloren, wenn Rechnung aus Lieferscheinliste generiert wird + - Bugfix 1524: Kundenrabatt geht verloren (wie 1284, aber auch Einkauf) + - Bugfix 1528: Vorlagen + - Bugfix 1529: falsche Tabellendefinition in Default-request_quotation.tex + - Bugfix 1530: Debitorenbuchung: Abfragefehler bei Kontonummer mit ""."" (Punkt) oder Text + - Bugfix 1533: Zahlungen in Rechnungsmaske einbuchen scheitert an locale + - Bugfix 1535: CSV-Exporte sind nicht mehr UTF8 + - Bugfix 1536: 'Alte' dbupgrade Skripte die SL::DBUtils verwenden sind defekt + - Bugfix 1537: Debitoren: Feld curr in Tabelle ar wird nicht gefüllt + - Bugfix 1541: Preisgruppeneintrag in Einkaufsrechungen ?? + - Bugfix 1547: Kreditorenbuchung in Fremdwährung: Steuerfehler + - Bugfix 1550: Sortieren einer Kundenauflistung ""vergisst"" gewählte Filterkriterien + - Bugfix 1552: Diverse Probleme mit der Sortierfunktion bei Stammdaten + - Bugfix 1553: Diese Kundennummer wird bereits verwendet. - Obwohl keine eingetragen ist + - Bugfix 1554: Kein Wechselkurs bei Debitotenbuchung in Fremdwährung unter 1 bei gleichem Datum + - Bugfix 1555: Sonderzeichen nicht korrekt escaped (Stückliste beim Erstellen eines Erzeugnisses) + - Bugfix 1561: benutzerdefinierte Variable wird unabsichtlich deaktiviert + - Bugfix 1562: Fehlender Hinweis im changelog zu gaenderten Rechten Beim Druck 2010-03-24 - Release 2.6.1 diff --git a/locale/de/all b/locale/de/all index 115222d37..1904fa978 100644 --- a/locale/de/all +++ b/locale/de/all @@ -38,9 +38,12 @@ $self->{texts} = { '4. Quarter' => '4. Quartal', 'What do you want to look for?' => 'Wonach wollen Sie suchen?', 'A Buchungsgruppe consists of a descriptive name and the account numbers for the income and expense accounts for those four tax zones as well as the inventory account number.' => 'Eine Buchungsgruppe besteht aus einem deskriptiven Namen, den Erlös- und Aufwandskonten für diese vier Steuerzonen sowie aus einem Inventarkonto.', + 'A digit is required.' => 'Eine Ziffer ist vorgeschrieben.', 'A group named "Full Access" has been created.' => 'Eine Gruppe namens "Vollzugriff" wurde angelegt.', 'A group with that name does already exist.' => 'Eine Gruppe mit diesem Namen gibt es bereits.', 'A lot of the usability of Lx-Office has been enhanced with javascript. Although it is currently possible to use every aspect of Lx-Office without javascript, we strongly recommend it. In a future version this may change and javascript may be necessary to access advanced features.' => 'Die Bedienung von Lx-Office wurde an vielen Stellen mit Javascript verbessert. Obwohl es derzeit möglich ist, jeden Aspekt von Lx-Office auch ohne Javascript zu benutzen, empfehlen wir es. In einer zukünftigen Version wird Javascript eventuell notwendig sein um weitergehende Features zu benutzen.', + 'A lower-case character is required.' => 'Ein Kleinbuchstabe ist vorgeschrieben.', + 'A special character is required (valid characters: #1).' => 'Ein Sonderzeichen ist vorgeschrieben (gültige Zeichen: #1).', 'A temporary directory could not be created:' => 'Ein temporäres Verzeichnis konnte nicht erstellt werden:', 'A temporary file could not be created. Please verify that the directory "#1" is writeable by the webserver.' => 'Eine temporäre Datei konnte nicht angelegt werden. Bitte stellen Sie sicher, dass das Verzeichnis "#1" vom Webserver beschrieben werden darf.', 'A temporary file could not be created:' => 'Eine temporäre Datei konnte nicht erstellt werden:', @@ -180,6 +183,9 @@ $self->{texts} = { 'Amount' => 'Betrag', 'Amount Due' => 'Betrag fällig', 'Amount has to be greater then zero! Wrong row number: ' => 'Leere Eingabe oder Werte kleiner, gleich null eingegeben. Fehler in Reihe Nummer: ', + 'An invalid character was used (invalid characters: #1).' => 'Ein ungültiges Zeichen wurde benutzt (ungültige Zeichen: #1).', + 'An invalid character was used (valid characters: #1).' => 'Ein ungültiges Zeichen wurde benutzt (gültige Zeichen: #1).', + 'An upper-case character is required.' => 'Ein Großbuchstabe ist vorgeschrieben.', 'Annotations' => 'Anmerkungen', 'Another user with the login #1 does already exist.' => 'Es existiert bereits ein anderer Benutzer mit diesem Login.', 'Ap aging on %s' => 'Offene Verbindlichkeiten zum %s', @@ -487,7 +493,7 @@ $self->{texts} = { 'Database Host' => 'Datenbankcomputer', 'Database User' => 'Datenbankbenutzer', 'Database User missing!' => 'Datenbankbenutzer fehlt!', - 'Database backups and restorations are disabled in lx-erp.conf.' => 'Datenbanksicherungen und -wiederherstellungen sind in der lx-erp.conf deaktiviert.', + 'Database backups and restorations are disabled in the configuration.' => 'Datenbanksicherungen und -wiederherstellungen sind in der Konfiguration deaktiviert.', 'Database name' => 'Datenbankname', 'Database template' => 'Datenbankvorlage', 'Database update error:' => 'Fehler beim Datenbankupgrade:', @@ -815,7 +821,6 @@ $self->{texts} = { 'Help Template Variables' => 'Hilfe zu Dokumenten-Variablen', 'Here\'s an example command line:' => 'Hier ist eine Kommandozeile, die als Beispiel dient:', 'Hide by default' => 'Standardmäßig verstecken', - 'History' => 'Historie', 'History Search' => 'Historien Suche', 'History Search Engine' => 'Historien Suchmaschine', 'Homepage' => 'Homepage', @@ -1665,7 +1670,7 @@ $self->{texts} = { 'The group has been saved.' => 'Die Gruppe wurde gespeichert.', 'The group memberships have been saved.' => 'Die Gruppenmitgliedschaften wurden gespeichert.', 'The group name is missing.' => 'Der Gruppenname fehlt.', - 'The licensing module has been deactivated in lx-erp.conf.' => 'Das Lizenzverwaltungsmodul wurde in lx-erp.conf deaktiviert.', + 'The licensing module has been deactivated in the configuration.' => 'Das Lizenzverwaltungsmodul wurde in der Konfiguration deaktiviert.', 'The list has been printed.' => 'Die Liste wurde ausgedruckt.', 'The login is missing.' => 'Das Login fehlt.', 'The name in row %d has already been used before.' => 'Der Name in Zeile %d wurde vorher bereits benutzt.', @@ -1679,6 +1684,9 @@ $self->{texts} = { 'The parts have been removed.' => 'Die Waren wurden aus dem Lager entnommen.', 'The parts have been stocked.' => 'Die Artikel wurden eingelagert.', 'The parts have been transferred.' => 'Die Waren wurden umgelagert.', + 'The password is too long (maximum length: #1).' => 'Das Passwort ist zu lang (maximale Länge: #1).', + 'The password is too short (minimum length: #1).' => 'Das Password ist zu kurz (minimale Länge: #1).', + 'The password is weak (e.g. it can be found in a dictionary).' => 'Das Passwort ist schwach (z.B. wenn es in einem Wörterbuch steht).', 'The payments have been posted.' => 'Die Zahlungen wurden gebucht.', 'The pg_dump process could not be started.' => 'Der pg_dump-Prozess konnte nicht gestartet werden.', 'The pg_restore process could not be started.' => 'Der pg_restore-Prozess konnte nicht gestartet werden.', @@ -1697,6 +1705,7 @@ $self->{texts} = { 'The selected warehouse does not exist.' => 'Das ausgewählte Lager existiert nicht.', 'The selected warehouse is empty.' => 'Das ausgewählte Lager ist leer.', 'The session is invalid or has expired.' => 'Sie sind von Lx-Office abgemeldet.', + 'The settings were saved, but the password was not changed.' => 'Die Einstellungen wurden gespeichert, aber das Passwort wurde nicht geändert.', 'The source warehouse does not contain any bins.' => 'Das Quelllager enthält keine Lagerplätze.', 'The start date is missing.' => 'Das Startdatum fehlt.', 'The subject is missing.' => 'Der Betreff fehlt.', diff --git a/locale/de_DE/all b/locale/de_DE/all index 767bed1da..8a0ee8e6e 100644 --- a/locale/de_DE/all +++ b/locale/de_DE/all @@ -38,9 +38,12 @@ $self->{texts} = { '4. Quarter' => '4. Quartal', 'What do you want to look for?' => 'Wonach wollen Sie suchen?', 'A Buchungsgruppe consists of a descriptive name and the account numbers for the income and expense accounts for those four tax zones as well as the inventory account number.' => 'Eine Buchungsgruppe besteht aus einem deskriptiven Namen, den Erlös- und Aufwandskonten für diese vier Steuerzonen sowie aus einem Inventarkonto.', + 'A digit is required.' => '', 'A group named "Full Access" has been created.' => 'Eine Gruppe namens "Vollzugriff" wurde angelegt.', 'A group with that name does already exist.' => 'Eine Gruppe mit diesem Namen gibt es bereits.', 'A lot of the usability of Lx-Office has been enhanced with javascript. Although it is currently possible to use every aspect of Lx-Office without javascript, we strongly recommend it. In a future version this may change and javascript may be necessary to access advanced features.' => 'Die Bedienung von Lx-Office wurde an vielen Stellen mit Javascript verbessert. Obwohl es derzeit möglich ist, jeden Aspekt von Lx-Office auch ohne Javascript zu benutzen, empfehlen wir es. In einer zukünftigen Version wird Javascript eventuell notwendig sein um weitergehende Features zu benutzen.', + 'A lower-case character is required.' => '', + 'A special character is required (valid characters: #1).' => '', 'A temporary directory could not be created:' => 'Ein temporäres Verzeichnis konnte nicht erstellt werden:', 'A temporary file could not be created. Please verify that the directory "#1" is writeable by the webserver.' => 'Eine temporäre Datei konnte nicht angelegt werden. Bitte stellen Sie sicher, dass das Verzeichnis "#1" vom Webserver beschrieben werden darf.', 'A temporary file could not be created:' => 'Eine temporäre Datei konnte nicht erstellt werden:', @@ -180,6 +183,9 @@ $self->{texts} = { 'Amount' => 'Betrag', 'Amount Due' => 'Betrag fällig', 'Amount has to be greater then zero! Wrong row number: ' => '"Betrag" muss größer Null sein. Fehlerhafte Zeile: ', + 'An invalid character was used (invalid characters: #1).' => '', + 'An invalid character was used (valid characters: #1).' => '', + 'An upper-case character is required.' => '', 'Annotations' => 'Hilfe', 'Another user with the login #1 does already exist.' => 'Es existiert bereits ein anderer Benutzer mit diesem Login.', 'Ap aging on %s' => 'Offene Verbindlichkeiten zum %s', @@ -382,6 +388,7 @@ $self->{texts} = { 'Company Name' => 'Firmenname', 'Compare to' => 'Gegenüberstellen zu', 'Configuration of individual TODO items' => 'Konfiguration für die einzelnen Aufgabenlistenpunkte', + 'Configure' => '', 'Confirm' => 'Bestätigen', 'Confirm!' => 'Bestätigen Sie!', 'Confirmation' => 'Auftragsbestätigung', @@ -486,7 +493,7 @@ $self->{texts} = { 'Database Host' => 'Datenbankcomputer', 'Database User' => 'Datenbankbenutzer', 'Database User missing!' => 'Datenbankbenutzer fehlt!', - 'Database backups and restorations are disabled in lx-erp.conf.' => 'Datenbanksicherungen und -wiederherstellungen sind in der lx-erp.conf deaktiviert.', + 'Database backups and restorations are disabled in the configuration.' => 'Datenbanksicherungen und -wiederherstellungen sind in der Konfiguration deaktiviert.', 'Database name' => 'Datenbankname', 'Database template' => 'Datenbankvorlage', 'Database update error:' => 'Fehler beim Datenbankupgrade:', @@ -675,6 +682,7 @@ $self->{texts} = { 'Edit rights' => 'Rechte bearbeiten', 'Edit templates' => 'Vorlagen bearbeiten', 'Edit the Delivery Order' => 'Lieferschein bearbeiten', + 'Edit the configuration for periodic invoices' => '', 'Edit the membership of all users in all groups:' => 'Bearbeiten der Mitgliedschaft aller Benutzer in allen Gruppen:', 'Edit the purchase_order' => 'Bearbeiten des Lieferantenauftrags', 'Edit the request_quotation' => 'Bearbeiten der Preisanfrage', @@ -687,6 +695,7 @@ $self->{texts} = { 'Element disabled' => 'Element deaktiviert', 'Employee' => 'Bearbeiter', 'Empty transaction!' => 'Buchung ist leer!', + 'End date' => '', 'Enter a description for this new draft.' => 'Geben Sie eine Beschreibung für diesen Entwurf ein.', 'Enter longdescription' => 'Langtext eingeben', 'Enter the requested execution date or leave empty for the quickest possible execution:' => 'Geben Sie das jeweils gewünschte Ausführungsdatum an, oder lassen Sie das Feld leer für die schnellstmögliche Ausführung:', @@ -733,6 +742,7 @@ $self->{texts} = { 'Export date' => 'Exportdatum', 'Export date from' => 'Exportdatum von', 'Export date to' => 'Exportdatum bis', + 'Extend automatically by n months' => '', 'Extended' => 'Gesamt', 'Extension Of Time' => 'Dauerfristverlängerung', 'Factor' => 'Faktor', @@ -811,7 +821,6 @@ $self->{texts} = { 'Help Template Variables' => 'Hilfe zu Dokumenten-Variablen', 'Here\'s an example command line:' => 'Hier ist eine Kommandozeile, die als Beispiel dient:', 'Hide by default' => 'Standardmäßig verstecken', - 'History' => 'Historie', 'History Search' => 'Historien Suche', 'History Search Engine' => 'Historien Suchmaschine', 'Homepage' => 'Homepage', @@ -1198,8 +1207,13 @@ $self->{texts} = { 'Payment posted!' => 'Zahlung gebucht!', 'Payment terms deleted!' => 'Zahlungskonditionen gelöscht!', 'Payments' => 'Zahlungsausgänge', + 'Per. Inv.' => '', 'Period' => 'Zeitraum', 'Period:' => 'Zeitraum:', + 'Periodic Invoices' => '', + 'Periodic invoices active' => '', + 'Periodic invoices inactive' => '', + 'Periodicity' => '', 'Personal settings' => 'Meine Daten', 'Pg Database Administration' => 'Datenbankadministration', 'Phone' => 'Telefon', @@ -1265,6 +1279,7 @@ $self->{texts} = { 'Pricegroups' => 'Preisgruppen', 'Print' => 'Drucken', 'Print and Post' => 'Drucken und Buchen', + 'Print automatically' => '', 'Print dunnings' => 'Mahnungen drucken', 'Print list' => 'Liste ausdrucken', 'Print options' => 'Drucken', @@ -1500,6 +1515,7 @@ $self->{texts} = { 'Spoolfile' => 'Druckdatei', 'Start Dunning Process' => 'Neue Mahnung', 'Start analysis' => 'Analyse beginnen', + 'Start date' => '', 'Start the correction assistant' => 'Korrekturassistenten starten', 'Startdate_coa' => 'Gültig ab', 'Starting Balance' => 'Eröffnungsbilanzwerte', @@ -1507,6 +1523,7 @@ $self->{texts} = { 'Statement Balance' => 'Sammelrechnungsbilanz', 'Statement sent to' => 'Sammelrechnung verschickt an', 'Statements sent to printer!' => 'Sammelrechnungen an Drucker geschickt!', + 'Status' => '', 'Step 1 of 3: Parts' => 'Schritt 1 von 3: Waren', 'Step 2' => 'Schritt 2', 'Step 2 of 3: Services' => 'Schritt 2 von 3: Dienstleistungen', @@ -1632,6 +1649,7 @@ $self->{texts} = { 'The dunning process started' => 'Der Mahnprozess ist gestartet.', 'The dunnings have been printed.' => 'Die Mahnung(en) wurden gedruckt.', 'The email address is missing.' => 'Die Emailadresse fehlt.', + 'The end date is the last day for which invoices will possibly be created.' => '', 'The factor is missing in row %d.' => 'Der Faktor fehlt in Zeile %d.', 'The factor is missing.' => 'Der Faktor fehlt.', 'The first reason is that Lx-Office contained a bug which resulted in the wrong taxkeys being recorded for transactions in which two entries are posted for the same chart with different taxkeys.' => 'Zum Einen gab es einen Bug in Lx-Office, der dazu führte, dass bei Buchungen mit verschiedenen Steuerschlüssel auf ein Konto teilweise falsche Steuerschlüssel gespeichert wurden.', @@ -1652,7 +1670,7 @@ $self->{texts} = { 'The group has been saved.' => 'Die Gruppe wurde gespeichert.', 'The group memberships have been saved.' => 'Die Gruppenmitgliedschaften wurden gespeichert.', 'The group name is missing.' => 'Der Gruppenname fehlt.', - 'The licensing module has been deactivated in lx-erp.conf.' => 'Das Lizenzverwaltungsmodul wurde in lx-erp.conf deaktiviert.', + 'The licensing module has been deactivated in the configuration.' => 'Das Lizenzverwaltungsmodul wurde in der Konfiguration deaktiviert.', 'The list has been printed.' => 'Die Liste wurde ausgedruckt.', 'The login is missing.' => 'Das Login fehlt.', 'The name in row %d has already been used before.' => 'Der Name in Zeile %d wurde vorher bereits benutzt.', @@ -1666,6 +1684,9 @@ $self->{texts} = { 'The parts have been removed.' => 'Die Waren wurden aus dem Lager entnommen.', 'The parts have been stocked.' => 'Die Artikel wurden eingelagert.', 'The parts have been transferred.' => 'Die Waren wurden umgelagert.', + 'The password is too long (maximum length: #1).' => '', + 'The password is too short (minimum length: #1).' => '', + 'The password is weak (e.g. it can be found in a dictionary).' => '', 'The payments have been posted.' => 'Die Zahlungen wurden gebucht.', 'The pg_dump process could not be started.' => 'Der pg_dump-Prozess konnte nicht gestartet werden.', 'The pg_restore process could not be started.' => 'Der pg_restore-Prozess konnte nicht gestartet werden.', @@ -1684,7 +1705,9 @@ $self->{texts} = { 'The selected warehouse does not exist.' => 'Das ausgewählte Lager existiert nicht.', 'The selected warehouse is empty.' => 'Das ausgewählte Lager ist leer.', 'The session is invalid or has expired.' => 'Sie sind von Lx-Office abgemeldet.', + 'The settings were saved, but the password was not changed.' => '', 'The source warehouse does not contain any bins.' => 'Das Quelllager enthält keine Lagerplätze.', + 'The start date is missing.' => '', 'The subject is missing.' => 'Der Betreff fehlt.', 'The tables for user management and authentication do not exist. They will be created in the next step in the following database:' => 'Die Tabellen zum Speichern der Benutzerdaten und zur Benutzerauthentifizierung wurden nicht gefunden. Sie werden in der folgenden Datenbank angelegt:', 'The tabulator character' => 'Das Tabulator-Symbol', @@ -1871,6 +1894,7 @@ $self->{texts} = { 'Warehouse management' => 'Lagerverwaltung/Bestandsveränderung', 'Warehouse saved.' => 'Lager gespeichert.', 'Warehouses' => 'Lager', + 'Warning' => '', 'Warnings during template upgrade' => 'Warnungen bei Aktualisierung der Dokumentenvorlagen', 'WebDAV link' => 'WebDAV-Link', 'Weight' => 'Gewicht', @@ -1944,6 +1968,7 @@ $self->{texts} = { '[email]' => '[email]', 'account_description' => 'Beschreibung', 'accrual' => 'Bilanzierung (Soll-Versteuerung)', + 'active' => '', 'all entries' => 'alle Einträge', 'ap_aging_list' => 'liste_offene_verbindlichkeiten', 'ar_aging_list' => 'liste_offene_forderungen', @@ -1998,6 +2023,7 @@ $self->{texts} = { 'general_ledger_list' => 'buchungsjournal', 'history' => 'Historie', 'history search engine' => 'Historien Suchmaschine', + 'inactive' => '', 'invoice' => 'Rechnung', 'invoice_list' => 'debitorenbuchungsliste', 'lead deleted!' => 'Kundenquelle gelöscht', @@ -2011,11 +2037,13 @@ $self->{texts} = { 'mark as paid' => 'als bezahlt markieren', 'missing' => 'Fehlbestand', 'month' => 'Monatliche Abgabe', + 'monthly' => '', 'new Window' => 'neues Fenster', 'no' => 'nein', 'no bestbefore' => 'keine Mindesthaltbarkeit', 'no chargenumber' => 'keine Chargennummer', 'none (pricegroup)' => 'keine', + 'not configured' => '', 'not executed' => 'nicht ausgeführt', 'not transferred in yet' => 'noch nicht eingelagert', 'not transferred out yet' => 'noch nicht ausgelagert', @@ -2040,6 +2068,7 @@ $self->{texts} = { 'purchase_order' => 'Auftrag', 'purchase_order_list' => 'lieferantenauftragsliste', 'quarter' => 'Vierteljährliche (quartalsweise) Abgabe', + 'quarterly' => '', 'quotation_list' => 'angebotsliste', 'release_material' => 'Materialausgabebe', 'report_generator_dispatch_to is not defined.' => 'report_generator_dispatch_to ist nicht definiert.', @@ -2069,6 +2098,7 @@ $self->{texts} = { 'tax_taxdescription' => 'Steuername', 'tax_taxkey' => 'Steuerschlüssel', 'taxnumber' => 'Automatikkonto', + 'terminated' => '', 'to (date)' => 'bis', 'to (time)' => 'bis', 'transfer' => 'Umlagerung', @@ -2085,6 +2115,7 @@ $self->{texts} = { 'warehouse_journal_list' => 'lagerbuchungsliste', 'warehouse_report_list' => 'lagerbestandsliste', 'wrongformat' => 'Falsches Format', + 'yearly' => '', 'yes' => 'ja', }; diff --git a/modules/fallback/List/MoreUtils.pm b/modules/fallback/List/MoreUtils.pm index 01a251093..a38013871 100644 --- a/modules/fallback/List/MoreUtils.pm +++ b/modules/fallback/List/MoreUtils.pm @@ -5,6 +5,8 @@ use strict; require Exporter; require DynaLoader; + + use vars qw($VERSION @ISA @EXPORT_OK %EXPORT_TAGS); @ISA = qw(Exporter DynaLoader); @@ -12,12 +14,12 @@ use vars qw($VERSION @ISA @EXPORT_OK %EXPORT_TAGS); all => [ qw(any all none notall true false firstidx first_index lastidx last_index insert_after insert_after_string apply after after_incl before before_incl indexes firstval first_value lastval last_value each_array - each_arrayref pairwise natatime mesh zip uniq minmax part) ], + each_arrayref pairwise natatime mesh zip uniq minmax part bsearch) ], ); @EXPORT_OK = ( @{ $EXPORT_TAGS{'all'} } ); -$VERSION = '0.22'; +$VERSION = '0.25_02'; eval { local $ENV{PERL_DL_NONLAZY} = 0 if $ENV{PERL_DL_NONLAZY}; @@ -27,6 +29,8 @@ eval { eval <<'EOP' if not defined &any; +require POSIX; + sub any (&@) { my $f = shift; return if ! @_; @@ -47,7 +51,7 @@ sub all (&@) { sub none (&@) { my $f = shift; - return if ! @_; + return 1 if ! @_; for (@_) { return 0 if $f->(); } @@ -280,7 +284,8 @@ sub mesh (\@\@;\@\@\@\@\@\@\@\@\@\@\@\@\@\@\@\@\@\@\@\@\@\@\@\@\@\@\@\@\@\@) { sub uniq (@) { my %h; - map { $h{$_}++ == 0 ? $_ : () } @_; + my $ref = \1; + map { $h{defined $_ ? $_ : $ref}++ == 0 ? $_ : () } @_; } sub minmax (@) { @@ -318,11 +323,39 @@ sub part(&@) { return @parts; } +sub bsearch(&@) { + my $code = shift; + + my $rc; + my $i = 0; + my $j = @_; + do { + my $k = int(($i + $j) / 2); + + return if $k >= @_; + + local *_ = \$_[$k]; + $rc = $code->(); + + $rc == 0 and + return wantarray ? $_ : 1; + + if ($rc < 0) { + $i = $k + 1; + } else { + $j = $k - 1; + } + } until $i > $j; + + return; +} + sub _XScompiled { return 0; } EOP +die $@ if $@; *first_index = \&firstidx; *last_index = \&lastidx; @@ -663,6 +696,15 @@ Negative values are only ok when they refer to a partition previously created: my $i = 0; my @part = part { $idx[$++ % 3] } 1 .. 8; # [1, 4, 7], [2, 3, 5, 6, 8] +=item bsearch BLOCK LIST + +Performs a binary search on LIST which must be a sorted list of values. BLOCK +must return a negative value if the current element (stored in C<$_>) is smaller, +a positive value if it is bigger and zero if it matches. + +Returns a boolean value in scalar context. In list context, it returns the element +if it was found, otherwise the empty list. + =back =head1 EXPORTS @@ -685,7 +727,7 @@ environment. =head1 VERSION -This is version 0.22. +This is version 0.25_01. =head1 BUGS @@ -785,11 +827,11 @@ L =head1 AUTHOR -Tassilo von Parseval, Etassilo.von.parseval@rwth-aachen.deE +Tassilo von Parseval, Evparseval@gmail.comE =head1 COPYRIGHT AND LICENSE -Copyright (C) 2004-2006 by Tassilo von Parseval +Copyright (C) 2004-2009 by Tassilo von Parseval This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.8.4 or, diff --git a/scripts/console b/scripts/console index added9f83..78b730559 100755 --- a/scripts/console +++ b/scripts/console @@ -9,16 +9,16 @@ BEGIN { push @INC, "modules/fallback"; # Only use our own versions of modules if there's no system version. } -use Config::Std; use Data::Dumper; use Devel::REPL 1.002001; use Term::ReadLine::Perl::Bind; # use sane key binding for rxvt users -read_config 'config/lx_office.conf' => my %config; +use SL::LxOfficeConf; +SL::LxOfficeConf->read; -my $login = shift || $config{Console}{login} || 'demo'; -my $history_file = $config{Console}{history_file} || '/tmp/lxoffice_console_history.log'; # fallback if users is not writable -my $autorun = $config{Console}{autorun}; +my $login = shift || $::lx_office_conf{console}{login} || 'demo'; +my $history_file = $::lx_office_conf{console}{history_file} || '/tmp/lxoffice_console_history.log'; # fallback if users is not writable +my $autorun = $::lx_office_conf{console}{autorun}; # will be configed eventually my @plugins = qw(History LexEnv Colors MultiLine::PPI FancyPrompt PermanentHistory AutoloadModules); @@ -41,7 +41,6 @@ use utf8; use CGI qw( -no_xhtml); use DateTime; use SL::Auth; -use SL::Dispatcher; use SL::Form; use SL::Helper::DateTime; use SL::Locale; @@ -59,24 +58,12 @@ sub lxinit { package main; - { no warnings 'once'; - $::userspath = "users"; - $::templates = "templates"; - $::sendmail = "| /usr/sbin/sendmail -t"; - } - - eval { require "config/lx-erp.conf"; }; - eval { require "config/lx-erp-local.conf"; } if -f "config/lx-erp-local.conf"; - $::lxdebug = LXDebug->new; - $::locale = Locale->new($::language); + $::locale = Locale->new($::lx_office_conf{system}->{language}); $::cgi = CGI->new qw(); $::form = Form->new; $::auth = SL::Auth->new; - read_config 'config/lx_office.conf' => %::lx_office_conf; - SL::Dispatcher::_decode_recursively(\%::lx_office_conf); - die 'cannot reach auth db' unless $::auth->session_tables_present; $::auth->restore_session; diff --git a/scripts/dbupgrade2_tool.pl b/scripts/dbupgrade2_tool.pl index 74d6326a5..a9054aaff 100755 --- a/scripts/dbupgrade2_tool.pl +++ b/scripts/dbupgrade2_tool.pl @@ -16,13 +16,16 @@ use strict; use utf8; use English '-no_match_vars'; +use Config::Std; use DBI; use Data::Dumper; use Getopt::Long; use Text::Iconv; use SL::LXDebug; +use SL::LxOfficeConf; +SL::LxOfficeConf->read; our $lxdebug = LXDebug->new(); use SL::Auth; @@ -356,9 +359,6 @@ sub build_upgrade_order { ####### ####### -eval { require "config/lx-erp.conf"; }; -eval { require "config/lx-erp-local.conf"; } if (-f "config/lx-erp-local.conf"); - $form = Form->new(); $locale = Locale->new("de"); diff --git a/scripts/locales.pl b/scripts/locales.pl index b972a49db..f03e5c667 100755 --- a/scripts/locales.pl +++ b/scripts/locales.pl @@ -31,7 +31,7 @@ parse_args(); my $basedir = "../.."; my $locales_dir = "."; my $bindir = "$basedir/bin/mozilla"; -my @progdirs = ( "$basedir/SL/Controller", "$basedir/SL/Template/Plugin" ); +my @progdirs = ( "$basedir/SL/Controller", "$basedir/SL/Template/Plugin", "$basedir/SL/Auth" ); my $dbupdir = "$basedir/sql/Pg-upgrade"; my $dbupdir2 = "$basedir/sql/Pg-upgrade2"; my $menufile = "menu.ini"; diff --git a/scripts/rose_auto_create_model.pl b/scripts/rose_auto_create_model.pl index 8ef9f5fb0..bfb3e3d6a 100755 --- a/scripts/rose_auto_create_model.pl +++ b/scripts/rose_auto_create_model.pl @@ -8,6 +8,7 @@ BEGIN { } use CGI qw( -no_xhtml); +use Config::Std; use Data::Dumper; use English qw( -no_match_vars ); use List::MoreUtils qw(any); @@ -18,12 +19,14 @@ use SL::DB; use SL::Form; use SL::Locale; use SL::LXDebug; +use SL::LxOfficeConf; use SL::DB::Helper::ALL; use SL::DB::Helper::Mappings; our $form; our $cgi; our $auth; +our %lx_office_conf; our $script = __FILE__; $script =~ s:.*/::; @@ -40,17 +43,12 @@ sub setup { exit 1; } - my $login = shift @ARGV; + SL::LxOfficeConf->read; - $::userspath = "users"; - $::templates = "templates"; - $::sendmail = "| /usr/sbin/sendmail -t"; + my $login = shift @ARGV; $::lxdebug = LXDebug->new(); - require "config/lx-erp.conf"; - require "config/lx-erp-local.conf" if -f "config/lx-erp-local.conf"; - # locale messages $::locale = Locale->new("de"); $::form = new Form; diff --git a/scripts/spawn_oo.pl b/scripts/spawn_oo.pl index 26991f109..d0e8f789c 100755 --- a/scripts/spawn_oo.pl +++ b/scripts/spawn_oo.pl @@ -13,17 +13,12 @@ use SL::LXDebug; use SL::Form; use SL::Template; -$userspath = "users"; -$templates = "templates"; -$memberfile = "users/members"; $sendmail = "| /usr/sbin/sendmail -t"; $| = 1; $lxdebug = LXDebug->new(); -require "lx-erp.conf"; - $form = new Form; $form->{"script"} = "oe.pl"; diff --git a/scripts/task_server.pl b/scripts/task_server.pl index 5dae0b3a5..c2061b76d 100755 --- a/scripts/task_server.pl +++ b/scripts/task_server.pl @@ -16,7 +16,6 @@ BEGIN { } use CGI qw( -no_xhtml); -use Config::Std; use Cwd; use Daemon::Generic; use Data::Dumper; @@ -29,6 +28,7 @@ use SL::BackgroundJob::ALL; use SL::Form; use SL::Helper::DateTime; use SL::LXDebug; +use SL::LxOfficeConf; use SL::Locale; our %lx_office_conf; @@ -42,17 +42,8 @@ sub lxinit { package main; - { no warnings 'once'; - $::userspath = "users"; - $::templates = "templates"; - $::sendmail = "| /usr/sbin/sendmail -t"; - } - - eval { require "config/lx-erp.conf"; 1; } or die $EVAL_ERROR; - eval { require "config/lx-erp-local.conf"; 1; } or die $EVAL_ERROR if -f "config/lx-erp-local.conf"; - $::lxdebug = LXDebug->new; - $::locale = Locale->new($::language); + $::locale = Locale->new($::lx_office_conf{system}->{language}); $::cgi = CGI->new qw(); $::form = Form->new; $::auth = SL::Auth->new; @@ -98,7 +89,7 @@ sub drop_privileges { sub gd_preconfig { my $self = shift; - read_config $self->{configfile} => %lx_office_conf; + SL::LxOfficeConf->read; die "Missing section [task_server] in config file" unless $lx_office_conf{task_server}; die "Missing key 'login' in section [task_server] in config file" unless $lx_office_conf{task_server}->{login}; @@ -121,7 +112,7 @@ sub gd_run { foreach my $job (@{ $jobs }) { # Provide fresh global variables in case legacy code modifies # them somehow. - $::locale = Locale->new($::language); + $::locale = Locale->new($::lx_office_conf{system}->{language}); $::form = Form->new; $job->run; @@ -145,7 +136,8 @@ my $pidbase = "${cwd}/users/pid"; mkdir($pidbase) if !-d $pidbase; -newdaemon(configfile => "${cwd}/config/lx_office.conf", +my $file = -f "${cwd}/config/lx_office.conf" ? "${cwd}/config/lx_office.conf" : "${cwd}/config/lx_office.conf.default"; +newdaemon(configfile => $file, progname => 'lx-office-task-server', pidbase => "${pidbase}/", ); diff --git a/sql/Pg-upgrade/Pg-upgrade-2.2.0.33-2.2.0.34.pl b/sql/Pg-upgrade/Pg-upgrade-2.2.0.33-2.2.0.34.pl index 297b14ac0..cc9a0f322 100644 --- a/sql/Pg-upgrade/Pg-upgrade-2.2.0.33-2.2.0.34.pl +++ b/sql/Pg-upgrade/Pg-upgrade-2.2.0.33-2.2.0.34.pl @@ -162,18 +162,18 @@ sub update_known_buchungsgruppen { $sth->execute() || mydberror($query); my $query_update = "UPDATE parts SET buchungsgruppen_id = ?"; - $query_update .= ", inventory_accno_id = ?" if ($main::eur); + $query_update .= ", inventory_accno_id = ?" if $::lx_office_conf{system}->{eur}; $query_update .= " WHERE id = ?"; my $sth_update = $dbh->prepare($query_update); while (my $ref = $sth->fetchrow_hashref()) { foreach my $bg (@{$buchungsgruppen}) { - if (($main::eur || + if (($::lx_office_conf{system}->{eur} || ($ref->{"inventory_accno_id"} == $bg->{"inventory_accno_id"})) && ($ref->{"income_accno_id"} == $bg->{"income_accno_id_0"}) && ($ref->{"expense_accno_id"} == $bg->{"expense_accno_id_0"})) { my @values = ($bg->{"id"}, $ref->{"id"}); - splice(@values, 1, 0, $bg->{"inventory_accno_id"}) if ($main::eur); + splice(@values, 1, 0, $bg->{"inventory_accno_id"}) if $::lx_office_conf{system}->{eur}; $sth_update->execute(@values) || mydberror($query_update . " (" . join(", ", @values) . ")"); last; @@ -195,7 +195,7 @@ sub update_known_buchungsgruppen { if (($ref->{"income_accno_id"} == $bg->{"income_accno_id_0"}) && ($ref->{"expense_accno_id"} == $bg->{"expense_accno_id_0"})) { my @values = ($bg->{"id"}, $ref->{"id"}); - splice(@values, 1, 0, undef) if ($main::eur); + splice(@values, 1, 0, undef) if $::lx_office_conf{system}->{eur}; $sth_update->execute(@values) || mydberror($query_update . " (" . join(", ", @values) . ")"); last; @@ -299,7 +299,7 @@ sub display_create_bgs_dialog { $entry->{"ACC_INVENTORY"} = $acc_inventory; $entry->{"ACC_INCOME"} = $acc_income; $entry->{"ACC_EXPENSE"} = $acc_expense; - $entry->{"eur"} = $main::eur; + $entry->{"eur"} = $::lx_office_conf{system}->{eur}; } # $form->parse_html_template("dbupgrade/buchungsgruppen_parts") @@ -439,7 +439,7 @@ sub do_update { # If balancing is off then force parts.inventory_accno_id to # a single value for parts. - force_inventory_accno_id_for_parts() if ($main::eur); + force_inventory_accno_id_for_parts() if $::lx_office_conf{system}->{eur}; # Force "IC" to be present in chart.link for all accounts # which have been used as inventory accounts in parts. diff --git a/sql/Pg-upgrade2/invalid_entries_in_custom_variables_validity.sql b/sql/Pg-upgrade2/invalid_entries_in_custom_variables_validity.sql new file mode 100644 index 000000000..62dd9447e --- /dev/null +++ b/sql/Pg-upgrade2/invalid_entries_in_custom_variables_validity.sql @@ -0,0 +1,9 @@ +-- @tag: invalid_entries_in_custom_variables_validity +-- @description: Ungültige Einträge in custom_variables_validity bereinigen +-- @depends: release_2_6_1 +-- @charset: utf-8 +DELETE FROM custom_variables_validity +WHERE trans_id NOT IN ( + SELECT id + FROM parts +);

| . $locale->text('Copies') . qq| {copies}>