effective_orders 6.21.3 → 6.22.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: 342b57d2357589ac84b7b8864e75a4948d662bbcf899cafb9dcd1134c16d4a16
4
- data.tar.gz: e1b3942a707ac68de5e7c883b3ee178621146ae9faf9825f0774e75c8351c547
3
+ metadata.gz: 7355efac3dc644c7345ef82d62786ebfc6224047d8a67d81c14778fcc490b0ac
4
+ data.tar.gz: 23ac4db7e268dbb3927bd19ce650d52585cdf8821ef0ae0462ccb61cdd93f8de
5
5
  SHA512:
6
- metadata.gz: 432194cc453ba1b16415e4efa6c68560ee075440acaa010c53c407dd4716a1e7cab7943fb0b9267e24dd950f0f40bf86788943aa6b26f34dd291ae6cc3dbe154
7
- data.tar.gz: d0009c4d688f25c982557dd58e6c750c585745c9ece99e176a4a108ac4bb24b844a7bfa01d7538bcd2bca792bcdd56ca4f0d45807f0049d45e07cc70562b9a3a
6
+ metadata.gz: c6434225d448689ff1eb02e4b3db328c29ab23f1e000726e65b76cd9556f1f521f58c7eb1f1fa91755ef074485caabb228321e934ff7f27c9c3e3448bb5e6508
7
+ data.tar.gz: d918d1edbb87a1444c6c306627d11f20a7e881ae12527e8d1adcc28eb49f5f47c13de1d3d95811df5f58cb26af6b0f45561823e94b5efbd36317070f6e723255
@@ -21,7 +21,7 @@ module Effective
21
21
  Effective::Cart.where(user: @order.current_user).destroy_all if @order.current_user.present?
22
22
 
23
23
  if flash[:success].blank?
24
- if email && EffectiveOrders.send_order_receipt_to_buyer
24
+ if email && EffectiveOrders.send_order_receipt_to_buyer && !@order.skip_order_emails?
25
25
  flash[:success] = "Payment successful! A receipt has been sent to #{@order.email}"
26
26
  else
27
27
  flash[:success] = "Payment successful! An email receipt has not been sent."
@@ -612,7 +612,6 @@ module Effective
612
612
  present_order_items.map { |oi| oi.quantity }.sum
613
613
  end
614
614
 
615
-
616
615
  def skip_buyer_validations?
617
616
  EffectiveResources.truthy?(skip_buyer_validations)
618
617
  end
@@ -628,7 +627,9 @@ module Effective
628
627
  self.addresses.clear if addresses.any? { |address| address.valid? == false }
629
628
  save!
630
629
 
631
- after_commit { send_payment_request_to_buyer! } if send_payment_request_to_buyer?
630
+ if send_payment_request_to_buyer?
631
+ after_commit { send_payment_request_to_buyer! }
632
+ end
632
633
 
633
634
  true
634
635
  end
@@ -877,8 +878,16 @@ module Effective
877
878
  (emails + [cc.presence]).compact.uniq.to_sentence
878
879
  end
879
880
 
881
+ def skip_order_emails?
882
+ return true if purchased? && free? && !EffectiveOrders.send_order_receipts_when_free
883
+ return true if purchased? && free? && OrderEmail.new(self).event_all_waitlisted_or_archived?
884
+ false
885
+ end
886
+
880
887
  def send_order_emails!
881
- if purchased_or_deferred? && (!free? || EffectiveOrders.send_order_receipts_when_free)
888
+ return false if skip_order_emails?
889
+
890
+ if purchased_or_deferred?
882
891
  EffectiveOrders.send_email(:order_email, self) if EffectiveOrders.send_order_receipt_to_buyer
883
892
  EffectiveOrders.send_email(:order_email_to_admin, self) if EffectiveOrders.send_order_receipt_to_admin
884
893
  end
@@ -43,6 +43,7 @@ module Effective
43
43
 
44
44
  def subject
45
45
  if event.present? && order.purchased_or_deferred?
46
+ return "Receipt - Order ##{order.to_param}" if order.purchased? && order.delayed_payment_date_past?
46
47
  return "Confirmation - #{event}" if event_none_waitlisted?
47
48
  return "Confirmation & Waitlist - #{event}" if event_some_waitlisted?
48
49
  return "Waitlist - #{event}" if event_all_waitlisted?
@@ -98,5 +99,9 @@ module Effective
98
99
  event_registrants.all? { |er| er.waitlisted_not_promoted? }
99
100
  end
100
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
101
106
  end
102
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
 
@@ -1,3 +1,3 @@
1
1
  module EffectiveOrders
2
- VERSION = '6.21.3'.freeze
2
+ VERSION = '6.22.0'.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: 6.21.3
4
+ version: 6.22.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