Revision 96670fe8
Von Moritz Bunkus vor etwa 8 Jahren hinzugefügt
SL/Controller/RequirementSpecTextBlock.pm | ||
---|---|---|
184 | 184 |
my $dropped_type = $position ne 'last' ? undef : $::form->{dropped_type} =~ m/^ text-blocks- (?:front|back) $/x ? $::form->{dropped_type} : die "Unknown 'dropped_type' parameter"; |
185 | 185 |
my $old_where = $self->text_block->output_position; |
186 | 186 |
|
187 |
$self->text_block->db->do_transaction(sub {
|
|
187 |
$self->text_block->db->with_transaction(sub {
|
|
188 | 188 |
1; |
189 | 189 |
$self->text_block->remove_from_list; |
190 | 190 |
$self->text_block->output_position($position =~ m/before|after/ ? $dropped_text_block->output_position : $::form->{dropped_type} eq 'text-blocks-front' ? 0 : 1); |
... | ... | |
482 | 482 |
sub paste_picture { |
483 | 483 |
my ($self, $copied) = @_; |
484 | 484 |
|
485 |
if (!$self->text_block->db->do_transaction(sub {
|
|
485 |
if (!$self->text_block->db->with_transaction(sub {
|
|
486 | 486 |
1; |
487 | 487 |
$self->picture($copied->to_object)->save; # Create new picture from copied data and save |
488 | 488 |
$self->text_block->add_pictures($self->picture); # Add new picture to text block |
Auch abrufbar als: Unified diff
»with_transaction« anstelle von »do_transaction« verwenden
Es sollte so selten wie möglich »do_transaction« verwndet werden, damit
man sich immer angewöhnt, »with_transaction« zu nutzen.
Hintergründe und Unterschiede zwischen den beiden Funktionen sind in der
Dokumentation von SL/DB.pm beschrieben.