Revision 9bfcaea8
Von Sven Schöling vor mehr als 8 Jahren hinzugefügt
SL/Common.pm | ||
---|---|---|
24 | 24 |
use Encode qw(decode); |
25 | 25 |
|
26 | 26 |
use SL::DBUtils; |
27 |
use SL::DB; |
|
27 | 28 |
|
28 | 29 |
sub unique_id { |
29 | 30 |
my ($a, $b) = gettimeofday(); |
... | ... | |
407 | 408 |
|
408 | 409 |
return $main::lxdebug->leave_sub() if (!$form->{id} || !$table || !$form->{formname}); |
409 | 410 |
|
410 |
$dbh = $form->get_standard_dbh($myconfig); |
|
411 |
SL::DB->client->with_transaction(sub { |
|
412 |
$dbh = SL::DB->client->dbh; |
|
411 | 413 |
|
412 |
my ($intnotes) = selectrow_query($form, $dbh, qq|SELECT intnotes FROM $table WHERE id = ?|, $form->{id}); |
|
414 |
my ($intnotes) = selectrow_query($form, $dbh, qq|SELECT intnotes FROM $table WHERE id = ?|, $form->{id});
|
|
413 | 415 |
|
414 |
$intnotes =~ s|\r||g; |
|
415 |
$intnotes =~ s|\n$||; |
|
416 |
$intnotes =~ s|\r||g;
|
|
417 |
$intnotes =~ s|\n$||;
|
|
416 | 418 |
|
417 |
$intnotes .= "\n\n" if ($intnotes); |
|
419 |
$intnotes .= "\n\n" if ($intnotes);
|
|
418 | 420 |
|
419 |
my $cc = $form->{cc} ? $main::locale->text('Cc') . ": $form->{cc}\n" : ''; |
|
420 |
my $bcc = $form->{bcc} ? $main::locale->text('Bcc') . ": $form->{bcc}\n" : ''; |
|
421 |
my $now = scalar localtime; |
|
421 |
my $cc = $form->{cc} ? $main::locale->text('Cc') . ": $form->{cc}\n" : '';
|
|
422 |
my $bcc = $form->{bcc} ? $main::locale->text('Bcc') . ": $form->{bcc}\n" : '';
|
|
423 |
my $now = scalar localtime;
|
|
422 | 424 |
|
423 |
$intnotes .= $main::locale->text('[email]') . "\n" |
|
424 |
. $main::locale->text('Date') . ": $now\n" |
|
425 |
. $main::locale->text('To (email)') . ": $form->{email}\n" |
|
426 |
. "${cc}${bcc}" |
|
427 |
. $main::locale->text('Subject') . ": $form->{subject}\n\n" |
|
428 |
. $main::locale->text('Message') . ": $form->{message}"; |
|
425 |
$intnotes .= $main::locale->text('[email]') . "\n"
|
|
426 |
. $main::locale->text('Date') . ": $now\n"
|
|
427 |
. $main::locale->text('To (email)') . ": $form->{email}\n"
|
|
428 |
. "${cc}${bcc}"
|
|
429 |
. $main::locale->text('Subject') . ": $form->{subject}\n\n"
|
|
430 |
. $main::locale->text('Message') . ": $form->{message}";
|
|
429 | 431 |
|
430 |
$intnotes =~ s|\r||g; |
|
432 |
$intnotes =~ s|\r||g;
|
|
431 | 433 |
|
432 |
do_query($form, $dbh, qq|UPDATE $table SET intnotes = ? WHERE id = ?|, $intnotes, $form->{id}); |
|
434 |
do_query($form, $dbh, qq|UPDATE $table SET intnotes = ? WHERE id = ?|, $intnotes, $form->{id});
|
|
433 | 435 |
|
434 |
$form->save_status($dbh); |
|
435 |
|
|
436 |
$dbh->commit(); |
|
436 |
$form->save_status($dbh); |
|
437 |
}); |
|
437 | 438 |
|
438 | 439 |
$main::lxdebug->leave_sub(); |
439 | 440 |
} |
Auch abrufbar als: Unified diff
Common: single-dbh