Revision 58b77960
Von Tamino Steinert vor mehr als 1 Jahr hinzugefügt
SL/Controller/Order.pm | ||
---|---|---|
67 | 67 |
|
68 | 68 |
__PACKAGE__->run_before('check_auth_for_edit', |
69 | 69 |
except => [ qw(edit show_customer_vendor_details_dialog price_popup load_second_rows close_quotations) ]); |
70 |
__PACKAGE__->run_before('get_basket_info_from_from'); |
|
70 | 71 |
|
71 | 72 |
# |
72 | 73 |
# actions |
... | ... | |
128 | 129 |
); |
129 | 130 |
} |
130 | 131 |
|
132 |
sub action_add_from_purchase_basket { |
|
133 |
my ($self) = @_; |
|
134 |
|
|
135 |
my $basket_item_ids = $::form->{basket_item_ids}; |
|
136 |
my $vendor_item_ids = $::form->{vendor_item_ids}; |
|
137 |
my $vendor_id = $::form->{vendor_id}; |
|
138 |
|
|
139 |
|
|
140 |
unless (scalar @{ $basket_item_ids} || scalar @{ $vendor_item_ids}) { |
|
141 |
$self->js->flash('error', t8('There are no items selected')); |
|
142 |
return $self->js->render(); |
|
143 |
} |
|
144 |
|
|
145 |
my $order = SL::DB::Order->create_from_purchase_basket( |
|
146 |
$basket_item_ids, $vendor_item_ids, $vendor_id |
|
147 |
); |
|
148 |
|
|
149 |
$self->order($order); |
|
150 |
|
|
151 |
$self->action_add(); |
|
152 |
} |
|
153 |
|
|
131 | 154 |
# edit an existing order |
132 | 155 |
sub action_edit { |
133 | 156 |
my ($self) = @_; |
... | ... | |
1708 | 1731 |
} |
1709 | 1732 |
$self->js->val('[name="converted_from_orderitems_ids[+]"]', ''); |
1710 | 1733 |
$self->js->val('[name="converted_from_reclamation_items_ids[+]"]', ''); |
1734 |
$self->js->val('[name="basket_item_ids[+]"]', ''); |
|
1711 | 1735 |
} |
1712 | 1736 |
|
1713 | 1737 |
# |
... | ... | |
2075 | 2099 |
return $item; |
2076 | 2100 |
} |
2077 | 2101 |
|
2102 |
sub get_basket_info_from_from { |
|
2103 |
my ($self) = @_; |
|
2104 |
|
|
2105 |
my $order = $self->order; |
|
2106 |
my $basket_item_ids = $::form->{basket_item_ids}; |
|
2107 |
if (scalar @{ $basket_item_ids || [] }) { |
|
2108 |
for my $idx (0 .. $#{ $order->items_sorted }) { |
|
2109 |
my $order_item = $order->items_sorted->[$idx]; |
|
2110 |
$order_item->{basket_item_id} = $basket_item_ids->[$idx]; |
|
2111 |
} |
|
2112 |
} |
|
2113 |
} |
|
2114 |
|
|
2078 | 2115 |
sub setup_order_from_cv { |
2079 | 2116 |
my ($order) = @_; |
2080 | 2117 |
|
Auch abrufbar als: Unified diff
DispositionManager: Lieferschein beim Erstellen nicht automatisch speichern