erp_base_erp_svcs 3.0.5 → 3.0.6

Sign up to get free protection for your applications and to get access to all the features.
data/app/models/party.rb CHANGED
@@ -1,12 +1,15 @@
1
1
  class Party < ActiveRecord::Base
2
2
  has_notes
3
-
3
+
4
4
  has_many :contacts, :dependent => :destroy
5
5
  has_many :created_notes, :class_name => 'Note', :foreign_key => 'created_by_id'
6
6
  belongs_to :business_party, :polymorphic => true
7
- has_many :party_roles, :dependent => :destroy
7
+
8
+ has_many :party_roles, :dependent => :destroy #role_types
8
9
  has_many :role_types, :through => :party_roles
9
10
 
11
+ has_and_belongs_to_many :security_roles
12
+
10
13
  after_destroy :destroy_business_party
11
14
 
12
15
  attr_reader :relationships
@@ -19,10 +22,9 @@ class Party < ActiveRecord::Base
19
22
  end
20
23
 
21
24
  def find_relationships_by_type(relationship_type_iid)
22
- PartyRelationship.includes(:relationship_type)
23
- .where('party_id_from = ? or party_id_to = ?', id, id)
24
- .where('relationship_types.internal_identifier' => relationship_type_iid.to_s)
25
-
25
+ PartyRelationship.includes(:relationship_type).
26
+ where('party_id_from = ? or party_id_to = ?', id, id).
27
+ where('relationship_types.internal_identifier' => relationship_type_iid.to_s)
26
28
  end
27
29
 
28
30
  # Creates a new PartyRelationship for this particular
@@ -4,12 +4,16 @@ class PostalAddress < ActiveRecord::Base
4
4
  belongs_to :geo_country
5
5
  belongs_to :geo_zone
6
6
 
7
- def summary_line
7
+ def summary_line
8
8
  "#{description} : #{address_line_1}, #{city}"
9
9
  end
10
10
 
11
- def to_label
12
- "#{description} : #{address_line_1}, #{city}"
11
+ def to_label(&block)
12
+ if block_given?
13
+ block.call(self)
14
+ else
15
+ "#{description} : #{address_line_1}, #{city}"
16
+ end
13
17
  end
14
18
 
15
19
  def zip_eql_to?(zip)
@@ -19,11 +19,8 @@ module ErpBaseErpSvcs
19
19
  extend ErpBaseErpSvcs::Extensions::ActiveRecord::StiInstantiation::ActMacro
20
20
  end
21
21
 
22
- engine = self
23
- config.to_prepare do
24
- ErpBaseErpSvcs.register_compass_ae_engine(engine)
25
- ErpBaseErpSvcs.load_root_compass_ae_framework_extensions
26
- end
22
+ ErpBaseErpSvcs.register_as_compass_ae_engine(config, self)
23
+ ErpBaseErpSvcs.load_root_compass_ae_framework_extensions(config)
27
24
 
28
25
  end
29
26
  end
@@ -2,7 +2,7 @@ module ErpBaseErpSvcs
2
2
  module VERSION #:nodoc:
3
3
  MAJOR = 3
4
4
  MINOR = 0
5
- TINY = 5
5
+ TINY = 6
6
6
 
7
7
  STRING = [MAJOR, MINOR, TINY].compact.join('.')
8
8
  end
@@ -2,21 +2,30 @@ require "erp_base_erp_svcs/version"
2
2
  require "erp_base_erp_svcs/extensions"
3
3
  require "erp_base_erp_svcs/ar_fixtures"
4
4
  require "erp_base_erp_svcs/config"
5
- require "erp_base_erp_svcs/engine"
6
5
  require "erp_base_erp_svcs/non_escape_json_string"
7
6
 
8
7
  module ErpBaseErpSvcs
9
8
  class << self
9
+ def determine_callback
10
+ (Rails.env == 'development') ? 'to_prepare' : 'after_initialize'
11
+ end
12
+
10
13
  def mount_compass_ae_engines(routes)
