effective_orders 5.2.4 → 5.2.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: b05f84b1f3b3cda586c6cb1721b3f7f2b5df015c16b03cea26842dec69e079d0
4
- data.tar.gz: 7064dc16608557f87e3189737c6df2ec54a39fccdf640cb9de40c03a0805011d
3
+ metadata.gz: 7850176b4c32949c586aa453834799cb0063919a1eb7437e5111f2a280e19fc0
4
+ data.tar.gz: e5753a21c4ba634a779bce34c0dafae0d94492db53f51bbb89720f860ea17985
5
5
  SHA512:
6
- metadata.gz: e2701472dd97d9fa7e8c02729abe8b403e59279ba551628efaebf35b9f0b4a72e5574a8620ee11b94b033f996f459ddd215596e9ed119b07d25f015759457eaf
7
- data.tar.gz: e612099005a16265d1d3f4165de40bf23e55fbc36252f66310ef04fbc0e3a993c4fa7f72357134e5ab2850d4c78d032498054afa0c9c3ce80a4345ef29ce511a
6
+ metadata.gz: 6251dfd17f63fce47aa1484d26bfb68afaa24f080819f8f8a00ffc21e280e36396c0d25ee6d0fc400af01120539d39f71aaef91bdb8770d9f28a87dd5198b4d6
7
+ data.tar.gz: 65a6ad794d855f8057f5e14051ec1d0b7099e21e54b864238f61b5a020f17f0f1a93042a30c74dcd0b5b581385ac1e466eb075344054958506a9ee2ad7e7605a
@@ -93,9 +93,10 @@ class Admin::EffectiveOrdersDatatable < Effective::Datatable
93
93
  end
94
94
 
95
95
  if attributes[:user_id].present?
96
- user_klass = (attributes[:user_type].safe_constantize || current_user.class)
97
- user = user_klass.find(attributes[:user_id])
96
+ user_klass = (attributes[:user_type].constantize if attributes[:user_type].present?)
97
+ user_klass ||= current_user.class
98
98
 
99
+ user = user_klass.find(attributes[:user_id])
99
100
  scope = scope.where(user: user)
100
101
  end
101
102
 
@@ -62,7 +62,9 @@ class EffectiveOrdersDatatable < Effective::Datatable
62
62
  end
63
63
 
64
64
  collection do
65
- user_klass = (attributes[:user_type].safe_constantize || current_user.class)
65
+ user_klass = (attributes[:user_type].constantize if attributes[:user_type].present?)
66
+ user_klass ||= current_user.class
67
+
66
68
  user = user_klass.find(attributes[:user_id])
67
69
 
68
70
  scope = Effective::Order.all.deep.where(user: user)
@@ -103,7 +103,7 @@ module Effective
103
103
  end
104
104
 
105
105
  # User validations -- An admin skips these when working in the admin/ namespace
106
- with_options unless: -> { pending? || skip_buyer_validations? } do
106
+ with_options unless: -> { pending? || skip_buyer_validations? || purchased? } do
107
107
  validates :tax_rate, presence: { message: "can't be determined based on billing address" }
108
108
  validates :tax, presence: true
109
109
 
@@ -320,7 +320,7 @@ module Effective
320
320
 
321
321
  # For moneris and moneris_checkout. Just a unique value.
322
322
  def transaction_id
323
- [to_param, billing_name.to_s.parameterize.presence, Time.zone.now.to_i].compact.join('-')
323
+ [to_param, billing_name.to_s.parameterize.presence, Time.zone.now.to_i, rand(10000)].compact.join('-')
324
324
  end
325
325
 
326
326
  def billing_first_name
@@ -596,7 +596,7 @@ module Effective
596
596
  end
597
597
 
598
598
  def assign_email
599
- self.email = user&.email
599
+ self.email = user&.email if user&.email.present?
600
600
  end
601
601
 
602
602
  def assign_last_address
@@ -1,3 +1,3 @@
1
1
  module EffectiveOrders
2
- VERSION = '5.2.4'.freeze
2
+ VERSION = '5.2.8'.freeze
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: effective_orders
3
3
  version: !ruby/object:Gem::Version
4
- version: 5.2.4
4
+ version: 5.2.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Code and Effect
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-12-17 00:00:00.000000000 Z
11
+ date: 2021-12-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails