Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision 3f78c062

Von Bernd Bleßmann vor fast 2 Jahren hinzugefügt

  • ID 3f78c0620a1a90621c1586fa9c4c769140774cfc
  • Vorgänger 9c01bef6
  • Nachfolger fdd6ef43

Order-Controller: Unterversion hochzählen über Model:Record umgesetzt

Todo: SL::Model::Record->save verwenden, sobald implementiert

Unterschiede anzeigen:

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
SL/DB/Order.pm
645 645
  return $final_version;
646 646
}
647 647

  
648
sub increment_version_number {
649
  my ($self) = @_;
650

  
651
  die t8('This sub-version is not yet finalized') if !$self->is_final_version;
652

  
653
  my $current_version_number = $self->current_version_number;
654
  my $new_version_number     = $current_version_number + 1;
655

  
656
  my $new_number = $self->number;
657
  $new_number    =~ s/-$current_version_number$//;
658
  $self->number($new_number . '-' . $new_version_number);
659
  $self->add_order_version(SL::DB::OrderVersion->new(version => $new_version_number));
660
}
661

  
648 662
sub netamount_base_currency {
649 663
  my ($self) = @_;
650 664

  
SL/Model/Record.pm
109 109
  #
110 110
  # return - nichts
111 111
  # fehlerfall: exception
112

  
113
  # Todo: check type data if this is allowed/supported for this record
114

  
115
  $record->increment_version_number;
116

  
117
  return;
112 118
}
113 119

  
114 120
sub delete {
......
223 229

  
224 230
=head1 AUTHORS
225 231

  
232
Bernd Bleßmann E<lt>bernd@kivitendo-premium.deE<gt>
233
...
234

  
235
=cut

Auch abrufbar als: Unified diff