use SL::DBUtils;
use SL::MoreCommon qw(listify);
use SL::Util qw(trim);
+use SL::DB;
sub get_configs {
$main::lxdebug->enter_sub();
}
sub save_custom_variables {
+ my ($self, %params) = @_;
$main::lxdebug->enter_sub();
+ my $rc = SL::DB->client->with_transaction(\&_save_custom_variables, $self, %params);
+
+ $::lxdebug->leave_sub;
+ return $rc;
+}
+
+sub _save_custom_variables {
my $self = shift;
my %params = @_;
my $myconfig = \%main::myconfig;
my $form = $main::form;
- my $dbh = $params{dbh} || $form->get_standard_dbh($myconfig);
+ my $dbh = $params{dbh} || SL::DB->client->dbh;
my @configs = $params{configs} ? @{ $params{configs} } : grep { $_->{module} eq $params{module} } @{ CVar->get_configs() };
$sth->finish();
- $dbh->commit() unless $params{dbh};
-
- $main::lxdebug->leave_sub();
+ return 1;
}
sub render_inputs {
}
sub save_custom_variables_validity {
+ my ($self, %params) = @_;
$main::lxdebug->enter_sub();
+ my $rc = SL::DB->client->with_transaction(\&_save_custom_variables_validity, $self, %params);
+
+ $::lxdebug->leave_sub;
+ return $rc;
+}
+
+sub _save_custom_variables_validity {
my $self = shift;
my %params = @_;
my $myconfig = \%main::myconfig;
my $form = $main::form;
- my $dbh = $params{dbh} || $form->get_standard_dbh($myconfig);
+ my $dbh = $params{dbh} || SL::DB->client->dbh;
my (@where, @values);
add_token(\@where, \@values, col => "config_id", val => $params{config_id}, esc => \&conv_i);
$sth->finish();
- $dbh->commit() unless $params{dbh};
-
- $main::lxdebug->leave_sub();
+ return 1;
}
my %_validity_sub_module_mapping = (