Fixed bug when adding new article to a stock order (balancing
controller)
This commit is contained in:
parent
8912dbaea0
commit
a1ca9f368d
1 changed files with 11 additions and 8 deletions
|
@ -79,15 +79,18 @@ class Finance::BalancingController < ApplicationController
|
||||||
|
|
||||||
def auto_complete_for_article_name
|
def auto_complete_for_article_name
|
||||||
order = Order.find(params[:order_id])
|
order = Order.find(params[:order_id])
|
||||||
type = order.stockit? ? "type = 'StockArticle'" : "type IS NULL"
|
find_params = {
|
||||||
@articles = Article.find(:all,
|
:conditions => ["LOWER(articles.name) LIKE ?", "%#{params[:article][:name].downcase}%" ],
|
||||||
:conditions => [ "supplier_id = ? AND #{type} AND LOWER(name) LIKE ?",
|
:order => 'articles.name ASC',
|
||||||
order.supplier_id,
|
:limit => 8
|
||||||
'%' + params[:article][:name].downcase + '%' ],
|
}
|
||||||
:order => 'name ASC',
|
@articles = if order.stockit?
|
||||||
:limit => 8)
|
StockArticle.all find_params
|
||||||
|
else
|
||||||
|
order.supplier.articles.all find_params
|
||||||
|
end
|
||||||
|
|
||||||
render :partial => 'shared/auto_complete_articles'
|
render :partial => 'shared/auto_complete_articles'
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def create_order_article
|
def create_order_article
|
||||||
|
|
Loading…
Reference in a new issue