From: Moritz Bunkus Date: Mon, 29 Nov 2010 16:52:00 +0000 (+0100) Subject: new bekommt Hash-Params, nicht positionsbezogene X-Git-Tag: release-2.6.2beta1~17^2~11^2~8 X-Git-Url: http://wagnertech.de/git?a=commitdiff_plain;h=0b6cb3b882036db18ce9c283bfaebe3bc483507e;p=kivitendo-erp.git new bekommt Hash-Params, nicht positionsbezogene --- diff --git a/SL/DBUpgrade2.pm b/SL/DBUpgrade2.pm index d52468eee..3d5d0de5c 100644 --- a/SL/DBUpgrade2.pm +++ b/SL/DBUpgrade2.pm @@ -8,14 +8,16 @@ use SL::Iconv; use strict; sub new { - my ($package, $form, $dbdriver) = @_; - my $self = { form => $form, dbdriver => $dbdriver }; - return bless($self, $package); + my $package = shift; + + return bless({}, $package)->init(@_); } -sub set_dbcharset { - my $self = shift; - $self->{dbcharset} = shift; +sub init { + my ($self, %params) = @_; + + map { $self->{$_} = $params{$_} } keys %params; + return $self; } diff --git a/SL/User.pm b/SL/User.pm index a30d54136..ec0968705 100644 --- a/SL/User.pm +++ b/SL/User.pm @@ -125,7 +125,7 @@ sub login { $rc = 0; - my $dbupdater = SL::DBUpgrade2->new($form, $myconfig{"dbdriver"}); + my $dbupdater = SL::DBUpgrade2->new(form => $form, dbdriver => $myconfig{dbdriver}); my $controls = $dbupdater->parse_dbupdate_controls; map({ $form->{$_} = $myconfig{$_} } @@ -395,7 +395,7 @@ sub dbcreate { my $db_charset = $Common::db_encoding_to_charset{$form->{encoding}}; $db_charset ||= Common::DEFAULT_CHARSET; - my $dbupdater = SL::DBUpgrade2->new($form, $form->{dbdriver}); + my $dbupdater = SL::DBUpgrade2->new(form => $form, dbdriver => $form->{dbdriver}); # create the tables $dbupdater->process_query($dbh, "sql/lx-office.sql", undef, $db_charset); @@ -457,7 +457,7 @@ sub dbneedsupdate { my ($self, $form) = @_; my %members = $main::auth->read_all_users(); - my $controls = SL::DBUpgrade2->new($form, $form->{dbdriver})->parse_dbupdate_controls; + my $controls = SL::DBUpgrade2->new(form => $form, dbdriver => $form->{dbdriver})->parse_dbupdate_controls; my ($query, $sth, %dbs_needing_updates); @@ -597,7 +597,7 @@ sub dbupdate { my $db_charset = $main::dbcharset; $db_charset ||= Common::DEFAULT_CHARSET; - my $dbupdater = SL::DBUpgrade2->new($form, $form->{dbdriver}); + my $dbupdater = SL::DBUpgrade2->new(form => $form, dbdriver => $form->{dbdriver}); foreach my $db (split(/ /, $form->{dbupdate})) {