effective_orders 6.22.0 → 6.23.1

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: 7355efac3dc644c7345ef82d62786ebfc6224047d8a67d81c14778fcc490b0ac
4
- data.tar.gz: 23ac4db7e268dbb3927bd19ce650d52585cdf8821ef0ae0462ccb61cdd93f8de
3
+ metadata.gz: aacbf648e88be000dccd67b2eaf3b5f659f58ce5d04238cc2ce06cf38abb496f
4
+ data.tar.gz: 88fe0446cc0a7788a199e63020db3605cd165b407836e51e963fafcb8ea4ab64
5
5
  SHA512:
6
- metadata.gz: c6434225d448689ff1eb02e4b3db328c29ab23f1e000726e65b76cd9556f1f521f58c7eb1f1fa91755ef074485caabb228321e934ff7f27c9c3e3448bb5e6508
7
- data.tar.gz: d918d1edbb87a1444c6c306627d11f20a7e881ae12527e8d1adcc28eb49f5f47c13de1d3d95811df5f58cb26af6b0f45561823e94b5efbd36317070f6e723255
6
+ metadata.gz: 18343e5fbc7c8d6462f40800078f02228afa29a983f1bab6ed5e6ce4c1b7ac7c824a60e30fdd93a9c0767dc1e9960b049fdfa3e9b22dc37925f7d6d7c20b14ba
7
+ data.tar.gz: 461cb7c6788cff12420017d6d1f4c0358f41131bc76500f92408b75e309a671c8e5baa0e221708a21a1843c4b4df859cc33a213316b5bcf2fbb5c29b7512387f
@@ -4,7 +4,7 @@ module Admin
4
4
 
5
5
  col :id, visible: false
6
6
 
7
- col :user, search: :string
7
+ col :user
8
8
 
9
9
  col :email do |customer|
10
10
  customer.user.email
@@ -0,0 +1,33 @@
1
+ module Admin
2
+ class EffectiveOrderItemsDatatable < Effective::Datatable
3
+ datatable do
4
+ order :created_at
5
+
6
+ col :id, visible: false
7
+ col :created_at, visible: false
8
+ col :updated_at, visible: false
9
+
10
+ col :order
11
+
12
+ col :order_status, search: Effective::Order.new.all_statuses do |order_item|
13
+ order_item.order.status
14
+ end
15
+
16
+ col :purchasable, visible: false
17
+
18
+ col :name
19
+ col :quantity
20
+ col :price, as: :price
21
+
22
+ col :total, as: :price
23
+
24
+ col :qb_item_name, label: qb_item_name_label, search: Effective::ItemName.sorted.map(&:to_s)
25
+
26
+ actions_col
27
+ end
28
+
29
+ collection do
30
+ Effective::OrderItem.all.includes(:order)
31
+ end
32
+ end
33
+ end
@@ -47,14 +47,14 @@ module Admin
47
47
  order.purchased_at&.strftime('%F %H:%M') || ('pending refund' if order.pending_refund?) || ("pending #{order.payment_provider}" if order.deferred?) || 'not purchased'
48
48
  end
49
49
 
50
- col :purchased_by, search: :string, visible: EffectiveOrders.organization_enabled?
50
+ col :purchased_by, visible: EffectiveOrders.organization_enabled?
51
51
 
52
52
  if attributes[:user_id].blank?
53
- col :user, search: :string, visible: !EffectiveOrders.organization_enabled?
53
+ col :user, visible: !EffectiveOrders.organization_enabled?
54
54
  end
55
55
 
56
56
  if attributes[:organization_id].blank?
57
- col :organization, search: :string, visible: EffectiveOrders.organization_enabled?
57
+ col :organization, visible: EffectiveOrders.organization_enabled?
58
58
  end
59
59
 
60
60
  if defined?(EffectiveMemberships)
@@ -70,7 +70,7 @@ module Admin
70
70
  col :billing_name, visible: false
71
71
  col :email, visible: false
72
72
 
73
- col :parent, visible: false, search: :string
73
+ col :parent, visible: false
74
74
 
75
75
  col :cc, visible: false
76
76
 
@@ -82,7 +82,7 @@ module Admin
82
82
  col :shipping_address, visible: false
83
83
  end
84
84
 
85
- col(:order_items, search: :string).search do |collection, term|
85
+ col(:order_items).search do |collection, term|
86
86
  collection.where(id: Effective::OrderItem.where('name ILIKE ?', "%#{term}%").select('order_id'))
87
87
  end
88
88
 
@@ -17,7 +17,7 @@ module Admin
17
17
  end
18
18
 
19
19
  col :purchased_at
20
- col :purchased_by, search: :string, visible: EffectiveOrders.organization_enabled?
20
+ col :purchased_by, visible: EffectiveOrders.organization_enabled?
21
21
 
22
22
  if EffectiveOrders.organization_enabled?
23
23
  col :organization
@@ -22,9 +22,9 @@ class EffectiveOrdersDatatable < Effective::Datatable
22
22
  '#' + order.to_param
23
23
  end
24
24
 
25
- col :parent, visible: false, search: :string
26
- col :user, visible: false, search: :string
27
- col :organization, search: :string, visible: false
25
+ col :parent, visible: false
26
+ col :user, visible: false
27
+ col :organization, visible: false
28
28
 
