effective_orders 6.21.4 → 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: 39ce34f3c38a2b137ae5d6277b766bab2215e1ef14271dc9ae26ced61897216a
4
- data.tar.gz: b27f892799caee6f152f14f6dc3757ca910a1db2568b146736c3aa877c226f15
3
+ metadata.gz: 260c5da1c1e8d7f330a0cedc2ea511227b3e4f633f8d8c5cde9ee7517fff4010
4
+ data.tar.gz: 27fcfffdff8dd456095775a285ff8dcb26f26de4a5fd1d5cc0f1954f9266a035
5
5
  SHA512:
6
- metadata.gz: 496a570f6ce2aa2fa1182c5b341761abb9183ea2da79e6d1e465b8c81bab11590edb529c385c825407258827ab703dfaba7c63da6d8680ccd6e607b2550bff90
7
- data.tar.gz: c26a9381da40a34dcfc49dd08c933dc86caf75bc29a80876905081806e04df5ea31b7af64abb9c74aa446cefe1adbf328817b91c4c17f2d458aa5d89a24b6c93
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)
@@ -880,7 +880,7 @@ module Effective
880
880
 
881
881
  def skip_order_emails?
882
882
  return true if purchased? && free? && !EffectiveOrders.send_order_receipts_when_free
883
- return true if purchased? && free? && OrderEmail.new(self).event_all_waitlisted?
883
+ return true if purchased? && free? && OrderEmail.new(self).event_all_waitlisted_or_archived?
884
884
  false
885
885
  end
886
886
 
@@ -99,5 +99,9 @@ module Effective
99
99
  event_registrants.all? { |er| er.waitlisted_not_promoted? }
100
100
  end
101
101
 
102
+ def event_all_waitlisted_or_archived?
103
+ return false unless event_registrants.present?
104
+ event_registrants.all? { |er| er.waitlisted_not_promoted? || er.archived? }
105
+ end
102
106
  end
103
107
  end
@@ -93,5 +93,9 @@ module Effective
93
93
  (qb_order_item || build_qb_order_item(name: purchasable.try(:qb_item_name))).name
94
94
  end
95
95
 
96
+ def archived?
97
+ purchasable.try(:archived?) == true && price.to_i == 0
98
+ end
99
+
96
100
  end
97
101
  end
@@ -1,13 +1,15 @@
1
1
  .effective-order-items
2
+ - present_order_items = order.order_items.reject(&:archived?)
3
+
2
4
  %table.table{style: "margin-bottom: 20px;"}
3
5
  %thead
4
6
  %tr
5
7
  %th.quantity Qty
6
- %th.item= order.order_items.length > 1 ? 'Items' : 'Item'
8
+ %th.item= present_order_items.length > 1 ? 'Items' : 'Item'
7
9
  %th.price Price
8
10
 
9
11
  %tbody
10
- - order.order_items.each do |item|
12
+ - present_order_items.each do |item|
11
13
  %tr
12
14
  %td.quantity= item.quantity
13
15
 
@@ -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.21.4'.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,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: effective_orders
3
3
  version: !ruby/object:Gem::Version
4
- version: 6.21.4
4
+ version: 6.23.0
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-03 00:00:00.000000000 Z
11
+ date: 2025-03-06 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