11
14
  Rails.application.config.erp_base_erp_svcs.compass_ae_engines.each do |engine|
12
15
  routes.mount engine => "/#{engine.name.split("::").first.underscore}"
13
16
  end
14
17
  end
15
18
 
16
- def register_compass_ae_engine(engine)
19
+ def register_as_compass_ae_engine(config, engine)
20
+ config.send(ErpBaseErpSvcs.determine_callback) do
21
+ ErpBaseErpSvcs.load_compass_ae_engine(engine, config)
22
+ end
23
+ end
24
+
25
+ def load_compass_ae_engine(engine, config)
17
26
  Rails.application.config.erp_base_erp_svcs.compass_ae_engines << engine unless Rails.application.config.erp_base_erp_svcs.compass_ae_engines.include?(engine)
18
27
  load_compass_ae_extensions(engine)
19
- load_root_compass_ae_framework_extensions()
28
+ load_root_compass_ae_framework_extensions(config)
20
29
  end
21
30
 
22
31
  #forces rails to reload model extensions and framework extensions
@@ -87,13 +96,19 @@ module ErpBaseErpSvcs
87
96
  end
88
97
  end
89
98
 
90
- def load_root_compass_ae_framework_extensions
91
- Dir.glob(File.join(Rails.root,"lib/extensions/compass_ae/**/*.rb")).each do |file|
92
- load file
99
+ def load_root_compass_ae_framework_extensions(config)
100
+ config.send(ErpBaseErpSvcs.determine_callback) do
101
+ Dir.glob(File.join(Rails.root,"lib/extensions/compass_ae/**/*.rb")).each do |file|
102
+ load file
103
+ end
93
104
  end
105
+
94
106
  end
95
107
 
96
108
  end
97
109
  end
98
110
 
111
+ #load the engine after this module is defined
112
+ require "erp_base_erp_svcs/engine"
113
+
99
114
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: erp_base_erp_svcs
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.0.5
4
+ version: 3.0.6
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,11 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-09-24 00:00:00.000000000 Z
12
+ date: 2013-01-10 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: railties
16
- requirement: &70130672354840 !ruby/object:Gem::Requirement
16
+ requirement: &70320522928120 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ~>
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: 3.1.0
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *70130672354840
24
+ version_requirements: *70320522928120
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: actionmailer
27
- requirement: &70130672353840 !ruby/object:Gem::Requirement
27
+ requirement: &70320522927620 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ~>
@@ -32,10 +32,10 @@ dependencies:
32
32
  version: 3.1.0
33
33
  type: :runtime
34
34
  prerelease: false
35
- version_requirements: *70130672353840
35
+ version_requirements: *70320522927620
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: actionpack
38
- requirement: &70130672352580 !ruby/object:Gem::Requirement
38
+ requirement: &70320522927160 !ruby/object:Gem::Requirement
39
39
  none: false
40
40
  requirements:
41
41
  - - ~>
@@ -43,10 +43,10 @@ dependencies:
43
43
  version: 3.1.0
44
44
  type: :runtime
45
45
  prerelease: false
46
- version_requirements: *70130672352580
46
+ version_requirements: *70320522927160
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: activerecord
49
- requirement: &70130672351280 !ruby/object:Gem::Requirement
49
+ requirement: &70320522926640 !ruby/object:Gem::Requirement
50
50
  none: false
51
51
  requirements:
52
52
  - - ~>
@@ -54,10 +54,10 @@ dependencies:
54
54
  version: 3.1.0
55
55
  type: :runtime
56
56
  prerelease: false
57
- version_requirements: *70130672351280
57
+ version_requirements: *70320522926640
58
58
  - !ruby/object:Gem::Dependency
59
59
  name: activeresource
60
- requirement: &70130672343880 !ruby/object:Gem::Requirement
60
+ requirement: &70320523198480 !ruby/object:Gem::Requirement
61
61
  none: false
62
62
  requirements:
63
63
  - - ~>
@@ -65,10 +65,10 @@ dependencies:
65
65
  version: 3.1.0
