From: Werner Hahn Date: Tue, 26 Mar 2019 08:54:10 +0000 (+0100) Subject: OrderController Sortierung berichtigt. Sort::Naturally hat auch nicht X-Git-Tag: release-3.5.4~81 X-Git-Url: http://wagnertech.de/git?a=commitdiff_plain;h=d1d70f4ad540f4d57d1b577b337b6db38074e223;p=kivitendo-erp.git OrderController Sortierung berichtigt. Sort::Naturally hat auch nicht wie erwartet sortiert --- diff --git a/SL/Controller/Order.pm b/SL/Controller/Order.pm index 656883c07..c37dc1c94 100644 --- a/SL/Controller/Order.pm +++ b/SL/Controller/Order.pm @@ -910,9 +910,17 @@ sub action_reorder_items { my $method = $sort_keys{$::form->{order_by}}; my @to_sort = map { { old_pos => $_->position, order_by => $method->($_) } } @{ $self->order->items_sorted }; if ($::form->{sort_dir}) { - @to_sort = sort { Sort::Naturally::ncmp($a->{order_by}, $b->{order_by} ) } @to_sort; + if ( $::form->{order_by} =~ m/qty|sellprice|discount/ ){ + @to_sort = sort { $a->{order_by} <=> $b->{order_by} } @to_sort; + } else { + @to_sort = sort { $a->{order_by} cmp $b->{order_by} } @to_sort; + } } else { - @to_sort = sort { Sort::Naturally::ncmp($b->{order_by}, $a->{order_by} ) } @to_sort; + if ( $::form->{order_by} =~ m/qty|sellprice|discount/ ){ + @to_sort = sort { $b->{order_by} <=> $a->{order_by} } @to_sort; + } else { + @to_sort = sort { $b->{order_by} cmp $a->{order_by} } @to_sort; + } } $self->js ->run('kivi.Order.redisplay_items', \@to_sort)