40 Commits

Author SHA1 Message Date
cyrillefr
7812d5f58a Replace set_methods in order model 2025-04-24 09:29:40 +02:00
Cillian O'Ruanaidh
7458dccea6 Call @order_cycles.count instead of #size because TagRuleApplicator doesn't return Relation anymore
In March 2020 this was changed to use :size instead of :count because TagRuleApplicator returned an ActiveRecord::Relation, see:

d2eee1dafd

However in October 2020 TagRuleApplicator was changed to always return an Array so this is no longer needed, see:

7e606471e4
2022-10-21 17:21:31 +01:00
Cillian O'Ruanaidh
747c88fb35 Update the Shop::OrderCyclesList service so it's clearer what kind of order cycles are being fetched
Before the Shop::OrderCyclesList service would return order cycles even if they are not ready for checkout and we had a check before calling the service in BaseController which would return OrderCycle.where('false'). It seems like this check should be part of the service too.
2022-09-30 13:13:39 +01:00
Cillian O'Ruanaidh
f4a4f7c9ff Remove validations checking order cycle has shipping methods
Instead we will make sure the order cycle is not available on the shopfront if it is doesn't have valid shipping methods. This will preven the issue where if one distributor deletes their shipping method, we don't want to invalidate the order cycle for all other distributors.

Co-authored-by: Maikel <maikel@email.org.au>
2022-09-30 13:13:39 +01:00
Cillian O'Ruanaidh
a46b77d10c Ensure hack for showing products on a shop with closed order cycles also works if an order cycle has no shipping methods
If a distributor order cycle has no shipping methods it will be invalid. This is a bit confusing because adding a check for :invalid seems like it would be better if it was done in the Shop::OrderCyclesList service but the hack doesn't work if you put it in there, it seems like something needs a refactor.
2022-09-30 13:13:39 +01:00
Matt-Yorkley
5e6dd1e6e1 Move #check_order_cycle_expiry method to OrderStockCheck and don't call it from BaseController :before_action callback 2022-01-31 15:55:35 +00:00
Andy Brett
334b9b520a removed deprecated calls to force_ssl; rely on config.force_ssl 2021-06-24 11:58:33 -07:00
Matt-Yorkley
943c00c924 WIP - Update loading of helpers in controllers
Rails has changed the way helpers are loaded. It's a bit weird. It was throwing lots of errors, and recommended using this setting, but now requires that all helpers are loaded explicitly. I'm not sure about this.
2021-05-03 14:17:54 +01:00
Andy Brett
8bcaeff6c8 resolve merge conflict; add ssl helper to base controller 2021-01-21 09:18:29 -08:00
Luis Ramos
23e6048bde Merge StoreController with BaseController 2021-01-15 21:59:16 +00:00
Luis Ramos
ff8a81cee7 Remove includes already present in parent ApplicationController 2021-01-15 21:59:16 +00:00
Maikel Linke
bb3f958dd2 Remove redundant includes 2020-08-19 10:37:18 +10:00
Maikel Linke
5761014205 Restore Spree customisations for controllers 2020-08-13 16:59:15 +10:00
Luis Ramos
144811268e Adapt require statements to new undecorated classes 2020-07-15 14:53:35 +01:00
Luis Ramos
8a61257547 Rename all before_filter to before_action, it's the same function with a new name 2020-06-22 13:11:57 +01:00
Luis Ramos
2ff8356c63 Delete dead code from products helper 2020-04-09 16:33:17 +01:00
Luis Ramos
0e62dc04bd Improve comments to explain glitch on set_order_cycle and OrderCyclesList 2020-03-20 09:47:59 +00:00
Luis Ramos
1c1f066884 Extract Shop::OrderCyclesList from base_controller 2020-03-20 09:47:59 +00:00
Luis Ramos
d5cf355a11 Call fetch_order_cycles from reset_order_cycles so we dont repeat the calculation
BaseController#set_order_cycle cant be used in reset_order_cycle because it will empty the order if the OC is not defined previously
2020-03-20 09:47:59 +00:00
Luis Ramos
d2eee1dafd Extract and fix reset_order_cycle logic from set_order_cycles: ActiveRecord.count will reload the relation and ignore the changes done by the TagRuleApplicator 2020-03-20 09:46:05 +00:00
luisramos0
4a67acf954 Removing a few rubocop warnings 2019-05-28 12:55:17 +01:00
Julius Pabrinkis
9429695e15 Add i18n helper for controllers to switch language by params 2017-08-02 09:57:32 +10:00
Pau Perez
cee24dcca7 Use indented style for multiline method calls
This enables the Rubocop's Style/MultilineMethodCallIndentation cop with
indentend enforced style. Which makes you split multiline method calls like:

  orders = Spree::Order
    .an_scope
    .another_scope
    .where(id: list_of_ids)

It also autofixes the current violations and updates the
rubocop_todo.yml
2017-07-12 10:40:53 +02:00
Maikel Linke
4809237ecc Fast fail set_order_cycles if distributor not ready 2017-04-19 14:28:17 +10:00
Matt-Yorkley
1f2c6f2a85 Ensure shops display as closed when not configured for sales
squashme

squashme

squash

squash

squash
2017-04-19 14:28:17 +10:00
Rohan Mitchell
8f0bc367d0 Include missing helpers 2016-11-04 09:39:17 +11:00
Rohan Mitchell
04a714426f Integrate from Spree fork: Fix spree issues #3531 and #2210 (patch provided by leiyangyou) 2016-11-04 09:39:17 +11:00
Rob Harrington
7028fbe288 Find current_customer via current_distributor and current_user rather than current_order
Moving available_payment_methods to enterprises_helper, as per available_shipping_methods
2016-05-28 00:31:59 +10:00
Rob Harrington
607b674c57 Refactoring tag rule logic, placing in TagRuleApplicator lib class 2016-05-27 16:25:10 +10:00
Rob Harrington
e32e3ddf70 Applying FilterOrderCycles rules in the frontend 2016-05-27 16:25:10 +10:00
Rob Harrington
c91f1301f0 Adding preferences to enterprises for sorting of order cycles in shopfront list 2015-12-16 11:55:23 +11:00
Rohan Mitchell
704955a185 Load active distributors where they're needed rather than in most controllers 2015-05-27 15:44:01 +10:00
Rob Harrington
6991e5e6b1 Finally got all callbacks available to all action that need them 2015-01-22 10:19:46 +11:00
Will Marshall
b9561ecf20 Minor refactoring from code review with Rohan 2014-06-19 11:41:24 +10:00
Will Marshall
224a70c11f Refactoring JSON injection a bit further 2014-06-18 16:43:57 +10:00
Rohan Mitchell
767bda3093 Redirect /products to enterprise path, since this page did not have correct product filtering 2013-10-24 11:33:03 +11:00
Rohan Mitchell
fb22b5e2b7 When there are no order cycles open, display an 'orders closed' message 2013-10-24 10:32:30 +11:00
Rohan Mitchell
e3307623dd When order cycle expires, clear cart and display a message (from BaseController) 2013-10-23 17:16:07 +11:00
Rob H
612017f143 WIP Upgrade to Spree 1.3 2013-02-05 15:01:45 +11:00
Rohan Mitchell
15e91f7743 WIP Move non-admin non-Spree controllers out of Spree namespace 2012-10-25 10:45:39 +11:00