66
66
  type: :runtime
67
67
  prerelease: false
68
- version_requirements: *70130672343880
68
+ version_requirements: *70320523198480
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: activesupport
71
- requirement: &70130672343080 !ruby/object:Gem::Requirement
71
+ requirement: &70320523197740 !ruby/object:Gem::Requirement
72
72
  none: false
73
73
  requirements:
74
74
  - - ~>
@@ -76,10 +76,10 @@ dependencies:
76
76
  version: 3.1.0
77
77
  type: :runtime
78
78
  prerelease: false
79
- version_requirements: *70130672343080
79
+ version_requirements: *70320523197740
80
80
  - !ruby/object:Gem::Dependency
81
81
  name: rails
82
- requirement: &70130672342160 !ruby/object:Gem::Requirement
82
+ requirement: &70320523196880 !ruby/object:Gem::Requirement
83
83
  none: false
84
84
  requirements:
85
85
  - - ~>
@@ -87,10 +87,10 @@ dependencies:
87
87
  version: 3.1.0
88
88
  type: :runtime
89
89
  prerelease: false
90
- version_requirements: *70130672342160
90
+ version_requirements: *70320523196880
91
91
  - !ruby/object:Gem::Dependency
92
92
  name: attr_encrypted
93
- requirement: &70130672341260 !ruby/object:Gem::Requirement
93
+ requirement: &70320523196420 !ruby/object:Gem::Requirement
94
94
  none: false
95
95
  requirements:
96
96
  - - =
@@ -98,10 +98,10 @@ dependencies:
98
98
  version: 1.2.0
99
99
  type: :runtime
100
100
  prerelease: false
101
- version_requirements: *70130672341260
101
+ version_requirements: *70320523196420
102
102
  - !ruby/object:Gem::Dependency
103
103
  name: awesome_nested_set
104
- requirement: &70130672340560 !ruby/object:Gem::Requirement
104
+ requirement: &70320523195900 !ruby/object:Gem::Requirement
105
105
  none: false
106
106
  requirements:
107
107
  - - =
@@ -109,10 +109,10 @@ dependencies:
109
109
  version: 2.0.2
110
110
  type: :runtime
111
111
  prerelease: false
112
- version_requirements: *70130672340560
112
+ version_requirements: *70320523195900
113
113
  - !ruby/object:Gem::Dependency
114
114
  name: data_migrator
115
- requirement: &70130672339700 !ruby/object:Gem::Requirement
115
+ requirement: &70320523195200 !ruby/object:Gem::Requirement
116
116
  none: false
117
117
  requirements:
118
118
  - - =
@@ -120,10 +120,10 @@ dependencies:
120
120
  version: '1.7'
121
121
  type: :runtime
122
122
  prerelease: false
123
- version_requirements: *70130672339700
123
+ version_requirements: *70320523195200
124
124
  - !ruby/object:Gem::Dependency
125
125
  name: has_many_polymorphic
126
- requirement: &70130672338760 !ruby/object:Gem::Requirement
126
+ requirement: &70320523194520 !ruby/object:Gem::Requirement
127
127
  none: false
128
128
  requirements:
129
129
  - - ! '>='
@@ -131,10 +131,10 @@ dependencies:
131
131
  version: 2.0.1
132
132
  type: :runtime
133
133
  prerelease: false
134
- version_requirements: *70130672338760
134
+ version_requirements: *70320523194520
135
135
  - !ruby/object:Gem::Dependency
136
136
  name: uuid
137
- requirement: &70130672337600 !ruby/object:Gem::Requirement
137
+ requirement: &70320523193800 !ruby/object:Gem::Requirement
138
138
  none: false
139
139
  requirements:
140
140
  - - =
@@ -142,10 +142,10 @@ dependencies:
142
142
  version: 2.3.4
143
143
  type: :runtime
144
144
  prerelease: false
145
- version_requirements: *70130672337600
145
+ version_requirements: *70320523193800
146
146
  - !ruby/object:Gem::Dependency
