foodsoft/app/helpers/finance/receive_helper.rb

13 lines
467 B
Ruby
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# :encoding:utf-8:
module Finance::ReceiveHelper
# TODO currently duplicate a bit of DeliveriesHelper.articles_for_select2
# except is an array of article id's to omit
def articles_for_select2(supplier, except = [])
articles = supplier.articles.reorder('articles.name ASC')
articles.reject! {|a| not except.index(a.id).nil? } if except
articles.map do |a|
{:id => a.id, :text => "#{a.name} (#{a.unit_quantity}#{a.unit})"}
end
end
end