effective_orders 5.2.17 → 5.3.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/datatables/admin/effective_orders_datatable.rb +7 -2
- data/app/datatables/effective_orders_datatable.rb +3 -1
- data/app/models/effective/order.rb +16 -4
- data/config/effective_orders.rb +1 -0
- data/lib/effective_orders/version.rb +1 -1
- data/lib/effective_orders.rb +14 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0ff21e266d5908efc6a31250b6b265879e0e6c2330f598bd673fee6058f54b3d
|
4
|
+
data.tar.gz: c20fba9f6371012d5895bf17555ef003d88c57d19ba0a8e0b5e087d69b8eab0e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 11dfee0b764d2b93259b0cde740ecc9fcd39b2f80d0c5dc5795ea76919ed27528fbeb69f2a84d99fc27cfe09feeab2d07bc9b809e804ce3e19abba210f51a42b
|
7
|
+
data.tar.gz: 05a83379f89294bf22f3c6010f944b62a4839e8129e14b6f8a81226a8315e555731afd76963a8cb0bbbe4ac9a3725dd9e46ce3d742fe84eddd993f254947e160
|
@@ -59,7 +59,9 @@ class Admin::EffectiveOrdersDatatable < Effective::Datatable
|
|
59
59
|
col :shipping_address, visible: false
|
60
60
|
end
|
61
61
|
|
62
|
-
col
|
62
|
+
col(:order_items, search: :string).search do |collection, term|
|
63
|
+
collection.where(id: Effective::OrderItem.where('name ILIKE ?', "%#{term}%").select('order_id'))
|
64
|
+
end
|
63
65
|
|
64
66
|
col :subtotal, as: :price, visible: false
|
65
67
|
col :tax, as: :price, visible: false
|
@@ -82,7 +84,10 @@ class Admin::EffectiveOrdersDatatable < Effective::Datatable
|
|
82
84
|
|
83
85
|
actions_col partial: 'admin/orders/datatable_actions', partial_as: :order
|
84
86
|
|
85
|
-
|
87
|
+
unless attributes[:total] == false
|
88
|
+
aggregate :total
|
89
|
+
end
|
90
|
+
|
86
91
|
end
|
87
92
|
|
88
93
|
collection do
|
@@ -38,7 +38,9 @@ class EffectiveOrdersDatatable < Effective::Datatable
|
|
38
38
|
col :shipping_address, visible: false
|
39
39
|
end
|
40
40
|
|
41
|
-
col
|
41
|
+
col(:order_items, search: :string).search do |collection, term|
|
42
|
+
collection.where(id: Effective::OrderItem.where('name ILIKE ?', "%#{term}%").select('order_id'))
|
43
|
+
end
|
42
44
|
|
43
45
|
col :subtotal, as: :price, visible: false
|
44
46
|
col :tax, as: :price, visible: false
|
@@ -479,13 +479,11 @@ module Effective
|
|
479
479
|
# Call this as a way to skip over non consequential orders
|
480
480
|
# And mark some purchasables purchased
|
481
481
|
def mark_as_purchased!
|
482
|
-
purchase!(skip_buyer_validations: true, email: false)
|
483
|
-
skip_qb_sync!
|
484
|
-
true
|
482
|
+
purchase!(skip_buyer_validations: true, email: false, skip_quickbooks: true)
|
485
483
|
end
|
486
484
|
|
487
485
|
# Effective::Order.new(items: Product.first, user: User.first).purchase!(email: false)
|
488
|
-
def purchase!(payment: 'none', provider: 'none', card: 'none', email: true, skip_buyer_validations: false)
|
486
|
+
def purchase!(payment: 'none', provider: 'none', card: 'none', email: true, skip_buyer_validations: false, skip_quickbooks: false)
|
489
487
|
# Assign attributes
|
490
488
|
self.state = EffectiveOrders::PURCHASED
|
491
489
|
self.skip_buyer_validations = skip_buyer_validations
|
@@ -514,6 +512,20 @@ module Effective
|
|
514
512
|
end
|
515
513
|
|
516
514
|
send_order_receipts! if email
|
515
|
+
after_commit { sync_quickbooks!(skip: skip_quickbooks) }
|
516
|
+
|
517
|
+
true
|
518
|
+
end
|
519
|
+
|
520
|
+
# We support two different Quickbooks synchronization gems: effective_qb_sync and effective_qb_online
|
521
|
+
def sync_quickbooks!(skip:)
|
522
|
+
if EffectiveOrders.qb_online?
|
523
|
+
skip ? EffectiveQbOnline.skip_order!(self) : EffectiveQbOnline.sync_order!(self)
|
524
|
+
end
|
525
|
+
|
526
|
+
if EffectiveOrders.qb_sync?
|
527
|
+
skip ? EffectiveQbSync.skip_order!(self) : true # Nothing to do
|
528
|
+
end
|
517
529
|
|
518
530
|
true
|
519
531
|
end
|
data/config/effective_orders.rb
CHANGED
@@ -25,6 +25,7 @@ EffectiveOrders.setup do |config|
|
|
25
25
|
|
26
26
|
# Synchronize with Quickbooks
|
27
27
|
config.use_effective_qb_sync = false
|
28
|
+
config.use_effective_qb_online = false
|
28
29
|
|
29
30
|
# If set, the orders#new screen will render effective/orders/_order_note_fields to capture any Note info
|
30
31
|
config.collect_note = false
|
data/lib/effective_orders.rb
CHANGED
@@ -35,7 +35,7 @@ module EffectiveOrders
|
|
35
35
|
:customers_table_name, :subscriptions_table_name, :products_table_name,
|
36
36
|
:layout, :mailer_class_name, :mailer,
|
37
37
|
:orders_collection_scope, :order_tax_rate_method,
|
38
|
-
:obfuscate_order_ids, :use_effective_qb_sync,
|
38
|
+
:obfuscate_order_ids, :use_effective_qb_sync, :use_effective_qb_online,
|
39
39
|
:billing_address, :shipping_address,
|
40
40
|
:collect_note, :collect_note_required, :collect_note_message,
|
41
41
|
:terms_and_conditions, :terms_and_conditions_label, :minimum_charge,
|
@@ -136,6 +136,14 @@ module EffectiveOrders
|
|
136
136
|
[('cheque' if cheque?), ('phone' if phone?)].compact
|
137
137
|
end
|
138
138
|
|
139
|
+
def self.qb_sync?
|
140
|
+
use_effective_qb_sync && defined?(EffectiveQbSync)
|
141
|
+
end
|
142
|
+
|
143
|
+
def self.qb_online?
|
144
|
+
use_effective_qb_online && defined?(EffectiveQbOnline)
|
145
|
+
end
|
146
|
+
|
139
147
|
def self.mailer_klass
|
140
148
|
name = mailer_class_name.presence || 'Effective::OrdersMailer'
|
141
149
|
name.safe_constantize || raise("unable to constantize mailer class. check config.mailer_class_name")
|
@@ -229,4 +237,9 @@ module EffectiveOrders
|
|
229
237
|
|
230
238
|
class SoldOutException < Exception; end
|
231
239
|
class AlreadyPurchasedException < Exception; end
|
240
|
+
|
241
|
+
def self.gem_path
|
242
|
+
__dir__.chomp('/lib')
|
243
|
+
end
|
244
|
+
|
232
245
|
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
|
+
version: 5.3.2
|
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: 2022-
|
11
|
+
date: 2022-03-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|