Revision 9ddaf796
Von Tamino Steinert vor mehr als 1 Jahr hinzugefügt
SL/Controller/DeliveryOrder.pm | ||
---|---|---|
sub action_add {
|
||
my ($self) = @_;
|
||
|
||
$self->order(SL::Model::Record->update_after_new($self->order, $self->type));
|
||
$self->order(SL::Model::Record->update_after_new($self->order));
|
||
|
||
$self->pre_render();
|
||
|
SL/Controller/Order.pm | ||
---|---|---|
sub action_add {
|
||
my ($self) = @_;
|
||
|
||
$self->order(SL::Model::Record->update_after_new($self->order, $self->type));
|
||
$self->order(SL::Model::Record->update_after_new($self->order));
|
||
|
||
$self->pre_render();
|
||
|
SL/Controller/Reclamation.pm | ||
---|---|---|
sub action_add {
|
||
my ($self) = @_;
|
||
|
||
$self->reclamation(SL::Model::Record->update_after_new($self->reclamation, $self->type));
|
||
$self->reclamation(SL::Model::Record->update_after_new($self->reclamation));
|
||
|
||
$self->pre_render();
|
||
|
SL/Model/Record.pm | ||
---|---|---|
use SL::DB::Invoice;
|
||
use SL::DB::Status;
|
||
use SL::DB::ValidityToken;
|
||
use SL::DB::Helper::TypeDataProxy;
|
||
use SL::DB::Order::TypeData qw(:types);
|
||
use SL::DB::DeliveryOrder::TypeData qw(:types);
|
||
use SL::DB::Reclamation::TypeData qw(:types);
|
||
... | ... | |
|
||
|
||
sub update_after_new {
|
||
my ($class, $new_record, $subtype, %flags) = @_;
|
||
my ($class, $new_record, %flags) = @_;
|
||
|
||
$new_record->transdate(DateTime->now_local());
|
||
|
||
# build TypeDataProxy
|
||
# TODO: remove when type is set in record and not infered form customer/vendor_id
|
||
my $type_data_proxy = SL::DB::Helper::TypeDataProxy->new(ref $new_record, $subtype);
|
||
$new_record->reqdate($type_data_proxy->defaults('reqdate'));
|
||
my $default_reqdate = $new_record->type_data->defaults('reqdate');
|
||
$new_record->reqdate($default_reqdate);
|
||
|
||
return $new_record;
|
||
}
|
||
... | ... | |
|
||
=item C<update_after_new>
|
||
|
||
Creates a new record_object by record_type and sub_type.
|
||
Sets reqdate and transdate if required by type_data.
|
||
Updates a record_object corresponding to type_data.
|
||
Sets reqdate and transdate.
|
||
|
||
Returns the record object.
|
||
|
||
... | ... | |
|
||
=item *
|
||
|
||
For SL::DB::Order and SL::DB::Reclamations the subtype should be saved in the database and not inferred from customer/vendor.
|
||
|
||
=item *
|
||
|
||
Further encapsulate the linking logic for creating linked records.
|
||
|
||
=item *
|
Auch abrufbar als: Unified diff
Model::Record: Entferne TypedataProxy
Auf Typedata kann jetzt immer über den Belege zugegriffen werden.