Revision 877cc904
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 |
... | ... | |
126 | 127 |
); |
127 | 128 |
} |
128 | 129 |
|
130 |
sub action_add_from_purchase_basket { |
|
131 |
my ($self) = @_; |
|
132 |
|
|
133 |
my $basket_item_ids = $::form->{basket_item_ids}; |
|
134 |
my $vendor_item_ids = $::form->{vendor_item_ids}; |
|
135 |
my $vendor_id = $::form->{vendor_id}; |
|
136 |
|
|
137 |
|
|
138 |
unless (scalar @{ $basket_item_ids} || scalar @{ $vendor_item_ids}) { |
|
139 |
$self->js->flash('error', t8('There are no items selected')); |
|
140 |
return $self->js->render(); |
|
141 |
} |
|
142 |
|
|
143 |
my $order = SL::DB::Order->create_from_purchase_basket( |
|
144 |
$basket_item_ids, $vendor_item_ids, $vendor_id |
|
145 |
); |
|
146 |
|
|
147 |
$self->order($order); |
|
148 |
|
|
149 |
$self->action_add(); |
|
150 |
} |
|
151 |
|
|
129 | 152 |
# edit an existing order |
130 | 153 |
sub action_edit { |
131 | 154 |
my ($self) = @_; |
... | ... | |
1700 | 1723 |
} |
1701 | 1724 |
$self->js->val('[name="converted_from_orderitems_ids[+]"]', ''); |
1702 | 1725 |
$self->js->val('[name="converted_from_reclamation_items_ids[+]"]', ''); |
1726 |
$self->js->val('[name="basket_item_ids[+]"]', ''); |
|
1703 | 1727 |
} |
1704 | 1728 |
|
1705 | 1729 |
# |
... | ... | |
2062 | 2086 |
return $item; |
2063 | 2087 |
} |
2064 | 2088 |
|
2089 |
sub get_basket_info_from_from { |
|
2090 |
my ($self) = @_; |
|
2091 |
|
|
2092 |
my $order = $self->order; |
|
2093 |
my $basket_item_ids = $::form->{basket_item_ids}; |
|
2094 |
if (scalar @{ $basket_item_ids || [] }) { |
|
2095 |
for my $idx (0 .. $#{ $order->items_sorted }) { |
|
2096 |
my $order_item = $order->items_sorted->[$idx]; |
|
2097 |
$order_item->{basket_item_id} = $basket_item_ids->[$idx]; |
|
2098 |
} |
|
2099 |
} |
|
2100 |
} |
|
2101 |
|
|
2065 | 2102 |
sub setup_order_from_cv { |
2066 | 2103 |
my ($order) = @_; |
2067 | 2104 |
|
Auch abrufbar als: Unified diff
DispositionManager: Lieferschein beim Erstellen nicht automatisch speichern