Revision e8889e47
Von Bernd Bleßmann vor fast 9 Jahren hinzugefügt
SL/Controller/Order.pm | ||
---|---|---|
449 | 449 |
$self->js->render(); |
450 | 450 |
} |
451 | 451 |
|
452 |
sub action_reorder_items { |
|
453 |
my ($self) = @_; |
|
454 |
|
|
455 |
my %sort_keys = ( |
|
456 |
partnumber => sub { $_[0]->part->partnumber }, |
|
457 |
description => sub { $_[0]->description }, |
|
458 |
qty => sub { $_[0]->qty }, |
|
459 |
sellprice => sub { $_[0]->sellprice }, |
|
460 |
discount => sub { $_[0]->discount }, |
|
461 |
); |
|
462 |
|
|
463 |
my $method = $sort_keys{$::form->{order_by}}; |
|
464 |
my @to_sort = map { { old_pos => $_->position, order_by => $method->($_) } } @{ $self->order->items_sorted }; |
|
465 |
if ($::form->{sort_dir}) { |
|
466 |
@to_sort = sort { $a->{order_by} cmp $b->{order_by} } @to_sort; |
|
467 |
} else { |
|
468 |
@to_sort = sort { $b->{order_by} cmp $a->{order_by} } @to_sort; |
|
469 |
} |
|
470 |
$self->js |
|
471 |
->run('redisplay_items', \@to_sort) |
|
472 |
->render; |
|
473 |
} |
|
474 |
|
|
452 | 475 |
sub action_price_popup { |
453 | 476 |
my ($self) = @_; |
454 | 477 |
|
Auch abrufbar als: Unified diff
Auftrags-Controller: Sortieren der Positionen