Hide zero results in matrix pdf.

This commit is contained in:
Benjamin Meichsner 2009-04-03 23:32:24 +02:00
parent de1aa2ac38
commit d62d45e4a4
2 changed files with 8 additions and 2 deletions

View file

@ -152,7 +152,12 @@ class OrdersController < ApplicationController
# Renders the matrix PDF.
def matrixPdf
@order = Order.find(params[:id])
prawnto :filename => "#{Date.today}_#{@order.name}_Matrix.pdf"
unless @order.order_articles.ordered.empty?
prawnto :filename => "#{Date.today}_#{@order.name}_Matrix.pdf"
else
flash[:error] = "Es sind keine Artikel bestellt worden."
redirect_to @order
end
end
# adds a Comment to the Order