Commit fb292e9d0884f013b68f484c542004585bd36b21
1 parent
4b901898
Exists in
master
and in
28 other branches
Make plugin monkey patches non-ambiguous
Showing
10 changed files
with
42 additions
and
42 deletions
Show diff stats
plugins/bsc/lib/bsc_plugin.rb
... | ... | @@ -0,0 +1,13 @@ |
1 | +require_dependency 'enterprise' | |
2 | + | |
3 | +class Enterprise | |
4 | + belongs_to :bsc, :class_name => 'BscPlugin::Bsc' | |
5 | + has_and_belongs_to_many :contracts, :class_name => 'BscPlugin::Contract', :join_table => 'bsc_plugin_contracts_enterprises' | |
6 | + | |
7 | + FIELDS << 'bsc_id' | |
8 | + FIELDS << 'enabled' | |
9 | + FIELDS << 'validated' | |
10 | + | |
11 | + named_scope :validated, :conditions => {:validated => true} | |
12 | + named_scope :not_validated, :conditions => {:validated => false} | |
13 | +end | ... | ... |
... | ... | @@ -0,0 +1,15 @@ |
1 | +require_dependency 'product' | |
2 | + | |
3 | +class Product | |
4 | + | |
5 | + has_many :sales, :class_name => 'BscPlugin::Sale' | |
6 | + has_many :contracts, :through => :sales, :class_name => 'BscPlugin::Contract' | |
7 | + | |
8 | + def bsc | |
9 | + enterprise.bsc if enterprise | |
10 | + end | |
11 | + | |
12 | + def display_supplier_on_search? | |
13 | + false | |
14 | + end | |
15 | +end | ... | ... |
plugins/bsc/lib/ext/enterprise.rb
... | ... | @@ -1,13 +0,0 @@ |
1 | -require_dependency 'enterprise' | |
2 | - | |
3 | -class Enterprise | |
4 | - belongs_to :bsc, :class_name => 'BscPlugin::Bsc' | |
5 | - has_and_belongs_to_many :contracts, :class_name => 'BscPlugin::Contract', :join_table => 'bsc_plugin_contracts_enterprises' | |
6 | - | |
7 | - FIELDS << 'bsc_id' | |
8 | - FIELDS << 'enabled' | |
9 | - FIELDS << 'validated' | |
10 | - | |
11 | - named_scope :validated, :conditions => {:validated => true} | |
12 | - named_scope :not_validated, :conditions => {:validated => false} | |
13 | -end |
plugins/bsc/lib/ext/product.rb
... | ... | @@ -1,15 +0,0 @@ |
1 | -require_dependency 'product' | |
2 | - | |
3 | -class Product | |
4 | - | |
5 | - has_many :sales, :class_name => 'BscPlugin::Sale' | |
6 | - has_many :contracts, :through => :sales, :class_name => 'BscPlugin::Contract' | |
7 | - | |
8 | - def bsc | |
9 | - enterprise.bsc if enterprise | |
10 | - end | |
11 | - | |
12 | - def display_supplier_on_search? | |
13 | - false | |
14 | - end | |
15 | -end |
plugins/shopping_cart/lib/ext/enterprise.rb
plugins/shopping_cart/lib/ext/person.rb
plugins/shopping_cart/lib/shopping_cart_plugin.rb
plugins/shopping_cart/lib/shopping_cart_plugin/ext/enterprise.rb
0 → 100644
plugins/shopping_cart/lib/shopping_cart_plugin/ext/person.rb
0 → 100644