From be6f6cfd8dc7def5356edd0c5aacb814b4baded1 Mon Sep 17 00:00:00 2001 From: Moritz Bunkus Date: Wed, 19 Jan 2011 15:42:22 +0100 Subject: [PATCH] =?utf8?q?Globale=20Variablen=20f=C3=BCr=20Systemeinstellu?= =?utf8?q?ngen=20und=20Features=20nach=20%::lx=5Foffice=5Fconf=20verschobe?= =?utf8?q?n?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Betroffen sind: $webdav $vertreter $lizenzen $show_best_before $parts_show_image $parts_image_css $parts_listing_images $eur $dbcharset $language --- SL/Auth.pm | 4 +-- SL/Common.pm | 2 +- SL/Controller/Base.pm | 12 +++---- SL/DB/Helper/PriceTaxCalculator.pm | 4 +-- SL/DB/Invoice.pm | 2 +- SL/DBUpgrade2.pm | 2 +- SL/DO.pm | 4 +-- SL/Dispatcher.pm | 6 ++-- SL/FCGIFixes.pm | 2 +- SL/Form.pm | 26 +++++++------- SL/IR.pm | 6 ++-- SL/IS.pm | 6 ++-- SL/Locale.pm | 6 ++-- SL/OE.pm | 4 +-- SL/ReportGenerator.pm | 2 +- SL/Template/OpenDocument.pm | 2 +- SL/User.pm | 4 +-- bin/mozilla/admin.pl | 8 ++--- bin/mozilla/am.pl | 6 ++-- bin/mozilla/ca.pl | 10 +++--- bin/mozilla/ct.pl | 4 +-- bin/mozilla/do.pl | 8 ++--- bin/mozilla/ic.pl | 2 +- bin/mozilla/installationcheck.pl | 3 +- bin/mozilla/invoice_io.pl | 2 +- bin/mozilla/io.pl | 8 ++--- bin/mozilla/ir.pl | 2 +- bin/mozilla/is.pl | 6 ++-- bin/mozilla/licenses.pl | 4 +-- bin/mozilla/login.pl | 2 +- bin/mozilla/menuXML.pl | 2 +- bin/mozilla/oe.pl | 6 ++-- bin/mozilla/rp.pl | 4 +-- bin/mozilla/sepa.pl | 2 +- bin/mozilla/wh.pl | 2 +- config/lx-erp.conf | 36 ------------------- config/lx-erp.conf.default | 36 ------------------- config/lx_office.conf.default | 30 ++++++++++++++++ scripts/console | 2 +- scripts/task_server.pl | 4 +-- .../Pg-upgrade-2.2.0.33-2.2.0.34.pl | 12 +++---- 41 files changed, 128 insertions(+), 167 deletions(-) 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/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 834c3e4b6..8135b5558 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,13 +67,13 @@ sub render { AUTH => $::auth, FORM => $::form, LOCALE => $::locale, - LXCONFIG => { dbcharset => $::dbcharset, - webdav => $::webdav, - lizenzen => $::lizenzen, + LXCONFIG => { dbcharset => $::lx_office_conf{system}->{dbcharset}, + webdav => $::lx_office_conf{system}->{webdav}, + lizenzen => $::lx_office_conf{system}->{lizenzen}, latex_templates => $::lx_office_conf{print_templates}->{latex}, opendocument_templates => $::lx_office_conf{print_templates}->{opendocument}, - vertreter => $::vertreter, - show_best_before => $::show_best_before, + vertreter => $::lx_office_conf{system}->{vertreter}, + show_best_before => $::lx_office_conf{system}->{show_best_before}, }, LXDEBUG => $::lxdebug, MYCONFIG => \%::myconfig, diff --git a/SL/DB/Helper/PriceTaxCalculator.pm b/SL/DB/Helper/PriceTaxCalculator.pm index 63dde450a..29c78f624 100644 --- a/SL/DB/Helper/PriceTaxCalculator.pm +++ b/SL/DB/Helper/PriceTaxCalculator.pm @@ -163,7 +163,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, @@ -184,7 +184,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/DO.pm b/SL/DO.pm index 7ed6724b3..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(); @@ -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 9ba2b70cf..3624cecef 100644 --- a/SL/Dispatcher.pm +++ b/SL/Dispatcher.pm @@ -52,10 +52,10 @@ sub show_error { my $template = shift; my $error_type = shift || ''; - $::locale = Locale->new($::language); + $::locale = Locale->new($::lx_office_conf{system}->{language}); $::form->{error} = $::locale->text('The session is invalid or has expired.') if ($error_type eq 'session'); $::form->{error} = $::locale->text('Incorrect password!.') if ($error_type eq 'password'); - $::myconfig{countrycode} = $::language; + $::myconfig{countrycode} = $::lx_office_conf{system}->{language}; $::form->{stylesheet} = 'css/lx-office-erp.css'; $::form->header; @@ -164,7 +164,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 = (); 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 ae1bfb140..a753dbc40 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_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"} = $::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_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; @@ -1311,7 +1311,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."; 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 6c3a95365..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; @@ -1584,7 +1584,7 @@ sub retrieve_invoice { } $sth->finish; - Common::webdav_folder($form) if ($main::webdav); + Common::webdav_folder($form); } my $rc = $dbh->commit; 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/OE.pm b/SL/OE.pm index b12932bef..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; @@ -993,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/OpenDocument.pm b/SL/Template/OpenDocument.pm index e2f7dcd63..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} = '"'; diff --git a/SL/User.pm b/SL/User.pm index becfcb799..520bf4229 100644 --- a/SL/User.pm +++ b/SL/User.pm @@ -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 3d1185deb..b1b24737b 100755 --- a/bin/mozilla/admin.pl +++ b/bin/mozilla/admin.pl @@ -767,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); @@ -934,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(); @@ -958,7 +958,7 @@ sub restore_dataset { $form->error($locale->text('Database backups and restorations are disabled in lx-erp.conf.')); } - my $default_charset = $main::dbcharset; + my $default_charset = $::lx_office_conf{system}->{dbcharset}; $default_charset ||= Common::DEFAULT_CHARSET; $form->{DBENCODINGS} = []; diff --git a/bin/mozilla/am.pl b/bin/mozilla/am.pl index 3c31bdd42..bcf934ed1 100644 --- a/bin/mozilla/am.pl +++ b/bin/mozilla/am.pl @@ -1111,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|| @@ -1224,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| @@ -1873,7 +1873,7 @@ sub buchungsgruppe_header { } my $linkaccounts; - if (!$main::eur) { + if (!$::lx_office_conf{system}->{eur}) { $linkaccounts = qq| | . $locale->text('Inventory') . qq| 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/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/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 952768611..c8097e325 100644 --- a/bin/mozilla/invoice_io.pl +++ b/bin/mozilla/invoice_io.pl @@ -163,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 2b9c780b0..af69e4488 100644 --- a/bin/mozilla/io.pl +++ b/bin/mozilla/io.pl @@ -489,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; @@ -497,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"} } }) { @@ -622,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); } @@ -937,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"); 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 eaf092370..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"); @@ -561,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"} } }) { diff --git a/bin/mozilla/licenses.pl b/bin/mozilla/licenses.pl index 95f520ff9..5e396fd5f 100644 --- a/bin/mozilla/licenses.pl +++ b/bin/mozilla/licenses.pl @@ -325,7 +325,7 @@ 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.') @@ -518,7 +518,7 @@ 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.') 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/menuXML.pl b/bin/mozilla/menuXML.pl index 245afa137..2e7de670a 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 =~ /^(\.\/)?$/; diff --git a/bin/mozilla/oe.pl b/bin/mozilla/oe.pl index e05c90635..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}"), @@ -1924,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 4ce3f5e33..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; 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 index 32f27012c..0afc6045c 100644 --- a/config/lx-erp.conf +++ b/config/lx-erp.conf @@ -1,37 +1 @@ -use Cwd; - -our ( - $dbcharset, $eur, $language, - $lizenzen, - $parts_image_css, $parts_listing_images, $parts_show_image, - $show_best_before, $vertreter, $webdav -); - -# Wenn Einnahmen-Überschussrechnung, dann auf 1 setzen -# Wenn Bilanzierung (z.B. GmbH), dann auf 0 setzen -$eur = 1; - -# set language for login and admin -# currently "de" (German), "de_DE" (new German) and "en" (English, not perfect) are available -$language = "de"; - -# 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] - -# Das charset, in dem die Daten in der Datenbank abgelegt sind. -$dbcharset = 'UTF-8'; # Für UNICODE UTF-8 -# $dbcharset = "ISO-8859-15"; - 1; diff --git a/config/lx-erp.conf.default b/config/lx-erp.conf.default index 32f27012c..0afc6045c 100644 --- a/config/lx-erp.conf.default +++ b/config/lx-erp.conf.default @@ -1,37 +1 @@ -use Cwd; - -our ( - $dbcharset, $eur, $language, - $lizenzen, - $parts_image_css, $parts_listing_images, $parts_show_image, - $show_best_before, $vertreter, $webdav -); - -# Wenn Einnahmen-Überschussrechnung, dann auf 1 setzen -# Wenn Bilanzierung (z.B. GmbH), dann auf 0 setzen -$eur = 1; - -# set language for login and admin -# currently "de" (German), "de_DE" (new German) and "en" (English, not perfect) are available -$language = "de"; - -# 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] - -# Das charset, in dem die Daten in der Datenbank abgelegt sind. -$dbcharset = 'UTF-8'; # Für UNICODE UTF-8 -# $dbcharset = "ISO-8859-15"; - 1; diff --git a/config/lx_office.conf.default b/config/lx_office.conf.default index f4b8b13ee..9fd502b02 100644 --- a/config/lx_office.conf.default +++ b/config/lx_office.conf.default @@ -1,3 +1,33 @@ +[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 diff --git a/scripts/console b/scripts/console index 2613c7237..79db5a96c 100755 --- a/scripts/console +++ b/scripts/console @@ -66,7 +66,7 @@ sub lxinit { SL::Dispatcher::_decode_recursively(\%::lx_office_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; diff --git a/scripts/task_server.pl b/scripts/task_server.pl index 843419fda..11c8f6694 100755 --- a/scripts/task_server.pl +++ b/scripts/task_server.pl @@ -46,7 +46,7 @@ sub lxinit { 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; @@ -115,7 +115,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; 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. -- 2.20.1