From: Moritz Bunkus Date: Tue, 26 Mar 2019 10:07:07 +0000 (+0100) Subject: Merge branch 'f-project-search-custom-variables' X-Git-Tag: release-3.5.4~80 X-Git-Url: http://wagnertech.de/gitweb/gitweb.cgi/mfinanz.git/commitdiff_plain/bc89ebf428c7bde2205b31c5c9abb66879e673e4?hp=e7088e2389156e0bd0e6741c5c98be2c456a6129 Merge branch 'f-project-search-custom-variables' --- 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)