Revision 2bef4707
Von Tamino Steinert vor etwa 1 Jahr hinzugefügt
SL/Controller/Order.pm | ||
---|---|---|
74 | 74 |
|
75 | 75 |
__PACKAGE__->run_before('check_auth_for_edit', |
76 | 76 |
except => [ qw(edit show_customer_vendor_details_dialog price_popup load_second_rows close_quotations) ]); |
77 |
__PACKAGE__->run_before('get_basket_info_from_from'); |
|
77 | 78 |
|
78 | 79 |
# |
79 | 80 |
# actions |
... | ... | |
143 | 144 |
); |
144 | 145 |
} |
145 | 146 |
|
147 |
sub action_add_from_purchase_basket { |
|
148 |
my ($self) = @_; |
|
149 |
|
|
150 |
my $basket_item_ids = $::form->{basket_item_ids}; |
|
151 |
my $vendor_item_ids = $::form->{vendor_item_ids}; |
|
152 |
my $vendor_id = $::form->{vendor_id}; |
|
153 |
|
|
154 |
|
|
155 |
unless (scalar @{ $basket_item_ids} || scalar @{ $vendor_item_ids}) { |
|
156 |
$self->js->flash('error', t8('There are no items selected')); |
|
157 |
return $self->js->render(); |
|
158 |
} |
|
159 |
|
|
160 |
my $order = SL::DB::Order->create_from_purchase_basket( |
|
161 |
$basket_item_ids, $vendor_item_ids, $vendor_id |
|
162 |
); |
|
163 |
|
|
164 |
$self->order($order); |
|
165 |
|
|
166 |
$self->action_add(); |
|
167 |
} |
|
168 |
|
|
146 | 169 |
# edit an existing order |
147 | 170 |
sub action_edit { |
148 | 171 |
my ($self) = @_; |
... | ... | |
1620 | 1643 |
} |
1621 | 1644 |
$self->js->val('[name="converted_from_orderitems_ids[+]"]', ''); |
1622 | 1645 |
$self->js->val('[name="converted_from_reclamation_items_ids[+]"]', ''); |
1646 |
$self->js->val('[name="basket_item_ids[+]"]', ''); |
|
1623 | 1647 |
} |
1624 | 1648 |
|
1625 | 1649 |
# |
... | ... | |
1967 | 1991 |
return $item; |
1968 | 1992 |
} |
1969 | 1993 |
|
1994 |
sub get_basket_info_from_from { |
|
1995 |
my ($self) = @_; |
|
1996 |
|
|
1997 |
my $order = $self->order; |
|
1998 |
my $basket_item_ids = $::form->{basket_item_ids}; |
|
1999 |
if (scalar @{ $basket_item_ids || [] }) { |
|
2000 |
for my $idx (0 .. $#{ $order->items_sorted }) { |
|
2001 |
my $order_item = $order->items_sorted->[$idx]; |
|
2002 |
$order_item->{basket_item_id} = $basket_item_ids->[$idx]; |
|
2003 |
} |
|
2004 |
} |
|
2005 |
} |
|
2006 |
|
|
1970 | 2007 |
# setup custom shipto from form |
1971 | 2008 |
# |
1972 | 2009 |
# The dialog returns form variables starting with 'shipto' and cvars starting |
Auch abrufbar als: Unified diff
DispositionManager: Lieferschein beim Erstellen nicht automatisch speichern