Revision cf6fdab1
Von Tamino Steinert vor etwa 1 Jahr hinzugefügt
SL/Controller/DeliveryOrder.pm | ||
---|---|---|
78 | 78 |
sub action_add { |
79 | 79 |
my ($self) = @_; |
80 | 80 |
|
81 |
$self->order->transdate(DateTime->now_local()); |
|
82 |
$self->type_data->set_reqdate_by_type; |
|
83 |
|
|
81 |
$self->order(SL::Model::Record->update_after_new($self->order, $self->type)); |
|
84 | 82 |
|
85 | 83 |
$self->pre_render(); |
86 | 84 |
|
SL/Controller/Order.pm | ||
---|---|---|
78 | 78 |
sub action_add { |
79 | 79 |
my ($self) = @_; |
80 | 80 |
|
81 |
$self->order->transdate(DateTime->now_local()); |
|
82 |
my $extra_days = $self->type eq sales_quotation_type() ? $::instance_conf->get_reqdate_interval : |
|
83 |
$self->type eq sales_order_type() ? $::instance_conf->get_delivery_date_interval : |
|
84 |
$self->type eq sales_order_intake_type() ? $::instance_conf->get_delivery_date_interval : 1; |
|
85 |
|
|
86 |
if (($self->type eq sales_order_intake_type() && $::instance_conf->get_deliverydate_on) |
|
87 |
|| ($self->type eq sales_order_type() && $::instance_conf->get_deliverydate_on) |
|
88 |
|| ($self->type eq sales_quotation_type() && $::instance_conf->get_reqdate_on) |
|
89 |
&& (!$self->order->reqdate)) { |
|
90 |
$self->order->reqdate(DateTime->today_local->next_workday(extra_days => $extra_days)); |
|
91 |
} |
|
92 |
|
|
81 |
$self->order(SL::Model::Record->update_after_new($self->order, $self->type)); |
|
93 | 82 |
|
94 | 83 |
$self->pre_render(); |
95 | 84 |
|
SL/Controller/Reclamation.pm | ||
---|---|---|
98 | 98 |
sub action_add { |
99 | 99 |
my ($self) = @_; |
100 | 100 |
|
101 |
$self->reclamation->transdate(DateTime->now_local());
|
|
101 |
$self->reclamation(SL::Model::Record->update_after_new($self->reclamation, $self->type));
|
|
102 | 102 |
|
103 | 103 |
$self->pre_render(); |
104 | 104 |
|
SL/Model/Record.pm | ||
---|---|---|
17 | 17 |
use SL::Util qw(trim); |
18 | 18 |
use SL::Locale::String qw(t8); |
19 | 19 |
|
20 |
sub new { |
|
21 |
my ($class, $target_type, %flags) = @_;
|
|
20 |
sub update_after_new {
|
|
21 |
my ($class, $new_record, $subtype, %flags) = @_;
|
|
22 | 22 |
|
23 |
# target_type: der angeforderte typ |
|
23 |
my $type_info = { |
|
24 |
# order |
|
25 |
sales_quotation => { |
|
26 |
get_new_reqdate => sub { |
|
27 |
if ($::instance_conf->get_reqdate_on) { |
|
28 |
return DateTime->today_local->next_workday( |
|
29 |
extra_days => $::instance_conf->get_reqdate_interval()); |
|
30 |
} else { |
|
31 |
return ''; |
|
32 |
} |
|
33 |
}, |
|
34 |
}, |
|
35 |
sales_order => { |
|
36 |
get_new_reqdate => sub { |
|
37 |
if ($::instance_conf->get_deliverydate_on) { |
|
38 |
return DateTime->today_local->next_workday( |
|
39 |
extra_days => $::instance_conf->get_delivery_date_interval()); |
|
40 |
} else { |
|
41 |
return ''; |
|
42 |
} |
|
43 |
}, |
|
44 |
}, |
|
45 |
request_quotation => { |
|
46 |
get_new_reqdate => sub { DateTime->today_local->next_workday(extra_days => 1); }, |
|
47 |
}, |
|
48 |
purchase_order => { |
|
49 |
get_new_reqdate => sub { DateTime->today_local->next_workday(extra_days => 1); }, |
|
50 |
}, |
|
51 |
# delivery_order |
|
52 |
rma_delivery_order => { |
|
53 |
get_new_reqdate => sub { DateTime->today_local->next_workday(extra_days => 1); }, |
|
54 |
}, |
|
55 |
sales_delivery_order => { |
|
56 |
get_new_reqdate => sub { DateTime->today_local->next_workday(extra_days => 1); }, |
|
57 |
}, |
|
58 |
supplier_delivery_order => { |
|
59 |
get_new_reqdate => sub { DateTime->today_local->next_workday(extra_days => 1); }, |
|
60 |
}, |
|
61 |
purchase_delivery_order => { |
|
62 |
get_new_reqdate => sub { DateTime->today_local->next_workday(extra_days => 1); }, |
|
63 |
}, |
|
64 |
# reclamation |
|
65 |
sales_reclamation => { |
|
66 |
get_new_reqdate => sub { return; }, |
|
67 |
}, |
|
68 |
purchase_reclamation => { |
|
69 |
get_new_reqdate => sub { return; }, |
|
70 |
}, |
|
71 |
}; |
|
72 |
|
|
73 |
$new_record->transdate(DateTime->now_local()); |
|
74 |
$new_record->reqdate($type_info->{$subtype}->{get_new_reqdate}->()); |
|
75 |
|
|
76 |
# new_record: der neuerstellte objekt |
|
24 | 77 |
# flags: zusätzliche informationen zu der behanldung (soll ) |
25 | 78 |
|
26 | 79 |
# (aus add) neues record mit vorbereitenden sachen wie transdate/reqdate |
27 | 80 |
# |
28 | 81 |
# rückgabe: neues objekt |
29 | 82 |
# fehlerfall: exception |
83 |
return $new_record; |
|
30 | 84 |
} |
31 | 85 |
|
32 | 86 |
sub new_from_workflow { |
Auch abrufbar als: Unified diff
Model::Record: update_after_new implementiert