solidus_product_assembly 1.0.0 → 1.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/.circleci/config.yml +47 -0
- data/.gem_release.yml +5 -0
- data/.github/dependabot.yml +7 -0
- data/.github/stale.yml +17 -0
- data/.github_changelog_generator +2 -0
- data/.gitignore +18 -2
- data/.rspec +1 -2
- data/.rubocop.yml +7 -0
- data/.rubocop_todo.yml +316 -0
- data/CHANGELOG.md +116 -0
- data/Gemfile +36 -9
- data/LICENSE +26 -0
- data/README.md +75 -50
- data/Rakefile +4 -19
- data/app/controllers/spree/admin/parts_controller.rb +13 -11
- data/app/decorators/helpers/solidus_product_assembly/spree/admin/orders_helper_decorator.rb +19 -0
- data/app/decorators/models/solidus_product_assembly/spree/inventory_unit_decorator.rb +19 -0
- data/app/decorators/models/solidus_product_assembly/spree/line_item_decorator.rb +52 -0
- data/app/decorators/models/solidus_product_assembly/spree/product_decorator.rb +83 -0
- data/app/decorators/models/solidus_product_assembly/spree/return_item_decorator.rb +15 -0
- data/app/decorators/models/solidus_product_assembly/spree/shipment_decorator.rb +55 -0
- data/app/decorators/models/solidus_product_assembly/spree/stock/availability_validator_decorator.rb +37 -0
- data/app/decorators/models/solidus_product_assembly/spree/stock/differentiator_decorator.rb +17 -0
- data/app/decorators/models/solidus_product_assembly/spree/stock/inventory_unit_builder_decorator.rb +39 -0
- data/app/decorators/models/solidus_product_assembly/spree/stock/inventory_units_finalizer_decorator.rb +33 -0
- data/app/decorators/models/solidus_product_assembly/spree/stock/inventory_validator_decorator.rb +22 -0
- data/app/decorators/models/solidus_product_assembly/spree/variant_decorator.rb +26 -0
- data/app/models/spree/assemblies_part.rb +6 -4
- data/app/models/spree/calculator/returns/assemblies_default_refund_amount.rb +17 -0
- data/app/models/spree/order_inventory_assembly.rb +11 -2
- data/app/overrides/add_admin_product_form_fields.rb +7 -5
- data/app/overrides/add_admin_tabs.rb +7 -5
- data/app/overrides/add_line_item_description.rb +7 -5
- data/app/overrides/spree/admin/orders/_carton_manifest/_assembly_parts_price.html.erb.deface +9 -0
- data/app/overrides/spree/admin/orders/_carton_manifest/_assembly_parts_total_price.html.erb.deface +9 -0
- data/app/overrides/spree/admin/orders/_shipment/stock_contents.html.erb.deface +7 -1
- data/app/overrides/spree/products/show/add_links_to_parts.html.erb.deface +2 -2
- data/app/views/spree/admin/orders/_assemblies.html.erb +8 -17
- data/app/views/spree/admin/orders/_stock_contents.html.erb +2 -62
- data/app/views/spree/admin/orders/_stock_contents_2_3.html.erb +69 -0
- data/app/views/spree/admin/orders/_stock_contents_2_4.html.erb +70 -0
- data/app/views/spree/admin/orders/_stock_item.html.erb +13 -10
- data/app/views/spree/admin/parts/_parts_table.html.erb +17 -11
- data/app/views/spree/admin/parts/available.html.erb +10 -8
- data/app/views/spree/admin/parts/available.js.erb +9 -7
- data/app/views/spree/admin/parts/index.html.erb +1 -1
- data/app/views/spree/admin/products/_product_assembly_fields.html.erb +2 -2
- data/app/views/spree/admin/shared/_product_assembly_product_tabs.html.erb +1 -1
- data/app/views/spree/api/line_items/show.v1.rabl +27 -0
- data/app/views/spree/checkout/_line_item_manifest.html.erb +3 -1
- data/bin/console +17 -0
- data/bin/rails +5 -5
- data/bin/rails-engine +13 -0
- data/bin/rails-sandbox +16 -0
- data/bin/rake +7 -0
- data/bin/sandbox +86 -0
- data/bin/setup +8 -0
- data/config/routes.rb +2 -2
- data/db/migrate/20091028152124_add_many_to_many_relation_to_products.rb +7 -5
- data/db/migrate/20091029165620_add_parts_fields_to_products.rb +18 -16
- data/db/migrate/20120316141830_namespace_product_assembly_for_spree_one.rb +3 -1
- data/db/migrate/20140620223938_add_id_to_spree_assemblies_parts.rb +4 -2
- data/lib/generators/solidus_product_assembly/install/install_generator.rb +22 -9
- data/lib/generators/solidus_product_assembly/install/templates/initializer.rb +6 -0
- data/lib/solidus_product_assembly/configuration.rb +21 -0
- data/lib/solidus_product_assembly/engine.rb +12 -8
- data/lib/solidus_product_assembly/testing_support/factories.rb +4 -0
- data/lib/solidus_product_assembly/version.rb +3 -1
- data/lib/solidus_product_assembly.rb +7 -1
- data/lib/tasks/spree2_upgrade.rake +12 -12
- data/solidus_product_assembly.gemspec +35 -29
- data/spec/features/admin/orders_spec.rb +114 -16
- data/spec/features/admin/parts_spec.rb +5 -3
- data/spec/features/admin/return_items_spec.rb +151 -0
- data/spec/features/checkout_spec.rb +103 -21
- data/spec/models/spree/assemblies_part_spec.rb +3 -1
- data/spec/models/spree/inventory_unit_spec.rb +15 -6
- data/spec/models/spree/line_item_spec.rb +6 -4
- data/spec/models/spree/order_contents_spec.rb +6 -5
- data/spec/models/spree/order_inventory_assembly_spec.rb +8 -6
- data/spec/models/spree/order_inventory_spec.rb +7 -3
- data/spec/models/spree/product_spec.rb +33 -14
- data/spec/models/spree/shipment_spec.rb +20 -13
- data/spec/models/spree/stock/availability_validator_spec.rb +22 -33
- data/spec/models/spree/stock/coordinator_spec.rb +11 -3
- data/spec/models/spree/stock/inventory_unit_builder_spec.rb +5 -7
- data/spec/models/spree/variant_spec.rb +3 -1
- data/spec/spec_helper.rb +21 -45
- data/spec/support/shared_contexts/order_with_bundle.rb +2 -0
- metadata +80 -80
- data/.travis.yml +0 -21
- data/LICENSE.md +0 -13
- data/app/controllers/spree/checkout_controller_decorator.rb +0 -9
- data/app/helpers/spree/admin/orders_helper_decorator.rb +0 -9
- data/app/models/spree/inventory_unit_decorator.rb +0 -13
- data/app/models/spree/line_item_decorator.rb +0 -44
- data/app/models/spree/product_decorator.rb +0 -56
- data/app/models/spree/shipment_decorator.rb +0 -50
- data/app/models/spree/stock/availability_validator.rb +0 -28
- data/app/models/spree/stock/inventory_unit_builder_decorator.rb +0 -30
- data/app/models/spree/stock/inventory_validator_decorator.rb +0 -12
- data/app/models/spree/variant_decorator.rb +0 -13
metadata
CHANGED
@@ -1,71 +1,57 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: solidus_product_assembly
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Roman Smirnov
|
8
|
-
autorequire:
|
9
|
-
bindir:
|
8
|
+
autorequire:
|
9
|
+
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2022-11-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
|
-
name:
|
14
|
+
name: solidus_core
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
17
|
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version:
|
19
|
+
version: 2.0.0
|
20
20
|
- - "<"
|
21
21
|
- !ruby/object:Gem::Version
|
22
|
-
version: '
|
22
|
+
version: '4'
|
23
23
|
type: :runtime
|
24
24
|
prerelease: false
|
25
25
|
version_requirements: !ruby/object:Gem::Requirement
|
26
26
|
requirements:
|
27
27
|
- - ">="
|
28
28
|
- !ruby/object:Gem::Version
|
29
|
-
version:
|
29
|
+
version: 2.0.0
|
30
30
|
- - "<"
|
31
31
|
- !ruby/object:Gem::Version
|
32
|
-
version: '
|
32
|
+
version: '4'
|
33
33
|
- !ruby/object:Gem::Dependency
|
34
|
-
name:
|
34
|
+
name: solidus_support
|
35
35
|
requirement: !ruby/object:Gem::Requirement
|
36
36
|
requirements:
|
37
37
|
- - "~>"
|
38
38
|
- !ruby/object:Gem::Version
|
39
|
-
version: '
|
40
|
-
type: :
|
39
|
+
version: '0.8'
|
40
|
+
type: :runtime
|
41
41
|
prerelease: false
|
42
42
|
version_requirements: !ruby/object:Gem::Requirement
|
43
43
|
requirements:
|
44
44
|
- - "~>"
|
45
45
|
- !ruby/object:Gem::Version
|
46
|
-
version: '
|
47
|
-
- !ruby/object:Gem::Dependency
|
48
|
-
name: sqlite3
|
49
|
-
requirement: !ruby/object:Gem::Requirement
|
50
|
-
requirements:
|
51
|
-
- - ">="
|
52
|
-
- !ruby/object:Gem::Version
|
53
|
-
version: '0'
|
54
|
-
type: :development
|
55
|
-
prerelease: false
|
56
|
-
version_requirements: !ruby/object:Gem::Requirement
|
57
|
-
requirements:
|
58
|
-
- - ">="
|
59
|
-
- !ruby/object:Gem::Version
|
60
|
-
version: '0'
|
46
|
+
version: '0.8'
|
61
47
|
- !ruby/object:Gem::Dependency
|
62
|
-
name:
|
48
|
+
name: deface
|
63
49
|
requirement: !ruby/object:Gem::Requirement
|
64
50
|
requirements:
|
65
51
|
- - ">="
|
66
52
|
- !ruby/object:Gem::Version
|
67
53
|
version: '0'
|
68
|
-
type: :
|
54
|
+
type: :runtime
|
69
55
|
prerelease: false
|
70
56
|
version_requirements: !ruby/object:Gem::Requirement
|
71
57
|
requirements:
|
@@ -73,63 +59,49 @@ dependencies:
|
|
73
59
|
- !ruby/object:Gem::Version
|
74
60
|
version: '0'
|
75
61
|
- !ruby/object:Gem::Dependency
|
76
|
-
name:
|
77
|
-
requirement: !ruby/object:Gem::Requirement
|
78
|
-
requirements:
|
79
|
-
- - "~>"
|
80
|
-
- !ruby/object:Gem::Version
|
81
|
-
version: '4.4'
|
82
|
-
type: :development
|
83
|
-
prerelease: false
|
84
|
-
version_requirements: !ruby/object:Gem::Requirement
|
85
|
-
requirements:
|
86
|
-
- - "~>"
|
87
|
-
- !ruby/object:Gem::Version
|
88
|
-
version: '4.4'
|
89
|
-
- !ruby/object:Gem::Dependency
|
90
|
-
name: capybara
|
62
|
+
name: solidus_dev_support
|
91
63
|
requirement: !ruby/object:Gem::Requirement
|
92
64
|
requirements:
|
93
65
|
- - "~>"
|
94
66
|
- !ruby/object:Gem::Version
|
95
|
-
version: '2.
|
67
|
+
version: '2.5'
|
96
68
|
type: :development
|
97
69
|
prerelease: false
|
98
70
|
version_requirements: !ruby/object:Gem::Requirement
|
99
71
|
requirements:
|
100
72
|
- - "~>"
|
101
73
|
- !ruby/object:Gem::Version
|
102
|
-
version: '2.
|
74
|
+
version: '2.5'
|
103
75
|
- !ruby/object:Gem::Dependency
|
104
|
-
name:
|
76
|
+
name: github_changelog_generator
|
105
77
|
requirement: !ruby/object:Gem::Requirement
|
106
78
|
requirements:
|
107
|
-
- - "
|
79
|
+
- - ">="
|
108
80
|
- !ruby/object:Gem::Version
|
109
|
-
version: '
|
81
|
+
version: '0'
|
110
82
|
type: :development
|
111
83
|
prerelease: false
|
112
84
|
version_requirements: !ruby/object:Gem::Requirement
|
113
85
|
requirements:
|
114
|
-
- - "
|
86
|
+
- - ">="
|
115
87
|
- !ruby/object:Gem::Version
|
116
|
-
version: '
|
88
|
+
version: '0'
|
117
89
|
- !ruby/object:Gem::Dependency
|
118
|
-
name:
|
90
|
+
name: selenium-webdriver
|
119
91
|
requirement: !ruby/object:Gem::Requirement
|
120
92
|
requirements:
|
121
|
-
- - "
|
93
|
+
- - ">="
|
122
94
|
- !ruby/object:Gem::Version
|
123
|
-
version: '
|
95
|
+
version: '0'
|
124
96
|
type: :development
|
125
97
|
prerelease: false
|
126
98
|
version_requirements: !ruby/object:Gem::Requirement
|
127
99
|
requirements:
|
128
|
-
- - "
|
100
|
+
- - ">="
|
129
101
|
- !ruby/object:Gem::Version
|
130
|
-
version: '
|
102
|
+
version: '0'
|
131
103
|
- !ruby/object:Gem::Dependency
|
132
|
-
name:
|
104
|
+
name: webdrivers
|
133
105
|
requirement: !ruby/object:Gem::Requirement
|
134
106
|
requirements:
|
135
107
|
- - ">="
|
@@ -142,17 +114,24 @@ dependencies:
|
|
142
114
|
- - ">="
|
143
115
|
- !ruby/object:Gem::Version
|
144
116
|
version: '0'
|
145
|
-
description: Adds
|
117
|
+
description: Adds opportunity to make bundle of products to your Spree store
|
146
118
|
email: roman@railsdog.com
|
147
119
|
executables: []
|
148
120
|
extensions: []
|
149
121
|
extra_rdoc_files: []
|
150
122
|
files:
|
123
|
+
- ".circleci/config.yml"
|
124
|
+
- ".gem_release.yml"
|
125
|
+
- ".github/dependabot.yml"
|
126
|
+
- ".github/stale.yml"
|
127
|
+
- ".github_changelog_generator"
|
151
128
|
- ".gitignore"
|
152
129
|
- ".rspec"
|
153
|
-
- ".
|
130
|
+
- ".rubocop.yml"
|
131
|
+
- ".rubocop_todo.yml"
|
132
|
+
- CHANGELOG.md
|
154
133
|
- Gemfile
|
155
|
-
- LICENSE
|
134
|
+
- LICENSE
|
156
135
|
- README.md
|
157
136
|
- Rakefile
|
158
137
|
- app/assets/images/spinner.gif
|
@@ -161,21 +140,26 @@ files:
|
|
161
140
|
- app/assets/stylesheets/spree/backend/solidus_product_assembly.css
|
162
141
|
- app/assets/stylesheets/spree/frontend/solidus_product_assembly.css
|
163
142
|
- app/controllers/spree/admin/parts_controller.rb
|
164
|
-
- app/
|
165
|
-
- app/
|
143
|
+
- app/decorators/helpers/solidus_product_assembly/spree/admin/orders_helper_decorator.rb
|
144
|
+
- app/decorators/models/solidus_product_assembly/spree/inventory_unit_decorator.rb
|
145
|
+
- app/decorators/models/solidus_product_assembly/spree/line_item_decorator.rb
|
146
|
+
- app/decorators/models/solidus_product_assembly/spree/product_decorator.rb
|
147
|
+
- app/decorators/models/solidus_product_assembly/spree/return_item_decorator.rb
|
148
|
+
- app/decorators/models/solidus_product_assembly/spree/shipment_decorator.rb
|
149
|
+
- app/decorators/models/solidus_product_assembly/spree/stock/availability_validator_decorator.rb
|
150
|
+
- app/decorators/models/solidus_product_assembly/spree/stock/differentiator_decorator.rb
|
151
|
+
- app/decorators/models/solidus_product_assembly/spree/stock/inventory_unit_builder_decorator.rb
|
152
|
+
- app/decorators/models/solidus_product_assembly/spree/stock/inventory_units_finalizer_decorator.rb
|
153
|
+
- app/decorators/models/solidus_product_assembly/spree/stock/inventory_validator_decorator.rb
|
154
|
+
- app/decorators/models/solidus_product_assembly/spree/variant_decorator.rb
|
166
155
|
- app/models/spree/assemblies_part.rb
|
167
|
-
- app/models/spree/
|
168
|
-
- app/models/spree/line_item_decorator.rb
|
156
|
+
- app/models/spree/calculator/returns/assemblies_default_refund_amount.rb
|
169
157
|
- app/models/spree/order_inventory_assembly.rb
|
170
|
-
- app/models/spree/product_decorator.rb
|
171
|
-
- app/models/spree/shipment_decorator.rb
|
172
|
-
- app/models/spree/stock/availability_validator.rb
|
173
|
-
- app/models/spree/stock/inventory_unit_builder_decorator.rb
|
174
|
-
- app/models/spree/stock/inventory_validator_decorator.rb
|
175
|
-
- app/models/spree/variant_decorator.rb
|
176
158
|
- app/overrides/add_admin_product_form_fields.rb
|
177
159
|
- app/overrides/add_admin_tabs.rb
|
178
160
|
- app/overrides/add_line_item_description.rb
|
161
|
+
- app/overrides/spree/admin/orders/_carton_manifest/_assembly_parts_price.html.erb.deface
|
162
|
+
- app/overrides/spree/admin/orders/_carton_manifest/_assembly_parts_total_price.html.erb.deface
|
179
163
|
- app/overrides/spree/admin/orders/_form/inject_product_assemblies.html.erb.deface
|
180
164
|
- app/overrides/spree/admin/orders/_shipment/stock_contents.html.erb.deface
|
181
165
|
- app/overrides/spree/checkout/_delivery/remove_unshippable_markup.html.erb.deface
|
@@ -185,6 +169,8 @@ files:
|
|
185
169
|
- app/overrides/spree/shared/_order_details/part_description.html.erb.deface
|
186
170
|
- app/views/spree/admin/orders/_assemblies.html.erb
|
187
171
|
- app/views/spree/admin/orders/_stock_contents.html.erb
|
172
|
+
- app/views/spree/admin/orders/_stock_contents_2_3.html.erb
|
173
|
+
- app/views/spree/admin/orders/_stock_contents_2_4.html.erb
|
188
174
|
- app/views/spree/admin/orders/_stock_item.html.erb
|
189
175
|
- app/views/spree/admin/parts/_parts_table.html.erb
|
190
176
|
- app/views/spree/admin/parts/available.html.erb
|
@@ -193,9 +179,16 @@ files:
|
|
193
179
|
- app/views/spree/admin/parts/update_parts_table.js.erb
|
194
180
|
- app/views/spree/admin/products/_product_assembly_fields.html.erb
|
195
181
|
- app/views/spree/admin/shared/_product_assembly_product_tabs.html.erb
|
182
|
+
- app/views/spree/api/line_items/show.v1.rabl
|
196
183
|
- app/views/spree/checkout/_line_item_manifest.html.erb
|
197
184
|
- app/views/spree/orders/_cart_description.html.erb
|
185
|
+
- bin/console
|
198
186
|
- bin/rails
|
187
|
+
- bin/rails-engine
|
188
|
+
- bin/rails-sandbox
|
189
|
+
- bin/rake
|
190
|
+
- bin/sandbox
|
191
|
+
- bin/setup
|
199
192
|
- config/locales/en.yml
|
200
193
|
- config/locales/fr.yml
|
201
194
|
- config/locales/ru.yml
|
@@ -206,13 +199,17 @@ files:
|
|
206
199
|
- db/migrate/20120316141830_namespace_product_assembly_for_spree_one.rb
|
207
200
|
- db/migrate/20140620223938_add_id_to_spree_assemblies_parts.rb
|
208
201
|
- lib/generators/solidus_product_assembly/install/install_generator.rb
|
202
|
+
- lib/generators/solidus_product_assembly/install/templates/initializer.rb
|
209
203
|
- lib/solidus_product_assembly.rb
|
204
|
+
- lib/solidus_product_assembly/configuration.rb
|
210
205
|
- lib/solidus_product_assembly/engine.rb
|
206
|
+
- lib/solidus_product_assembly/testing_support/factories.rb
|
211
207
|
- lib/solidus_product_assembly/version.rb
|
212
208
|
- lib/tasks/spree2_upgrade.rake
|
213
209
|
- solidus_product_assembly.gemspec
|
214
210
|
- spec/features/admin/orders_spec.rb
|
215
211
|
- spec/features/admin/parts_spec.rb
|
212
|
+
- spec/features/admin/return_items_spec.rb
|
216
213
|
- spec/features/checkout_spec.rb
|
217
214
|
- spec/models/spree/assemblies_part_spec.rb
|
218
215
|
- spec/models/spree/inventory_unit_spec.rb
|
@@ -229,9 +226,13 @@ files:
|
|
229
226
|
- spec/spec_helper.rb
|
230
227
|
- spec/support/shared_contexts/order_with_bundle.rb
|
231
228
|
homepage: https://solidus.io
|
232
|
-
licenses:
|
233
|
-
|
234
|
-
|
229
|
+
licenses:
|
230
|
+
- BSD-3-Clause
|
231
|
+
metadata:
|
232
|
+
homepage_uri: https://solidus.io
|
233
|
+
source_code_uri: https://github.com/solidusio-contrib/solidus_product_assembly
|
234
|
+
changelog_uri: https://github.com/SuperGoodSoft/solidus_product_assembly/blob/master/CHANGELOG.md
|
235
|
+
post_install_message:
|
235
236
|
rdoc_options: []
|
236
237
|
require_paths:
|
237
238
|
- lib
|
@@ -239,22 +240,21 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
239
240
|
requirements:
|
240
241
|
- - ">="
|
241
242
|
- !ruby/object:Gem::Version
|
242
|
-
version:
|
243
|
+
version: '2.4'
|
243
244
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
244
245
|
requirements:
|
245
246
|
- - ">="
|
246
247
|
- !ruby/object:Gem::Version
|
247
248
|
version: '0'
|
248
|
-
requirements:
|
249
|
-
|
250
|
-
|
251
|
-
rubygems_version: 2.5.1
|
252
|
-
signing_key:
|
249
|
+
requirements: []
|
250
|
+
rubygems_version: 3.1.6
|
251
|
+
signing_key:
|
253
252
|
specification_version: 4
|
254
|
-
summary: Adds
|
253
|
+
summary: Adds opportunity to make bundle of products to your Spree store
|
255
254
|
test_files:
|
256
255
|
- spec/features/admin/orders_spec.rb
|
257
256
|
- spec/features/admin/parts_spec.rb
|
257
|
+
- spec/features/admin/return_items_spec.rb
|
258
258
|
- spec/features/checkout_spec.rb
|
259
259
|
- spec/models/spree/assemblies_part_spec.rb
|
260
260
|
- spec/models/spree/inventory_unit_spec.rb
|
data/.travis.yml
DELETED
@@ -1,21 +0,0 @@
|
|
1
|
-
sudo: false
|
2
|
-
cache: bundler
|
3
|
-
language: ruby
|
4
|
-
rvm:
|
5
|
-
- 2.3.1
|
6
|
-
env:
|
7
|
-
matrix:
|
8
|
-
- SOLIDUS_BRANCH=v1.0 DB=postgres
|
9
|
-
- SOLIDUS_BRANCH=v1.1 DB=postgres
|
10
|
-
- SOLIDUS_BRANCH=v1.2 DB=postgres
|
11
|
-
- SOLIDUS_BRANCH=v1.3 DB=postgres
|
12
|
-
- SOLIDUS_BRANCH=v1.4 DB=postgres
|
13
|
-
- SOLIDUS_BRANCH=v2.0 DB=postgres
|
14
|
-
- SOLIDUS_BRANCH=master DB=postgres
|
15
|
-
- SOLIDUS_BRANCH=v1.0 DB=mysql
|
16
|
-
- SOLIDUS_BRANCH=v1.1 DB=mysql
|
17
|
-
- SOLIDUS_BRANCH=v1.2 DB=mysql
|
18
|
-
- SOLIDUS_BRANCH=v1.3 DB=mysql
|
19
|
-
- SOLIDUS_BRANCH=v1.4 DB=mysql
|
20
|
-
- SOLIDUS_BRANCH=v2.0 DB=mysql
|
21
|
-
- SOLIDUS_BRANCH=master DB=mysql
|
data/LICENSE.md
DELETED
@@ -1,13 +0,0 @@
|
|
1
|
-
Spree Product Assembly License
|
2
|
-
==============================
|
3
|
-
|
4
|
-
Copyright © 2007-2014, Spree Commerce Inc. and other contributors.
|
5
|
-
All rights reserved.
|
6
|
-
|
7
|
-
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
|
8
|
-
|
9
|
-
* Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
|
10
|
-
* Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
|
11
|
-
* Neither the name of Spree Commerce Inc. nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
|
12
|
-
|
13
|
-
_This software is provided by the copyright holders and contributors "as is" and any express or implied warranties, including, but not limited to, the implied warranties of merchantability and fitness for a particular purpose are disclaimed. In no event shall the copyright owner of contributors be liable for any direct, indirect, incidental, special, exemplary, or consequential damages (including, but not limited to, procurement of substitute goods or services; loss of use, data, or profits; or business interruption) however caused and on any theory of liability, whether in contract, strict liability, or tort (including negligence or otherwise) arising in any way out of the use of this software, even if advised of the possibility of such damage._
|
@@ -1,13 +0,0 @@
|
|
1
|
-
module Spree
|
2
|
-
InventoryUnit.class_eval do
|
3
|
-
def percentage_of_line_item
|
4
|
-
product = line_item.product
|
5
|
-
if product.assembly?
|
6
|
-
total_value = line_item.quantity_by_variant.map { |part, quantity| part.price * quantity }.sum
|
7
|
-
variant.price / total_value
|
8
|
-
else
|
9
|
-
1 / BigDecimal.new(line_item.quantity)
|
10
|
-
end
|
11
|
-
end
|
12
|
-
end
|
13
|
-
end
|
@@ -1,44 +0,0 @@
|
|
1
|
-
module Spree
|
2
|
-
LineItem.class_eval do
|
3
|
-
scope :assemblies, -> { joins(:product => :parts).uniq }
|
4
|
-
|
5
|
-
def any_units_shipped?
|
6
|
-
inventory_units.any? { |unit| unit.shipped? }
|
7
|
-
end
|
8
|
-
|
9
|
-
# The parts that apply to this particular LineItem. Usually `product#parts`, but
|
10
|
-
# provided as a hook if you want to override and customize the parts for a specific
|
11
|
-
# LineItem.
|
12
|
-
def parts
|
13
|
-
product.parts
|
14
|
-
end
|
15
|
-
|
16
|
-
# The number of the specified variant that make up this LineItem. By default, calls
|
17
|
-
# `product#count_of`, but provided as a hook if you want to override and customize
|
18
|
-
# the parts available for a specific LineItem. Note that if you only customize whether
|
19
|
-
# a variant is included in the LineItem, and don't customize the quantity of that part
|
20
|
-
# per LineItem, you shouldn't need to override this method.
|
21
|
-
def count_of(variant)
|
22
|
-
product.count_of(variant)
|
23
|
-
end
|
24
|
-
|
25
|
-
def quantity_by_variant
|
26
|
-
if self.product.assembly?
|
27
|
-
{}.tap { |hash| self.product.assemblies_parts.each { |ap| hash[ap.part] = ap.count * self.quantity } }
|
28
|
-
else
|
29
|
-
{ self.variant => self.quantity }
|
30
|
-
end
|
31
|
-
end
|
32
|
-
|
33
|
-
private
|
34
|
-
def update_inventory
|
35
|
-
if (changed? || target_shipment.present?) && self.order.has_checkout_step?("delivery")
|
36
|
-
if self.product.assembly?
|
37
|
-
OrderInventoryAssembly.new(self).verify(target_shipment)
|
38
|
-
else
|
39
|
-
OrderInventory.new(self.order, self).verify(target_shipment)
|
40
|
-
end
|
41
|
-
end
|
42
|
-
end
|
43
|
-
end
|
44
|
-
end
|
@@ -1,56 +0,0 @@
|
|
1
|
-
Spree::Product.class_eval do
|
2
|
-
has_and_belongs_to_many :parts, :class_name => "Spree::Variant",
|
3
|
-
:join_table => "spree_assemblies_parts",
|
4
|
-
:foreign_key => "assembly_id", :association_foreign_key => "part_id"
|
5
|
-
|
6
|
-
has_many :assemblies_parts, :class_name => "Spree::AssembliesPart",
|
7
|
-
:foreign_key => "assembly_id"
|
8
|
-
|
9
|
-
scope :individual_saled, -> { where(individual_sale: true) }
|
10
|
-
|
11
|
-
scope :search_can_be_part, ->(query){ not_deleted.available.joins(:master)
|
12
|
-
.where(arel_table["name"].matches("%#{query}%").or(Spree::Variant.arel_table["sku"].matches("%#{query}%")))
|
13
|
-
.where(can_be_part: true)
|
14
|
-
.limit(30)
|
15
|
-
}
|
16
|
-
|
17
|
-
validate :assembly_cannot_be_part, :if => :assembly?
|
18
|
-
|
19
|
-
def add_part(variant, count = 1)
|
20
|
-
set_part_count(variant, count_of(variant) + count)
|
21
|
-
end
|
22
|
-
|
23
|
-
def remove_part(variant)
|
24
|
-
set_part_count(variant, 0)
|
25
|
-
end
|
26
|
-
|
27
|
-
def set_part_count(variant, count)
|
28
|
-
ap = assemblies_part(variant)
|
29
|
-
if count > 0
|
30
|
-
ap.count = count
|
31
|
-
ap.save
|
32
|
-
else
|
33
|
-
ap.destroy
|
34
|
-
end
|
35
|
-
reload
|
36
|
-
end
|
37
|
-
|
38
|
-
def assembly?
|
39
|
-
parts.present?
|
40
|
-
end
|
41
|
-
|
42
|
-
def count_of(variant)
|
43
|
-
ap = assemblies_part(variant)
|
44
|
-
# This checks persisted because the default count is 1
|
45
|
-
ap.persisted? ? ap.count : 0
|
46
|
-
end
|
47
|
-
|
48
|
-
def assembly_cannot_be_part
|
49
|
-
errors.add(:can_be_part, Spree.t(:assembly_cannot_be_part)) if can_be_part
|
50
|
-
end
|
51
|
-
|
52
|
-
private
|
53
|
-
def assemblies_part(variant)
|
54
|
-
Spree::AssembliesPart.get(self.id, variant.id)
|
55
|
-
end
|
56
|
-
end
|
@@ -1,50 +0,0 @@
|
|
1
|
-
module Spree
|
2
|
-
Shipment.class_eval do
|
3
|
-
# Overriden from Spree core as a product bundle part should not be put
|
4
|
-
# together with an individual product purchased (even though they're the
|
5
|
-
# very same variant) That is so we can tell the store admin which units
|
6
|
-
# were purchased individually and which ones as parts of the bundle
|
7
|
-
#
|
8
|
-
# Account for situations where we can't track the line_item for a variant.
|
9
|
-
# This should avoid exceptions when users upgrade from spree 1.3
|
10
|
-
#
|
11
|
-
# TODO Can possibly be removed as well. We already override the manifest
|
12
|
-
# partial so we can get the product there
|
13
|
-
def manifest
|
14
|
-
items = []
|
15
|
-
inventory_units.joins(:variant).includes(:variant, :line_item).group_by(&:variant).each do |variant, units|
|
16
|
-
|
17
|
-
units.group_by(&:line_item).each do |line_item, units|
|
18
|
-
states = {}
|
19
|
-
units.group_by(&:state).each { |state, iu| states[state] = iu.count }
|
20
|
-
line_item ||= order.find_line_item_by_variant(variant)
|
21
|
-
|
22
|
-
part = line_item ? line_item.product.assembly? : false
|
23
|
-
items << OpenStruct.new(part: part,
|
24
|
-
product: line_item.try(:product),
|
25
|
-
line_item: line_item,
|
26
|
-
variant: variant,
|
27
|
-
quantity: units.length,
|
28
|
-
states: states)
|
29
|
-
end
|
30
|
-
end
|
31
|
-
items
|
32
|
-
end
|
33
|
-
|
34
|
-
# There might be scenarios where we don't want to display every single
|
35
|
-
# variant on the shipment. e.g. when ordering a product bundle that includes
|
36
|
-
# 5 other parts. Frontend users should only see the product bundle as a
|
37
|
-
# single item to ship
|
38
|
-
def line_item_manifest
|
39
|
-
inventory_units.includes(:line_item, :variant).group_by(&:line_item).map do |line_item, units|
|
40
|
-
states = {}
|
41
|
-
units.group_by(&:state).each { |state, iu| states[state] = iu.count }
|
42
|
-
OpenStruct.new(line_item: line_item, variant: line_item.variant, quantity: units.length, states: states)
|
43
|
-
end
|
44
|
-
end
|
45
|
-
|
46
|
-
def inventory_units_for_item(line_item, variant)
|
47
|
-
inventory_units.where(line_item_id: line_item.id, variant_id: variant.id)
|
48
|
-
end
|
49
|
-
end
|
50
|
-
end
|
@@ -1,28 +0,0 @@
|
|
1
|
-
module Spree
|
2
|
-
module Stock
|
3
|
-
# Overridden from spree core to make it also check for assembly parts stock
|
4
|
-
class AvailabilityValidator < ActiveModel::Validator
|
5
|
-
def validate(line_item)
|
6
|
-
line_item.quantity_by_variant.each do |variant, variant_quantity|
|
7
|
-
inventory_units = line_item.inventory_units.where(variant: variant).count
|
8
|
-
quantity = variant_quantity - inventory_units
|
9
|
-
|
10
|
-
next if quantity <= 0
|
11
|
-
next unless variant
|
12
|
-
|
13
|
-
quantifier = Stock::Quantifier.new(variant)
|
14
|
-
|
15
|
-
unless quantifier.can_supply? quantity
|
16
|
-
display_name = %Q{#{variant.name}}
|
17
|
-
display_name += %Q{ (#{variant.options_text})} unless variant.options_text.blank?
|
18
|
-
|
19
|
-
line_item.errors[:quantity] << Spree.t(
|
20
|
-
:selected_quantity_not_available,
|
21
|
-
item: display_name.inspect
|
22
|
-
)
|
23
|
-
end
|
24
|
-
end
|
25
|
-
end
|
26
|
-
end
|
27
|
-
end
|
28
|
-
end
|
@@ -1,30 +0,0 @@
|
|
1
|
-
module Spree
|
2
|
-
module Stock
|
3
|
-
InventoryUnitBuilder.class_eval do
|
4
|
-
def units
|
5
|
-
@order.line_items.flat_map do |line_item|
|
6
|
-
line_item.quantity_by_variant.flat_map do |variant, quantity|
|
7
|
-
quantity.times.map { build_inventory_unit(variant, line_item) }
|
8
|
-
end
|
9
|
-
end
|
10
|
-
end
|
11
|
-
|
12
|
-
def build_inventory_unit(variant, line_item)
|
13
|
-
@order.inventory_units.includes(
|
14
|
-
variant: {
|
15
|
-
product: {
|
16
|
-
shipping_category: {
|
17
|
-
shipping_methods: [:calculator, { zones: :zone_members }]
|
18
|
-
}
|
19
|
-
}
|
20
|
-
}
|
21
|
-
).build(
|
22
|
-
pending: true,
|
23
|
-
variant: variant,
|
24
|
-
line_item: line_item,
|
25
|
-
order: @order
|
26
|
-
)
|
27
|
-
end
|
28
|
-
end
|
29
|
-
end
|
30
|
-
end
|
@@ -1,12 +0,0 @@
|
|
1
|
-
Spree::Stock::InventoryValidator.class_eval do
|
2
|
-
def validate(line_item)
|
3
|
-
total_quantity = line_item.quantity_by_variant.values.sum
|
4
|
-
|
5
|
-
if line_item.inventory_units.count != total_quantity
|
6
|
-
line_item.errors[:inventory] << Spree.t(
|
7
|
-
:inventory_not_available,
|
8
|
-
item: line_item.variant.name
|
9
|
-
)
|
10
|
-
end
|
11
|
-
end
|
12
|
-
end
|
@@ -1,13 +0,0 @@
|
|
1
|
-
Spree::Variant.class_eval do
|
2
|
-
has_and_belongs_to_many :assemblies, :class_name => "Spree::Product",
|
3
|
-
:join_table => "spree_assemblies_parts",
|
4
|
-
:foreign_key => "part_id", :association_foreign_key => "assembly_id"
|
5
|
-
|
6
|
-
def assemblies_for(products)
|
7
|
-
assemblies.where(id: products)
|
8
|
-
end
|
9
|
-
|
10
|
-
def part?
|
11
|
-
assemblies.exists?
|
12
|
-
end
|
13
|
-
end
|