147
147
  name: database_cleaner
148
- requirement: &70130672336980 !ruby/object:Gem::Requirement
148
+ requirement: &70320523193240 !ruby/object:Gem::Requirement
149
149
  none: false
150
150
  requirements:
151
151
  - - ! '>='
@@ -153,10 +153,10 @@ dependencies:
153
153
  version: '0'
154
154
  type: :development
155
155
  prerelease: false
156
- version_requirements: *70130672336980
156
+ version_requirements: *70320523193240
157
157
  - !ruby/object:Gem::Dependency
158
158
  name: factory_girl_rails
159
- requirement: &70130672336220 !ruby/object:Gem::Requirement
159
+ requirement: &70320523192400 !ruby/object:Gem::Requirement
160
160
  none: false
161
161
  requirements:
162
162
  - - =
@@ -164,10 +164,10 @@ dependencies:
164
164
  version: 1.3.0
165
165
  type: :development
166
166
  prerelease: false
167
- version_requirements: *70130672336220
167
+ version_requirements: *70320523192400
168
168
  - !ruby/object:Gem::Dependency
169
169
  name: rspec-rails
170
- requirement: &70130672329240 !ruby/object:Gem::Requirement
170
+ requirement: &70320523191420 !ruby/object:Gem::Requirement
171
171
  none: false
172
172
  requirements:
173
173
  - - =
@@ -175,10 +175,10 @@ dependencies:
175
175
  version: '2.7'
176
176
  type: :development
177
177
  prerelease: false
178
- version_requirements: *70130672329240
178
+ version_requirements: *70320523191420
179
179
  - !ruby/object:Gem::Dependency
180
180
  name: simplecov
181
- requirement: &70130672328660 !ruby/object:Gem::Requirement
181
+ requirement: &70320523229800 !ruby/object:Gem::Requirement
182
182
  none: false
183
183
  requirements:
184
184
  - - =
@@ -186,10 +186,10 @@ dependencies:
186
186
  version: '0.5'
187
187
  type: :development
188
188
  prerelease: false
189
- version_requirements: *70130672328660
189
+ version_requirements: *70320523229800
190
190
  - !ruby/object:Gem::Dependency
191
191
  name: spork
192
- requirement: &70130672328020 !ruby/object:Gem::Requirement
192
+ requirement: &70320523229340 !ruby/object:Gem::Requirement
193
193
  none: false
194
194
  requirements:
195
195
  - - =
@@ -197,10 +197,10 @@ dependencies:
197
197
  version: 0.9.0.rc
198
198
  type: :development
199
199
  prerelease: false
200
- version_requirements: *70130672328020
200
+ version_requirements: *70320523229340
201
201
  - !ruby/object:Gem::Dependency
202
202
  name: sqlite3
203
- requirement: &70130672327260 !ruby/object:Gem::Requirement
203
+ requirement: &70320523228880 !ruby/object:Gem::Requirement
204
204
  none: false
205
205
  requirements:
206
206
  - - =
@@ -208,10 +208,10 @@ dependencies:
208
208
  version: 1.3.4
209
209
  type: :development
210
210
  prerelease: false
211
- version_requirements: *70130672327260
211
+ version_requirements: *70320523228880
212
212
  - !ruby/object:Gem::Dependency
213
213
  name: watchr
214
- requirement: &70130672326640 !ruby/object:Gem::Requirement
214
+ requirement: &70320523228460 !ruby/object:Gem::Requirement
215
215
  none: false
216
216
  requirements:
217
217
  - - ! '>='
@@ -219,7 +219,7 @@ dependencies:
219
219
  version: '0'
220
220
  type: :development
221
221
  prerelease: false
222
- version_requirements: *70130672326640
222
+ version_requirements: *70320523228460
223
223
  description: contains an implementation of the ubiquitous 'party model' for managing
224
224
  people, organizations, roles, relationships and contact information. The models
225
225
  in this library are designed to be useful in a variety of circumstances, including