32 |
32 |
use SL::DB::ValidityToken;
|
33 |
33 |
use SL::DB::Warehouse;
|
34 |
34 |
use SL::DB::Helper::RecordLink qw(set_record_link_conversions);
|
|
35 |
use SL::DB::Helper::TypeDataProxy;
|
|
36 |
use SL::DB::DeliveryOrder;
|
|
37 |
use SL::DB::DeliveryOrder::TypeData qw(:types);
|
35 |
38 |
use SL::Model::Record;
|
36 |
39 |
|
37 |
40 |
use SL::Helper::CreatePDF qw(:all);
|
... | ... | |
42 |
45 |
use SL::Helper::UserPreferences::UpdatePositions;
|
43 |
46 |
|
44 |
47 |
use SL::Controller::Helper::GetModels;
|
45 |
|
use SL::Controller::DeliveryOrder::TypeData qw(:types);
|
46 |
48 |
|
47 |
49 |
use List::Util qw(first sum0);
|
48 |
50 |
use List::UtilsBy qw(sort_by uniq_by);
|
... | ... | |
98 |
100 |
# this interfers with init_order
|
99 |
101 |
$self->{converted_from_oe_id} = delete $::form->{id};
|
100 |
102 |
|
101 |
|
$self->type_data->validate($::form->{type});
|
|
103 |
$self->type_data->validate;
|
102 |
104 |
|
103 |
105 |
my $order = SL::DB::Order->new(id => $self->{converted_from_oe_id})->load;
|
104 |
106 |
|
... | ... | |
190 |
192 |
sub action_delete {
|
191 |
193 |
my ($self) = @_;
|
192 |
194 |
|
193 |
|
my $number_type = $self->type_data;
|
194 |
195 |
my %history = (snumbers => $self->type . '_' . $self->order->number);
|
195 |
196 |
my %params = (history => \%history);
|
196 |
197 |
SL::Model::Record->delete($self->order,%params);
|
... | ... | |
436 |
437 |
email_form => $email_form,
|
437 |
438 |
show_bcc => $::auth->assert('email_bcc', 'may fail'),
|
438 |
439 |
FILES => \%files,
|
439 |
|
is_customer => $self->type_data->is_customer,
|
|
440 |
is_customer => $self->type_data->properties("is_customer"),
|
440 |
441 |
ALL_EMPLOYEES => $self->{all_employees},
|
441 |
442 |
);
|
442 |
443 |
|
... | ... | |
699 |
700 |
ITEM => $item,
|
700 |
701 |
ID => $item_id,
|
701 |
702 |
SELF => $self,
|
702 |
|
in_out => $self->type_data->transfer,
|
|
703 |
in_out => $self->type_data->properties("transfer"),
|
703 |
704 |
);
|
704 |
705 |
|
705 |
706 |
if ($::form->{insert_before_item_id}) {
|
... | ... | |
787 |
788 |
ITEM => $item,
|
788 |
789 |
ID => $item_id,
|
789 |
790 |
SELF => $self,
|
790 |
|
in_out => $self->type_data->transfer,
|
|
791 |
in_out => $self->type_data->properties("transfer"),
|
791 |
792 |
);
|
792 |
793 |
|
793 |
794 |
if ($::form->{insert_before_item_id}) {
|
... | ... | |
930 |
931 |
my $item_id = $::form->{item_id};
|
931 |
932 |
my $qty = _parse_number($::form->{qty_as_number});
|
932 |
933 |
|
933 |
|
my $inout = $self->type_data->transfer;
|
|
934 |
my $inout = $self->type_data->properties("transfer");
|
934 |
935 |
|
935 |
936 |
my @contents = DO->get_item_availability(parts_id => $part->id);
|
936 |
937 |
my $stock_info = DO->unpack_stock_information(packed => $stock);
|
... | ... | |
1261 |
1262 |
sub init_cv {
|
1262 |
1263 |
my ($self) = @_;
|
1263 |
1264 |
|
1264 |
|
return $self->type_data->customervendor;
|
|
1265 |
return $self->type_data->properties("customervendor");
|
1265 |
1266 |
}
|
1266 |
1267 |
|
1267 |
1268 |
sub init_search_cvpartnumber {
|
... | ... | |
1302 |
1303 |
sub check_auth {
|
1303 |
1304 |
my ($self) = @_;
|
1304 |
1305 |
|
1305 |
|
$::auth->assert($self->type_data->access('view') || 'DOES_NOT_EXIST');
|
|
1306 |
$::auth->assert($self->type_data->rights('view') || 'DOES_NOT_EXIST');
|
1306 |
1307 |
}
|
1307 |
1308 |
|
1308 |
1309 |
sub check_auth_for_edit {
|
1309 |
1310 |
my ($self) = @_;
|
1310 |
1311 |
|
1311 |
|
$::auth->assert($self->type_data->access('edit') || 'DOES_NOT_EXIST');
|
|
1312 |
$::auth->assert($self->type_data->rights('edit') || 'DOES_NOT_EXIST');
|
1312 |
1313 |
}
|
1313 |
1314 |
|
1314 |
1315 |
# build the selection box for contacts
|
... | ... | |
1396 |
1397 |
# order here solves this problem.
|
1397 |
1398 |
my $order;
|
1398 |
1399 |
$order = SL::DB::DeliveryOrder->new(id => $::form->{id})->load(with => [ 'orderitems', 'orderitems.part' ]) if $::form->{id};
|
1399 |
|
$order ||= SL::DB::DeliveryOrder->new(orderitems => [], currency_id => $::instance_conf->get_currency_id(), order_type => $self->type_data->validate($::form->{type}));
|
|
1400 |
$order ||= SL::DB::DeliveryOrder->new(orderitems => [], currency_id => $::instance_conf->get_currency_id(), order_type => $self->type_data->validate);
|
1400 |
1401 |
|
1401 |
1402 |
my $cv_id_method = $self->cv . '_id';
|
1402 |
1403 |
if (!$::form->{id} && $::form->{$cv_id_method}) {
|
... | ... | |
1815 |
1816 |
$item->active_discount_source($price_source->discount_from_source($item->active_discount_source));
|
1816 |
1817 |
}
|
1817 |
1818 |
|
1818 |
|
if ($self->order->${\ $self->type_data->nr_key } && $::instance_conf->get_webdav) {
|
|
1819 |
if ($self->order->${\ $self->type_data->properties("nr_key") } && $::instance_conf->get_webdav) {
|
1819 |
1820 |
my $webdav = SL::Webdav->new(
|
1820 |
1821 |
type => $self->type,
|
1821 |
1822 |
number => $self->order->number,
|
... | ... | |
1827 |
1828 |
} } @all_objects;
|
1828 |
1829 |
}
|
1829 |
1830 |
|
1830 |
|
$self->{template_args}{in_out} = $self->type_data->transfer;
|
|
1831 |
$self->{template_args}{in_out} = $self->type_data->properties("transfer");
|
1831 |
1832 |
$self->{template_args}{longdescription_dialog_size_percentage} = SL::Helper::UserPreferences::DisplayPreferences->new()->get_longdescription_dialog_size_percentage();
|
1832 |
1833 |
|
1833 |
1834 |
$self->get_item_cvpartnumber($_) for @{$self->order->items_sorted};
|
... | ... | |
1841 |
1842 |
my ($self, %params) = @_;
|
1842 |
1843 |
|
1843 |
1844 |
my $deletion_allowed = $self->type_data->show_menu("delete");
|
1844 |
|
my $may_edit_create = $::auth->assert($self->type_data->access('edit') || 'DOES_NOT_EXIST', 1);
|
|
1845 |
my $may_edit_create = $::auth->assert($self->type_data->rights('edit') || 'DOES_NOT_EXIST', 1);
|
1845 |
1846 |
|
1846 |
1847 |
for my $bar ($::request->layout->get('actionbar')) {
|
1847 |
1848 |
$bar->add(
|
... | ... | |
2174 |
2175 |
}
|
2175 |
2176 |
|
2176 |
2177 |
sub nr_key {
|
2177 |
|
return $_[0]->type_data->nr_key;
|
|
2178 |
return $_[0]->type_data->properties("nr_key");
|
2178 |
2179 |
}
|
2179 |
2180 |
|
2180 |
2181 |
sub save_and_redirect_to {
|
... | ... | |
2278 |
2279 |
}
|
2279 |
2280 |
|
2280 |
2281 |
sub init_type_data {
|
2281 |
|
SL::Controller::DeliveryOrder::TypeData->new($_[0]);
|
|
2282 |
SL::DB::Helper::TypeDataProxy->new('SL::DB::DeliveryOrder', $::form->{type});
|
2282 |
2283 |
}
|
2283 |
2284 |
|
2284 |
2285 |
sub init_valid_types {
|
DeliveryOrder: TypeData jetzt über proxy eingebunden
Macht den Controller proxy unnötig. reqdate default werden jetzt anders
behandelt