1084 |
1084 |
|
1085 |
1085 |
return unless $form_attr->{parts_id};
|
1086 |
1086 |
|
1087 |
|
my $item = new_item($self->order, $form_attr);
|
|
1087 |
my $item = $self->new_item($self->order, $form_attr);
|
1088 |
1088 |
|
1089 |
1089 |
$self->order->add_items($item);
|
1090 |
1090 |
|
... | ... | |
1115 |
1115 |
unit => $assortment_item->unit,
|
1116 |
1116 |
description => $assortment_item->part->description,
|
1117 |
1117 |
};
|
1118 |
|
my $item = new_item($self->order, $attr);
|
|
1118 |
my $item = $self->new_item($self->order, $attr);
|
1119 |
1119 |
|
1120 |
1120 |
# set discount to 100% if item isn't supposed to be charged, overwriting any customer discount
|
1121 |
1121 |
$item->discount(1) unless $assortment_item->charge;
|
... | ... | |
1163 |
1163 |
|
1164 |
1164 |
my @items;
|
1165 |
1165 |
foreach my $attr (@form_attr) {
|
1166 |
|
my $item = new_item($self->order, $attr);
|
|
1166 |
my $item = $self->new_item($self->order, $attr);
|
1167 |
1167 |
push @items, $item;
|
1168 |
1168 |
if ( $item->part->is_assortment ) {
|
1169 |
1169 |
foreach my $assortment_item ( @{$item->part->assortment_items} ) {
|
... | ... | |
1172 |
1172 |
unit => $assortment_item->unit,
|
1173 |
1173 |
description => $assortment_item->part->description,
|
1174 |
1174 |
};
|
1175 |
|
my $item = new_item($self->order, $attr);
|
|
1175 |
my $item = $self->new_item($self->order, $attr);
|
1176 |
1176 |
|
1177 |
1177 |
# set discount to 100% if item isn't supposed to be charged, overwriting any customer discount
|
1178 |
1178 |
$item->discount(1) unless $assortment_item->charge;
|
... | ... | |
1369 |
1369 |
foreach my $item_id (@{ $::form->{item_ids} }) {
|
1370 |
1370 |
my $idx = first_index { $_ eq $item_id } @{ $::form->{orderitem_ids} };
|
1371 |
1371 |
my $item = $self->order->items_sorted->[$idx];
|
1372 |
|
my $texts = get_part_texts($item->part, $self->order->language_id);
|
|
1372 |
my $texts = $self->get_part_texts($item->part, $self->order->language_id);
|
1373 |
1373 |
|
1374 |
1374 |
$item->description($texts->{description});
|
1375 |
1375 |
$item->longdescription($texts->{longdescription});
|
... | ... | |
1870 |
1870 |
#
|
1871 |
1871 |
# This is used to add one item
|
1872 |
1872 |
sub new_item {
|
1873 |
|
my ($record, $attr) = @_;
|
|
1873 |
my ($self, $record, $attr) = @_;
|
1874 |
1874 |
|
1875 |
1875 |
my $item = SL::DB::OrderItem->new;
|
1876 |
1876 |
|
... | ... | |
1904 |
1904 |
# saved. Adding empty custom_variables to new orderitem here solves this problem.
|
1905 |
1905 |
$new_attr{custom_variables} = [];
|
1906 |
1906 |
|
1907 |
|
my $texts = get_part_texts($item->part, $record->language_id, description => $new_attr{description}, longdescription => $new_attr{longdescription});
|
|
1907 |
my $texts = $self->get_part_texts($item->part, $record->language_id, description => $new_attr{description}, longdescription => $new_attr{longdescription});
|
1908 |
1908 |
|
1909 |
1909 |
$item->assign_attributes(%new_attr, %{ $texts });
|
1910 |
1910 |
|
... | ... | |
2664 |
2664 |
}
|
2665 |
2665 |
|
2666 |
2666 |
sub get_part_texts {
|
2667 |
|
my ($part_or_id, $language_or_id, %defaults) = @_;
|
|
2667 |
my ($self, $part_or_id, $language_or_id, %defaults) = @_;
|
2668 |
2668 |
|
2669 |
2669 |
my $part = ref($part_or_id) ? $part_or_id : SL::DB::Part->load_cached($part_or_id);
|
2670 |
2670 |
my $language_id = ref($language_or_id) ? $language_or_id->id : $language_or_id;
|
FIX: S:C:RecordBase: rufe alle Funktionen auf self auf.