Revision 28999c3c
Von Werner Hahn vor 5 Tagen hinzugefügt
- ID 28999c3cbfe038561cb0c418a44a29ae689ad050
- Vorgänger 64a0ac19
SL/Controller/Order.pm | ||
---|---|---|
1039 | 1039 |
# add an item row for a new item entered in the input row |
1040 | 1040 |
sub action_add_item { |
1041 | 1041 |
my ($self) = @_; |
1042 |
my $template_name = $::form->{point_of_sale} ? |
|
1043 |
'pos/tabs/_row' |
|
1044 |
: 'order/tabs/_row'; |
|
1042 | 1045 |
|
1043 | 1046 |
delete $::form->{add_item}->{create_part_type}; |
1044 | 1047 |
|
... | ... | |
1055 | 1058 |
$self->get_item_cvpartnumber($item); |
1056 | 1059 |
|
1057 | 1060 |
my $item_id = join('_', 'new', Time::HiRes::gettimeofday(), int rand 1000000000000); |
1058 |
my $row_as_html = $self->p->render('order/tabs/_row', |
|
1059 |
ITEM => $item, |
|
1060 |
ID => $item_id, |
|
1061 |
SELF => $self, |
|
1061 |
|
|
1062 |
my $row_as_html = $self->p->render( |
|
1063 |
$template_name, |
|
1064 |
ITEM => $item, |
|
1065 |
ID => $item_id, |
|
1066 |
SELF => $self, |
|
1062 | 1067 |
); |
1063 | 1068 |
|
1064 | 1069 |
if ($::form->{insert_before_item_id}) { |
... | ... | |
1070 | 1075 |
} |
1071 | 1076 |
|
1072 | 1077 |
if ( $item->part->is_assortment ) { |
1073 |
$form_attr->{qty_as_number} = 1 unless $form_attr->{qty_as_number}; |
|
1074 | 1078 |
foreach my $assortment_item ( @{$item->part->assortment_items} ) { |
1075 |
my $attr = { parts_id => $assortment_item->parts_id, |
|
1076 |
qty => $assortment_item->qty * $::form->parse_amount(\%::myconfig, $form_attr->{qty_as_number}), # TODO $form_attr->{unit} |
|
1077 |
unit => $assortment_item->unit, |
|
1078 |
description => $assortment_item->part->description, |
|
1079 |
}; |
|
1079 |
my $attr = { |
|
1080 |
parts_id => $assortment_item->parts_id, |
|
1081 |
qty => $assortment_item->qty * ($item->qty || 1), # TODO $item->unit |
|
1082 |
unit => $assortment_item->unit, |
|
1083 |
description => $assortment_item->part->description, |
|
1084 |
}; |
|
1080 | 1085 |
my $item = new_item($self->order, $attr); |
1081 | 1086 |
|
1082 | 1087 |
# set discount to 100% if item isn't supposed to be charged, overwriting any customer discount |
... | ... | |
1086 | 1091 |
$self->recalc(); |
1087 | 1092 |
$self->get_item_cvpartnumber($item); |
1088 | 1093 |
my $item_id = join('_', 'new', Time::HiRes::gettimeofday(), int rand 1000000000000); |
1089 |
my $row_as_html = $self->p->render('order/tabs/_row', |
|
1090 |
ITEM => $item, |
|
1091 |
ID => $item_id, |
|
1092 |
SELF => $self, |
|
1094 |
my $row_as_html = $self->p->render( |
|
1095 |
$template_name, |
|
1096 |
ITEM => $item, |
|
1097 |
ID => $item_id, |
|
1098 |
SELF => $self, |
|
1093 | 1099 |
); |
1094 | 1100 |
if ($::form->{insert_before_item_id}) { |
1095 | 1101 |
$self->js |
Auch abrufbar als: Unified diff
POS: initial