Merge remote-tracking branch 'bennibu/rails3' into rails3
Conflicts: app/controllers/admin/ordergroups_controller.rb app/controllers/finance/balancing_controller.rb app/controllers/suppliers_controller.rb app/views/articles/_article.html.haml app/views/finance/balancing/_summary.haml app/views/finance/balancing/new.html.haml app/views/group_orders/_form.html.haml app/views/home/_apple_bar.html.haml app/views/suppliers/index.haml
This commit is contained in:
commit
7af796c09c
47 changed files with 325 additions and 240 deletions
|
@ -1 +0,0 @@
|
||||||
1.9.3-p327
|
|
1
Gemfile
1
Gemfile
|
@ -24,7 +24,6 @@ gem 'haml-rails'
|
||||||
gem 'kaminari'
|
gem 'kaminari'
|
||||||
gem 'client_side_validations'
|
gem 'client_side_validations'
|
||||||
gem 'simple_form'
|
gem 'simple_form'
|
||||||
gem 'rails3_acts_as_paranoid', "~>0.2.0"
|
|
||||||
gem 'inherited_resources'
|
gem 'inherited_resources'
|
||||||
gem 'localize_input', :git => "git://github.com/bennibu/localize_input.git"
|
gem 'localize_input', :git => "git://github.com/bennibu/localize_input.git"
|
||||||
gem 'wikicloth'
|
gem 'wikicloth'
|
||||||
|
|
77
Gemfile.lock
77
Gemfile.lock
|
@ -22,32 +22,32 @@ GEM
|
||||||
remote: https://rubygems.org/
|
remote: https://rubygems.org/
|
||||||
specs:
|
specs:
|
||||||
Ascii85 (1.0.2)
|
Ascii85 (1.0.2)
|
||||||
actionmailer (3.2.11)
|
actionmailer (3.2.13)
|
||||||
actionpack (= 3.2.11)
|
actionpack (= 3.2.13)
|
||||||
mail (~> 2.4.4)
|
mail (~> 2.5.3)
|
||||||
actionpack (3.2.11)
|
actionpack (3.2.13)
|
||||||
activemodel (= 3.2.11)
|
activemodel (= 3.2.13)
|
||||||
activesupport (= 3.2.11)
|
activesupport (= 3.2.13)
|
||||||
builder (~> 3.0.0)
|
builder (~> 3.0.0)
|
||||||
erubis (~> 2.7.0)
|
erubis (~> 2.7.0)
|
||||||
journey (~> 1.0.4)
|
journey (~> 1.0.4)
|
||||||
rack (~> 1.4.0)
|
rack (~> 1.4.5)
|
||||||
rack-cache (~> 1.2)
|
rack-cache (~> 1.2)
|
||||||
rack-test (~> 0.6.1)
|
rack-test (~> 0.6.1)
|
||||||
sprockets (~> 2.2.1)
|
sprockets (~> 2.2.1)
|
||||||
activemodel (3.2.11)
|
activemodel (3.2.13)
|
||||||
activesupport (= 3.2.11)
|
activesupport (= 3.2.13)
|
||||||
builder (~> 3.0.0)
|
builder (~> 3.0.0)
|
||||||
activerecord (3.2.11)
|
activerecord (3.2.13)
|
||||||
activemodel (= 3.2.11)
|
activemodel (= 3.2.13)
|
||||||
activesupport (= 3.2.11)
|
activesupport (= 3.2.13)
|
||||||
arel (~> 3.0.2)
|
arel (~> 3.0.2)
|
||||||
tzinfo (~> 0.3.29)
|
tzinfo (~> 0.3.29)
|
||||||
activeresource (3.2.11)
|
activeresource (3.2.13)
|
||||||
activemodel (= 3.2.11)
|
activemodel (= 3.2.13)
|
||||||
activesupport (= 3.2.11)
|
activesupport (= 3.2.13)
|
||||||
activesupport (3.2.11)
|
activesupport (3.2.13)
|
||||||
i18n (~> 0.6)
|
i18n (= 0.6.1)
|
||||||
multi_json (~> 1.0)
|
multi_json (~> 1.0)
|
||||||
acts_as_tree (1.2.0)
|
acts_as_tree (1.2.0)
|
||||||
activerecord (>= 3.0.0)
|
activerecord (>= 3.0.0)
|
||||||
|
@ -94,7 +94,7 @@ GEM
|
||||||
jquery-rails (2.1.3)
|
jquery-rails (2.1.3)
|
||||||
railties (>= 3.1.0, < 5.0)
|
railties (>= 3.1.0, < 5.0)
|
||||||
thor (~> 0.14)
|
thor (~> 0.14)
|
||||||
json (1.7.6)
|
json (1.7.7)
|
||||||
kaminari (0.14.1)
|
kaminari (0.14.1)
|
||||||
actionpack (>= 3.0.0)
|
actionpack (>= 3.0.0)
|
||||||
activesupport (>= 3.0.0)
|
activesupport (>= 3.0.0)
|
||||||
|
@ -104,7 +104,7 @@ GEM
|
||||||
actionpack (>= 3.1)
|
actionpack (>= 3.1)
|
||||||
less (~> 2.2.0)
|
less (~> 2.2.0)
|
||||||
libv8 (3.3.10.4)
|
libv8 (3.3.10.4)
|
||||||
mail (2.4.4)
|
mail (2.5.3)
|
||||||
i18n (>= 0.4.0)
|
i18n (>= 0.4.0)
|
||||||
mime-types (~> 1.16)
|
mime-types (~> 1.16)
|
||||||
treetop (~> 1.4.8)
|
treetop (~> 1.4.8)
|
||||||
|
@ -113,8 +113,8 @@ GEM
|
||||||
activerecord (~> 3.1)
|
activerecord (~> 3.1)
|
||||||
activesupport (~> 3.1)
|
activesupport (~> 3.1)
|
||||||
polyamorous (~> 0.5.0)
|
polyamorous (~> 0.5.0)
|
||||||
mime-types (1.19)
|
mime-types (1.21)
|
||||||
multi_json (1.5.0)
|
multi_json (1.7.1)
|
||||||
mysql2 (0.3.11)
|
mysql2 (0.3.11)
|
||||||
pdf-reader (1.2.0)
|
pdf-reader (1.2.0)
|
||||||
Ascii85 (~> 1.0.0)
|
Ascii85 (~> 1.0.0)
|
||||||
|
@ -126,34 +126,32 @@ GEM
|
||||||
prawn (0.12.0)
|
prawn (0.12.0)
|
||||||
pdf-reader (>= 0.9.0)
|
pdf-reader (>= 0.9.0)
|
||||||
ttfunk (~> 1.0.2)
|
ttfunk (~> 1.0.2)
|
||||||
rack (1.4.3)
|
rack (1.4.5)
|
||||||
rack-cache (1.2)
|
rack-cache (1.2)
|
||||||
rack (>= 0.4)
|
rack (>= 0.4)
|
||||||
rack-protection (1.3.2)
|
rack-protection (1.3.2)
|
||||||
rack
|
rack
|
||||||
rack-ssl (1.3.2)
|
rack-ssl (1.3.3)
|
||||||
rack
|
rack
|
||||||
rack-test (0.6.2)
|
rack-test (0.6.2)
|
||||||
rack (>= 1.0)
|
rack (>= 1.0)
|
||||||
rails (3.2.11)
|
rails (3.2.13)
|
||||||
actionmailer (= 3.2.11)
|
actionmailer (= 3.2.13)
|
||||||
actionpack (= 3.2.11)
|
actionpack (= 3.2.13)
|
||||||
activerecord (= 3.2.11)
|
activerecord (= 3.2.13)
|
||||||
activeresource (= 3.2.11)
|
activeresource (= 3.2.13)
|
||||||
activesupport (= 3.2.11)
|
activesupport (= 3.2.13)
|
||||||
bundler (~> 1.0)
|
bundler (~> 1.0)
|
||||||
railties (= 3.2.11)
|
railties (= 3.2.13)
|
||||||
rails3_acts_as_paranoid (0.2.4)
|
railties (3.2.13)
|
||||||
activerecord (~> 3.2)
|
actionpack (= 3.2.13)
|
||||||
railties (3.2.11)
|
activesupport (= 3.2.13)
|
||||||
actionpack (= 3.2.11)
|
|
||||||
activesupport (= 3.2.11)
|
|
||||||
rack-ssl (~> 1.3.2)
|
rack-ssl (~> 1.3.2)
|
||||||
rake (>= 0.8.7)
|
rake (>= 0.8.7)
|
||||||
rdoc (~> 3.4)
|
rdoc (~> 3.4)
|
||||||
thor (>= 0.14.6, < 2.0)
|
thor (>= 0.14.6, < 2.0)
|
||||||
rake (10.0.3)
|
rake (10.0.3)
|
||||||
rdoc (3.12)
|
rdoc (3.12.2)
|
||||||
json (~> 1.4)
|
json (~> 1.4)
|
||||||
redis (3.0.2)
|
redis (3.0.2)
|
||||||
redis-namespace (1.2.1)
|
redis-namespace (1.2.1)
|
||||||
|
@ -192,8 +190,8 @@ GEM
|
||||||
test-unit (2.5.3)
|
test-unit (2.5.3)
|
||||||
therubyracer (0.10.2)
|
therubyracer (0.10.2)
|
||||||
libv8 (~> 3.3.10)
|
libv8 (~> 3.3.10)
|
||||||
thor (0.16.0)
|
thor (0.17.0)
|
||||||
tilt (1.3.3)
|
tilt (1.3.6)
|
||||||
treetop (1.4.12)
|
treetop (1.4.12)
|
||||||
polyglot
|
polyglot
|
||||||
polyglot (>= 0.3.1)
|
polyglot (>= 0.3.1)
|
||||||
|
@ -203,7 +201,7 @@ GEM
|
||||||
less-rails (~> 2.2.3)
|
less-rails (~> 2.2.3)
|
||||||
railties (>= 3.1)
|
railties (>= 3.1)
|
||||||
therubyracer (~> 0.10.2)
|
therubyracer (~> 0.10.2)
|
||||||
tzinfo (0.3.35)
|
tzinfo (0.3.37)
|
||||||
uglifier (1.3.0)
|
uglifier (1.3.0)
|
||||||
execjs (>= 0.3.0)
|
execjs (>= 0.3.0)
|
||||||
multi_json (~> 1.0, >= 1.0.2)
|
multi_json (~> 1.0, >= 1.0.2)
|
||||||
|
@ -240,7 +238,6 @@ DEPENDENCIES
|
||||||
mysql2
|
mysql2
|
||||||
prawn
|
prawn
|
||||||
rails (~> 3.2.9)
|
rails (~> 3.2.9)
|
||||||
rails3_acts_as_paranoid (~> 0.2.0)
|
|
||||||
resque
|
resque
|
||||||
ruby-prof
|
ruby-prof
|
||||||
sass-rails (~> 3.2.3)
|
sass-rails (~> 3.2.3)
|
||||||
|
|
|
@ -49,7 +49,7 @@ function addData(orderArticleId, itemPrice, itemUnit, itemSubtotal, itemQuantity
|
||||||
|
|
||||||
function increaseQuantity(item) {
|
function increaseQuantity(item) {
|
||||||
var value = Number($('#q_' + item).val()) + 1;
|
var value = Number($('#q_' + item).val()) + 1;
|
||||||
if (!isStockit || (value <= (quantityAvailable[item] - quantityOthers[item]))) {
|
if (!isStockit || (value <= (quantityAvailable[item] + itemsAllocated[item]))) {
|
||||||
update(item, value, $('#t_' + item).val());
|
update(item, value, $('#t_' + item).val());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,7 +3,7 @@ class Admin::OrdergroupsController < Admin::BaseController
|
||||||
inherit_resources
|
inherit_resources
|
||||||
|
|
||||||
def index
|
def index
|
||||||
@ordergroups = Ordergroup.order('name ASC')
|
@ordergroups = Ordergroup.undeleted.order('name ASC')
|
||||||
|
|
||||||
# if somebody uses the search field:
|
# if somebody uses the search field:
|
||||||
unless params[:query].blank?
|
unless params[:query].blank?
|
||||||
|
@ -15,7 +15,7 @@ class Admin::OrdergroupsController < Admin::BaseController
|
||||||
|
|
||||||
def destroy
|
def destroy
|
||||||
@ordergroup = Ordergroup.find(params[:id])
|
@ordergroup = Ordergroup.find(params[:id])
|
||||||
@ordergroup.destroy
|
@ordergroup.mark_as_deleted
|
||||||
redirect_to admin_ordergroups_url, notice: t('admin.ordergroups.destroy.notice')
|
redirect_to admin_ordergroups_url, notice: t('admin.ordergroups.destroy.notice')
|
||||||
rescue => error
|
rescue => error
|
||||||
redirect_to admin_ordergroups_url, alert: t('admin.ordergroups.destroy.error')
|
redirect_to admin_ordergroups_url, alert: t('admin.ordergroups.destroy.error')
|
||||||
|
|
|
@ -20,7 +20,7 @@ class ArticlesController < ApplicationController
|
||||||
sort = "article_categories.name, articles.name"
|
sort = "article_categories.name, articles.name"
|
||||||
end
|
end
|
||||||
|
|
||||||
@articles = Article.where(supplier_id: @supplier, :type => nil).includes(:article_category).order(sort)
|
@articles = Article.undeleted.where(supplier_id: @supplier, :type => nil).includes(:article_category).order(sort)
|
||||||
@articles = @articles.where('articles.name LIKE ?', "%#{params[:query]}%") unless params[:query].nil?
|
@articles = @articles.where('articles.name LIKE ?', "%#{params[:query]}%") unless params[:query].nil?
|
||||||
|
|
||||||
@articles = @articles.page(params[:page]).per(@per_page)
|
@articles = @articles.page(params[:page]).per(@per_page)
|
||||||
|
@ -64,13 +64,13 @@ class ArticlesController < ApplicationController
|
||||||
# Deletes article from database. send error msg, if article is used in a current order
|
# Deletes article from database. send error msg, if article is used in a current order
|
||||||
def destroy
|
def destroy
|
||||||
@article = Article.find(params[:id])
|
@article = Article.find(params[:id])
|
||||||
@article.destroy unless @order = @article.in_open_order # If article is in an active Order, the Order will be returned
|
@article.mark_as_deleted unless @order = @article.in_open_order # If article is in an active Order, the Order will be returned
|
||||||
render :layout => false
|
render :layout => false
|
||||||
end
|
end
|
||||||
|
|
||||||
# Renders a form for editing all articles from a supplier
|
# Renders a form for editing all articles from a supplier
|
||||||
def edit_all
|
def edit_all
|
||||||
@articles = @supplier.articles
|
@articles = @supplier.articles.undeleted
|
||||||
end
|
end
|
||||||
|
|
||||||
# Updates all article of specific supplier
|
# Updates all article of specific supplier
|
||||||
|
@ -92,7 +92,7 @@ class ArticlesController < ApplicationController
|
||||||
end
|
end
|
||||||
# delete articles
|
# delete articles
|
||||||
if params[:outlisted_articles]
|
if params[:outlisted_articles]
|
||||||
params[:outlisted_articles].keys.each {|id| Article.find(id).destroy }
|
params[:outlisted_articles].keys.each {|id| Article.find(id).mark_as_deleted }
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
# Successfully done.
|
# Successfully done.
|
||||||
|
@ -114,19 +114,20 @@ class ArticlesController < ApplicationController
|
||||||
def update_selected
|
def update_selected
|
||||||
raise 'Du hast keine Artikel ausgewählt' if params[:selected_articles].nil?
|
raise 'Du hast keine Artikel ausgewählt' if params[:selected_articles].nil?
|
||||||
articles = Article.find(params[:selected_articles])
|
articles = Article.find(params[:selected_articles])
|
||||||
|
Article.transaction do
|
||||||
case params[:selected_action]
|
case params[:selected_action]
|
||||||
when 'destroy'
|
when 'destroy'
|
||||||
articles.each {|a| a.destroy }
|
articles.each(&:mark_as_deleted)
|
||||||
flash[:notice] = 'Alle gewählten Artikel wurden gelöscht'
|
flash[:notice] = 'Alle gewählten Artikel wurden gelöscht'
|
||||||
when 'setNotAvailable'
|
when 'setNotAvailable'
|
||||||
articles.each {|a| a.update_attribute(:availability, false) }
|
articles.each {|a| a.update_attribute(:availability, false) }
|
||||||
flash[:notice] = 'Alle gewählten Artikel wurden auf "nicht verfügbar" gesetzt'
|
flash[:notice] = 'Alle gewählten Artikel wurden auf "nicht verfügbar" gesetzt'
|
||||||
when 'setAvailable'
|
when 'setAvailable'
|
||||||
articles.each {|a| a.update_attribute(:availability, true) }
|
articles.each {|a| a.update_attribute(:availability, true) }
|
||||||
flash[:notice] = 'Alle gewählten Artikel wurden auf "verfügbar" gesetzt'
|
flash[:notice] = 'Alle gewählten Artikel wurden auf "verfügbar" gesetzt'
|
||||||
else
|
else
|
||||||
flash[:alert] = 'Keine Aktion ausgewählt!'
|
flash[:alert] = 'Keine Aktion ausgewählt!'
|
||||||
|
end
|
||||||
end
|
end
|
||||||
# action succeded
|
# action succeded
|
||||||
redirect_to supplier_articles_url(@supplier, :per_page => params[:per_page])
|
redirect_to supplier_articles_url(@supplier, :per_page => params[:per_page])
|
||||||
|
|
|
@ -10,28 +10,30 @@ class Finance::BalancingController < Finance::BaseController
|
||||||
flash.now.alert = t('finance.balancing.new.alert') if @order.closed?
|
flash.now.alert = t('finance.balancing.new.alert') if @order.closed?
|
||||||
@comments = @order.comments
|
@comments = @order.comments
|
||||||
|
|
||||||
if params['sort']
|
@articles = @order.order_articles.ordered.includes(:article, :article_price,
|
||||||
sort = case params['sort']
|
group_order_articles: {group_order: :ordergroup})
|
||||||
when "name" then "articles.name"
|
|
||||||
when "order_number" then "articles.order_number"
|
|
||||||
when "name_reverse" then "articles.name DESC"
|
|
||||||
when "order_number_reverse" then "articles.order_number DESC"
|
|
||||||
end
|
|
||||||
else
|
|
||||||
sort = "id"
|
|
||||||
end
|
|
||||||
|
|
||||||
@articles = @order.order_articles.ordered.includes(:article).order(sort)
|
sort_param = params['sort'] || 'name'
|
||||||
|
@articles = case sort_param
|
||||||
if params[:sort] == "order_number"
|
when 'name' then
|
||||||
@articles = @articles.to_a.sort { |a,b| a.article.order_number.gsub(/[^[:digit:]]/, "").to_i <=> b.article.order_number.gsub(/[^[:digit:]]/, "").to_i }
|
OrderArticle.sort_by_name(@articles)
|
||||||
elsif params[:sort] == "order_number_reverse"
|
when 'name_reverse' then
|
||||||
@articles = @articles.to_a.sort { |a,b| b.article.order_number.gsub(/[^[:digit:]]/, "").to_i <=> a.article.order_number.gsub(/[^[:digit:]]/, "").to_i }
|
OrderArticle.sort_by_name(@articles).reverse
|
||||||
end
|
when 'order_number' then
|
||||||
|
OrderArticle.sort_by_order_number(@articles)
|
||||||
|
when 'order_number_reverse' then
|
||||||
|
OrderArticle.sort_by_order_number(@articles).reverse
|
||||||
|
else
|
||||||
|
@articles
|
||||||
|
end
|
||||||
|
|
||||||
render layout: false if request.xhr?
|
render layout: false if request.xhr?
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def update_summary
|
||||||
|
@order = Order.find(params[:id])
|
||||||
|
end
|
||||||
|
|
||||||
def edit_note
|
def edit_note
|
||||||
@order = Order.find(params[:id])
|
@order = Order.find(params[:id])
|
||||||
render :layout => false
|
render :layout => false
|
||||||
|
@ -55,7 +57,7 @@ class Finance::BalancingController < Finance::BaseController
|
||||||
def close
|
def close
|
||||||
@order = Order.find(params[:id])
|
@order = Order.find(params[:id])
|
||||||
@order.close!(@current_user)
|
@order.close!(@current_user)
|
||||||
redirect_to finance_root_url, notice: t('finance.balancing.close.notice')
|
redirect_to finance_order_index_url, notice: t('finance.balancing.close.notice')
|
||||||
|
|
||||||
rescue => error
|
rescue => error
|
||||||
redirect_to new_finance_order_url(order_id: @order.id), alert: t('finance.balancing.close.alert', message: error.message)
|
redirect_to new_finance_order_url(order_id: @order.id), alert: t('finance.balancing.close.alert', message: error.message)
|
||||||
|
@ -65,9 +67,9 @@ class Finance::BalancingController < Finance::BaseController
|
||||||
def close_direct
|
def close_direct
|
||||||
@order = Order.find(params[:id])
|
@order = Order.find(params[:id])
|
||||||
@order.close_direct!(@current_user)
|
@order.close_direct!(@current_user)
|
||||||
redirect_to finance_balancing_url, notice: t('finance.balancing.close_direct.notice')
|
redirect_to finance_order_index_url, notice: t('finance.balancing.close_direct.notice')
|
||||||
rescue => error
|
rescue => error
|
||||||
redirect_to finance_balancing_url, alert: t('finance.balancing.close_direct.alert', message: error.message)
|
redirect_to finance_order_index_url, alert: t('finance.balancing.close_direct.alert', message: error.message)
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
|
@ -26,7 +26,7 @@ class Finance::OrderArticlesController < ApplicationController
|
||||||
@order = Order.find(params[:order_id])
|
@order = Order.find(params[:order_id])
|
||||||
@order_article = OrderArticle.find(params[:id])
|
@order_article = OrderArticle.find(params[:id])
|
||||||
begin
|
begin
|
||||||
@order_article.update_article_and_price!(params[:article], params[:article_price], params[:order_article])
|
@order_article.update_article_and_price!(params[:order_article], params[:article], params[:article_price])
|
||||||
rescue
|
rescue
|
||||||
render action: :edit
|
render action: :edit
|
||||||
end
|
end
|
||||||
|
|
|
@ -12,7 +12,7 @@ class Finance::OrdergroupsController < Finance::BaseController
|
||||||
sort = "name"
|
sort = "name"
|
||||||
end
|
end
|
||||||
|
|
||||||
@ordergroups = Ordergroup.order(sort)
|
@ordergroups = Ordergroup.undeleted.order(sort)
|
||||||
@ordergroups = @ordergroups.where('name LIKE ?', "%#{params[:query]}%") unless params[:query].nil?
|
@ordergroups = @ordergroups.where('name LIKE ?', "%#{params[:query]}%") unless params[:query].nil?
|
||||||
|
|
||||||
@ordergroups = @ordergroups.page(params[:page]).per(@per_page)
|
@ordergroups = @ordergroups.page(params[:page]).per(@per_page)
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
class Foodcoop::OrdergroupsController < ApplicationController
|
class Foodcoop::OrdergroupsController < ApplicationController
|
||||||
|
|
||||||
def index
|
def index
|
||||||
@ordergroups = Ordergroup.order('name DESC')
|
@ordergroups = Ordergroup.undeleted.order('name DESC')
|
||||||
|
|
||||||
unless params[:name].blank? # Search by name
|
unless params[:name].blank? # Search by name
|
||||||
@ordergroups = @ordergroups.where('name LIKE ?', "%#{params[:name]}%")
|
@ordergroups = @ordergroups.where('name LIKE ?', "%#{params[:name]}%")
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
class StockitController < ApplicationController
|
class StockitController < ApplicationController
|
||||||
|
|
||||||
def index
|
def index
|
||||||
@stock_articles = StockArticle.includes(:supplier, :article_category).
|
@stock_articles = StockArticle.undeleted.includes(:supplier, :article_category).
|
||||||
order('suppliers.name, article_categories.name, articles.name')
|
order('suppliers.name, article_categories.name, articles.name')
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -33,7 +33,7 @@ class StockitController < ApplicationController
|
||||||
|
|
||||||
def destroy
|
def destroy
|
||||||
@article = StockArticle.find(params[:id])
|
@article = StockArticle.find(params[:id])
|
||||||
@article.destroy
|
@article.mark_as_deleted
|
||||||
render :layout => false
|
render :layout => false
|
||||||
rescue => error
|
rescue => error
|
||||||
render :partial => "destroy_fail", :layout => false,
|
render :partial => "destroy_fail", :layout => false,
|
||||||
|
|
|
@ -4,7 +4,7 @@ class SuppliersController < ApplicationController
|
||||||
helper :deliveries
|
helper :deliveries
|
||||||
|
|
||||||
def index
|
def index
|
||||||
@suppliers = Supplier.order(:name)
|
@suppliers = Supplier.undeleted.order(:name)
|
||||||
@deliveries = Delivery.recent
|
@deliveries = Delivery.recent
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -50,7 +50,7 @@ class SuppliersController < ApplicationController
|
||||||
|
|
||||||
def destroy
|
def destroy
|
||||||
@supplier = Supplier.find(params[:id])
|
@supplier = Supplier.find(params[:id])
|
||||||
@supplier.destroy
|
@supplier.mark_as_deleted
|
||||||
flash[:notice] = I18n.t('suppliers.destroy.notice')
|
flash[:notice] = I18n.t('suppliers.destroy.notice')
|
||||||
redirect_to suppliers_path
|
redirect_to suppliers_path
|
||||||
rescue => e
|
rescue => e
|
||||||
|
|
|
@ -14,28 +14,26 @@ class OrderFax < OrderPdf
|
||||||
|
|
||||||
# From paragraph
|
# From paragraph
|
||||||
bounding_box [margin_box.right-200,margin_box.top], width: 200 do
|
bounding_box [margin_box.right-200,margin_box.top], width: 200 do
|
||||||
text FoodsoftConfig[:name], align: :right
|
text FoodsoftConfig[:name], size: 9, align: :right
|
||||||
move_down 5
|
move_down 5
|
||||||
text contact[:street], align: :right
|
text contact[:street], size: 9, align: :right
|
||||||
move_down 5
|
move_down 5
|
||||||
text "#{contact[:zip_code]} #{contact[:city]}", align: :right
|
text "#{contact[:zip_code]} #{contact[:city]}", size: 9, align: :right
|
||||||
move_down 5
|
move_down 5
|
||||||
if @order.supplier.customer_number != ''
|
text "Kundennummer: #{@order.supplier.try(:customer_number)}", size: 9, align: :right
|
||||||
text "Kundennummer: #{@order.supplier.customer_number}", align: :right
|
|
||||||
end
|
|
||||||
move_down 10
|
|
||||||
text contact[:phone], size: 9, align: :right
|
|
||||||
move_down 5
|
move_down 5
|
||||||
text contact[:email], size: 9, align: :right
|
text "Telefon: #{contact[:phone]}", size: 9, align: :right
|
||||||
|
move_down 5
|
||||||
|
text "E-mail: #{contact[:email]}", size: 9, align: :right
|
||||||
end
|
end
|
||||||
|
|
||||||
# Recipient
|
# Recipient
|
||||||
bounding_box [margin_box.left,margin_box.top-60], width: 200 do
|
bounding_box [margin_box.left,margin_box.top-60], width: 200 do
|
||||||
text @order.name
|
text @order.name
|
||||||
move_down 5
|
move_down 5
|
||||||
text @order.supplier.address
|
text @order.supplier.try(:address).to_s
|
||||||
move_down 5
|
move_down 5
|
||||||
text "Fax: " + @order.supplier.fax
|
text "Fax: #{@order.supplier.try(:fax)}"
|
||||||
end
|
end
|
||||||
|
|
||||||
move_down 5
|
move_down 5
|
||||||
|
@ -44,7 +42,7 @@ class OrderFax < OrderPdf
|
||||||
move_down 10
|
move_down 10
|
||||||
text "Lieferdatum:"
|
text "Lieferdatum:"
|
||||||
move_down 10
|
move_down 10
|
||||||
text "Ansprechpartner: " + @order.supplier.contact_person
|
text "Ansprechpartner: #{@order.supplier.try(:contact_person)}"
|
||||||
move_down 10
|
move_down 10
|
||||||
|
|
||||||
# Articles
|
# Articles
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
# encoding: utf-8
|
# encoding: utf-8
|
||||||
class Article < ActiveRecord::Base
|
class Article < ActiveRecord::Base
|
||||||
acts_as_paranoid # Avoid deleting the article for consistency of order-results
|
|
||||||
extend ActiveSupport::Memoizable # Ability to cache method results. Use memoize :expensive_method
|
extend ActiveSupport::Memoizable # Ability to cache method results. Use memoize :expensive_method
|
||||||
|
|
||||||
# Replace numeric seperator with database format
|
# Replace numeric seperator with database format
|
||||||
|
@ -11,7 +10,8 @@ class Article < ActiveRecord::Base
|
||||||
belongs_to :article_category
|
belongs_to :article_category
|
||||||
has_many :article_prices, :order => "created_at DESC"
|
has_many :article_prices, :order => "created_at DESC"
|
||||||
|
|
||||||
scope :available, :conditions => {:availability => true}
|
scope :undeleted, -> { where(deleted_at: nil) }
|
||||||
|
scope :available, -> { undeleted.where(availability: true) }
|
||||||
scope :not_in_stock, :conditions => {:type => nil}
|
scope :not_in_stock, :conditions => {:type => nil}
|
||||||
|
|
||||||
# Validations
|
# Validations
|
||||||
|
@ -49,6 +49,11 @@ class Article < ActiveRecord::Base
|
||||||
end
|
end
|
||||||
memoize :in_open_order
|
memoize :in_open_order
|
||||||
|
|
||||||
|
# Returns true if the article has been ordered in the given order at least once
|
||||||
|
def ordered_in_order?(order)
|
||||||
|
order.order_articles.where(article_id: id).where('quantity > 0').one?
|
||||||
|
end
|
||||||
|
|
||||||
# this method checks, if the shared_article has been changed
|
# this method checks, if the shared_article has been changed
|
||||||
# unequal attributes will returned in array
|
# unequal attributes will returned in array
|
||||||
# if only the timestamps differ and the attributes are equal,
|
# if only the timestamps differ and the attributes are equal,
|
||||||
|
@ -136,6 +141,15 @@ class Article < ActiveRecord::Base
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def deleted?
|
||||||
|
deleted_at.present?
|
||||||
|
end
|
||||||
|
|
||||||
|
def mark_as_deleted
|
||||||
|
check_article_in_use
|
||||||
|
update_column :deleted_at, Time.now
|
||||||
|
end
|
||||||
|
|
||||||
protected
|
protected
|
||||||
|
|
||||||
# Checks if the article is in use before it will deleted
|
# Checks if the article is in use before it will deleted
|
||||||
|
|
|
@ -8,7 +8,7 @@ class ArticleCategory < ActiveRecord::Base
|
||||||
protected
|
protected
|
||||||
|
|
||||||
def check_for_associated_articles
|
def check_for_associated_articles
|
||||||
raise I18n.t('activerecord.errors.has_many_left', collection: Article.model_name.human) if articles.exists?
|
raise I18n.t('activerecord.errors.has_many_left', collection: Article.model_name.human) if articles.undeleted.exists?
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,13 +1,15 @@
|
||||||
# Groups organize the User.
|
# Groups organize the User.
|
||||||
# A Member gets the roles from the Group
|
# A Member gets the roles from the Group
|
||||||
class Group < ActiveRecord::Base
|
class Group < ActiveRecord::Base
|
||||||
has_many :memberships, :dependent => :destroy
|
has_many :memberships
|
||||||
has_many :users, :through => :memberships
|
has_many :users, :through => :memberships
|
||||||
|
|
||||||
validates :name, :presence => true, :length => {:in => 1..25}
|
validates :name, :presence => true, :length => {:in => 1..25}
|
||||||
|
|
||||||
attr_reader :user_tokens
|
attr_reader :user_tokens
|
||||||
|
|
||||||
|
scope :undeleted, -> { where(deleted_at: nil) }
|
||||||
|
|
||||||
# Returns true if the given user if is an member of this group.
|
# Returns true if the given user if is an member of this group.
|
||||||
def member?(user)
|
def member?(user)
|
||||||
memberships.find_by_user_id(user.id)
|
memberships.find_by_user_id(user.id)
|
||||||
|
@ -22,6 +24,18 @@ class Group < ActiveRecord::Base
|
||||||
self.user_ids = ids.split(",")
|
self.user_ids = ids.split(",")
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def deleted?
|
||||||
|
deleted_at.present?
|
||||||
|
end
|
||||||
|
|
||||||
|
def mark_as_deleted
|
||||||
|
# TODO: Checks for participating in not closed orders
|
||||||
|
transaction do
|
||||||
|
memberships.destroy_all
|
||||||
|
# TODO: What should happen to users?
|
||||||
|
update_column :deleted_at, Time.now
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -22,35 +22,25 @@ class GroupOrder < ActiveRecord::Base
|
||||||
data = {}
|
data = {}
|
||||||
data[:available_funds] = ordergroup.get_available_funds(self)
|
data[:available_funds] = ordergroup.get_available_funds(self)
|
||||||
|
|
||||||
unless new_record?
|
|
||||||
# Group has already ordered, so get the results...
|
|
||||||
goas = {}
|
|
||||||
group_order_articles.all.each do |goa|
|
|
||||||
goas[goa.order_article_id] = {
|
|
||||||
:quantity => goa.quantity,
|
|
||||||
:tolerance => goa.tolerance,
|
|
||||||
:quantity_result => goa.result(:quantity),
|
|
||||||
:tolerance_result => goa.result(:tolerance),
|
|
||||||
:total_price => goa.total_price
|
|
||||||
}
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
# load prices and other stuff....
|
# load prices and other stuff....
|
||||||
data[:order_articles] = {}
|
data[:order_articles] = {}
|
||||||
#order.order_articles.each do |order_article|
|
|
||||||
order.articles_grouped_by_category.each do |article_category, order_articles|
|
order.articles_grouped_by_category.each do |article_category, order_articles|
|
||||||
order_articles.each do |order_article|
|
order_articles.each do |order_article|
|
||||||
|
|
||||||
|
# Get the result of last time ordering, if possible
|
||||||
|
goa = group_order_articles.detect { |goa| goa.order_article_id == order_article.id }
|
||||||
|
|
||||||
|
# Build hash with relevant data
|
||||||
data[:order_articles][order_article.id] = {
|
data[:order_articles][order_article.id] = {
|
||||||
:price => order_article.article.fc_price,
|
:price => order_article.article.fc_price,
|
||||||
:unit => order_article.article.unit_quantity,
|
:unit => order_article.article.unit_quantity,
|
||||||
:quantity => (new_record? ? 0 : goas[order_article.id][:quantity]),
|
:quantity => (goa ? goa.quantity : 0),
|
||||||
:others_quantity => order_article.quantity - (new_record? ? 0 : goas[order_article.id][:quantity]),
|
:others_quantity => order_article.quantity - (goa ? goa.quantity : 0),
|
||||||
:used_quantity => (new_record? ? 0 : goas[order_article.id][:quantity_result]),
|
:used_quantity => (goa ? goa.result(:quantity) : 0),
|
||||||
:tolerance => (new_record? ? 0 : goas[order_article.id][:tolerance]),
|
:tolerance => (goa ? goa.result(:tolerance) : 0),
|
||||||
:others_tolerance => order_article.tolerance - (new_record? ? 0 : goas[order_article.id][:tolerance]),
|
:others_tolerance => order_article.tolerance - (goa ? goa.result(:tolerance) : 0),
|
||||||
:used_tolerance => (new_record? ? 0 : goas[order_article.id][:tolerance_result]),
|
:used_tolerance => (goa ? goa.result(:tolerance) : 0),
|
||||||
:total_price => (new_record? ? 0 : goas[order_article.id][:total_price]),
|
:total_price => (goa ? goa.total_price : 0),
|
||||||
:missing_units => order_article.missing_units,
|
:missing_units => order_article.missing_units,
|
||||||
:quantity_available => (order.stockit? ? order_article.article.quantity_available : 0)
|
:quantity_available => (order.stockit? ? order_article.article.quantity_available : 0)
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,8 +19,7 @@ class Order < ActiveRecord::Base
|
||||||
validate :starts_before_ends, :include_articles
|
validate :starts_before_ends, :include_articles
|
||||||
|
|
||||||
# Callbacks
|
# Callbacks
|
||||||
after_update :update_price_of_group_orders
|
after_save :save_order_articles, :update_price_of_group_orders
|
||||||
after_save :save_order_articles
|
|
||||||
|
|
||||||
# Finders
|
# Finders
|
||||||
scope :open, where(state: 'open').order('ends DESC')
|
scope :open, where(state: 'open').order('ends DESC')
|
||||||
|
@ -39,9 +38,11 @@ class Order < ActiveRecord::Base
|
||||||
|
|
||||||
def articles_for_ordering
|
def articles_for_ordering
|
||||||
if stockit?
|
if stockit?
|
||||||
|
# make sure to include those articles which are no longer available
|
||||||
|
# but which have already been ordered in this stock order
|
||||||
StockArticle.available.all(:include => :article_category,
|
StockArticle.available.all(:include => :article_category,
|
||||||
:order => 'article_categories.name, articles.name').reject{ |a|
|
:order => 'article_categories.name, articles.name').reject{ |a|
|
||||||
a.quantity_available <= 0
|
a.quantity_available <= 0 and not a.ordered_in_order?(self)
|
||||||
}.group_by { |a| a.article_category.name }
|
}.group_by { |a| a.article_category.name }
|
||||||
else
|
else
|
||||||
supplier.articles.available.all.group_by { |a| a.article_category.name }
|
supplier.articles.available.all.group_by { |a| a.article_category.name }
|
||||||
|
@ -114,25 +115,25 @@ class Order < ActiveRecord::Base
|
||||||
def sum(type = :gross)
|
def sum(type = :gross)
|
||||||
total = 0
|
total = 0
|
||||||
if type == :net || type == :gross || type == :fc
|
if type == :net || type == :gross || type == :fc
|
||||||
for oa in order_articles.ordered.all(:include => [:article,:article_price])
|
for oa in order_articles.ordered.includes(:article, :article_price)
|
||||||
quantity = oa.units_to_order * oa.price.unit_quantity
|
quantity = oa.units_to_order * oa.price.unit_quantity
|
||||||
case type
|
case type
|
||||||
when :net
|
when :net
|
||||||
total += quantity * oa.price.price
|
total += quantity * oa.price.price
|
||||||
when :gross
|
when :gross
|
||||||
total += quantity * oa.price.gross_price
|
total += quantity * oa.price.gross_price
|
||||||
when :fc
|
when :fc
|
||||||
total += quantity * oa.price.fc_price
|
total += quantity * oa.price.fc_price
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
elsif type == :groups || type == :groups_without_markup
|
elsif type == :groups || type == :groups_without_markup
|
||||||
for go in group_orders.all(:include => :group_order_articles)
|
for go in group_orders.includes(group_order_articles: {order_article: [:article, :article_price]})
|
||||||
for goa in go.group_order_articles.all(:include => [:order_article])
|
for goa in go.group_order_articles
|
||||||
case type
|
case type
|
||||||
when :groups
|
when :groups
|
||||||
total += goa.result * goa.order_article.price.fc_price
|
total += goa.result * goa.order_article.price.fc_price
|
||||||
when :groups_without_markup
|
when :groups_without_markup
|
||||||
total += goa.result * goa.order_article.price.gross_price
|
total += goa.result * goa.order_article.price.gross_price
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -215,7 +216,24 @@ class Order < ActiveRecord::Base
|
||||||
end
|
end
|
||||||
|
|
||||||
def save_order_articles
|
def save_order_articles
|
||||||
self.articles = Article.find(article_ids)
|
#self.articles = Article.find(article_ids) # This doesn't deletes the group_order_articles, belonging to order_articles,
|
||||||
|
# # see http://api.rubyonrails.org/classes/ActiveRecord/Associations/ClassMethods.html#method-i-has_many
|
||||||
|
#
|
||||||
|
## Ensure to delete also the group_order_articles, belonging to order_articles
|
||||||
|
## This case is relevant, when removing articles from a running order
|
||||||
|
#goa_ids = GroupOrderArticle.where(group_order_id: group_order_ids).includes(:order_article).
|
||||||
|
# select { |goa| goa.order_article.nil? }.map(&:id)
|
||||||
|
#GroupOrderArticle.delete_all(id: goa_ids) unless goa_ids.empty?
|
||||||
|
|
||||||
|
|
||||||
|
# fetch selected articles
|
||||||
|
articles_list = Article.find(article_ids)
|
||||||
|
# create new order_articles
|
||||||
|
(articles_list - articles).each { |article| order_articles.create(:article => article) }
|
||||||
|
# delete old order_articles
|
||||||
|
articles.reject { |article| articles_list.include?(article) }.each do |article|
|
||||||
|
order_articles.detect { |order_article| order_article.article_id == article.id }.destroy
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|
|
@ -17,6 +17,17 @@ class OrderArticle < ActiveRecord::Base
|
||||||
before_create :init_from_balancing
|
before_create :init_from_balancing
|
||||||
after_destroy :update_ordergroup_prices
|
after_destroy :update_ordergroup_prices
|
||||||
|
|
||||||
|
def self.sort_by_name(order_articles)
|
||||||
|
order_articles.sort { |a,b| a.article.name <=> b.article.name }
|
||||||
|
end
|
||||||
|
|
||||||
|
def self.sort_by_order_number(order_articles)
|
||||||
|
order_articles.sort do |a,b|
|
||||||
|
a.article.order_number.to_s.gsub(/[^[:digit:]]/, "").to_i <=>
|
||||||
|
b.article.order_number.to_s.gsub(/[^[:digit:]]/, "").to_i
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
# This method returns either the ArticlePrice or the Article
|
# This method returns either the ArticlePrice or the Article
|
||||||
# The first will be set, when the the order is finished
|
# The first will be set, when the the order is finished
|
||||||
def price
|
def price
|
||||||
|
@ -82,7 +93,7 @@ class OrderArticle < ActiveRecord::Base
|
||||||
end
|
end
|
||||||
|
|
||||||
# Updates order_article and belongings during balancing process
|
# Updates order_article and belongings during balancing process
|
||||||
def update_article_and_price!(article_attributes, price_attributes, order_article_attributes)
|
def update_article_and_price!(order_article_attributes, article_attributes, price_attributes = nil)
|
||||||
OrderArticle.transaction do
|
OrderArticle.transaction do
|
||||||
# Updates self
|
# Updates self
|
||||||
self.update_attributes!(order_article_attributes)
|
self.update_attributes!(order_article_attributes)
|
||||||
|
@ -91,20 +102,22 @@ class OrderArticle < ActiveRecord::Base
|
||||||
article.update_attributes!(article_attributes)
|
article.update_attributes!(article_attributes)
|
||||||
|
|
||||||
# Updates article_price belonging to current order article
|
# Updates article_price belonging to current order article
|
||||||
article_price.attributes = price_attributes
|
if price_attributes.present?
|
||||||
if article_price.changed?
|
article_price.attributes = price_attributes
|
||||||
# Updates also price attributes of article if update_current_price is selected
|
if article_price.changed?
|
||||||
if update_current_price
|
# Updates also price attributes of article if update_current_price is selected
|
||||||
article.update_attributes!(price_attributes)
|
if update_current_price
|
||||||
self.article_price = article.article_prices.first # Assign new created article price to order article
|
article.update_attributes!(price_attributes)
|
||||||
else
|
self.article_price = article.article_prices.first # Assign new created article price to order article
|
||||||
# Creates a new article_price if neccessary
|
else
|
||||||
# Set created_at timestamp to order ends, to make sure the current article price isn't changed
|
# Creates a new article_price if neccessary
|
||||||
create_article_price!(price_attributes.merge(created_at: order.ends)) and save
|
# Set created_at timestamp to order ends, to make sure the current article price isn't changed
|
||||||
end
|
create_article_price!(price_attributes.merge(created_at: order.ends)) and save
|
||||||
|
end
|
||||||
|
|
||||||
# Updates ordergroup values
|
# Updates ordergroup values
|
||||||
update_ordergroup_prices
|
update_ordergroup_prices
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -8,7 +8,6 @@ class Ordergroup < Group
|
||||||
|
|
||||||
APPLE_MONTH_AGO = 6 # How many month back we will count tasks and orders sum
|
APPLE_MONTH_AGO = 6 # How many month back we will count tasks and orders sum
|
||||||
|
|
||||||
acts_as_paranoid # Avoid deleting the ordergroup for consistency of order-results
|
|
||||||
serialize :stats
|
serialize :stats
|
||||||
|
|
||||||
has_many :financial_transactions
|
has_many :financial_transactions
|
||||||
|
@ -120,7 +119,7 @@ class Ordergroup < Group
|
||||||
# Make sure, the name is uniq, add usefull message if uniq group is already deleted
|
# Make sure, the name is uniq, add usefull message if uniq group is already deleted
|
||||||
def uniqueness_of_name
|
def uniqueness_of_name
|
||||||
id = new_record? ? '' : self.id
|
id = new_record? ? '' : self.id
|
||||||
group = Ordergroup.with_deleted.where('groups.id != ? AND groups.name = ?', id, name).first
|
group = Ordergroup.where('groups.id != ? AND groups.name = ?', id, name).first
|
||||||
if group.present?
|
if group.present?
|
||||||
message = group.deleted? ? :taken_with_deleted : :taken
|
message = group.deleted? ? :taken_with_deleted : :taken
|
||||||
errors.add :name, message
|
errors.add :name, message
|
||||||
|
|
|
@ -1,10 +1,9 @@
|
||||||
# encoding: utf-8
|
# encoding: utf-8
|
||||||
class StockArticle < Article
|
class StockArticle < Article
|
||||||
acts_as_paranoid
|
|
||||||
|
|
||||||
has_many :stock_changes
|
has_many :stock_changes
|
||||||
|
|
||||||
scope :available, :conditions => "quantity > 0"
|
scope :available, -> { undeleted.where'quantity > 0' }
|
||||||
|
|
||||||
before_destroy :check_quantity
|
before_destroy :check_quantity
|
||||||
|
|
||||||
|
@ -23,6 +22,11 @@ class StockArticle < Article
|
||||||
available.collect { |a| a.quantity * a.gross_price }.sum
|
available.collect { |a| a.quantity * a.gross_price }.sum
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def mark_as_deleted
|
||||||
|
check_quantity
|
||||||
|
super
|
||||||
|
end
|
||||||
|
|
||||||
protected
|
protected
|
||||||
|
|
||||||
def check_quantity
|
def check_quantity
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
class StockChange < ActiveRecord::Base
|
class StockChange < ActiveRecord::Base
|
||||||
belongs_to :delivery
|
belongs_to :delivery
|
||||||
belongs_to :order
|
belongs_to :order
|
||||||
belongs_to :stock_article, with_deleted: true
|
belongs_to :stock_article
|
||||||
|
|
||||||
validates_presence_of :stock_article_id, :quantity
|
validates_presence_of :stock_article_id, :quantity
|
||||||
validates_numericality_of :quantity
|
validates_numericality_of :quantity
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
|
# encoding: utf-8
|
||||||
class Supplier < ActiveRecord::Base
|
class Supplier < ActiveRecord::Base
|
||||||
acts_as_paranoid # Avoid deleting the supplier for consistency of order-results
|
|
||||||
|
|
||||||
has_many :articles, :dependent => :destroy, :conditions => {:type => nil},
|
has_many :articles, :conditions => {:type => nil},
|
||||||
:include => [:article_category], :order => 'article_categories.name, articles.name'
|
:include => [:article_category], :order => 'article_categories.name, articles.name'
|
||||||
has_many :stock_articles, :include => [:article_category], :order => 'article_categories.name, articles.name'
|
has_many :stock_articles, :include => [:article_category], :order => 'article_categories.name, articles.name'
|
||||||
has_many :orders
|
has_many :orders
|
||||||
|
@ -20,13 +20,15 @@ class Supplier < ActiveRecord::Base
|
||||||
validates_length_of :address, :in => 8..50
|
validates_length_of :address, :in => 8..50
|
||||||
validate :uniqueness_of_name
|
validate :uniqueness_of_name
|
||||||
|
|
||||||
|
scope :undeleted, -> { where(deleted_at: nil) }
|
||||||
|
|
||||||
# sync all articles with the external database
|
# sync all articles with the external database
|
||||||
# returns an array with articles(and prices), which should be updated (to use in a form)
|
# returns an array with articles(and prices), which should be updated (to use in a form)
|
||||||
# also returns an array with outlisted_articles, which should be deleted
|
# also returns an array with outlisted_articles, which should be deleted
|
||||||
def sync_all
|
def sync_all
|
||||||
updated_articles = Array.new
|
updated_articles = Array.new
|
||||||
outlisted_articles = Array.new
|
outlisted_articles = Array.new
|
||||||
for article in articles
|
for article in articles.undeleted
|
||||||
# try to find the associated shared_article
|
# try to find the associated shared_article
|
||||||
shared_article = article.shared_article
|
shared_article = article.shared_article
|
||||||
|
|
||||||
|
@ -65,12 +67,23 @@ class Supplier < ActiveRecord::Base
|
||||||
return [updated_articles, outlisted_articles]
|
return [updated_articles, outlisted_articles]
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def deleted?
|
||||||
|
deleted_at.present?
|
||||||
|
end
|
||||||
|
|
||||||
|
def mark_as_deleted
|
||||||
|
transaction do
|
||||||
|
update_column :deleted_at, Time.now
|
||||||
|
articles.each(&:mark_as_deleted)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
protected
|
protected
|
||||||
|
|
||||||
# Make sure, the name is uniq, add usefull message if uniq group is already deleted
|
# Make sure, the name is uniq, add usefull message if uniq group is already deleted
|
||||||
def uniqueness_of_name
|
def uniqueness_of_name
|
||||||
id = new_record? ? '' : self.id
|
id = new_record? ? '' : self.id
|
||||||
supplier = Supplier.with_deleted.where('suppliers.id != ? AND suppliers.name = ?', id, name).first
|
supplier = Supplier.where('suppliers.id != ? AND suppliers.name = ?', id, name).first
|
||||||
if supplier.present?
|
if supplier.present?
|
||||||
message = supplier.deleted? ? :taken_with_deleted : :taken
|
message = supplier.deleted? ? :taken_with_deleted : :taken
|
||||||
errors.add :name, message
|
errors.add :name, message
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
%tr{class: row_classes(article)}
|
%tr{class: row_classes(article)}[article]
|
||||||
%td= check_box_tag 'selected_articles[]', article.id.to_s, false, {:id => "checkbox_#{article.id}", 'data-ignore-onchange' => true}
|
%td= check_box_tag 'selected_articles[]', article.id.to_s, false, {:id => "checkbox_#{article.id}", 'data-ignore-onchange' => true}
|
||||||
%td{'data-check-this' => "#checkbox_#{article.id}", :class => 'click-me'}= article.name
|
%td{'data-check-this' => "#checkbox_#{article.id}", :class => 'click-me'}= article.name
|
||||||
%td= article.origin
|
%td= article.origin
|
||||||
|
@ -15,5 +15,3 @@
|
||||||
:remote => true, class: 'btn btn-mini'
|
:remote => true, class: 'btn btn-mini'
|
||||||
%td= link_to t('ui.delete'), [@supplier, article],
|
%td= link_to t('ui.delete'), [@supplier, article],
|
||||||
:method => :delete, :confirm => t('.confirm_delete'), :remote => true, class: 'btn btn-mini btn-danger'
|
:method => :delete, :confirm => t('.confirm_delete'), :remote => true, class: 'btn btn-mini btn-danger'
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -25,7 +25,7 @@
|
||||||
%td= article.unit_quantity
|
%td= article.unit_quantity
|
||||||
%td
|
%td
|
||||||
- logger.debug "[debug] #{article.attributes.inspect}"
|
- logger.debug "[debug] #{article.attributes.inspect}"
|
||||||
- if @supplier.articles.where(order_number: article.number).exists?
|
- if @supplier.articles.undeleted.where(order_number: article.number).exists?
|
||||||
%i.icon-ok
|
%i.icon-ok
|
||||||
schon importiert
|
schon importiert
|
||||||
- else
|
- else
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
- title "Artikel von #{@supplier.name} (#{@supplier.articles.count})"
|
- title "Artikel von #{@supplier.name} (#{@supplier.articles.undeleted.count})"
|
||||||
|
|
||||||
.well.well-small
|
.well.well-small
|
||||||
.btn-toolbar
|
.btn-toolbar
|
||||||
|
@ -28,7 +28,7 @@
|
||||||
Lieferant wechseln ..
|
Lieferant wechseln ..
|
||||||
%span.caret
|
%span.caret
|
||||||
%ul.dropdown-menu
|
%ul.dropdown-menu
|
||||||
- Supplier.where('id != ?', @supplier.id).order('name ASC').each do |supplier|
|
- Supplier.undeleted.where('id != ?', @supplier.id).order('suppliers.name ASC').each do |supplier|
|
||||||
%li= link_to supplier.name, supplier_articles_path(supplier), tabindex: -1
|
%li= link_to supplier.name, supplier_articles_path(supplier), tabindex: -1
|
||||||
|
|
||||||
- unless @supplier.shared_supplier.nil?
|
- unless @supplier.shared_supplier.nil?
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
%h1 Artikel mit externer Datenbank synchronisieren
|
- title 'Artikel mit externer Datenbank synchronisieren'
|
||||||
|
|
||||||
- form_tag update_all_supplier_articles_path(@supplier, :sync => "1") do
|
= form_tag update_all_supplier_articles_path(@supplier, :sync => "1") do
|
||||||
%h2 Auslisten ...
|
%h2 Auslisten ...
|
||||||
%p
|
%p
|
||||||
- unless @outlisted_articles.empty?
|
- unless @outlisted_articles.empty?
|
||||||
|
@ -25,47 +25,49 @@
|
||||||
Werten vorausgefüllt.
|
Werten vorausgefüllt.
|
||||||
%br/
|
%br/
|
||||||
Abweichungen zu den alten Artikeln sind gelb markiert.
|
Abweichungen zu den alten Artikeln sind gelb markiert.
|
||||||
%table
|
%table.table
|
||||||
%tr
|
%thead
|
||||||
%th Name
|
|
||||||
%th Notiz
|
|
||||||
%th Hersteller
|
|
||||||
%th Herkunft
|
|
||||||
%th Einheit
|
|
||||||
%th GebGr
|
|
||||||
%th Preis
|
|
||||||
%th MwSt.
|
|
||||||
%th Pfand
|
|
||||||
%th Kategorie
|
|
||||||
- @updated_articles.each do |@article, unequal_attributes|
|
|
||||||
- article = Article.find(@article.id)
|
|
||||||
%tr{:style => 'color:grey'}
|
|
||||||
%td= article.name
|
|
||||||
%td= article.note
|
|
||||||
%td= article.manufacturer
|
|
||||||
%td= article.origin
|
|
||||||
%td= article.unit
|
|
||||||
%td= article.unit_quantity
|
|
||||||
%td= article.price
|
|
||||||
%td= article.tax
|
|
||||||
%td= article.deposit
|
|
||||||
%td= article.article_category.name if article.article_category
|
|
||||||
%tr
|
%tr
|
||||||
- fields_for 'articles[]', @article do |form|
|
%th Name
|
||||||
%td{:style => highlight_new(unequal_attributes, :name)}
|
%th Notiz
|
||||||
= form.text_field 'name', :size => 0
|
%th Hersteller
|
||||||
= form.hidden_field 'shared_updated_on'
|
%th Herkunft
|
||||||
%td{:style => highlight_new(unequal_attributes, :note)}= form.text_field 'note', :size => 15
|
%th Einheit
|
||||||
%td{:style => highlight_new(unequal_attributes, :manufacturer)}= form.text_field 'manufacturer', :size => 10
|
%th GebGr
|
||||||
%td{:style => highlight_new(unequal_attributes, :origin)}= form.text_field 'origin', :size => 5
|
%th Preis
|
||||||
%td{:style => highlight_new(unequal_attributes, :unit)}= form.text_field 'unit', :size => 5
|
%th MwSt.
|
||||||
%td{:style => highlight_new(unequal_attributes, :unit_quantity)}= form.text_field 'unit_quantity', :size => 5
|
%th Pfand
|
||||||
%td{:style => highlight_new(unequal_attributes, :price)}= form.text_field 'price', :size => 5
|
%th Kategorie
|
||||||
%td{:style => highlight_new(unequal_attributes, :tax)}= form.text_field 'tax', :size => 4
|
%tbody
|
||||||
%td{:style => highlight_new(unequal_attributes, :deposit)}= form.text_field 'deposit', :size => 4
|
- @updated_articles.each do |updated_article, attrs|
|
||||||
%td= select 'article[]', 'article_category_id', ArticleCategory.find(:all).collect {|a| [ a.name, a.id ] }, { :include_blank => true }
|
- article = Article.find(updated_article.id)
|
||||||
|
%tr{:style => 'color:grey'}
|
||||||
|
%td= article.name
|
||||||
|
%td= article.note
|
||||||
|
%td= article.manufacturer
|
||||||
|
%td= article.origin
|
||||||
|
%td= article.unit
|
||||||
|
%td= article.unit_quantity
|
||||||
|
%td= article.price
|
||||||
|
%td= article.tax
|
||||||
|
%td= article.deposit
|
||||||
|
%td= article.article_category.name if article.article_category
|
||||||
|
%tr
|
||||||
|
= fields_for 'articles[]', updated_article do |form|
|
||||||
|
%td{:style => highlight_new(attrs, :name)}
|
||||||
|
= form.text_field 'name', :size => 0
|
||||||
|
= form.hidden_field 'shared_updated_on'
|
||||||
|
%td{:style => highlight_new(attrs, :note)}= form.text_field 'note', class: 'input-small'
|
||||||
|
%td{:style => highlight_new(attrs, :manufacturer)}= form.text_field 'manufacturer', class: 'input-small'
|
||||||
|
%td{:style => highlight_new(attrs, :origin)}= form.text_field 'origin', class: 'input-mini'
|
||||||
|
%td{:style => highlight_new(attrs, :unit)}= form.text_field 'unit', class: 'input-mini'
|
||||||
|
%td{:style => highlight_new(attrs, :unit_quantity)}= form.text_field 'unit_quantity', class: 'input-mini'
|
||||||
|
%td{:style => highlight_new(attrs, :price)}= form.text_field 'price', class: 'input-mini'
|
||||||
|
%td{:style => highlight_new(attrs, :tax)}= form.text_field 'tax', class: 'input-mini'
|
||||||
|
%td{:style => highlight_new(attrs, :deposit)}= form.text_field 'deposit', class: 'input-mini'
|
||||||
|
%td= form.select :article_category_id, ArticleCategory.all.map {|a| [ a.name, a.id ] },
|
||||||
|
{include_blank: true}, class: 'input-small'
|
||||||
%hr/
|
%hr/
|
||||||
= hidden_field 'supplier', 'id'
|
= hidden_field 'supplier', 'id'
|
||||||
= submit_tag 'Alle löschen/aktualisieren'
|
= submit_tag 'Alle löschen/aktualisieren', class: 'btn btn-primary'
|
||||||
|
|
= link_to 'oder abbrechen', supplier_articles_path(@supplier)
|
||||||
= link_to 'Abbrechen', supplier_articles_path(@supplier)
|
|
|
@ -10,7 +10,7 @@
|
||||||
= link_to t('.add_group'), new_finance_group_order_article_path(order_article_id: order_article.id),
|
= link_to t('.add_group'), new_finance_group_order_article_path(order_article_id: order_article.id),
|
||||||
remote: true, class: 'btn btn-mini'
|
remote: true, class: 'btn btn-mini'
|
||||||
%tbody
|
%tbody
|
||||||
- for group_order_article in order_article.group_order_articles.ordered.all(:include => [:group_order])
|
- for group_order_article in order_article.group_order_articles.select { |goa| goa.result > 0 }
|
||||||
%tr[group_order_article]
|
%tr[group_order_article]
|
||||||
%td
|
%td
|
||||||
%td{:style=>"width:50%"}
|
%td{:style=>"width:50%"}
|
||||||
|
|
|
@ -25,3 +25,7 @@
|
||||||
= t('.fc_profit')
|
= t('.fc_profit')
|
||||||
%small= t('.with_extra_charge')
|
%small= t('.with_extra_charge')
|
||||||
%td#order_profit.numeric= number_to_currency(order.profit)
|
%td#order_profit.numeric= number_to_currency(order.profit)
|
||||||
|
#summaryChangedWarning.alert(style="display:none;")
|
||||||
|
%strong= t '.changed'
|
||||||
|
%br/
|
||||||
|
= link_to t('.reload'), update_summary_finance_order_path(order), remote: true
|
||||||
|
|
|
@ -20,7 +20,7 @@
|
||||||
|
|
||||||
.well.well-small
|
.well.well-small
|
||||||
%h3= t('.comments')
|
%h3= t('.comments')
|
||||||
#comments= render :partial => 'shared/comments', locals: {comments: @order.comments}
|
#comments= render :partial => 'shared/comments', locals: {comments: @order.comments.includes(:user)}
|
||||||
|
|
||||||
- content_for :actionbar do
|
- content_for :actionbar do
|
||||||
.btn-group
|
.btn-group
|
||||||
|
|
1
app/views/finance/balancing/update_summary.js.haml
Normal file
1
app/views/finance/balancing/update_summary.js.haml
Normal file
|
@ -0,0 +1 @@
|
||||||
|
$('#summary').html('#{j(render('finance/balancing/summary', order: @order))}');
|
|
@ -1,4 +1,4 @@
|
||||||
$('#modalContainer').modal('hide');
|
$('#modalContainer').modal('hide');
|
||||||
$('#order_article_#{@order_article.id}').html('#{j(render('finance/balancing/order_article', order_article: @order_article))}');
|
$('#order_article_#{@order_article.id}').html('#{j(render('finance/balancing/order_article', order_article: @order_article))}');
|
||||||
$('#group_order_articles_#{@order_article.id}').html('#{j(render('finance/balancing/group_order_articles', order_article: @order_article))}');
|
$('#group_order_articles_#{@order_article.id}').html('#{j(render('finance/balancing/group_order_articles', order_article: @order_article))}');
|
||||||
$('#summary').html('#{j(render('finance/balancing/summary', order: @order_article.order))}');
|
$('#summaryChangedWarning').show();
|
|
@ -5,18 +5,20 @@
|
||||||
.modal-body
|
.modal-body
|
||||||
= form.input :units_to_order
|
= form.input :units_to_order
|
||||||
|
|
||||||
= simple_fields_for @order_article.article do |f|
|
= simple_fields_for :article, @order_article.article do |f|
|
||||||
= f.input :name
|
= f.input :name
|
||||||
= f.input :order_number
|
= f.input :order_number
|
||||||
= f.input :unit
|
= f.input :unit
|
||||||
= simple_fields_for @order_article.article_price do |f|
|
|
||||||
= f.input :unit_quantity
|
|
||||||
= f.input :price
|
|
||||||
= f.input :tax
|
|
||||||
= f.input :deposit
|
|
||||||
|
|
||||||
= form.input :update_current_price, as: :boolean
|
|
||||||
|
|
||||||
|
- if @order_article.article.is_a?(StockArticle)
|
||||||
|
%div.alert Preise von Lagerartikeln können nicht geändert werden!
|
||||||
|
- else
|
||||||
|
= simple_fields_for :article_price, @order_article.article_price do |f|
|
||||||
|
= f.input :unit_quantity
|
||||||
|
= f.input :price
|
||||||
|
= f.input :tax
|
||||||
|
= f.input :deposit
|
||||||
|
= form.input :update_current_price, as: :boolean
|
||||||
.modal-footer
|
.modal-footer
|
||||||
= button_tag t('ui.close'), class: 'btn', data: {dismiss: 'modal'}
|
= button_tag t('ui.close'), class: 'btn', data: {dismiss: 'modal'}
|
||||||
= form.submit class: 'btn btn-primary'
|
= form.submit class: 'btn btn-primary'
|
||||||
|
|
|
@ -45,6 +45,8 @@
|
||||||
%thead
|
%thead
|
||||||
%tr
|
%tr
|
||||||
%th= t '.name'
|
%th= t '.name'
|
||||||
|
- if @order.stockit?
|
||||||
|
%th{style: 'width:120px'}= t '.supplier'
|
||||||
%th{style: "width:13px;"}
|
%th{style: "width:13px;"}
|
||||||
%th{style: "width:4.5em;"}= t '.price'
|
%th{style: "width:4.5em;"}= t '.price'
|
||||||
%th{style: "width:4.5em;"}= t '.unit'
|
%th{style: "width:4.5em;"}= t '.unit'
|
||||||
|
@ -66,6 +68,8 @@
|
||||||
- order_articles.each do |order_article|
|
- order_articles.each do |order_article|
|
||||||
%tr{class: "#{cycle('even', 'odd', name: 'articles')} order-article", valign: "top"}
|
%tr{class: "#{cycle('even', 'odd', name: 'articles')} order-article", valign: "top"}
|
||||||
%td.name= order_article.article.name
|
%td.name= order_article.article.name
|
||||||
|
- if @order.stockit?
|
||||||
|
%td= truncate order_article.article.supplier.name, length: 15
|
||||||
%td= h order_article.article.origin
|
%td= h order_article.article.origin
|
||||||
%td= number_to_currency(@ordering_data[:order_articles][order_article.id][:price])
|
%td= number_to_currency(@ordering_data[:order_articles][order_article.id][:price])
|
||||||
%td= order_article.article.unit
|
%td= order_article.article.unit
|
||||||
|
|
|
@ -5,4 +5,5 @@
|
||||||
%span.description
|
%span.description
|
||||||
= t '.desc', amount: number_to_currency(apple_bar.mean_order_amount_per_job, :precision=>0)
|
= t '.desc', amount: number_to_currency(apple_bar.mean_order_amount_per_job, :precision=>0)
|
||||||
- if FoodsoftConfig[:stop_ordering_under].present?
|
- if FoodsoftConfig[:stop_ordering_under].present?
|
||||||
%strong= t '.warning', threshold: FoodsoftConfig[:stop_ordering_under]
|
%strong= t('.warning', threshold: FoodsoftConfig[:stop_ordering_under])
|
||||||
|
= link_to t('.more_info'), FoodsoftConfig[:applepear_url], target: '_blank'
|
||||||
|
|
1
app/views/messages/index.js.haml
Normal file
1
app/views/messages/index.js.haml
Normal file
|
@ -0,0 +1 @@
|
||||||
|
$('#messages').html('#{j(render('messages', messages: @messages, pagination: true))}');
|
|
@ -37,7 +37,7 @@
|
||||||
|
|
||||||
#recipients
|
#recipients
|
||||||
= f.input :recipient_tokens, :input_html => { 'data-pre' => User.find_all_by_id(@message.recipients_ids).map { |u| u.token_attributes }.to_json }
|
= f.input :recipient_tokens, :input_html => { 'data-pre' => User.find_all_by_id(@message.recipients_ids).map { |u| u.token_attributes }.to_json }
|
||||||
= f.input :group_id, :as => :select, :collection => Group.order('type DESC, name ASC').all.reject { |g| g.memberships.empty? }
|
= f.input :group_id, :as => :select, :collection => Group.undeleted.order('type DESC, name ASC').all.reject { |g| g.memberships.empty? }
|
||||||
= f.input :private
|
= f.input :private
|
||||||
= f.input :subject, input_html: {class: 'input-xxlarge'}
|
= f.input :subject, input_html: {class: 'input-xxlarge'}
|
||||||
= f.input :body, input_html: {class: 'input-xxlarge'}
|
= f.input :body, input_html: {class: 'input-xxlarge'}
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
= t '.new_order'
|
= t '.new_order'
|
||||||
%span.caret
|
%span.caret
|
||||||
%ul.dropdown-menu
|
%ul.dropdown-menu
|
||||||
- Supplier.all.each do |supplier|
|
- Supplier.undeleted.order('suppliers.name ASC').each do |supplier|
|
||||||
%li= link_to supplier.name, new_order_path(supplier_id: supplier.id), tabindex: -1
|
%li= link_to supplier.name, new_order_path(supplier_id: supplier.id), tabindex: -1
|
||||||
|
|
||||||
.well
|
.well
|
||||||
|
|
|
@ -8,5 +8,5 @@
|
||||||
= render :partial => 'page_list_item', :locals => {:page => homepage, :level => 0, :siteMap => 1}
|
= render :partial => 'page_list_item', :locals => {:page => homepage, :level => 0, :siteMap => 1}
|
||||||
%tbody
|
%tbody
|
||||||
- for page in @pages
|
- for page in @pages
|
||||||
- if page.id != homepage.id
|
- if page.id != homepage.try(:id)
|
||||||
= render :partial => 'page_list_item', :locals => {:page => page, :level => 0, :siteMap => 1}
|
= render :partial => 'page_list_item', :locals => {:page => page, :level => 0, :siteMap => 1}
|
||||||
|
|
|
@ -3,5 +3,5 @@
|
||||||
= form.hidden_field :stock_article_id
|
= form.hidden_field :stock_article_id
|
||||||
= "Menge (#{stock_change.stock_article.quantity_available})"
|
= "Menge (#{stock_change.stock_article.quantity_available})"
|
||||||
= form.text_field :quantity, :size => 5, :autocomplete => 'off'
|
= form.text_field :quantity, :size => 5, :autocomplete => 'off'
|
||||||
%b=h truncate(stock_change.stock_article.name)
|
%b= stock_change.stock_article.name
|
||||||
= "(#{number_to_currency(stock_change.stock_article.price)} / #{stock_change.stock_article.unit})"
|
= "(#{number_to_currency(stock_change.stock_article.price)} / #{stock_change.stock_article.unit})"
|
||||||
|
|
|
@ -18,8 +18,8 @@
|
||||||
%td= link_to h(supplier.name) , supplier
|
%td= link_to h(supplier.name) , supplier
|
||||||
%td= supplier.phone
|
%td= supplier.phone
|
||||||
%td= supplier.customer_number
|
%td= supplier.customer_number
|
||||||
%td= link_to t('.articles', count: supplier.articles.count), supplier_articles_path(supplier)
|
%td= link_to t('.articles', count: supplier.articles.undeleted.count), supplier_articles_path(supplier)
|
||||||
%td= link_to t('.stock', count: supplier.stock_articles.count), stock_articles_path
|
%td= link_to t('.stock', count: supplier.stock_articles.undeleted.count), stock_articles_path
|
||||||
%td= link_to t('.deliveries', count: supplier.deliveries.count), supplier_deliveries_path(supplier)
|
%td= link_to t('.deliveries', count: supplier.deliveries.count), supplier_deliveries_path(supplier)
|
||||||
%td
|
%td
|
||||||
= link_to t('ui.edit'), edit_supplier_path(supplier), class: 'btn btn-mini'
|
= link_to t('ui.edit'), edit_supplier_path(supplier), class: 'btn btn-mini'
|
||||||
|
|
|
@ -31,6 +31,9 @@ default: &defaults
|
||||||
# foodsoft documentation URL
|
# foodsoft documentation URL
|
||||||
help_url: https://github.com/bennibu/foodsoft/wiki/Doku
|
help_url: https://github.com/bennibu/foodsoft/wiki/Doku
|
||||||
|
|
||||||
|
# documentation URL for the apples&pears work system
|
||||||
|
applepear_url: https://github.com/bennibu/foodsoft/wiki/%C3%84pfel-u.-Birnen
|
||||||
|
|
||||||
# price markup in percent
|
# price markup in percent
|
||||||
price_markup: 2.0
|
price_markup: 2.0
|
||||||
|
|
||||||
|
|
3
config/initializers/rack.rb
Normal file
3
config/initializers/rack.rb
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
# Increase key space for post request.
|
||||||
|
# Warning, this is dangerous. See http://stackoverflow.com/questions/12243694/getting-error-exceeded-available-parameter-key-space
|
||||||
|
Rack::Utils.key_space_limit = 262144
|
|
@ -54,6 +54,8 @@ de:
|
||||||
fc_profit: 'FC Gewinn'
|
fc_profit: 'FC Gewinn'
|
||||||
without_extra_charge: 'ohne Aufschlag:'
|
without_extra_charge: 'ohne Aufschlag:'
|
||||||
with_extra_charge: 'mit Aufschlag:'
|
with_extra_charge: 'mit Aufschlag:'
|
||||||
|
changed: 'Daten wurden verändert!'
|
||||||
|
reload: 'Zusammenfassung neu laden'
|
||||||
orders:
|
orders:
|
||||||
name: 'Name'
|
name: 'Name'
|
||||||
end: 'Ende'
|
end: 'Ende'
|
||||||
|
|
|
@ -16,6 +16,7 @@ de:
|
||||||
last_update: 'Zuletzt bestellt'
|
last_update: 'Zuletzt bestellt'
|
||||||
funds: 'Guthaben'
|
funds: 'Guthaben'
|
||||||
name: 'Name'
|
name: 'Name'
|
||||||
|
supplier: 'Lieferant'
|
||||||
price: 'Preis'
|
price: 'Preis'
|
||||||
unit: 'Einheit'
|
unit: 'Einheit'
|
||||||
unit_missing: 'Fehlende Einheiten'
|
unit_missing: 'Fehlende Einheiten'
|
||||||
|
|
|
@ -56,6 +56,7 @@ de:
|
||||||
points: 'Deine aktueller Äpfelpunktestand: %{points}'
|
points: 'Deine aktueller Äpfelpunktestand: %{points}'
|
||||||
desc: 'Abgebildet ist das Verhältnis von erledigten Aufgaben zu dem Bestellvolumen Deiner Bestellgruppe im Vergleich zum Durchschnitt in der Foodcoop. Konkret: Pro %{amount} Bestellsumme solltest Du eine Aufgabe machen!'
|
desc: 'Abgebildet ist das Verhältnis von erledigten Aufgaben zu dem Bestellvolumen Deiner Bestellgruppe im Vergleich zum Durchschnitt in der Foodcoop. Konkret: Pro %{amount} Bestellsumme solltest Du eine Aufgabe machen!'
|
||||||
warning: 'Achtung, hast Du weniger als %{threshold} Äpfel, darfst Du nicht mehr bestellen!'
|
warning: 'Achtung, hast Du weniger als %{threshold} Äpfel, darfst Du nicht mehr bestellen!'
|
||||||
|
more_info: 'Mehr Informationen'
|
||||||
|
|
||||||
ordergroup:
|
ordergroup:
|
||||||
title: 'Meine Bestellgruppe'
|
title: 'Meine Bestellgruppe'
|
||||||
|
|
|
@ -129,6 +129,7 @@ Foodsoft::Application.routes.draw do
|
||||||
|
|
||||||
resources :order, controller: 'balancing', path: 'balancing' do
|
resources :order, controller: 'balancing', path: 'balancing' do
|
||||||
member do
|
member do
|
||||||
|
get :update_summary
|
||||||
get :edit_note
|
get :edit_note
|
||||||
put :update_note
|
put :update_note
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue