Revision 0fdcea4d
Von Moritz Bunkus vor fast 11 Jahren hinzugefügt
SL/DB/Order.pm | ||
---|---|---|
130 | 130 |
croak("Conversion to invoices is only supported for sales records") unless $self->customer_id; |
131 | 131 |
|
132 | 132 |
my $invoice; |
133 |
if (!$self->db->do_transaction(sub {
|
|
133 |
if (!$self->db->with_transaction(sub {
|
|
134 | 134 |
require SL::DB::Invoice; |
135 | 135 |
$invoice = SL::DB::Invoice->new_from($self)->post(%params) || die; |
136 | 136 |
$self->link_to_record($invoice); |
137 | 137 |
$self->update_attributes(closed => 1); |
138 |
# die;
|
|
138 |
1;
|
|
139 | 139 |
})) { |
140 | 140 |
return undef; |
141 | 141 |
} |
... | ... | |
147 | 147 |
my ($self, %params) = @_; |
148 | 148 |
|
149 | 149 |
my ($delivery_order, $custom_shipto); |
150 |
if (!$self->db->do_transaction(sub {
|
|
150 |
if (!$self->db->with_transaction(sub {
|
|
151 | 151 |
require SL::DB::DeliveryOrder; |
152 | 152 |
($delivery_order, $custom_shipto) = SL::DB::DeliveryOrder->new_from($self); |
153 | 153 |
$delivery_order->save; |
154 | 154 |
$custom_shipto->save if $custom_shipto; |
155 | 155 |
$self->link_to_record($delivery_order); |
156 |
# die;
|
|
156 |
1;
|
|
157 | 157 |
})) { |
158 |
return undef; |
|
158 |
return wantarray ? () : undef;
|
|
159 | 159 |
} |
160 | 160 |
|
161 | 161 |
return wantarray ? ($delivery_order, $custom_shipto) : $delivery_order; |
Auch abrufbar als: Unified diff
SL::DB::Order: with_transaction anstelle von do_transaction nutzen
do_transaction startet immer eine Transaktion, auch wenn außen rum
schon eine läuft. Damit wird die äußere Transaktion de facto außer
Kraft gesetzt.