summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xLedgerSMB/Form.pm5
-rwxr-xr-xbin/admin.pl1
-rwxr-xr-xmenu.pl1
3 files changed, 6 insertions, 1 deletions
diff --git a/LedgerSMB/Form.pm b/LedgerSMB/Form.pm
index 5f7adb01..4b6fbad2 100755
--- a/LedgerSMB/Form.pm
+++ b/LedgerSMB/Form.pm
@@ -2704,8 +2704,13 @@ sub update_defaults {
my ($self, $myconfig, $fld) = @_;
+ if (!$self->{dbh}){
+ $self->db_init($myconfig);
+ }
+
my $dbh = $self->{dbh};
+
my $query = qq|SELECT $fld FROM defaults FOR UPDATE|;
($_) = $dbh->selectrow_array($query);
diff --git a/bin/admin.pl b/bin/admin.pl
index 9a90830a..88ecc367 100755
--- a/bin/admin.pl
+++ b/bin/admin.pl
@@ -754,6 +754,7 @@ sub form_header {
sub save {
+ $form->db_init;
# no driver checked
$form->error($locale->text('Database Driver not checked!')) unless $form->{dbdriver};
diff --git a/menu.pl b/menu.pl
index 6482a66d..03d22670 100755
--- a/menu.pl
+++ b/menu.pl
@@ -106,7 +106,6 @@ $SIG{__DIE__} = sub { $form->error($_[0]) };
$myconfig{dbpasswd} = unpack 'u', $myconfig{dbpasswd};
map { $form->{$_} = $myconfig{$_} } qw(stylesheet timeout) unless ($form->{type} eq 'preferences');
-
$form->db_init(\%myconfig);
if ($form->{path} ne 'bin/lynx'){ $form->{path} = 'bin/mozilla';}