Changed default order of articles on balancing page.

This commit is contained in:
Benjamin Meichsner 2009-05-04 17:56:52 +02:00
parent e8fa912e8c
commit 4c57c57827

View file

@ -17,14 +17,14 @@ class Finance::BalancingController < ApplicationController
@comments = @order.comments @comments = @order.comments
if params['sort'] if params['sort']
sort = case params['sort'] sort = case params['sort']
when "name" then "articles.name" when "name" then "articles.name"
when "order_number" then "articles.order_number" when "order_number" then "articles.order_number"
when "name_reverse" then "articles.name DESC" when "name_reverse" then "articles.name DESC"
when "order_number_reverse" then "articles.order_number DESC" when "order_number_reverse" then "articles.order_number DESC"
end end
else else
sort = "articles.name" sort = "id"
end end
@articles = @order.order_articles.ordered.find( @articles = @order.order_articles.ordered.find(
@ -32,7 +32,7 @@ class Finance::BalancingController < ApplicationController
:include => :article, :include => :article,
:order => sort :order => sort
) )
if params[:sort] == "order_number" if params[:sort] == "order_number"
@articles = @articles.sort { |a,b| a.article.order_number.gsub(/[^[:digit:]]/, "").to_i <=> b.article.order_number.gsub(/[^[:digit:]]/, "").to_i } @articles = @articles.sort { |a,b| a.article.order_number.gsub(/[^[:digit:]]/, "").to_i <=> b.article.order_number.gsub(/[^[:digit:]]/, "").to_i }
elsif params[:sort] == "order_number_reverse" elsif params[:sort] == "order_number_reverse"