Revision 9df5680a
Von Sven Schöling vor etwa 8 Jahren hinzugefügt
SL/CVar.pm | ||
---|---|---|
11 | 11 |
use SL::DBUtils; |
12 | 12 |
use SL::MoreCommon qw(listify); |
13 | 13 |
use SL::Util qw(trim); |
14 |
use SL::DB; |
|
14 | 15 |
|
15 | 16 |
sub get_configs { |
16 | 17 |
$main::lxdebug->enter_sub(); |
... | ... | |
200 | 201 |
} |
201 | 202 |
|
202 | 203 |
sub save_custom_variables { |
204 |
my ($self, %params) = @_; |
|
203 | 205 |
$main::lxdebug->enter_sub(); |
204 | 206 |
|
207 |
my $rc = SL::DB->client->with_transaction(\&_save_custom_variables, $self, %params); |
|
208 |
|
|
209 |
$::lxdebug->leave_sub; |
|
210 |
return $rc; |
|
211 |
} |
|
212 |
|
|
213 |
sub _save_custom_variables { |
|
205 | 214 |
my $self = shift; |
206 | 215 |
my %params = @_; |
207 | 216 |
|
... | ... | |
210 | 219 |
my $myconfig = \%main::myconfig; |
211 | 220 |
my $form = $main::form; |
212 | 221 |
|
213 |
my $dbh = $params{dbh} || $form->get_standard_dbh($myconfig);
|
|
222 |
my $dbh = $params{dbh} || SL::DB->client->dbh;
|
|
214 | 223 |
|
215 | 224 |
my @configs = $params{configs} ? @{ $params{configs} } : grep { $_->{module} eq $params{module} } @{ CVar->get_configs() }; |
216 | 225 |
|
... | ... | |
267 | 276 |
|
268 | 277 |
$sth->finish(); |
269 | 278 |
|
270 |
$dbh->commit() unless $params{dbh}; |
|
271 |
|
|
272 |
$main::lxdebug->leave_sub(); |
|
279 |
return 1; |
|
273 | 280 |
} |
274 | 281 |
|
275 | 282 |
sub render_inputs { |
... | ... | |
548 | 555 |
} |
549 | 556 |
|
550 | 557 |
sub save_custom_variables_validity { |
558 |
my ($self, %params) = @_; |
|
551 | 559 |
$main::lxdebug->enter_sub(); |
552 | 560 |
|
561 |
my $rc = SL::DB->client->with_transaction(\&_save_custom_variables_validity, $self, %params); |
|
562 |
|
|
563 |
$::lxdebug->leave_sub; |
|
564 |
return $rc; |
|
565 |
} |
|
566 |
|
|
567 |
sub _save_custom_variables_validity { |
|
553 | 568 |
my $self = shift; |
554 | 569 |
my %params = @_; |
555 | 570 |
|
... | ... | |
558 | 573 |
my $myconfig = \%main::myconfig; |
559 | 574 |
my $form = $main::form; |
560 | 575 |
|
561 |
my $dbh = $params{dbh} || $form->get_standard_dbh($myconfig);
|
|
576 |
my $dbh = $params{dbh} || SL::DB->client->dbh;
|
|
562 | 577 |
|
563 | 578 |
my (@where, @values); |
564 | 579 |
add_token(\@where, \@values, col => "config_id", val => $params{config_id}, esc => \&conv_i); |
... | ... | |
584 | 599 |
|
585 | 600 |
$sth->finish(); |
586 | 601 |
|
587 |
$dbh->commit() unless $params{dbh}; |
|
588 |
|
|
589 |
$main::lxdebug->leave_sub(); |
|
602 |
return 1; |
|
590 | 603 |
} |
591 | 604 |
|
592 | 605 |
my %_validity_sub_module_mapping = ( |
Auch abrufbar als: Unified diff
CVar: single-dbh