31 |
31 |
use SL::DB::RequirementSpec;
|
32 |
32 |
use SL::DB::Shipto;
|
33 |
33 |
use SL::DB::Translation;
|
|
34 |
use SL::DB::ValidityToken;
|
34 |
35 |
|
35 |
36 |
use SL::Helper::CreatePDF qw(:all);
|
36 |
37 |
use SL::Helper::PrintOptions;
|
... | ... | |
86 |
87 |
|
87 |
88 |
|
88 |
89 |
$self->pre_render();
|
|
90 |
|
|
91 |
if (!$::form->{form_validity_token}) {
|
|
92 |
$::form->{form_validity_token} = SL::DB::ValidityToken->create(scope => SL::DB::ValidityToken::SCOPE_ORDER_SAVE())->token;
|
|
93 |
}
|
|
94 |
|
89 |
95 |
$self->render(
|
90 |
96 |
'order/form',
|
91 |
97 |
title => $self->get_title_for('add'),
|
... | ... | |
107 |
113 |
|
108 |
114 |
$self->recalc();
|
109 |
115 |
$self->pre_render();
|
|
116 |
|
|
117 |
if (!$::form->{form_validity_token}) {
|
|
118 |
$::form->{form_validity_token} = SL::DB::ValidityToken->create(scope => SL::DB::ValidityToken::SCOPE_ORDER_SAVE())->token;
|
|
119 |
}
|
|
120 |
|
110 |
121 |
$self->render(
|
111 |
122 |
'order/form',
|
112 |
123 |
title => $self->get_title_for('edit'),
|
... | ... | |
132 |
143 |
# are loaded only on demand. So we need to keep the values from
|
133 |
144 |
# the source.
|
134 |
145 |
$_->{render_second_row} = 1 for @{ $self->order->items_sorted };
|
|
146 |
|
|
147 |
if (!$::form->{form_validity_token}) {
|
|
148 |
$::form->{form_validity_token} = SL::DB::ValidityToken->create(scope => SL::DB::ValidityToken::SCOPE_ORDER_SAVE())->token;
|
|
149 |
}
|
135 |
150 |
}
|
136 |
151 |
|
137 |
152 |
$self->recalc();
|
... | ... | |
306 |
321 |
# no linked records on save as new
|
307 |
322 |
delete $::form->{$_} for qw(converted_from_oe_id converted_from_orderitems_ids);
|
308 |
323 |
|
|
324 |
if (!$::form->{form_validity_token}) {
|
|
325 |
$::form->{form_validity_token} = SL::DB::ValidityToken->create(scope => SL::DB::ValidityToken::SCOPE_ORDER_SAVE())->token;
|
|
326 |
}
|
|
327 |
|
309 |
328 |
# save
|
310 |
329 |
$self->action_save();
|
311 |
330 |
}
|
... | ... | |
943 |
962 |
# source.
|
944 |
963 |
$_->{render_second_row} = 1 for @{ $self->order->items_sorted };
|
945 |
964 |
|
|
965 |
if (!$::form->{form_validity_token}) {
|
|
966 |
$::form->{form_validity_token} = SL::DB::ValidityToken->create(scope => SL::DB::ValidityToken::SCOPE_ORDER_SAVE())->token;
|
|
967 |
}
|
|
968 |
|
946 |
969 |
$self->render(
|
947 |
970 |
'order/form',
|
948 |
971 |
title => $self->get_title_for('edit'),
|
... | ... | |
2097 |
2120 |
sub save {
|
2098 |
2121 |
my ($self) = @_;
|
2099 |
2122 |
|
|
2123 |
my $validity_token;
|
|
2124 |
if (!$self->order->id) {
|
|
2125 |
$validity_token = SL::DB::Manager::ValidityToken->fetch_valid_token(
|
|
2126 |
scope => SL::DB::ValidityToken::SCOPE_ORDER_SAVE(),
|
|
2127 |
token => $::form->{form_validity_token},
|
|
2128 |
);
|
|
2129 |
|
|
2130 |
return [t8('The form is not valid anymore.')] if !$validity_token;
|
|
2131 |
}
|
|
2132 |
|
2100 |
2133 |
$self->recalc();
|
2101 |
2134 |
$self->get_unalterable_data();
|
2102 |
2135 |
|
... | ... | |
2189 |
2222 |
|
2190 |
2223 |
$self->save_history('SAVED');
|
2191 |
2224 |
|
|
2225 |
$validity_token->delete if $validity_token;
|
|
2226 |
delete $::form->{form_validity_token};
|
|
2227 |
|
2192 |
2228 |
1;
|
2193 |
2229 |
}) || push(@{$errors}, $db->error);
|
2194 |
2230 |
|
Gültigkeitstoken Auftragscontroller