Revision 289c5ed9
Von Werner Hahn vor mehr als 6 Jahren hinzugefügt
SL/Controller/ShopOrder.pm | ||
---|---|---|
32 | 32 |
foreach my $shop_config ( @{ $active_shops } ) { |
33 | 33 |
my $shop = SL::Shop->new( config => $shop_config ); |
34 | 34 |
my $new_orders = $shop->connector->get_new_orders; |
35 |
# push @{ $orders_fetched },@{ $new_orders };
|
|
35 |
push @{ $orders_fetched }, $new_orders ;
|
|
36 | 36 |
}; |
37 |
$main::lxdebug->dump(0, 'WH:OF ',$orders_fetched); |
|
38 | 37 |
|
39 |
# flash('info', t8('#1 shoporders has been fetched', scalar(@{$orders_fetched})-1)); |
|
40 |
$self->action_list; |
|
38 |
foreach my $shop_fetched(@{ $orders_fetched }) { |
|
39 |
flash_later('info', t8('From shop #1 : #2 shoporders has been fetched', $shop_fetched->{shop_id}, $shop_fetched->{number_of_orders})); |
|
40 |
} |
|
41 |
$self->redirect_to(controller => "ShopOrder", action => 'list'); |
|
41 | 42 |
} |
42 | 43 |
|
43 | 44 |
sub action_list { |
... | ... | |
108 | 109 |
die "Can't load shop_order form form->import_id" unless $self->shop_order; |
109 | 110 |
|
110 | 111 |
my $order = $self->shop_order->convert_to_sales_order(customer => $customer, employee => $employee); |
111 |
## price_tax_calculator |
|
112 |
$order->calculate_prices_and_taxes; |
|
113 |
|
|
112 | 114 |
if ($order->{error}){ |
113 | 115 |
flash_later('error',@{$order->{errors}}); |
114 |
$self->redirect_to(controller => "ShopOrder", action => 'show', id => $self->shop_order->id); |
|
116 |
$self->redirect_to(controller => "ShopOrder", action => 'show', id => $self->shop_order->id);
|
|
115 | 117 |
}else{ |
116 | 118 |
$order->save; |
117 | 119 |
|
... | ... | |
190 | 192 |
'phone' => $::form->{$what.'_phone'}, |
191 | 193 |
'email' => $::form->{$what.'_email'}, |
192 | 194 |
'greeting' => $::form->{$what.'_greeting'}, |
193 |
# TODO in shopconfig |
|
194 |
'taxincluded_checked' => $shop->pricetype eq "brutto" ? 1 : 0, |
|
195 |
'taxincluded' => $shop->pricetype eq "brutto" ? 1 : 0, |
|
196 |
'pricegroup_id' => (split '\/',$shop->price_source)[0] eq "pricegroup" ? (split '\/',$shop->price_source)[1] : undef, |
|
197 |
'taxzone_id' => $shop->taxzone_id, |
|
198 |
'currency' => 1, # TODO hardcoded |
|
199 |
#'payment_id' => 7345,# TODO hardcoded |
|
195 |
'taxincluded_checked' => $shop->pricetype eq "brutto" ? 1 : 0, |
|
196 |
'taxincluded' => $shop->pricetype eq "brutto" ? 1 : 0, |
|
197 |
'pricegroup_id' => (split '\/',$shop->price_source)[0] eq "pricegroup" ? (split '\/',$shop->price_source)[1] : undef, |
|
198 |
'taxzone_id' => $shop->taxzone_id, |
|
199 |
'currency' => $::instance_conf->get_currency_id, |
|
200 |
#'payment_id' => 7345,# TODO hardcoded |
|
200 | 201 |
); |
201 | 202 |
my $customer; |
202 | 203 |
if($::form->{cv_id}){ |
... | ... | |
233 | 234 |
# |
234 | 235 |
# Helper |
235 | 236 |
# |
236 |
sub check_address { |
|
237 |
my ($self,%address) = @_; |
|
238 |
my $addressdata = SL::DB::Manager::Customer->get_all( |
|
239 |
query => [ |
|
240 |
or => [ 'name' => { ilike => "%$address{'name'}%" }, 'name' => { ilike => $address{'company'} }, ], |
|
241 |
'street' => { ilike => $address{'street'} }, |
|
242 |
'zipcode'=> { ilike => $address{'zipcode'} }, |
|
243 |
'city' => { ilike => $address{'city'} }, |
|
244 |
]); |
|
245 |
return @{$addressdata}[0]; |
|
246 |
} |
|
247 | 237 |
|
248 | 238 |
sub init_shop_order { |
249 | 239 |
my ( $self ) = @_; |
... | ... | |
251 | 241 |
} |
252 | 242 |
|
253 | 243 |
sub init_transferred { |
254 |
# data for drop down filter options |
|
255 |
|
|
256 | 244 |
[ { title => t8("all"), value => '' }, |
257 | 245 |
{ title => t8("transferred"), value => 1 }, |
258 | 246 |
{ title => t8("not transferred"), value => 0 }, ] |
... | ... | |
290 | 278 |
|
291 | 279 |
=head1 NAME |
292 | 280 |
|
293 |
SL::Controller::ShopOrder - Handles th imported shoporders |
|
281 |
SL::Controller::ShopOrder - Shoporder CRUD Controller |
|
282 |
|
|
283 |
=head1 DESCRIPTION |
|
294 | 284 |
|
295 |
=head1 SYNOPSIS
|
|
285 |
Fetches the shoporders and transfers them to orders.
|
|
296 | 286 |
|
287 |
Relations for shoporders |
|
297 | 288 |
|
298 |
=head1 DESCRIPTION |
|
289 |
=over 2 |
|
290 |
|
|
291 |
=item shop_order_items |
|
292 |
|
|
293 |
=item shops |
|
294 |
|
|
295 |
=item shop_parts |
|
296 |
|
|
297 |
=back |
|
298 |
|
|
299 |
=head1 URL ACTIONS |
|
300 |
|
|
301 |
=over 4 |
|
302 |
|
|
303 |
=item C<action_get_orders> |
|
304 |
|
|
305 |
Fetches the shoporders with the shopconnector class |
|
306 |
|
|
307 |
=item C<action_list> |
|
308 |
|
|
309 |
List the shoporders by different filters. |
|
310 |
From the List you can transfer shoporders into orders in batch where it is possible or one by one. |
|
311 |
|
|
312 |
=item C<action_show> |
|
313 |
|
|
314 |
Shows one order. From here you can apply/change/select customer data and transfer the shoporder to an order. |
|
315 |
|
|
316 |
=item C<action_delete> |
|
317 |
|
|
318 |
Marks the shoporder as obsolete. It's for shoporders you don't want to transfer. |
|
319 |
|
|
320 |
=item C<action_undelete> |
|
321 |
|
|
322 |
Marks the shoporder obsolete = false |
|
323 |
|
|
324 |
=item C<action_transfer> |
|
325 |
|
|
326 |
Transfers one shoporder to an order. |
|
327 |
|
|
328 |
=item C<action_apply_customer> |
|
329 |
|
|
330 |
Applys a new customer from the shoporder. |
|
331 |
|
|
332 |
=back |
|
333 |
|
|
334 |
=head1 TASKSERVER ACTIONS |
|
335 |
|
|
336 |
=over 4 |
|
337 |
|
|
338 |
=item C<action_mass_transfer> |
|
339 |
|
|
340 |
Transfers more shoporders by backgroundjob called from the taskserver to orders. |
|
341 |
|
|
342 |
=item C<action_transfer_status> |
|
343 |
|
|
344 |
Shows the backgroundjobdata for the popup status window |
|
345 |
|
|
346 |
=back |
|
347 |
|
|
348 |
=head1 SETUP |
|
349 |
|
|
350 |
=over 4 |
|
351 |
|
|
352 |
=item C<setup> |
|
353 |
|
|
354 |
=back |
|
355 |
|
|
356 |
=head1 INITS |
|
357 |
|
|
358 |
=over 4 |
|
359 |
|
|
360 |
=item C<init_shoporder> |
|
361 |
|
|
362 |
=item C<init_transfered> |
|
363 |
|
|
364 |
Transferstatuses for the filter dropdown |
|
299 | 365 |
|
366 |
=back |
|
300 | 367 |
|
301 | 368 |
=head1 BUGS |
302 | 369 |
|
303 |
None yet. :)
|
|
370 |
None yet. :) |
|
304 | 371 |
|
305 | 372 |
=head1 AUTHOR |
306 | 373 |
|
307 |
W. Hahn E<lt>wh@futureworldsearch.netE<gt>
|
|
374 |
W. Hahn E<lt>wh@futureworldsearch.netE<gt> |
|
308 | 375 |
|
309 | 376 |
=cut |
Auch abrufbar als: Unified diff
Shopmodul: ShopOrders Verschiedene Sachen aus dem Shopware Connector
ausgelagert. Da diese auch für andere Connectoren gültigkeit haben.
Anzahl der zu holenden Bestellungen anders geregelt. Es werden zuerst
alle Kopfzeilen der Bestellungen geholt und anhand dessen die einzelne
Bestellung. So wird die Schleife nicht überlaufen wenn es keine
Bestellung mehr gibt und Shopware schreibt keinen Fehler.
POD