spree_core 4.9.0 → 4.10.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/LICENSE.md +57 -0
- data/app/finders/spree/orders/find_complete.rb +3 -13
- data/app/finders/spree/orders/find_current.rb +3 -1
- data/app/finders/spree/orders/finder_helper.rb +17 -0
- data/app/models/spree/fulfilment_changer.rb +1 -0
- data/app/models/spree/line_item.rb +3 -1
- data/app/models/spree/price.rb +8 -1
- data/app/models/spree/shipment.rb +2 -0
- data/app/models/spree/shipping_method.rb +18 -2
- data/app/models/spree/store.rb +1 -4
- data/app/models/spree/taxon.rb +83 -17
- data/app/models/spree/taxonomy.rb +1 -0
- data/app/models/spree/variant.rb +8 -3
- data/app/services/spree/tracking_numbers/base_service.rb +19 -0
- data/db/migrate/20240822163534_add_pretty_name_to_spree_taxons.rb +9 -0
- data/lib/spree/core/components.rb +6 -0
- data/lib/spree/core/dependencies.rb +3 -0
- data/lib/spree/core/engine.rb +2 -1
- data/lib/spree/core/runtime_configuration.rb +1 -0
- data/lib/spree/core/version.rb +1 -1
- data/lib/spree/permitted_attributes.rb +1 -0
- data/lib/spree/testing_support/capybara_config.rb +8 -4
- data/spree_core.gemspec +4 -3
- metadata +27 -8
- data/LICENSE +0 -26
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 918652467235e29f0c6defaeddbb7530e77c10f67f12abe2355b6e66c1401b86
|
4
|
+
data.tar.gz: 685c2ec7206e68233b5811dc8f5ab3ab47029a3fd07431db724b79da47175fea
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e4ab07e13870ed8a97caeb349f37d439090081ed7d693b76858bea8718f698d2546664315f2525c1134dfa7633c2068dd82d9bebc77a41e59f094deb4d7b54ee
|
7
|
+
data.tar.gz: dacf561acf437770b5ad7291c5785a2eed28d53056a30b3eb6480146d862c6332b9849849344cc91e7c69b63cc77e73aeab373c0601ecc760eb2c46f9ed2322b
|
data/LICENSE.md
ADDED
@@ -0,0 +1,57 @@
|
|
1
|
+
# License
|
2
|
+
|
3
|
+
Copyright © 2024-present, Vendo Connect Inc.
|
4
|
+
|
5
|
+
Copyright © 2015-2024, Spark Solutions Sp. z o.o.
|
6
|
+
|
7
|
+
Copyright © 2007-2015, Spree Commerce Inc.
|
8
|
+
|
9
|
+
Spree Commerce is a free, open-source eCommerce framework giving you full control and customizability.
|
10
|
+
|
11
|
+
For **Spree Commerce versions 4.10** and later in the [spree/spree](https://github.com/spree/spree) repository two licenses apply simultaneously and users are required to comply with the terms of these two licenses at the same time:
|
12
|
+
|
13
|
+
* [AGPL-3.0](https://opensource.org/license/agpl-v3) - for all contributions from version 4.10 onwards
|
14
|
+
|
15
|
+
* [BSD-3-Clause](https://opensource.org/license/bsd-3-clause) - for all other contributions predating version 4.10
|
16
|
+
Effectively, for versions 4.10 and upwards **AGPL-3.0** license applies.
|
17
|
+
|
18
|
+
**Spree Commerce versions 4.9** and earlier in the [spree/spree](https://github.com/spree/spree) repository are available under the **BSD-3-Clause** license and users are required to comply with its terms.
|
19
|
+
|
20
|
+
If you’d like to use Spree Commerce without the AGPL-3.0 restrictions e.g. for a **SaaS** business, please talk to us about obtaining a [Commercial License](#commercial-license).
|
21
|
+
|
22
|
+
All third party components incorporated into this software are licensed under the original license provided by the owner of the applicable component.
|
23
|
+
|
24
|
+
Please refer to our [Licensing FAQ](https://spreecommerce.org/why-spree-is-changing-its-open-source-license-to-agpl-3-0-and-introducing-a-commercial-license/) in case of questions.
|
25
|
+
|
26
|
+
## AGPL-3.0 License - Spree 4.10 upwards
|
27
|
+
|
28
|
+
If you decide to accept the AGPL-3.0 license by using Spree Commerce version 4.10 or later, you must comply with the following terms:
|
29
|
+
|
30
|
+
This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
|
31
|
+
|
32
|
+
This program is distributed in the hope that it will be useful,
|
33
|
+
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
34
|
+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
35
|
+
GNU Affero General Public License for more details.
|
36
|
+
|
37
|
+
You should have received a copy of the GNU Affero General Public License
|
38
|
+
along with this program. If not, see [https://www.gnu.org/licenses/](https://www.gnu.org/licenses/).
|
39
|
+
|
40
|
+
## BSD 3-Clause License
|
41
|
+
|
42
|
+
If you decide to accept the BSD-3-Clause license by using Spree Commerce, you must comply with the following terms:
|
43
|
+
|
44
|
+
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
|
45
|
+
Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
|
46
|
+
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.
|
47
|
+
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.
|
48
|
+
|
49
|
+
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 OR 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.
|
50
|
+
|
51
|
+
## Commercial License
|
52
|
+
|
53
|
+
Should you decide to use Spree Commerce version 4.10 or later for commercial redistribution (eg. SaaS) - also known as Commercial Distribution - you must do so in accordance with the terms and conditions contained in a separate written agreement between you and [Vendo Connect Inc.](https://www.getvendo.com/).
|
54
|
+
|
55
|
+
For more information about the Commercial License (CL) please contact [sales@getvendo.com](mailto:sales@getvendo.com).
|
56
|
+
|
57
|
+
Please refer to our [Licensing FAQ](https://spreecommerce.org/why-spree-is-changing-its-open-source-license-to-agpl-3-0-and-introducing-a-commercial-license/) in case of questions.
|
@@ -1,6 +1,8 @@
|
|
1
1
|
module Spree
|
2
2
|
module Orders
|
3
3
|
class FindComplete
|
4
|
+
include Spree::Orders::FinderHelper
|
5
|
+
|
4
6
|
attr_reader :user, :number, :token, :store
|
5
7
|
|
6
8
|
def initialize(user: nil, number: nil, token: nil, store: nil)
|
@@ -22,7 +24,7 @@ module Spree
|
|
22
24
|
private
|
23
25
|
|
24
26
|
def scope
|
25
|
-
user? ? user.orders.complete.includes(
|
27
|
+
user? ? user.orders.complete.includes(order_includes) : Spree::Order.complete.includes(order_includes)
|
26
28
|
end
|
27
29
|
|
28
30
|
def user?
|
@@ -64,18 +66,6 @@ module Spree
|
|
64
66
|
|
65
67
|
orders.where(store: store)
|
66
68
|
end
|
67
|
-
|
68
|
-
def scope_includes
|
69
|
-
{
|
70
|
-
line_items: [
|
71
|
-
variant: [
|
72
|
-
:images,
|
73
|
-
option_values: :option_type,
|
74
|
-
product: :product_properties,
|
75
|
-
]
|
76
|
-
]
|
77
|
-
}
|
78
|
-
end
|
79
69
|
end
|
80
70
|
end
|
81
71
|
end
|
@@ -1,6 +1,8 @@
|
|
1
1
|
module Spree
|
2
2
|
module Orders
|
3
3
|
class FindCurrent
|
4
|
+
include Spree::Orders::FinderHelper
|
5
|
+
|
4
6
|
def execute(user:, store:, **params)
|
5
7
|
params = params.merge(store_id: store.id)
|
6
8
|
|
@@ -15,7 +17,7 @@ module Spree
|
|
15
17
|
private
|
16
18
|
|
17
19
|
def incomplete_orders
|
18
|
-
Spree::Order.incomplete.not_canceled
|
20
|
+
Spree::Order.incomplete.not_canceled.includes(order_includes)
|
19
21
|
end
|
20
22
|
end
|
21
23
|
end
|
@@ -5,6 +5,8 @@ module Spree
|
|
5
5
|
include Spree::Webhooks::HasWebhooks
|
6
6
|
end
|
7
7
|
|
8
|
+
attribute :quantity, :integer, default: 1
|
9
|
+
|
8
10
|
before_validation :ensure_valid_quantity
|
9
11
|
|
10
12
|
with_options inverse_of: :line_items do
|
@@ -27,7 +29,7 @@ module Spree
|
|
27
29
|
# numericality: :less_than_or_equal_to validation is due to the restriction at the database level
|
28
30
|
# https://github.com/spree/spree/issues/2695#issuecomment-143314161
|
29
31
|
validates :quantity, numericality: {
|
30
|
-
|
32
|
+
in: 0..DatabaseTypeUtilities.maximum_value_for(:integer),
|
31
33
|
only_integer: true, message: Spree.t('validation.must_be_int')
|
32
34
|
}
|
33
35
|
|
data/app/models/spree/price.rb
CHANGED
@@ -14,10 +14,17 @@ module Spree
|
|
14
14
|
before_validation :ensure_currency
|
15
15
|
before_save :remove_compare_at_amount_if_equals_amount
|
16
16
|
|
17
|
+
# legacy behavior
|
17
18
|
validates :amount, allow_nil: true, numericality: {
|
18
19
|
greater_than_or_equal_to: 0,
|
19
20
|
less_than_or_equal_to: MAXIMUM_AMOUNT
|
20
|
-
}
|
21
|
+
}, if: -> { Spree::RuntimeConfig.allow_empty_price_amount }
|
22
|
+
|
23
|
+
# new behavior
|
24
|
+
validates :amount, allow_nil: false, numericality: {
|
25
|
+
greater_than_or_equal_to: 0,
|
26
|
+
less_than_or_equal_to: MAXIMUM_AMOUNT
|
27
|
+
}, unless: -> { Spree::RuntimeConfig.allow_empty_price_amount }
|
21
28
|
|
22
29
|
validates :compare_at_amount, allow_nil: true, numericality: {
|
23
30
|
greater_than_or_equal_to: 0,
|
@@ -109,6 +109,8 @@ module Spree
|
|
109
109
|
money_methods :cost, :discounted_cost, :final_price, :item_cost, :additional_tax_total, :included_tax_total, :tax_total
|
110
110
|
alias display_amount display_cost
|
111
111
|
|
112
|
+
auto_strip_attributes :tracking
|
113
|
+
|
112
114
|
# Returns the shipment number and shipping method name
|
113
115
|
#
|
114
116
|
# @return [String]
|
@@ -48,9 +48,25 @@ module Spree
|
|
48
48
|
end
|
49
49
|
|
50
50
|
def build_tracking_url(tracking)
|
51
|
-
return if tracking.blank?
|
51
|
+
return if tracking.blank?
|
52
|
+
|
53
|
+
tracking = tracking.upcase
|
54
|
+
|
55
|
+
# build tracking url automatically
|
56
|
+
if tracking_url.blank?
|
57
|
+
# use tracking number gem to build tracking url
|
58
|
+
# we need to upcase the tracking number
|
59
|
+
# https://github.com/jkeen/tracking_number/pull/85
|
60
|
+
tracking_number_service(tracking).tracking_url if tracking_number_service(tracking).valid?
|
61
|
+
else
|
62
|
+
# build tracking url manually
|
63
|
+
tracking_url.gsub(/:tracking/, ERB::Util.url_encode(tracking)) # :url_encode exists in 1.8.7 through 2.1.0
|
64
|
+
end
|
65
|
+
end
|
52
66
|
|
53
|
-
|
67
|
+
# your shipping method subclasses can override this method to provide a custom tracking number service
|
68
|
+
def tracking_number_service(tracking)
|
69
|
+
@tracking_number_service ||= Spree::Dependencies.tracking_number_service.constantize.new(tracking)
|
54
70
|
end
|
55
71
|
|
56
72
|
def self.calculators
|
data/app/models/spree/store.rb
CHANGED
@@ -127,9 +127,7 @@ module Spree
|
|
127
127
|
end
|
128
128
|
|
129
129
|
def self.available_locales
|
130
|
-
|
131
|
-
Spree::Store.all.map(&:supported_locales_list).flatten.uniq
|
132
|
-
end
|
130
|
+
Spree::Store.all.map(&:supported_locales_list).flatten.uniq
|
133
131
|
end
|
134
132
|
|
135
133
|
def default_menu(location)
|
@@ -245,7 +243,6 @@ module Spree
|
|
245
243
|
|
246
244
|
def clear_cache
|
247
245
|
Rails.cache.delete('default_store')
|
248
|
-
Rails.cache.delete('stores_available_locales')
|
249
246
|
end
|
250
247
|
|
251
248
|
def ensure_default_country
|
data/app/models/spree/taxon.rb
CHANGED
@@ -13,7 +13,6 @@ module Spree
|
|
13
13
|
extend FriendlyId
|
14
14
|
friendly_id :permalink, slug_column: :permalink, use: :history
|
15
15
|
before_validation :set_permalink, on: :create, if: :name
|
16
|
-
alias_attribute :slug, :permalink
|
17
16
|
|
18
17
|
acts_as_nested_set dependent: :destroy
|
19
18
|
|
@@ -21,6 +20,8 @@ module Spree
|
|
21
20
|
has_many :classifications, -> { order(:position) }, dependent: :delete_all, inverse_of: :taxon
|
22
21
|
has_many :products, through: :classifications
|
23
22
|
|
23
|
+
delegate :store, to: :taxonomy
|
24
|
+
|
24
25
|
has_many :menu_items, as: :linked_resource
|
25
26
|
has_many :cms_sections, as: :linked_resource
|
26
27
|
|
@@ -44,9 +45,13 @@ module Spree
|
|
44
45
|
end
|
45
46
|
|
46
47
|
before_validation :copy_taxonomy_from_parent
|
48
|
+
before_save :set_pretty_name
|
49
|
+
before_save :set_permalink
|
47
50
|
after_save :touch_ancestors_and_taxonomy
|
48
51
|
after_update :sync_taxonomy_name
|
49
52
|
after_touch :touch_ancestors_and_taxonomy
|
53
|
+
after_commit :regenerate_pretty_name_and_permalink, on: :update, if: :should_regenerate_pretty_name_and_permalink?
|
54
|
+
after_move :regenerate_pretty_name_and_permalink
|
50
55
|
|
51
56
|
has_one :store, through: :taxonomy
|
52
57
|
|
@@ -59,17 +64,45 @@ module Spree
|
|
59
64
|
|
60
65
|
scope :for_stores, ->(stores) { joins(:taxonomy).where(spree_taxonomies: { store_id: stores.ids }) }
|
61
66
|
|
62
|
-
TRANSLATABLE_FIELDS = %i[name description permalink].freeze
|
67
|
+
TRANSLATABLE_FIELDS = %i[name pretty_name description permalink].freeze
|
63
68
|
translates(*TRANSLATABLE_FIELDS, column_fallback: !Spree.always_use_translations?)
|
64
69
|
|
70
|
+
def slug
|
71
|
+
permalink
|
72
|
+
end
|
73
|
+
|
74
|
+
def slug=(value)
|
75
|
+
self.permalink = value
|
76
|
+
end
|
77
|
+
|
65
78
|
self::Translation.class_eval do
|
66
|
-
alias_attribute :slug, :permalink
|
67
79
|
before_save :set_permalink
|
80
|
+
before_save :set_pretty_name
|
81
|
+
|
82
|
+
def slug
|
83
|
+
permalink
|
84
|
+
end
|
85
|
+
|
86
|
+
def slug=(value)
|
87
|
+
self.permalink = value
|
88
|
+
end
|
68
89
|
|
69
90
|
def set_permalink
|
70
91
|
self.permalink = generate_slug
|
71
92
|
end
|
72
93
|
|
94
|
+
def set_pretty_name
|
95
|
+
self[:pretty_name] = generate_pretty_name
|
96
|
+
end
|
97
|
+
|
98
|
+
def name_with_fallback
|
99
|
+
name.blank? ? translated_model.name : name
|
100
|
+
end
|
101
|
+
|
102
|
+
def pretty_name_with_fallback
|
103
|
+
pretty_name.blank? ? translated_model.pretty_name : pretty_name
|
104
|
+
end
|
105
|
+
|
73
106
|
private
|
74
107
|
|
75
108
|
def generate_slug
|
@@ -82,12 +115,22 @@ module Spree
|
|
82
115
|
end
|
83
116
|
end
|
84
117
|
|
118
|
+
def generate_pretty_name
|
119
|
+
if parent.present?
|
120
|
+
generate_pretty_name_including_parent
|
121
|
+
elsif pretty_name.blank?
|
122
|
+
pretty_name_with_fallback
|
123
|
+
else
|
124
|
+
pretty_name
|
125
|
+
end
|
126
|
+
end
|
127
|
+
|
85
128
|
def generate_permalink_including_parent
|
86
129
|
[parent_permalink_with_fallback, (permalink.blank? ? name_with_fallback.to_url : permalink.split('/').last.to_url)].join('/')
|
87
130
|
end
|
88
131
|
|
89
|
-
def
|
90
|
-
|
132
|
+
def generate_pretty_name_including_parent
|
133
|
+
[parent_pretty_name_with_fallback, (pretty_name.blank? ? name_with_fallback : pretty_name)].compact.join(' -> ')
|
91
134
|
end
|
92
135
|
|
93
136
|
def parent
|
@@ -98,6 +141,11 @@ module Spree
|
|
98
141
|
localized_parent = parent.translations.find_by(locale: locale)
|
99
142
|
localized_parent.present? ? localized_parent.permalink : parent.permalink
|
100
143
|
end
|
144
|
+
|
145
|
+
def parent_pretty_name_with_fallback
|
146
|
+
localized_parent = parent.translations.find_by(locale: locale)
|
147
|
+
localized_parent.present? ? localized_parent.pretty_name : parent.pretty_name
|
148
|
+
end
|
101
149
|
end
|
102
150
|
|
103
151
|
# indicate which filters should be used for a taxon
|
@@ -117,13 +165,12 @@ module Spree
|
|
117
165
|
meta_title.blank? ? name : meta_title
|
118
166
|
end
|
119
167
|
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
end
|
168
|
+
def set_pretty_name
|
169
|
+
self[:pretty_name] = generate_pretty_name
|
170
|
+
end
|
171
|
+
|
172
|
+
def generate_pretty_name
|
173
|
+
[parent&.pretty_name, name].compact.join(' -> ')
|
127
174
|
end
|
128
175
|
|
129
176
|
def generate_slug
|
@@ -136,15 +183,30 @@ module Spree
|
|
136
183
|
end
|
137
184
|
end
|
138
185
|
|
186
|
+
def set_permalink
|
187
|
+
if Spree.use_translations?
|
188
|
+
translations.each(&:set_permalink)
|
189
|
+
else
|
190
|
+
self.permalink = generate_slug
|
191
|
+
end
|
192
|
+
end
|
193
|
+
|
139
194
|
def active_products
|
140
195
|
products.active
|
141
196
|
end
|
142
197
|
|
143
|
-
def
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
198
|
+
def regenerate_pretty_name_and_permalink
|
199
|
+
set_permalink
|
200
|
+
update_columns(pretty_name: generate_pretty_name, updated_at: Time.current)
|
201
|
+
|
202
|
+
children.reload.each(&:regenerate_pretty_name_and_permalink_as_child)
|
203
|
+
end
|
204
|
+
|
205
|
+
def regenerate_pretty_name_and_permalink_as_child
|
206
|
+
set_permalink
|
207
|
+
update_columns(pretty_name: generate_pretty_name, updated_at: Time.current)
|
208
|
+
|
209
|
+
children.reload.each(&:regenerate_pretty_name_and_permalink_as_child)
|
148
210
|
end
|
149
211
|
|
150
212
|
def cached_self_and_descendants_ids
|
@@ -165,6 +227,10 @@ module Spree
|
|
165
227
|
|
166
228
|
private
|
167
229
|
|
230
|
+
def should_regenerate_pretty_name_and_permalink?
|
231
|
+
saved_changes.key?(:name) || saved_changes.key?(:permalink)
|
232
|
+
end
|
233
|
+
|
168
234
|
def sync_taxonomy_name
|
169
235
|
if saved_changes.key?(:name) && root?
|
170
236
|
return if taxonomy.name.to_s == name.to_s
|
data/app/models/spree/variant.rb
CHANGED
@@ -128,13 +128,18 @@ module Spree
|
|
128
128
|
self.whitelisted_ransackable_scopes = %i(product_name_or_sku_cont search_by_product_name_or_sku)
|
129
129
|
|
130
130
|
def self.product_name_or_sku_cont(query)
|
131
|
+
sanitized_query = ActiveRecord::Base.sanitize_sql_like(query.to_s.downcase.strip)
|
132
|
+
query_pattern = "%#{sanitized_query}%"
|
133
|
+
sku_condition = arel_table[:sku].lower.matches(query_pattern)
|
134
|
+
|
131
135
|
if Spree.use_translations?
|
136
|
+
product_name_condition = Product.translation_table[:name].lower.matches(query_pattern)
|
132
137
|
joins(:product).
|
133
138
|
join_translation_table(Product).
|
134
|
-
where(
|
135
|
-
OR LOWER(sku) LIKE LOWER(:query)", query: "%#{query}%")
|
139
|
+
where(product_name_condition.or(sku_condition))
|
136
140
|
else
|
137
|
-
|
141
|
+
product_name_condition = Product.arel_table[:name].lower.matches(query_pattern)
|
142
|
+
joins(:product).where(product_name_condition.or(sku_condition))
|
138
143
|
end
|
139
144
|
end
|
140
145
|
|
@@ -0,0 +1,19 @@
|
|
1
|
+
require 'tracking_number'
|
2
|
+
|
3
|
+
# This is a very basic service that can be used to track packages.
|
4
|
+
# It uses the tracking_number gem to validate and build tracking urls.
|
5
|
+
# https://github.com/jkeen/tracking_number
|
6
|
+
# You can create your own service by subclassing this one and using 3rd party services, eg. AfterShip or Shippo
|
7
|
+
module Spree
|
8
|
+
module TrackingNumbers
|
9
|
+
class BaseService
|
10
|
+
def initialize(tracking_number)
|
11
|
+
@tracking = TrackingNumber.new(tracking_number)
|
12
|
+
end
|
13
|
+
|
14
|
+
attr_reader :tracking
|
15
|
+
|
16
|
+
delegate :valid?, :tracking_url, to: :tracking
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
@@ -0,0 +1,9 @@
|
|
1
|
+
class AddPrettyNameToSpreeTaxons < ActiveRecord::Migration[6.1]
|
2
|
+
def change
|
3
|
+
add_column :spree_taxons, :pretty_name, :string, null: true, if_not_exists: true
|
4
|
+
add_index :spree_taxons, :pretty_name, if_not_exists: true
|
5
|
+
|
6
|
+
add_column :spree_taxon_translations, :pretty_name, :string, null: true, if_not_exists: true
|
7
|
+
add_index :spree_taxon_translations, :pretty_name, if_not_exists: true
|
8
|
+
end
|
9
|
+
end
|
@@ -5,10 +5,16 @@ module Spree
|
|
5
5
|
@@api_available ||= ::Rails::Engine.subclasses.map(&:instance).map { |e| e.class.to_s }.include?('Spree::Api::Engine')
|
6
6
|
end
|
7
7
|
|
8
|
+
# old, legacy admin
|
8
9
|
def self.backend_available?
|
9
10
|
@@backend_available ||= ::Rails::Engine.subclasses.map(&:instance).map { |e| e.class.to_s }.include?('Spree::Backend::Engine')
|
10
11
|
end
|
11
12
|
|
13
|
+
# new shiny admin
|
14
|
+
def self.admin_available?
|
15
|
+
@@admin_available ||= ::Rails::Engine.subclasses.map(&:instance).map { |e| e.class.to_s }.include?('Spree::Admin::Engine')
|
16
|
+
end
|
17
|
+
|
12
18
|
def self.frontend_available?
|
13
19
|
@@frontend_available ||= ::Rails::Engine.subclasses.map(&:instance).map { |e| e.class.to_s }.include?('Spree::Frontend::Engine')
|
14
20
|
end
|
@@ -43,6 +43,9 @@ module Spree
|
|
43
43
|
shipment_add_item_service: 'Spree::Shipments::AddItem',
|
44
44
|
shipment_remove_item_service: 'Spree::Shipments::RemoveItem',
|
45
45
|
|
46
|
+
# tracking numbers
|
47
|
+
tracking_number_service: 'Spree::TrackingNumbers::BaseService',
|
48
|
+
|
46
49
|
# sorter
|
47
50
|
collection_sorter: 'Spree::BaseSorter',
|
48
51
|
order_sorter: 'Spree::BaseSorter',
|
data/lib/spree/core/engine.rb
CHANGED
@@ -26,7 +26,8 @@ module Spree
|
|
26
26
|
|
27
27
|
initializer 'spree.environment', before: :load_config_initializers do |app|
|
28
28
|
app.config.spree = Environment.new(SpreeCalculators.new, Spree::Core::Configuration.new, Spree::Core::RuntimeConfiguration.new, Spree::Core::Dependencies.new)
|
29
|
-
app.config.active_record.yaml_column_permitted_classes
|
29
|
+
app.config.active_record.yaml_column_permitted_classes ||= []
|
30
|
+
app.config.active_record.yaml_column_permitted_classes << [Symbol, BigDecimal, ActiveSupport::HashWithIndifferentAccess]
|
30
31
|
Spree::Config = app.config.spree.preferences
|
31
32
|
Spree::RuntimeConfig = app.config.spree.runtime_preferences
|
32
33
|
Spree::Dependencies = app.config.spree.dependencies
|
data/lib/spree/core/version.rb
CHANGED
@@ -154,6 +154,7 @@ module Spree
|
|
154
154
|
:position, :track_inventory,
|
155
155
|
:product_id, :product, :option_values_attributes, :price, :compare_at_price,
|
156
156
|
:weight, :height, :width, :depth, :sku, :barcode, :cost_currency,
|
157
|
+
:weight_unit, :dimensions_unit,
|
157
158
|
{ options: [:name, :value], option_value_ids: [] }
|
158
159
|
]
|
159
160
|
|
@@ -16,8 +16,12 @@ if ENV['WEBDRIVER'] == 'accessible'
|
|
16
16
|
Capybara.javascript_driver = :accessible
|
17
17
|
end
|
18
18
|
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
19
|
+
Capybara.register_driver :selenium_chrome_headless do |app|
|
20
|
+
options = ::Selenium::WebDriver::Chrome::Options.new
|
21
|
+
options.add_argument '--headless'
|
22
|
+
options.add_argument '--disable-gpu'
|
23
|
+
options.add_argument '--window-size=1400,900'
|
24
|
+
options.add_argument '--disable-search-engine-choice-screen'
|
25
|
+
|
26
|
+
Capybara::Selenium::Driver.new(app, browser: :chrome, options: options)
|
23
27
|
end
|
data/spree_core.gemspec
CHANGED
@@ -6,12 +6,12 @@ Gem::Specification.new do |s|
|
|
6
6
|
s.platform = Gem::Platform::RUBY
|
7
7
|
s.name = 'spree_core'
|
8
8
|
s.version = Spree.version
|
9
|
-
s.authors = ['Sean Schofield', 'Spark Solutions']
|
9
|
+
s.authors = ['Sean Schofield', 'Spark Solutions Sp. z o.o.', 'Vendo Connect Inc.']
|
10
10
|
s.email = 'hello@spreecommerce.org'
|
11
11
|
s.summary = 'The bare bones necessary for Spree'
|
12
12
|
s.description = 'Spree Models, Helpers, Services and core libraries'
|
13
13
|
s.homepage = 'https://spreecommerce.org'
|
14
|
-
s.
|
14
|
+
s.licenses = ['AGPL-3.0-or-later', 'BSD-3-Clause']
|
15
15
|
|
16
16
|
s.metadata = {
|
17
17
|
"bug_tracker_uri" => "https://github.com/spree/spree/issues",
|
@@ -44,12 +44,13 @@ Gem::Specification.new do |s|
|
|
44
44
|
s.add_dependency 'kaminari', '~> 1.2'
|
45
45
|
s.add_dependency 'money', '~> 6.13'
|
46
46
|
s.add_dependency 'monetize', '~> 1.9'
|
47
|
-
s.add_dependency 'paranoia', '
|
47
|
+
s.add_dependency 'paranoia', '>= 2.4'
|
48
48
|
s.add_dependency 'ransack', '>= 4.1'
|
49
49
|
s.add_dependency 'rexml'
|
50
50
|
s.add_dependency 'state_machines-activerecord', '~> 0.6'
|
51
51
|
s.add_dependency 'state_machines-activemodel', '~> 0.7'
|
52
52
|
s.add_dependency 'stringex'
|
53
|
+
s.add_dependency 'tracking_number'
|
53
54
|
s.add_dependency 'validates_zipcode'
|
54
55
|
s.add_dependency 'image_processing', '~> 1.2'
|
55
56
|
s.add_dependency 'active_storage_validations', '~> 1.1'
|
metadata
CHANGED
@@ -1,15 +1,16 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: spree_core
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 4.
|
4
|
+
version: 4.10.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sean Schofield
|
8
|
-
- Spark Solutions
|
8
|
+
- Spark Solutions Sp. z o.o.
|
9
|
+
- Vendo Connect Inc.
|
9
10
|
autorequire:
|
10
11
|
bindir: bin
|
11
12
|
cert_chain: []
|
12
|
-
date: 2024-
|
13
|
+
date: 2024-09-06 00:00:00.000000000 Z
|
13
14
|
dependencies:
|
14
15
|
- !ruby/object:Gem::Dependency
|
15
16
|
name: actionpack
|
@@ -347,14 +348,14 @@ dependencies:
|
|
347
348
|
name: paranoia
|
348
349
|
requirement: !ruby/object:Gem::Requirement
|
349
350
|
requirements:
|
350
|
-
- - "
|
351
|
+
- - ">="
|
351
352
|
- !ruby/object:Gem::Version
|
352
353
|
version: '2.4'
|
353
354
|
type: :runtime
|
354
355
|
prerelease: false
|
355
356
|
version_requirements: !ruby/object:Gem::Requirement
|
356
357
|
requirements:
|
357
|
-
- - "
|
358
|
+
- - ">="
|
358
359
|
- !ruby/object:Gem::Version
|
359
360
|
version: '2.4'
|
360
361
|
- !ruby/object:Gem::Dependency
|
@@ -427,6 +428,20 @@ dependencies:
|
|
427
428
|
- - ">="
|
428
429
|
- !ruby/object:Gem::Version
|
429
430
|
version: '0'
|
431
|
+
- !ruby/object:Gem::Dependency
|
432
|
+
name: tracking_number
|
433
|
+
requirement: !ruby/object:Gem::Requirement
|
434
|
+
requirements:
|
435
|
+
- - ">="
|
436
|
+
- !ruby/object:Gem::Version
|
437
|
+
version: '0'
|
438
|
+
type: :runtime
|
439
|
+
prerelease: false
|
440
|
+
version_requirements: !ruby/object:Gem::Requirement
|
441
|
+
requirements:
|
442
|
+
- - ">="
|
443
|
+
- !ruby/object:Gem::Version
|
444
|
+
version: '0'
|
430
445
|
- !ruby/object:Gem::Dependency
|
431
446
|
name: validates_zipcode
|
432
447
|
requirement: !ruby/object:Gem::Requirement
|
@@ -546,7 +561,7 @@ extensions: []
|
|
546
561
|
extra_rdoc_files: []
|
547
562
|
files:
|
548
563
|
- Gemfile
|
549
|
-
- LICENSE
|
564
|
+
- LICENSE.md
|
550
565
|
- Rakefile
|
551
566
|
- app/controllers/spree/base_controller.rb
|
552
567
|
- app/finders/concerns/spree/product_filterable.rb
|
@@ -560,6 +575,7 @@ files:
|
|
560
575
|
- app/finders/spree/option_values/find_available.rb
|
561
576
|
- app/finders/spree/orders/find_complete.rb
|
562
577
|
- app/finders/spree/orders/find_current.rb
|
578
|
+
- app/finders/spree/orders/finder_helper.rb
|
563
579
|
- app/finders/spree/product_properties/find_available.rb
|
564
580
|
- app/finders/spree/products/find.rb
|
565
581
|
- app/finders/spree/stores/find_current.rb
|
@@ -890,6 +906,7 @@ files:
|
|
890
906
|
- app/services/spree/shipments/remove_item.rb
|
891
907
|
- app/services/spree/shipments/update.rb
|
892
908
|
- app/services/spree/stock_locations/stock_items/create.rb
|
909
|
+
- app/services/spree/tracking_numbers/base_service.rb
|
893
910
|
- app/services/spree/variants/remove_line_items.rb
|
894
911
|
- app/services/spree/wallet/create_payment_source.rb
|
895
912
|
- app/sorters/spree/base_sorter.rb
|
@@ -966,6 +983,7 @@ files:
|
|
966
983
|
- db/migrate/20240514105216_add_weight_and_dimension_units_to_spree_variants.rb
|
967
984
|
- db/migrate/20240623172111_add_deleted_at_to_spree_stock_locations.rb
|
968
985
|
- db/migrate/20240725124530_add_refunder_to_spree_refunds.rb
|
986
|
+
- db/migrate/20240822163534_add_pretty_name_to_spree_taxons.rb
|
969
987
|
- db/seeds.rb
|
970
988
|
- lib/friendly_id/paranoia.rb
|
971
989
|
- lib/generators/spree/custom_authentication/custom_authentication_generator.rb
|
@@ -1143,12 +1161,13 @@ files:
|
|
1143
1161
|
- spree_core.gemspec
|
1144
1162
|
homepage: https://spreecommerce.org
|
1145
1163
|
licenses:
|
1164
|
+
- AGPL-3.0-or-later
|
1146
1165
|
- BSD-3-Clause
|
1147
1166
|
metadata:
|
1148
1167
|
bug_tracker_uri: https://github.com/spree/spree/issues
|
1149
|
-
changelog_uri: https://github.com/spree/spree/releases/tag/v4.
|
1168
|
+
changelog_uri: https://github.com/spree/spree/releases/tag/v4.10.1
|
1150
1169
|
documentation_uri: https://docs.spreecommerce.org/
|
1151
|
-
source_code_uri: https://github.com/spree/spree/tree/v4.
|
1170
|
+
source_code_uri: https://github.com/spree/spree/tree/v4.10.1
|
1152
1171
|
post_install_message:
|
1153
1172
|
rdoc_options: []
|
1154
1173
|
require_paths:
|
data/LICENSE
DELETED
@@ -1,26 +0,0 @@
|
|
1
|
-
Copyright (c) 2007-2024, Spree Commerce, Inc., Spark Solutuons Sp. z o.o. and other contributors
|
2
|
-
All rights reserved.
|
3
|
-
|
4
|
-
Redistribution and use in source and binary forms, with or without modification,
|
5
|
-
are permitted provided that the following conditions are met:
|
6
|
-
|
7
|
-
* Redistributions of source code must retain the above copyright notice,
|
8
|
-
this list of conditions and the following disclaimer.
|
9
|
-
* Redistributions in binary form must reproduce the above copyright notice,
|
10
|
-
this list of conditions and the following disclaimer in the documentation
|
11
|
-
and/or other materials provided with the distribution.
|
12
|
-
* Neither the name Spree nor the names of its contributors may be used to
|
13
|
-
endorse or promote products derived from this software without specific
|
14
|
-
prior written permission.
|
15
|
-
|
16
|
-
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
17
|
-
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
18
|
-
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
19
|
-
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
|
20
|
-
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
21
|
-
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
22
|
-
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
23
|
-
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
24
|
-
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
25
|
-
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
26
|
-
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|