David Rodríguez
4c6d894bc0
Bump RuboCop to 1.86.6
...
There were a few changes needed:
* Plugins are now specified through `plugin:` config keyword.
* All plugin gems need to be specified explicitly in Gemfile since they
are no longer dependencies of plugins already specified explicitly.
* All plugin gems need to be updated in other to use the new APIs.
* One cop was renamed.
* New offenses safe to correct were corrected directly with `bundle exec
rubocop -a`.
* New offenses unsafe to correct were added to the TODO configuration
with `bundle exec rubocop --auto-gen-config --auto-gen-only-exclude
--exclude-limit 1400 --no-auto-gen-timestamp`.
2025-10-27 11:30:33 +01:00
Maikel Linke
54f83b45c8
Replace has_spree_role? with simpler admin?
...
We have only one role, so let's get rid of the unneeded method.
Now we are in a better place to get rid of Spree::Role and replace it
with a simple boolean.
2024-12-19 09:19:01 +11:00
Joseph Johansen
b73e529bfc
Scope injected enterprise properties to specific enterprises
2024-08-22 17:41:00 +02:00
cyrillefr
404fcf1f72
Fix FixRailsWhereEquals
...
- fixes offenses caused by RuboCop::Cop::Rails::WhereEquals cop
2024-04-09 10:44:02 +02:00
Neal Chambers
85fef7ac4b
Safely autocorrect Style/RedundantRegexpArgument
...
Inspecting 1513 files
...........................................................................................................................................................................................................................................................................................................................................................C....................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................C........................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................
Offenses:
app/models/spree/shipping_method.rb:69:25: C: [Corrected] Style/RedundantRegexpArgument: Use string ":tracking" as argument instead of regexp /:tracking/.
tracking_url.gsub(/:tracking/, tracking) unless tracking.blank? || tracking_url.blank?
^^^^^^^^^^^
lib/spree/i18n.rb:36:17: C: [Corrected] Style/RedundantRegexpArgument: Use string "spree" as argument instead of regexp /spree/.
path.gsub(/spree/, '')
^^^^^^^
1513 files inspected, 2 offenses detected, 2 offenses corrected
2023-11-17 08:59:27 +09:00
Neal Chambers
fec59e5ae2
Apply Changes Suggested by Code Review
2023-10-06 10:58:49 +09:00
Neal Chambers
cf07a055d0
Fix Rails/HasManyOrHasOneDependent with nil
2023-10-06 10:58:49 +09:00
Neal Chambers
b76fb10d46
Fix Rails/HasManyOrHasOneDependent with Destroy
2023-10-06 10:58:49 +09:00
Maikel Linke
4a13576f78
Remove now superfluous belongs_to default declaration
2023-08-11 10:14:47 +10:00
Maikel Linke
d88781a083
Start to adopt new default to require belongs_to
...
Newer version of Rails have this option as default. We can slowly
transition to opt in gradually, model by model. Once all models are
covered, we can change the default and remove the setting from the
models again.
The style violation was added to the todo file because it's temporary.
We have 60 models using `belongs_to`. And changing them all at once
breaks some specs. So let's do it gradually.
2023-06-14 15:06:59 +10:00
Neal Chambers
4e32bfd70b
Rename Inversable Method Names
2023-04-18 22:58:06 +09:00
Jean-Baptiste Bellet
719025f98e
Only set calculator if it's a new record (having an id)
...
Unless we have a ActiveRecord::NotNullViolation
```
ActiveRecord::NotNullViolation:
PG::NotNullViolation: ERROR: null value in column "calculable_id" of relation "spree_calculators" violates not-null constraint
DETAIL: Failing row contains (9370, Calculator::None, null, Spree::ShippingMethod, 2023-01-12 15:09:44.381142, 2023-01-12 15:09:44.381142).
# ------------------
# --- Caused by: ---
# PG::NotNullViolation:
# ERROR: null value in column "calculable_id" of relation "spree_calculators" violates not-null constraint
# DETAIL: Failing row contains (9370, Calculator::None, null, Spree::ShippingMethod, 2023-01-12 15:09:44.381142, 2023-01-12 15:09:44.381142).
```
2023-01-16 09:31:15 +01:00
Jean-Baptiste Bellet
a9097df112
Already defined via CalculatedAdjustments
2023-01-16 09:31:15 +01:00
Jean-Baptiste Bellet
7015cb30c3
Calculator 'None' is the default one for both shipping and payment method
...
+ update specs as well
Update shipping_method.rb
2023-01-16 09:31:15 +01:00
Cillian O'Ruanaidh
87431c188e
Use ShippingMethod :frontend method and drop :backend to avoid ClassLength Rubocop error
2022-09-30 13:13:39 +01:00
Cillian O'Ruanaidh
0673f9a5ae
Use a more simple layout on the order cycle checkout options form
...
Before there was a row for each distributor and a 'shared' row for shipping methods which were shared among more than one distributor. This layout displays a single list of shipping methods with the distributor or distributors it belongs to beside it as suggested by @lin-d-hop
2022-09-30 13:13:39 +01:00
Cillian O'Ruanaidh
80b7a5d39a
Remove OrderCycleShippingMethod model and use a :has_and_belongs_to_many association instead
...
Before the OrderCycleShippingMethod had a validation which checked the shipping method belonged to the order cycle distributor. Instead of this validation this just ignores shipping methods which don't belong to one of the order cycle's distributors when they are being attached in the OrderCycleForm service. This pattern is already being used in the OrderCycleForm service for ignoring Schedules that the person doesn't own.
Co-authored-by: Maikel <maikel@email.org.au >
2022-09-30 13:13:39 +01:00
Cillian O'Ruanaidh
541a340dcf
If an OrderCycle or Spree::ShippingMethod is destroyed then remove it's associated OrderCycleShippingMethod records too
2022-09-30 13:13:39 +01:00
Cillian O'Ruanaidh
593da4996f
A shop won't be shown as open if it doesn't have useable shipping method so these shipping method validations are really necessary
2022-09-30 13:13:39 +01:00
Cillian O'Ruanaidh
9296686384
Make backend, frontend scopes on Spree::ShippingMethod neater
...
Co-authored-by: Co-authored-by: Maikel <maikel@email.org.au >
2022-09-30 13:13:39 +01:00
Cillian O'Ruanaidh
fc4f951a1a
Only require OrderCycleShippingMethod records if people want to override the default shipping methods
...
It makes things much simpler if we return all shipping methods by default without needing OrderCycleShippingMethod records to be added to the database.
Co-authored-by: Maikel <maikel@email.org.au >
2022-09-30 13:13:39 +01:00
Cillian O'Ruanaidh
1e817af5aa
Validate deleting a shipping method or switching it to backoffice only doesn't invalidate any order cycles
2022-09-30 13:13:39 +01:00
Cillian O'Ruanaidh
94d71b8dce
Remove extra unnecessary :display_on_checkout scope and reuse :frontend scope instead
2022-09-30 13:13:39 +01:00
Cillian O'Ruanaidh
a5daee39e3
Extract out a DISPLAY_ON_OPTIONS constant in Spree::ShippingMethod instead of magic strings
2022-09-30 13:13:39 +01:00
Matt-Yorkley
2d69810c5d
Convert CalculatedAdjustments into a proper Concern and remove class_eval
2021-07-24 21:28:13 +01:00
Andy Brett
e24d2e5077
address deprecation warning
2021-06-29 09:17:31 -07:00
Luis Ramos
23627c5453
Run rubocop -a (safe corrections) removing all exceptions so all possible fixes are applied
...
9290 issues fixed
2021-06-17 22:19:26 +01:00
Maikel Linke
1364b878fe
Add ApplicationRecord for customisations
...
Rails 5 introduced this new class to confine application-specific monkey
patches to our models only, and not leak into other libraries using
ActiveRecord::Base.
https://bigbinary.com/blog/application-record-in-rails-5
2021-04-15 15:59:03 +10:00
Matt-Yorkley
8fccdbf92f
Introduce TaxCategories to ShippingMethods
2021-04-04 19:19:06 +01:00
Matt-Yorkley
d5443cf489
Update has_many_through on ShippingMethod
...
Fixes:
259) Spree::ShippingMethod#shipments can gather all the related shipments
Failure/Error: expect(shipping_method.shipments).to include(shipment)
ActiveRecord::HasManyThroughOrderError:
Cannot have a has_many :through association 'Spree::ShippingMethod#shipments' which goes through 'Spree::ShippingMethod#shipping_rates' before the through association is defined.
# ./spec/models/spree/shipping_method_spec.rb:190:in `block (3 levels) in <module:Spree>'
2021-03-18 21:56:37 +00:00
Matt-Yorkley
c0b33de0f0
Move #adjustment_label to shipment
2021-03-04 14:27:02 +00:00
Matt-Yorkley
2a0f132b8b
Improve ShippingMethod -> Shipment association
...
5a54a0b6b0
2021-03-04 14:27:01 +00:00
Andy Brett
7ca81f45d0
Merge pull request #6641 from Matt-Yorkley/shipping-method-soft-deletion
...
Ensure ShippingMethod is correctly using soft-deletion
2021-01-14 11:53:19 -08:00
Matt-Yorkley
46ff247bc9
Ensure ShippingMethod#destroy is using soft-deletion
...
25f5c2daf8
We've already applied some of the changes in this commit during previous Spree upgrade work, but there were a couple of bits missing.
2021-01-11 15:46:38 +00:00
Matt-Yorkley
139773bc22
Add inverse_of to associations between shipping methods and rates
...
See 20d913c21c
2021-01-08 15:42:58 +00:00
Luis Ramos
086c521a27
Fix easy rubocop issues
2020-08-07 10:28:41 +01:00
Luis Ramos
7cefdda579
Run rubocop autocorrect
2020-08-07 10:21:09 +01:00
Luis Ramos
ba859111de
Merge decorators with original files brought from spree
2020-08-07 10:17:30 +01:00
Luis Ramos
fd9479f720
Bring modesl from spree_core
2020-08-07 10:06:08 +01:00