Second (last) part of multiple foodcoop installation.

* When before_filter select_foodcoop is activated,
  the database and configs will be loaded on each request.
* Replaced APP_CONFIG with new Foodsoft.config method.
This commit is contained in:
Benjamin Meichsner 2009-03-24 17:25:33 +01:00
parent 1c24127928
commit ffc3adf907
18 changed files with 51 additions and 57 deletions

View file

@ -70,7 +70,7 @@ class Article < ActiveRecord::Base
# The price for the foodcoop-member.
def fc_price
(gross_price * (APP_CONFIG[:price_markup] / 100 + 1)).round(2)
(gross_price * (Foodsoft.config[:price_markup] / 100 + 1)).round(2)
end
# Returns true if article has been updated at least 2 days ago
@ -157,8 +157,8 @@ class Article < ActiveRecord::Base
false
end
else # get factors for fc and supplier
fc_unit_factor = APP_CONFIG[:units][self.unit]
supplier_unit_factor = APP_CONFIG[:units][self.shared_article.unit]
fc_unit_factor = Foodsoft.config[:units][self.unit]
supplier_unit_factor = Foodsoft.config[:units][self.shared_article.unit]
if fc_unit_factor and supplier_unit_factor
convertion_factor = fc_unit_factor / supplier_unit_factor
new_price = BigDecimal((convertion_factor * shared_article.price).to_s).round(2)