From 8cd05ad64866ce200f888a35723ae4b7e24a2012 Mon Sep 17 00:00:00 2001 From: Moritz Bunkus Date: Wed, 19 Jan 2011 14:03:10 +0100 Subject: [PATCH] Globale Variablen $::userspath, $::templates, $::membersfile nach %::lx_office_conf verschoben --- SL/AM.pm | 2 +- SL/AP.pm | 2 +- SL/BP.pm | 8 +++- SL/BackgroundJob/CreatePeriodicInvoices.pm | 2 +- SL/CT.pm | 2 +- SL/Controller/Base.pm | 2 +- SL/DATEV.pm | 4 +- SL/DN.pm | 21 +++++---- SL/DO.pm | 2 +- SL/Dispatcher.pm | 5 +- SL/Form.pm | 6 ++- SL/IS.pm | 9 ++-- SL/OE.pm | 3 +- SL/Template.pm | 2 +- SL/User.pm | 6 +-- bin/mozilla/admin.pl | 53 ++++++++++++---------- bin/mozilla/ap.pl | 2 +- bin/mozilla/bp.pl | 7 +-- bin/mozilla/dn.pl | 4 +- bin/mozilla/io.pl | 6 +-- bin/mozilla/is.pl | 2 +- bin/mozilla/oe.pl | 2 +- bin/mozilla/rp.pl | 2 +- config/lx-erp.conf | 12 ----- config/lx-erp.conf.default | 12 ----- config/lx_office.conf.default | 10 ++++ scripts/console | 2 - scripts/rose_auto_create_model.pl | 2 - scripts/spawn_oo.pl | 4 +- scripts/task_server.pl | 2 - 30 files changed, 96 insertions(+), 102 deletions(-) diff --git a/SL/AM.pm b/SL/AM.pm index e6101b402..bf5c97d0c 100644 --- a/SL/AM.pm +++ b/SL/AM.pm @@ -1434,7 +1434,7 @@ sub save_preferences { $myconfig->{$item} = $form->{$item}; } - $myconfig->save_member($main::memberfile); + $myconfig->save_member; my $auth = $main::auth; 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/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..dc89c3da4 100644 --- a/SL/BackgroundJob/CreatePeriodicInvoices.pm +++ b/SL/BackgroundJob/CreatePeriodicInvoices.pm @@ -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/Controller/Base.pm b/SL/Controller/Base.pm index c79ceecac..723ce1d6a 100644 --- a/SL/Controller/Base.pm +++ b/SL/Controller/Base.pm @@ -179,7 +179,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}; 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/DN.pm b/SL/DN.pm index 2cc87df2c..e9a7e8133 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,7 +661,8 @@ 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; @@ -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..7ed6724b3 100644 --- a/SL/DO.pm +++ b/SL/DO.pm @@ -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); diff --git a/SL/Dispatcher.pm b/SL/Dispatcher.pm index e92af8b02..57e2b545b 100644 --- a/SL/Dispatcher.pm +++ b/SL/Dispatcher.pm @@ -87,9 +87,6 @@ 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; @@ -193,7 +190,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}"; diff --git a/SL/Form.pm b/SL/Form.pm index 345e61301..35a87340a 100644 --- a/SL/Form.pm +++ b/SL/Form.pm @@ -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}"; diff --git a/SL/IS.pm b/SL/IS.pm index 7087c5aa0..6c3a95365 100644 --- a/SL/IS.pm +++ b/SL/IS.pm @@ -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; } @@ -2080,13 +2081,13 @@ sub get_pricegroups_for_parts { # 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"} + } 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 ) { diff --git a/SL/OE.pm b/SL/OE.pm index 7f0c8e363..b12932bef 100644 --- a/SL/OE.pm +++ b/SL/OE.pm @@ -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; } 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/User.pm b/SL/User.pm index 024a683db..becfcb799 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" : diff --git a/bin/mozilla/admin.pl b/bin/mozilla/admin.pl index eee799958..acaae17e0 100755 --- a/bin/mozilla/admin.pl +++ b/bin/mozilla/admin.pl @@ -144,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 = $&; } @@ -155,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(); @@ -179,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 = { @@ -203,7 +205,8 @@ sub migrate_users { my $memberdir = ""; - if ($main::memberfile =~ m|^.*/|) { + my $memberfile = $::lx_office_conf{paths}->{memberfile}; + if ($memberfile =~ m|^.*/|) { $memberdir = $&; } @@ -213,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); @@ -266,7 +269,7 @@ sub migrate_users { } } - unlink $main::memberfile; + unlink $memberfile; my @member_list = sort { lc $a->{login} cmp lc $b->{login} } values %members; @@ -341,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(); @@ -411,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; @@ -497,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}); @@ -522,7 +525,7 @@ sub save_user { $myconfig->save_member(); $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 @@ -534,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") @@ -1097,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"; @@ -1109,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); @@ -1180,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/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/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/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/io.pl b/bin/mozilla/io.pl index 3ec65da21..060efe84a 100644 --- a/bin/mozilla/io.pl +++ b/bin/mozilla/io.pl @@ -1611,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; @@ -1619,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"; @@ -1647,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/is.pl b/bin/mozilla/is.pl index 740002bee..eaf092370 100644 --- a/bin/mozilla/is.pl +++ b/bin/mozilla/is.pl @@ -964,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/oe.pl b/bin/mozilla/oe.pl index d70ee6fc7..e05c90635 100644 --- a/bin/mozilla/oe.pl +++ b/bin/mozilla/oe.pl @@ -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}; diff --git a/bin/mozilla/rp.pl b/bin/mozilla/rp.pl index 25e62594e..0dbea7864 100644 --- a/bin/mozilla/rp.pl +++ b/bin/mozilla/rp.pl @@ -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); } } diff --git a/config/lx-erp.conf b/config/lx-erp.conf index 1e17ab36b..f28d8e3e6 100644 --- a/config/lx-erp.conf +++ b/config/lx-erp.conf @@ -9,18 +9,6 @@ our ( $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; diff --git a/config/lx-erp.conf.default b/config/lx-erp.conf.default index 1e17ab36b..f28d8e3e6 100644 --- a/config/lx-erp.conf.default +++ b/config/lx-erp.conf.default @@ -9,18 +9,6 @@ our ( $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; diff --git a/config/lx_office.conf.default b/config/lx_office.conf.default index aa581a64d..4a0d9b327 100644 --- a/config/lx_office.conf.default +++ b/config/lx_office.conf.default @@ -1,3 +1,13 @@ +[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 + [task_server] # User name to use for database access login = mb diff --git a/scripts/console b/scripts/console index 4d89fdb57..5e85b0264 100755 --- a/scripts/console +++ b/scripts/console @@ -60,8 +60,6 @@ sub lxinit { package main; { no warnings 'once'; - $::userspath = "users"; - $::templates = "templates"; $::sendmail = "| /usr/sbin/sendmail -t"; } diff --git a/scripts/rose_auto_create_model.pl b/scripts/rose_auto_create_model.pl index 8ef9f5fb0..43d1af9eb 100755 --- a/scripts/rose_auto_create_model.pl +++ b/scripts/rose_auto_create_model.pl @@ -42,8 +42,6 @@ sub setup { my $login = shift @ARGV; - $::userspath = "users"; - $::templates = "templates"; $::sendmail = "| /usr/sbin/sendmail -t"; $::lxdebug = LXDebug->new(); diff --git a/scripts/spawn_oo.pl b/scripts/spawn_oo.pl index 26991f109..2e4b2ff8c 100755 --- a/scripts/spawn_oo.pl +++ b/scripts/spawn_oo.pl @@ -5,6 +5,7 @@ BEGIN { push @INC, "modules/fallback"; # Only use our own versions of modules if there's no system version. } + use DBI; use Data::Dumper; @@ -13,9 +14,6 @@ use SL::LXDebug; use SL::Form; use SL::Template; -$userspath = "users"; -$templates = "templates"; -$memberfile = "users/members"; $sendmail = "| /usr/sbin/sendmail -t"; $| = 1; diff --git a/scripts/task_server.pl b/scripts/task_server.pl index 5dae0b3a5..cbdc1bd12 100755 --- a/scripts/task_server.pl +++ b/scripts/task_server.pl @@ -43,8 +43,6 @@ sub lxinit { package main; { no warnings 'once'; - $::userspath = "users"; - $::templates = "templates"; $::sendmail = "| /usr/sbin/sendmail -t"; } -- 2.20.1