Fixed multi coop routing and changed config accessors.
This commit is contained in:
parent
2860a3ca44
commit
ec2e761e7f
28 changed files with 124 additions and 88 deletions
|
|
@ -33,7 +33,7 @@ class Article < ActiveRecord::Base
|
|||
|
||||
# The price for the foodcoop-member.
|
||||
def fc_price
|
||||
(gross_price * (Foodsoft.config[:price_markup] / 100 + 1)).round(2)
|
||||
(gross_price * (FoodsoftConfig[:price_markup] / 100 + 1)).round(2)
|
||||
end
|
||||
|
||||
# Returns true if article has been updated at least 2 days ago
|
||||
|
|
@ -120,8 +120,8 @@ class Article < ActiveRecord::Base
|
|||
false
|
||||
end
|
||||
else # get factors for fc and supplier
|
||||
fc_unit_factor = Foodsoft.config[:units][self.unit]
|
||||
supplier_unit_factor = Foodsoft.config[:units][self.shared_article.unit]
|
||||
fc_unit_factor = FoodsoftConfig[:units][self.unit]
|
||||
supplier_unit_factor = FoodsoftConfig[: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)
|
||||
|
|
|
|||
|
|
@ -27,7 +27,7 @@ class ArticlePrice < ActiveRecord::Base
|
|||
|
||||
# The price for the foodcoop-member.
|
||||
def fc_price
|
||||
(gross_price * (Foodsoft.config[:price_markup] / 100 + 1)).round(2)
|
||||
(gross_price * (FoodsoftConfig[:price_markup] / 100 + 1)).round(2)
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
|||
|
|
@ -168,7 +168,7 @@ class GroupOrderArticle < ActiveRecord::Base
|
|||
# will be the value depending of the article results.
|
||||
def total_price
|
||||
unless order_article.order.finished?
|
||||
if Foodsoft.config[:tolerance_is_costly]
|
||||
if FoodsoftConfig[:tolerance_is_costly]
|
||||
order_article.article.fc_price * (quantity + tolerance)
|
||||
else
|
||||
order_article.article.fc_price * quantity
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
class SharedArticle < ActiveRecord::Base
|
||||
|
||||
# connect to database from sharedLists-Application
|
||||
SharedArticle.establish_connection(Foodsoft.config[:shared_lists])
|
||||
SharedArticle.establish_connection(FoodsoftConfig[:shared_lists])
|
||||
# set correct table_name in external DB
|
||||
set_table_name :articles
|
||||
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
class SharedSupplier < ActiveRecord::Base
|
||||
|
||||
# connect to database from sharedLists-Application
|
||||
SharedSupplier.establish_connection(Foodsoft.config[:shared_lists])
|
||||
SharedSupplier.establish_connection(FoodsoftConfig[:shared_lists])
|
||||
# set correct table_name in external DB
|
||||
set_table_name :suppliers
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue