Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision 48f45a37

Von Bernd Bleßmann vor etwa 1 Jahr hinzugefügt

  • ID 48f45a37adaddd0d4f99212204bd4cb6b18cc624
  • Vorgänger dd593357
  • Nachfolger 94263c26

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

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

Unterschiede anzeigen:

SL/Controller/Order.pm
270 270
sub action_add_subversion {
271 271
  my ($self) = @_;
272 272

  
273
  my $current_version_number = $self->order->current_version_number;
274
  my $new_version_number     = $current_version_number + 1;
273
  SL::DB->client->with_transaction(
274
    sub {
275
      SL::Model::Record->increment_subversion($self->order);
275 276

  
276
  my $new_number = $self->order->number;
277
  $new_number    =~ s/-$current_version_number$//;
278
  $self->order->number($new_number . '-' . $new_version_number);
279
  $self->order->add_order_version(SL::DB::OrderVersion->new(oe_id   => $self->order->id,
280
                                                            version => $new_version_number));
277
      # Todo: Call SL::Model::Record->save when implemented
278
      # SL::Model::Record->save($self->order);
279
      my $errors = $self->save();
280
      die join "\n", @{ $errors } if scalar @{ $errors };
281 281

  
282
  # call the save action
283
  $self->action_save();
282
      1;
283
    }
284
  );
284 285

  
286
  $self->redirect_to(action => 'edit',
287
                     type   => $self->type,
288
                     id     => $self->order->id,
289
  );
285 290
}
286 291

  
287 292
# save the order as new document and open it for edit
SL/DB/Order.pm
672 672
  return $final_version;
673 673
}
674 674

  
675
sub increment_version_number {
676
  my ($self) = @_;
677

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

  
680
  my $current_version_number = $self->current_version_number;
681
  my $new_version_number     = $current_version_number + 1;
682

  
683
  my $new_number = $self->number;
684
  $new_number    =~ s/-$current_version_number$//;
685
  $self->number($new_number . '-' . $new_version_number);
686
  $self->add_order_version(SL::DB::OrderVersion->new(version => $new_version_number));
687
}
688

  
675 689
sub netamount_base_currency {
676 690
  my ($self) = @_;
677 691

  
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