From e61c3c9267ba4c60a863da7687bf782fff91d71f Mon Sep 17 00:00:00 2001 From: wvengen Date: Mon, 18 Aug 2014 10:56:03 +0200 Subject: [PATCH] order articles by number then name in fax+receive This makes it easier to enter the receive screen from an order pdf print with received amounts. Conflicts: app/documents/order_fax.rb --- app/controllers/orders_controller.rb | 2 +- app/documents/order_fax.rb | 2 +- app/views/orders/_edit_amounts.html.haml | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/app/controllers/orders_controller.rb b/app/controllers/orders_controller.rb index eb31227c..8f9d9aa7 100644 --- a/app/controllers/orders_controller.rb +++ b/app/controllers/orders_controller.rb @@ -114,7 +114,7 @@ class OrdersController < ApplicationController def receive @order = Order.find(params[:id]) unless request.post? - @order_articles = @order.order_articles.ordered.includes(:article) + @order_articles = @order.order_articles.ordered.includes(:article).order('articles.order_number, articles.name') else s = update_order_amounts flash[:notice] = (s ? I18n.t('orders.receive.notice', :msg => s) : I18n.t('orders.receive.notice_none')) diff --git a/app/documents/order_fax.rb b/app/documents/order_fax.rb index fcd4abdf..ca7c8d92 100644 --- a/app/documents/order_fax.rb +++ b/app/documents/order_fax.rb @@ -58,7 +58,7 @@ class OrderFax < OrderPdf # Articles total = 0 data = [I18n.t('documents.order_fax.rows')] - data += @order.order_articles.ordered.includes(:article).collect do |a| + data += @order.order_articles.ordered.includes(:article).order('articles.order_number, articles.name').collect do |a| subtotal = a.units_to_order * a.price.unit_quantity * a.price.price total += subtotal [a.article.order_number, diff --git a/app/views/orders/_edit_amounts.html.haml b/app/views/orders/_edit_amounts.html.haml index c66c8bbd..ecc52a89 100644 --- a/app/views/orders/_edit_amounts.html.haml +++ b/app/views/orders/_edit_amounts.html.haml @@ -78,7 +78,7 @@ %thead %tr %th.sort{:data => {:sort => 'string'}}= heading_helper Article, :order_number, short: true - %th.default-sort.sort{:data => {:sort => 'string'}}= heading_helper Article, :name + %th.sort{:data => {:sort => 'string'}}= heading_helper Article, :name %th= heading_helper Article, :unit %th= heading_helper Article, :price %th= heading_helper OrderArticle, :quantity, short: true