From: Sven Schöling Date: Fri, 15 Apr 2011 09:51:32 +0000 (+0200) Subject: Merge branch 'master' of git@lx-office.linet-services.de:lx-office-erp X-Git-Tag: release-2.6.3~33^2~7 X-Git-Url: http://wagnertech.de/gitweb/gitweb.cgi/mfinanz.git/commitdiff_plain/470a8fa1710b22e2b381eef4cacb01bebaeff725?hp=dcfdf5de55446462a2e6d54366feef2be8726713 Merge branch 'master' of git@lx-office.linet-services.de:lx-office-erp --- diff --git a/SL/AP.pm b/SL/AP.pm index e4ff230c2..ef7ca8126 100644 --- a/SL/AP.pm +++ b/SL/AP.pm @@ -422,9 +422,12 @@ sub ap_transactions { push(@values, $form->like($form->{vendor})); } if ($form->{department}) { - my ($null, $department_id) = split /--/, $form->{department}; + # ähnlich wie commit 0bbfb33b6aa8e38bb6c81d1684ab7d08e5b5c5af abteilung + # wird so nicht mehr als zeichenkette zusammengebaut + # hätte zu ee9f9f9aa4c3b9d5d20ab10a45c12bcaa6aa78d0 auffallen können ;-) jan + #my ($null, $department_id) = split /--/, $form->{department}; $where .= " AND a.department_id = ?"; - push(@values, $department_id); + push(@values, $form->{department}); } if ($form->{invnumber}) { $where .= " AND a.invnumber ILIKE ?"; diff --git a/SL/Auth.pm b/SL/Auth.pm index 73a37c5eb..978fe497d 100644 --- a/SL/Auth.pm +++ b/SL/Auth.pm @@ -13,6 +13,7 @@ use SL::Auth::DB; use SL::Auth::LDAP; use SL::User; +use SL::DBConnect; use SL::DBUpgrade2; use SL::DBUtils; @@ -38,7 +39,7 @@ sub new { sub get_user_dbh { my ($self, $login) = @_; my %user = $self->read_user($login); - my $dbh = DBI->connect( + my $dbh = SL::DBConnect->connect( $user{dbconnect}, $user{dbuser}, $user{dbpasswd}, @@ -166,7 +167,7 @@ sub dbconnect { $main::lxdebug->message(LXDebug->DEBUG1, "Auth::dbconnect DSN: $dsn"); - $self->{dbh} = DBI->connect($dsn, $cfg->{user}, $cfg->{password}, { pg_enable_utf8 => $::locale->is_utf8, AutoCommit => 1 }); + $self->{dbh} = SL::DBConnect->connect($dsn, $cfg->{user}, $cfg->{password}, { pg_enable_utf8 => $::locale->is_utf8, AutoCommit => 1 }); if (!$may_fail && !$self->{dbh}) { $main::form->error($main::locale->text('The connection to the authentication database failed:') . "\n" . $DBI::errstr); @@ -246,7 +247,7 @@ sub create_database { my $encoding = $Common::charset_to_db_encoding{$charset}; $encoding ||= 'UNICODE'; - my $dbh = DBI->connect($dsn, $params{superuser}, $params{superuser_password}, { pg_enable_utf8 => $charset =~ m/^utf-?8$/i }); + my $dbh = SL::DBConnect->connect($dsn, $params{superuser}, $params{superuser_password}, { pg_enable_utf8 => $charset =~ m/^utf-?8$/i }); if (!$dbh) { $main::form->error($main::locale->text('The connection to the template database failed:') . "\n" . $DBI::errstr); diff --git a/SL/Auth/PasswordPolicy.pm b/SL/Auth/PasswordPolicy.pm index 3cf5c149b..5e0a9a42b 100644 --- a/SL/Auth/PasswordPolicy.pm +++ b/SL/Auth/PasswordPolicy.pm @@ -73,7 +73,7 @@ sub errors { sub init_config { my ($self) = @_; - my %cfg = %{ $::emmvee_conf{password_policy} || {} }; + my %cfg = %{ $::lx_office_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}; diff --git a/SL/CA.pm b/SL/CA.pm index f9dd76d88..c200b664e 100644 --- a/SL/CA.pm +++ b/SL/CA.pm @@ -57,8 +57,12 @@ sub all_accounts { # 1.) Gehe zurück bis zu dem Datum an dem die Bücher geschlossen wurden # 2.) Falls die Bücher noch nie geschlossen wurden, gehe zurück bis zum Bearbeitungsstart # COALESCE((SELECT closedto FROM defaults),(SELECT itime FROM defaults)) + # PROBLEM: Das date_trunc schneidet auf den 1.1.20XX ab und KEINE Buchungen werden angezeigt + # Lösung: date_trunc rausgeworfen und nicht mehr auf itime geprüft, sondern auf die erste Buchung + # in transdate jan 11.04.2011 - my $closedto_sql = "COALESCE((SELECT closedto FROM defaults),(SELECT itime FROM defaults))"; + my $closedto_sql = "COALESCE((SELECT closedto FROM defaults), + (SELECT transdate from acc_trans order by transdate limit 1))"; if ($form->{method} eq "cash") { # EÜR $acc_cash_where = qq| AND (a.trans_id IN (SELECT id FROM ar WHERE datepaid>= $closedto_sql @@ -66,7 +70,7 @@ sub all_accounts { UNION SELECT id FROM gl WHERE transdate>= $closedto_sql )) |; } else { # Bilanzierung - $acc_cash_where = " AND ((select date_trunc('year', a.transdate::date)) >= $closedto_sql) "; + $acc_cash_where = " AND (a.transdate >= $closedto_sql) "; } my $query = diff --git a/SL/DB.pm b/SL/DB.pm index 67888ef59..491a03349 100644 --- a/SL/DB.pm +++ b/SL/DB.pm @@ -16,24 +16,14 @@ my (%_db_registered, %_initial_sql_executed); sub dbi_connect { shift; - return DBI->connect(@_) unless $::lx_office_conf{debug} && $::lx_office_conf{debug}->{dbix_log4perl}; - - require Log::Log4perl; - require DBIx::Log4perl; - - my $filename = $LXDebug::file_name; - my $config = $::lx_office_conf{debug}->{dbix_log4perl_config}; - $config =~ s/LXDEBUGFILE/${filename}/g; - - Log::Log4perl->init(\$config); - return DBIx::Log4perl->connect(@_); + return SL::DBConnect->connect(@_); } sub create { my $domain = shift || SL::DB->default_domain; my $type = shift || SL::DB->default_type; - my ($domain, $type) = _register_db($domain, $type); + ($domain, $type) = _register_db($domain, $type); my $db = __PACKAGE__->new_or_cached(domain => $domain, type => $type); @@ -91,7 +81,7 @@ sub _register_db { my %flattened_settings = _flatten_settings(%connect_settings); $domain = 'LXOFFICE' if $type =~ m/^LXOFFICE/; - $type .= join($SUBSCRIPT_SEPARATOR, map { ($_, $flattened_settings{$_}) } sort keys %flattened_settings); + $type .= join($SUBSCRIPT_SEPARATOR, map { ($_, $flattened_settings{$_} || '') } sort keys %flattened_settings); my $idx = "${domain}::${type}"; if (!$_db_registered{$idx}) { diff --git a/SL/DBConnect.pm b/SL/DBConnect.pm new file mode 100644 index 000000000..fbcf1d5a1 --- /dev/null +++ b/SL/DBConnect.pm @@ -0,0 +1,23 @@ +package SL::DBConnect; + +use strict; + +use DBI; + +sub connect { + shift; + + return DBI->connect(@_) unless $::lx_office_conf{debug} && $::lx_office_conf{debug}->{dbix_log4perl}; + + require Log::Log4perl; + require DBIx::Log4perl; + + my $filename = $LXDebug::file_name; + my $config = $::lx_office_conf{debug}->{dbix_log4perl_config}; + $config =~ s/LXDEBUGFILE/${filename}/g; + + Log::Log4perl->init(\$config); + return DBIx::Log4perl->connect(@_); +} + +1; diff --git a/SL/Form.pm b/SL/Form.pm index 11d72a6ed..31020aebc 100644 --- a/SL/Form.pm +++ b/SL/Form.pm @@ -52,6 +52,7 @@ use SL::AM; use SL::Common; use SL::CVar; use SL::DB; +use SL::DBConnect; use SL::DBUtils; use SL::DO; use SL::IC; @@ -1582,7 +1583,7 @@ sub dbconnect { my ($self, $myconfig) = @_; # connect to database - my $dbh = DBI->connect($myconfig->{dbconnect}, $myconfig->{dbuser}, $myconfig->{dbpasswd}, $self->_dbconnect_options) + my $dbh = SL::DBConnect->connect($myconfig->{dbconnect}, $myconfig->{dbuser}, $myconfig->{dbpasswd}, $self->_dbconnect_options) or $self->dberror; # set db options @@ -1601,7 +1602,7 @@ sub dbconnect_noauto { my ($self, $myconfig) = @_; # connect to database - my $dbh = DBI->connect($myconfig->{dbconnect}, $myconfig->{dbuser}, $myconfig->{dbpasswd}, $self->_dbconnect_options(AutoCommit => 0)) + my $dbh = SL::DBConnect->connect($myconfig->{dbconnect}, $myconfig->{dbuser}, $myconfig->{dbpasswd}, $self->_dbconnect_options(AutoCommit => 0)) or $self->dberror; # set db options diff --git a/SL/User.pm b/SL/User.pm index 520bf4229..d6b870552 100644 --- a/SL/User.pm +++ b/SL/User.pm @@ -38,6 +38,7 @@ use IO::File; use Fcntl qw(:seek); #use SL::Auth; +use SL::DBConnect; use SL::DBUpgrade2; use SL::DBUtils; use SL::Iconv; @@ -104,9 +105,7 @@ sub login { my %myconfig = $main::auth->read_user($self->{login}); # check if database is down - my $dbh = - DBI->connect($myconfig{dbconnect}, $myconfig{dbuser}, - $myconfig{dbpasswd}) + my $dbh = SL::DBConnect->connect($myconfig{dbconnect}, $myconfig{dbuser}, $myconfig{dbpasswd}) or $self->error($DBI::errstr); # we got a connection, check the version @@ -252,8 +251,7 @@ sub dbsources { $form->{sid} = $form->{dbdefault}; &dbconnect_vars($form, $form->{dbdefault}); - my $dbh = - DBI->connect($form->{dbconnect}, $form->{dbuser}, $form->{dbpasswd}) + my $dbh = SL::DBConnect->connect($form->{dbconnect}, $form->{dbuser}, $form->{dbpasswd}) or $form->dberror; if ($form->{dbdriver} eq 'Pg') { @@ -270,8 +268,7 @@ sub dbsources { next if ($db =~ /^template/); &dbconnect_vars($form, $db); - my $dbh = - DBI->connect($form->{dbconnect}, $form->{dbuser}, $form->{dbpasswd}) + my $dbh = SL::DBConnect->connect($form->{dbconnect}, $form->{dbuser}, $form->{dbpasswd}) or $form->dberror; $query = @@ -326,7 +323,7 @@ sub dbclusterencoding { dbconnect_vars($form, $form->{dbdefault}); - my $dbh = DBI->connect($form->{dbconnect}, $form->{dbuser}, $form->{dbpasswd}) || $form->dberror(); + my $dbh = SL::DBConnect->connect($form->{dbconnect}, $form->{dbuser}, $form->{dbpasswd}) || $form->dberror(); my $query = qq|SELECT pg_encoding_to_char(encoding) FROM pg_database WHERE datname = 'template0'|; my ($cluster_encoding) = $dbh->selectrow_array($query); $dbh->disconnect(); @@ -344,7 +341,7 @@ sub dbcreate { $form->{sid} = $form->{dbdefault}; &dbconnect_vars($form, $form->{dbdefault}); my $dbh = - DBI->connect($form->{dbconnect}, $form->{dbuser}, $form->{dbpasswd}) + SL::DBConnect->connect($form->{dbconnect}, $form->{dbuser}, $form->{dbpasswd}) or $form->dberror; $form->{db} =~ s/\"//g; my %dbcreate = ( @@ -386,7 +383,7 @@ sub dbcreate { &dbconnect_vars($form, $form->{db}); - $dbh = DBI->connect($form->{dbconnect}, $form->{dbuser}, $form->{dbpasswd}) + $dbh = SL::DBConnect->connect($form->{dbconnect}, $form->{dbuser}, $form->{dbpasswd}) or $form->dberror; my $db_charset = $Common::db_encoding_to_charset{$form->{encoding}}; @@ -417,8 +414,7 @@ sub dbdelete { $form->{sid} = $form->{dbdefault}; &dbconnect_vars($form, $form->{dbdefault}); - my $dbh = - DBI->connect($form->{dbconnect}, $form->{dbuser}, $form->{dbpasswd}) + my $dbh = SL::DBConnect->connect($form->{dbconnect}, $form->{dbuser}, $form->{dbpasswd}) or $form->dberror; my $query = $dbdelete{$form->{dbdriver}}; do_query($form, $dbh, $query); @@ -464,7 +460,7 @@ sub dbneedsupdate { map { $form->{$_} = $member->{$_} } qw(dbname dbuser dbpasswd dbhost dbport); dbconnect_vars($form, $form->{dbname}); - my $dbh = DBI->connect($form->{dbconnect}, $form->{dbuser}, $form->{dbpasswd}); + my $dbh = SL::DBConnect->connect($form->{dbconnect}, $form->{dbuser}, $form->{dbpasswd}); next unless $dbh; @@ -594,8 +590,7 @@ sub dbupdate { $db =~ s/^db//; &dbconnect_vars($form, $db); - my $dbh = - DBI->connect($form->{dbconnect}, $form->{dbuser}, $form->{dbpasswd}) + my $dbh = SL::DBConnect->connect($form->{dbconnect}, $form->{dbuser}, $form->{dbpasswd}) or $form->dberror; $dbh->do($form->{dboptions}) if ($form->{dboptions}); @@ -659,7 +654,7 @@ sub dbupdate2 { $db =~ s/^db//; &dbconnect_vars($form, $db); - my $dbh = DBI->connect($form->{dbconnect}, $form->{dbuser}, $form->{dbpasswd}) or $form->dberror; + my $dbh = SL::DBConnect->connect($form->{dbconnect}, $form->{dbuser}, $form->{dbpasswd}) or $form->dberror; $dbh->do($form->{dboptions}) if ($form->{dboptions}); @@ -700,7 +695,7 @@ sub save_member { $main::auth->save_user($self->{login}, map { $_, $self->{$_} } config_vars()); - my $dbh = DBI->connect($self->{dbconnect}, $self->{dbuser}, $self->{dbpasswd}); + my $dbh = SL::DBConnect->connect($self->{dbconnect}, $self->{dbuser}, $self->{dbpasswd}); if ($dbh) { $self->create_employee_entry($form, $dbh, $self, 1); $dbh->disconnect(); diff --git a/bin/mozilla/common.pl b/bin/mozilla/common.pl index cef7fcab8..dfa7d0f78 100644 --- a/bin/mozilla/common.pl +++ b/bin/mozilla/common.pl @@ -396,6 +396,32 @@ sub reformat_numbers { # ------------------------------------------------------------------------- +sub show_history { + $main::lxdebug->enter_sub(); + + my $form = $main::form; + my %myconfig = %main::myconfig; + my $locale = $main::locale; + + my $dbh = $form->dbconnect(\%myconfig); + my ($sort, $sortby) = split(/\-\-/, $form->{order}); + $sort =~ s/.*\.(.*)/$1/; + + $form->{title} = $locale->text("History"); + $form->header(); + print $form->parse_html_template( "common/show_history", { + "DATEN" => $form->get_history($dbh,$form->{input_name},"",$form->{order}), + "SUCCESS" => ($form->get_history($dbh,$form->{input_name}) ne "0"), + uc($sort) => 1, + uc($sort)."BY" => $sortby + } ); + + $dbh->disconnect(); + $main::lxdebug->leave_sub(); +} + +# ------------------------------------------------------------------------- + sub call_sub { $main::lxdebug->enter_sub(); diff --git a/config/lx_office.conf.default b/config/lx_office.conf.default index 1972e9530..e78f2c357 100644 --- a/config/lx_office.conf.default +++ b/config/lx_office.conf.default @@ -224,4 +224,4 @@ watch_form = 0 keep_temp_files = 0 # The file name where the debug messages are written to. -file_name = /tmp/mb-lxdebug.log +file_name = /tmp/lx-office-debug.log diff --git a/doc/changelog b/doc/changelog index d7cd59ecc..8c6257943 100644 --- a/doc/changelog +++ b/doc/changelog @@ -13,6 +13,12 @@ - Bei Verkaufsgutschriften zusätzlich noch die Rechnungsnummer mitnehmen, damit der Bezug klarer ist. + - Kontenübersicht. Bei Auswahl Bilanz und keinem closedto (Bücher-Abschluss) wurden keine Konten + ausgewählt, falls das Installationsjahr gleich dem laufenden Jahr ist + + - Verkauf -> Berichte -> Filter nach Abteilungen wieder aktiviert + + Liste gefixter Bugs aus dem Bugtracker: - Bugfix 1613: Status teilweise diff --git a/locale/de/all b/locale/de/all index eed49d818..b7df1ba6e 100644 --- a/locale/de/all +++ b/locale/de/all @@ -823,6 +823,7 @@ $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',