Revision 57657390
Von Bernd Bleßmann vor fast 2 Jahren hinzugefügt
SL/Controller/DeliveryOrder.pm | ||
---|---|---|
1658 | 1658 |
sub save { |
1659 | 1659 |
my ($self) = @_; |
1660 | 1660 |
|
1661 |
my $validity_token; |
|
1662 |
if (!$self->order->id) { |
|
1663 |
$validity_token = SL::DB::Manager::ValidityToken->fetch_valid_token( |
|
1664 |
scope => SL::DB::ValidityToken::SCOPE_DELIVERY_ORDER_SAVE(), |
|
1665 |
token => $::form->{form_validity_token}, |
|
1666 |
); |
|
1667 |
|
|
1668 |
return [t8('The form is not valid anymore.')] if !$validity_token; |
|
1669 |
} |
|
1670 |
|
|
1671 | 1661 |
my $errors = []; |
1672 | 1662 |
my $db = $self->order->db; |
1673 | 1663 |
|
1674 | 1664 |
$db->with_transaction(sub { |
1665 |
my $validity_token; |
|
1666 |
if (!$self->order->id) { |
|
1667 |
$validity_token = SL::DB::Manager::ValidityToken->fetch_valid_token( |
|
1668 |
scope => SL::DB::ValidityToken::SCOPE_DELIVERY_ORDER_SAVE(), |
|
1669 |
token => $::form->{form_validity_token}, |
|
1670 |
); |
|
1671 |
|
|
1672 |
die $::locale->text('The form is not valid anymore.') if !$validity_token; |
|
1673 |
} |
|
1674 |
|
|
1675 | 1675 |
# delete custom shipto if it is to be deleted or if it is empty |
1676 | 1676 |
if ($self->order->custom_shipto && ($self->is_custom_shipto_to_delete || $self->order->custom_shipto->is_empty)) { |
1677 | 1677 |
$self->order->custom_shipto->delete if $self->order->custom_shipto->shipto_id; |
Auch abrufbar als: Unified diff
Gültigkeitstoken in Transaction abfragen und löschen ("neue" Controller)