Revision 3f78c062
Von Bernd Bleßmann vor mehr als 1 Jahr hinzugefügt
SL/Controller/Order.pm | ||
---|---|---|
256 | 256 |
sub action_add_subversion { |
257 | 257 |
my ($self) = @_; |
258 | 258 |
|
259 |
my $current_version_number = $self->order->current_version_number; |
|
260 |
my $new_version_number = $current_version_number + 1; |
|
259 |
SL::DB->client->with_transaction( |
|
260 |
sub { |
|
261 |
SL::Model::Record->increment_subversion($self->order); |
|
261 | 262 |
|
262 |
my $new_number = $self->order->number; |
|
263 |
$new_number =~ s/-$current_version_number$//; |
|
264 |
$self->order->number($new_number . '-' . $new_version_number); |
|
265 |
$self->order->add_order_version(SL::DB::OrderVersion->new(oe_id => $self->order->id, |
|
266 |
version => $new_version_number)); |
|
263 |
# Todo: Call SL::Model::Record->save when implemented |
|
264 |
# SL::Model::Record->save($self->order); |
|
265 |
my $errors = $self->save(); |
|
266 |
die join "\n", @{ $errors } if scalar @{ $errors }; |
|
267 | 267 |
|
268 |
# call the save action |
|
269 |
$self->action_save(); |
|
268 |
1; |
|
269 |
} |
|
270 |
); |
|
270 | 271 |
|
272 |
$self->redirect_to(action => 'edit', |
|
273 |
type => $self->type, |
|
274 |
id => $self->order->id, |
|
275 |
); |
|
271 | 276 |
} |
272 | 277 |
|
273 | 278 |
# save the order as new document and open it for edit |
Auch abrufbar als: Unified diff
Order-Controller: Unterversion hochzählen über Model:Record umgesetzt
Todo: SL::Model::Record->save verwenden, sobald implementiert