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.
croak("Conversion to invoices is only supported for sales records") unless $self->customer_id;
my $invoice;
croak("Conversion to invoices is only supported for sales records") unless $self->customer_id;
my $invoice;
- if (!$self->db->do_transaction(sub {
+ if (!$self->db->with_transaction(sub {
require SL::DB::Invoice;
$invoice = SL::DB::Invoice->new_from($self)->post(%params) || die;
$self->link_to_record($invoice);
$self->update_attributes(closed => 1);
require SL::DB::Invoice;
$invoice = SL::DB::Invoice->new_from($self)->post(%params) || die;
$self->link_to_record($invoice);
$self->update_attributes(closed => 1);
my ($self, %params) = @_;
my ($delivery_order, $custom_shipto);
my ($self, %params) = @_;
my ($delivery_order, $custom_shipto);
- if (!$self->db->do_transaction(sub {
+ if (!$self->db->with_transaction(sub {
require SL::DB::DeliveryOrder;
($delivery_order, $custom_shipto) = SL::DB::DeliveryOrder->new_from($self);
$delivery_order->save;
$custom_shipto->save if $custom_shipto;
$self->link_to_record($delivery_order);
require SL::DB::DeliveryOrder;
($delivery_order, $custom_shipto) = SL::DB::DeliveryOrder->new_from($self);
$delivery_order->save;
$custom_shipto->save if $custom_shipto;
$self->link_to_record($delivery_order);
+ return wantarray ? () : undef;
}
return wantarray ? ($delivery_order, $custom_shipto) : $delivery_order;
}
return wantarray ? ($delivery_order, $custom_shipto) : $delivery_order;