effective_orders 6.22.0 → 6.23.0

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: 260c5da1c1e8d7f330a0cedc2ea511227b3e4f633f8d8c5cde9ee7517fff4010
4
+ data.tar.gz: 27fcfffdff8dd456095775a285ff8dcb26f26de4a5fd1d5cc0f1954f9266a035
5
5
  SHA512:
6
- metadata.gz: c6434225d448689ff1eb02e4b3db328c29ab23f1e000726e65b76cd9556f1f521f58c7eb1f1fa91755ef074485caabb228321e934ff7f27c9c3e3448bb5e6508
7
- data.tar.gz: d918d1edbb87a1444c6c306627d11f20a7e881ae12527e8d1adcc28eb49f5f47c13de1d3d95811df5f58cb26af6b0f45561823e94b5efbd36317070f6e723255
6
+ metadata.gz: 2db38d74a702dcda44d80c041a1e6fb8eeb02b16db406685d8404f09d4bc975f1254f615c3bdcca1a3147b3fcaf45b7dbd91ed54fc556cd0293c13951317164e
7
+ data.tar.gz: cece056c424e1ddbc810a24a549c13f9355dad85dc78611242df7c41df575c2ee86d42f3a50517a12e28826e3bf04e3f6b922bf6bf0214c02c36ff7e9e16ff45
@@ -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
@@ -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.0'.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,7 +1,7 @@
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.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Code and Effect
@@ -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