Revision 8eaf5ab5
Von Tamino Steinert vor etwa 1 Jahr hinzugefügt
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