29
29
  col :status
30
30
 
@@ -33,7 +33,7 @@ class EffectiveOrdersDatatable < Effective::Datatable
33
33
  order.purchased_at&.strftime('%F %H:%M') || 'not purchased'
34
34
  end
35
35
 
36
- col :purchased_by, search: :string, visible: EffectiveOrders.organization_enabled?
36
+ col :purchased_by, visible: EffectiveOrders.organization_enabled?
37
37
  end
38
38
 
39
39
  if EffectiveOrders.billing_address
@@ -44,7 +44,7 @@ class EffectiveOrdersDatatable < Effective::Datatable
44
44
  col :shipping_address, visible: false
45
45
  end
46
46
 
47
- col(:order_items, search: :string).search do |collection, term|
47
+ col(:order_items).search do |collection, term|
48
48
  collection.where(id: Effective::OrderItem.where('name ILIKE ?', "%#{term}%").select('order_id'))
49
49
  end
50
50
 
@@ -12,12 +12,21 @@ module EffectiveActsAsPurchasableHelper
12
12
 
13
13
  options = options.reverse_merge(
14
14
  label: (EffectiveOrders.quickbooks? ? "Quickbooks #{etd(Effective::ItemName)}" : et(Effective::ItemName)),
15
- hint: "Can't find the #{etd(Effective::ItemName)} you need? #{link_to('Click here to add one', effective_orders.admin_item_names_path, target: '_blank')}"
15
+ hint: "Can't find the #{etd(Effective::ItemName)} you need? #{link_to('Click here to add one', effective_orders.admin_item_names_path, target: '_blank')}",
16
+ required: EffectiveOrders.require_item_names?
16
17
  )
17
18
 
18
19
  form.select :qb_item_name, collection, options
19
20
  end
20
21
 
22
+ def qb_item_name_label
23
+ EffectiveOrders.quickbooks? ? "Quickbooks #{etd(Effective::ItemName)}" : et(Effective::ItemName)
24
+ end
25
+
26
+ def qb_item_names_label
27
+ EffectiveOrders.quickbooks? ? "Quickbooks #{etsd(Effective::ItemName)}" : ets(Effective::ItemName)
28
+ end
29
+
21
30
  # This is called on the My Sales Page and is intended to be overridden in the app if needed
22
31
  def acts_as_purchasable_path(purchasable, action = :show)
23
32
  polymorphic_path(purchasable)
@@ -49,6 +49,10 @@ module ActsAsPurchasable
49
49
  validates_with Effective::SoldOutValidator, on: :create
50
50
  end
51
51
 
52
+ with_options(if: -> { EffectiveOrders.require_item_names? }) do
53
+ validates :qb_item_name, presence: true
54
+ end
55
+
52
56
  scope :purchased, -> {
53
57
  if respond_to?(:unarchived)
54
58
  unarchived.where.not(purchased_order_id: nil)
@@ -26,6 +26,9 @@ EffectiveOrders.setup do |config|
26
26
  # Display the item name field on the orders#new screen
27
27
  config.use_item_names = true
28
28
 
29
+ # Require item names throughout
30
+ config.require_item_names = false
31
+
29
32
  # If set, the orders#new screen will render effective/orders/_order_note_fields to capture any Note info
30
33
  config.collect_note = false
31
34
  config.collect_note_required = false
@@ -1,3 +1,3 @@
1
1
  module EffectiveOrders
2
- VERSION = '6.22.0'.freeze
2
+ VERSION = '6.23.1'.freeze
3
3
  end
@@ -19,7 +19,7 @@ module EffectiveOrders
19
19
  :customers_table_name, :subscriptions_table_name, :products_table_name, :item_names_table_name,
20
20
  :layout,
21
21
  :orders_collection_scope, :order_tax_rate_method,
22
- :obfuscate_order_ids, :use_item_names,
22
+ :obfuscate_order_ids, :use_item_names, :require_item_names,
23
23
  :use_effective_qb_sync, :use_effective_qb_online,
24
24
  :tax_label,
25
25
  :billing_address, :shipping_address,
@@ -218,6 +218,10 @@ module EffectiveOrders
218
218
  use_item_names != false
219
219
  end
220
220
 
221
+ def self.require_item_names?
222
+ require_item_names == true
223
+ end
224
+
221
225
  def self.tax_label
222
226
  config[:tax_label].presence || "Tax"
223
227
  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: 6.22.0
4
+ version: 6.23.1
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: 2025-03-06 00:00:00.000000000 Z
11
+ date: 2025-04-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -228,6 +228,7 @@ files:
228
228
  - app/controllers/effective/webhooks_controller.rb
229
229
  - app/datatables/admin/effective_customers_datatable.rb
230
230
  - app/datatables/admin/effective_item_names_datatable.rb
231
+ - app/datatables/admin/effective_order_items_datatable.rb
231
232
  - app/datatables/admin/effective_orders_datatable.rb
232
233
  - app/datatables/admin/report_payment_providers_datatable.rb
233
234
  - app/datatables/admin/report_transactions_datatable.rb