effective_events 2.29.5 → 2.30.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: c14e31c639caed97a4e6f5b15206e6da6734c97a5cd60af0aebcc654ac41fc8a
4
- data.tar.gz: 2f9ec428eb3d1794f77b8ed757af584c3323e98c75e6040e2d64994ba70ed303
3
+ metadata.gz: a00e6d6e6fce1100f98e19f6d9a0e5d1a9ba66ebfadf33de9b65f73127c859fa
4
+ data.tar.gz: 0abd39dd425fe5aa03a4aca9bc3e23e35319b829eb8136ac274a06531297f098
5
5
  SHA512:
6
- metadata.gz: 985572039dc88d35c6e339acfbf38fac38e6d96b388210ed2f6f416a3c215fd1acbf35dd8a3f1991ca622cfc75e8a3d818377faa636dc432a13226baaf3162de
7
- data.tar.gz: 499e41790fd28b1c6d74af26bcfca71c76fc1256a8fe4280982e8072dcaa0b0150bc2f05d30bd33b583ac388a17f22e9aeb6b4bb97cc4055dffa5788ec3c0e01
6
+ metadata.gz: 53bb80da8ecd9e1cedea4f489c9e3cd48a8d76ec839655480e7ed7e238a7e5daf1586830e68c3e79c5744d50d3e81a095a9c3296c5105545fd57965cd36e92d9
7
+ data.tar.gz: ab519af6f7760009617670f236a8983189112931d9ab3eb50b292fe419f52921e6b1009c5f6fecc8610376c28989d2b7c9ff3c457527ca50f99ee5d3447955ea
@@ -27,7 +27,7 @@ module Admin
27
27
 
28
28
  if defined?(EffectiveMemberships) && EffectiveMemberships.Organization.respond_to?(:sponsors)
29
29
  col :sponsorship, search: EffectiveMemberships.Organization::SPONSORSHIPS do |er|
30
- (er.owner || er.user).try(:sponsorship)
30
+ er.user.try(:sponsorship)
31
31
  end
32
32
  end
33
33
 
@@ -15,39 +15,6 @@ module Effective
15
15
  mail(to: resource.email, **headers_for(resource, opts))
16
16
  end
17
17
 
18
- # Sent on registration purchase
19
- # Sent on delayed payment date registration submitted
20
- # Sent on delayed payment date registration update
21
- # Sent on update blank registrants
22
- def event_registration_confirmation(resource, opts = {})
23
- raise('expected an event registration') unless resource.class.try(:effective_events_event_registration?)
24
-
25
- @event_registration = resource
26
- @event = resource.event
27
-
28
- @order = @event_registration.submit_order
29
- raise('expected an event registration submit_order') unless @order.present?
30
-
31
- subject = subject_for(__method__, "Confirmation - #{@event}", resource, opts)
32
- headers = headers_for(resource, opts)
33
-
34
- mail(to: resource.owner.email, cc: mailer_admin, subject: subject, **headers)
35
- end
36
-
37
- # Sent manually by an admin to one registrant
38
- def event_registrant_confirmation(resource, opts = {})
39
- raise('expected an event registrant') unless resource.kind_of?(Effective::EventRegistrant)
40
-
41
- @event_registrant = resource
42
- @event = resource.event
43
- @event_registration = resource.event_registration # Optional
44
-
45
- subject = subject_for(__method__, "Confirmation - #{@event}", resource, opts)
46
- headers = headers_for(resource, opts)
47
-
48
- mail(to: resource.email, cc: mailer_admin, subject: subject, **headers)
49
- end
50
-
51
18
  protected
52
19
 
53
20
  def assigns_for(resource)
@@ -246,7 +246,6 @@ module EffectiveEventsEventRegistration
246
246
 
247
247
  def after_submit_deferred!
248
248
  update_deferred_event_registration!
249
- send_event_registration_confirmation!
250
249
  end
251
250
 
252
251
  def after_submit_purchased!
@@ -255,8 +254,6 @@ module EffectiveEventsEventRegistration
255
254
  notifications = event.event_notifications.select(&:registrant_purchased?)
256
255
  notifications.each { |notification| notification.notify!(event_registrants: event_registrants) }
257
256
 
258
- send_event_registration_confirmation! unless submit_order&.delayed? || submit_order&.deferred?
259
-
260
257
  true
261
258
  end
262
259
  end
@@ -390,17 +387,6 @@ module EffectiveEventsEventRegistration
390
387
  save!
391
388
  end
392
389
 
393
- # Not involved in money processing
394
- # This will only be called when the order is previously delayed and deferred
395
- # And we're going through the registration again with a saved card
396
- def checkout!
397
- if submit_order.present? && submit_order.delayed? && submit_order.deferred?
398
- send_event_registration_confirmation!
399
- end
400
-
401
- save!
402
- end
403
-
404
390
  def try_completed!
405
391
  return false unless submitted?
406
392
  return false unless submit_order&.purchased?
@@ -506,20 +492,14 @@ module EffectiveEventsEventRegistration
506
492
  update_submit_fees_and_order! if submit_order.present? && !submit_order.purchased?
507
493
 
508
494
  after_commit do
509
- send_event_registration_confirmation!
495
+ send_order_emails!
510
496
  end
511
497
 
512
498
  true
513
499
  end
514
500
 
515
- # Sent on registration purchase
516
- # Sent on delayed payment date registration submitted
517
- # Sent on delayed payment date registration update
518
- # Sent on update blank registrants
519
- def send_event_registration_confirmation!
520
- return false unless EffectiveEvents.send_confirmation_email?
521
-
522
- EffectiveEvents.send_email(:event_registration_confirmation, self)
501
+ def send_order_emails!
502
+ submit_order.send_order_emails!
523
503
  end
524
504
 
525
505
  def just_let_them_edit_tickets_and_register_anyway?
@@ -48,6 +48,8 @@ module Effective
48
48
  acts_as_tagged if respond_to?(:acts_as_tagged)
49
49
  log_changes if respond_to?(:log_changes)
50
50
 
51
+ attr_accessor :mailer_preview # Set by the mailer preview. Disabled delayed payment validations
52
+
51
53
  effective_resource do
52
54
  title :string
53
55
 
@@ -161,7 +163,7 @@ module Effective
161
163
  end
162
164
 
163
165
  validate(if: -> { delayed_payment? }) do
164
- errors.add(:delayed_payment, 'no delayed payment processor available') unless EffectiveOrders.try(:delayed?)
166
+ errors.add(:delayed_payment, 'no delayed payment processor available') unless EffectiveOrders.try(:delayed?) || mailer_preview
165
167
  end
166
168
 
167
169
  validate(if: -> { file.attached? }) do
@@ -161,6 +161,21 @@ module Effective
161
161
  registered! if event_registration.blank? && !registered?
162
162
  end
163
163
 
164
+ # Build an event registration for this registrant with a $0 purchased order
165
+ after_commit(if: -> { event_registration.blank? && created_by_admin? }) do
166
+ event_registration = EffectiveEvents.EventRegistration.new(event: event, owner: owner)
167
+ event_registration.event_registrants << self
168
+ event_registration.build_submit_fees_and_order()
169
+ event_registration.save!
170
+
171
+ order = event_registration.submit_order
172
+ order.order_items.each { |oi| oi.assign_attributes(price: 0) }
173
+ order.order_items.each { |oi| oi.purchasable.assign_attributes(price: 0) }
174
+ order.mark_as_purchased!
175
+
176
+ order.update_columns(subtotal: 0, total: 0, tax: 0, amount_owing: 0)
177
+ end
178
+
164
179
  def to_s
165
180
  persisted? ? title : 'registrant'
166
181
  end
@@ -343,7 +358,12 @@ module Effective
343
358
 
344
359
  # Manual admin action only
345
360
  def send_confirmation_email!
346
- EffectiveEvents.send_email(:event_registrant_confirmation, self)
361
+ order = event_registration&.submit_order
362
+ order.send_order_emails!
363
+ end
364
+
365
+ def event_registration_submit_order
366
+ event_registration&.submit_order
347
367
  end
348
368
 
349
369
  private
@@ -25,6 +25,10 @@
25
25
  - if f.object.purchased?
26
26
  = f.static_field :event_ticket, label: 'Purchased ticket'
27
27
 
28
+ - if (order = f.object.event_registration_submit_order).present?
29
+ = f.static_field :event_registration_submit_order, label: 'Order' do
30
+ = link_to(order, effective_orders.admin_order_path(order), target: '_blank')
31
+
28
32
  = f.select :event_ticket_id, effective_events_event_tickets_collection(f.object.event, namespace), required: true
29
33
 
30
34
  - if f.object.event.allow_blank_registrants? && (f.object.new_record? || f.object.blank_registrant?)
@@ -35,6 +39,10 @@
35
39
  = f.show_if(:blank_registrant, false) do
36
40
  = render('effective/event_registrants/fields', f: f)
37
41
 
42
+ - if f.object.new_record?
43
+ %p.text-muted
44
+ %small A $0 purchased event registration and order will be created. No emails will be sent.
45
+
38
46
  = f.check_box :archived, label: "Archive this registrant. It will be displayed as archived on the owner's event registration"
39
47
 
40
48
  - if f.object.new_record?
@@ -29,9 +29,6 @@ EffectiveEvents.setup do |config|
29
29
  # Hint text for event images attachments
30
30
  config.events_hint_text = 'Optional. Shown on the events index and event pages. Dimensions are 220px tall and 350px wide.'
31
31
 
32
- # Send confirmation emails
33
- config.send_confirmation_email = false
34
-
35
32
  # Mailer Settings
36
33
  # Please see config/initializers/effective_resources.rb for default effective_* gem mailer settings
37
34
  #
@@ -1,3 +1,3 @@
1
1
  module EffectiveEvents
2
- VERSION = '2.29.5'.freeze
2
+ VERSION = '2.30.0'.freeze
3
3
  end
@@ -9,7 +9,7 @@ module EffectiveEvents
9
9
  :events_table_name, :event_registrants_table_name, :event_tickets_table_name, :event_ticket_selections_table_name,
10
10
  :event_registrations_table_name, :event_products_table_name, :event_addons_table_name, :event_notifications_table_name,
11
11
  :mailer, :parent_mailer, :deliver_method, :mailer_layout, :mailer_sender, :mailer_admin, :mailer_subject,
12
- :layout, :per_page, :use_effective_roles, :categories, :events_hint_text, :send_confirmation_email,
12
+ :layout, :per_page, :use_effective_roles, :categories, :events_hint_text,
13
13
  :organization_enabled, :create_users, :company_or_organization_required,
14
14
  :event_registration_class_name
15
15
  ]
@@ -39,8 +39,4 @@ module EffectiveEvents
39
39
  !!EffectiveOrders.try(:delayed?)
40
40
  end
41
41
 
42
- def self.send_confirmation_email?
43
- send_confirmation_email == true
44
- end
45
-
46
42
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: effective_events
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.29.5
4
+ version: 2.30.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-02-14 00:00:00.000000000 Z
11
+ date: 2025-02-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -297,9 +297,7 @@ files:
297
297
  - app/views/effective/events/_sidebar.html.haml
298
298
  - app/views/effective/events/index.html.haml
299
299
  - app/views/effective/events/show.html.haml
300
- - app/views/effective/events_mailer/event_registrant_confirmation.html.haml
301
300
  - app/views/effective/events_mailer/event_registrant_purchased.liquid
302
- - app/views/effective/events_mailer/event_registration_confirmation.html.haml
303
301
  - app/views/simple_calendar/_month_calendar.html.haml
304
302
  - config/effective_events.rb
305
303
  - config/locales/effective_events.en.yml
@@ -1,39 +0,0 @@
1
- %h1{style: "text-align: center"} Your tickets have been confirmed!
2
-
3
- %p{style: "text-align: center"}
4
- %strong{style: "font-size: 18px"}= @event.title
5
- %br
6
- #{effective_events_event_schedule(@event)}
7
-
8
- - if @event.rich_text_confirmation_email.present?
9
- %hr
10
- = @event.rich_text_confirmation_email.to_s.html_safe
11
-
12
- - if @event.delayed_payment? && @event_registration.present? && @event_registrant.user == @event_registration.owner && @event_registration.submit_order.delayed? && @event_registration.submit_order.deferred?
13
- %hr
14
- %p{style: "margin-bottom: 4px; font-weight: bold;"} Please note:
15
- %ul{style: "margin-top: 0;"}
16
- %li Your credit card will be charged on <strong>#{@event.delayed_payment_date.strftime("%A, %B %d, %Y")}</strong>.
17
- %li Changes and cancellations must be made before this date.
18
- %li A receipt will be sent after the transaction is completed.
19
-
20
- %hr
21
-
22
- %table.table
23
- %thead
24
- %tr
25
- %th{style: "text-align: left;"} Qty
26
- %th{style: "text-align: left;"} Ticket
27
- %th{style: "text-align: right;"} Price
28
- %tbody
29
- %tr
30
- %td{style: "text-align: left;"} 1
31
- %td{style: "text-align: left;"}
32
- = @event_registrant.purchasable_name
33
- = @event_registrant.responses if @event_registrant.responses.present?
34
- %td{style: "text-align: right;"}= price_to_currency(@event_registrant.price)
35
-
36
- - if @event_registration.present? && @event_registrant.user == @event_registration.owner
37
- %hr
38
- %p{style: "text-align: center;"}
39
- = link_to('View your registration', effective_events.event_event_registration_url(@event, @event_registration))
@@ -1,101 +0,0 @@
1
- %h1{style: "text-align: center"} Your tickets have been confirmed!
2
-
3
- %p{style: "text-align: center"}
4
- %strong{style: "font-size: 18px"}= @event.title
5
- %br
6
- #{effective_events_event_schedule(@event)}
7
-
8
- - if @event.rich_text_confirmation_email.present?
9
- %hr
10
- = @event.rich_text_confirmation_email.to_s.html_safe
11
-
12
- - if @event.delayed_payment?
13
- %hr
14
- %p{style: "margin-bottom: 4px; font-weight: bold;"} Please note:
15
- %ul{style: "margin-top: 0;"}
16
- %li Your credit card will be charged on <strong>#{@event.delayed_payment_date.strftime("%A, %B %d, %Y")}</strong>.
17
- %li Changes and cancellations must be made before this date.
18
- %li A receipt will be sent after the transaction is completed.
19
-
20
- %hr
21
-
22
- .effective-order
23
- %table.table{style: "margin-bottom: 20px;"}
24
- %thead
25
- %tr
26
- %th{style: "text-align: left;"} Qty
27
- %th{style: "text-align: left;"} Ticket
28
- %th{style: "text-align: right;"} Price
29
-
30
- %tbody
31
- - @order.order_items.each do |oi|
32
- %tr
33
- %td{style: "text-align: left;"}= oi.quantity
34
- %td{style: "text-align: left;"}
35
- = oi.to_s.html_safe
36
- = oi.purchasable.try(:responses) || oi.purchasable.try(:notes)
37
- %td.price= price_to_currency(oi.price)
38
-
39
- %tfoot
40
- %tr
41
- %td{colspan: 3}= "&nbsp;".html_safe
42
- %tr
43
- %th.subtotal{colspan: 2}
44
- Subtotal
45
- %td.price.subtotal-price
46
- = price_to_currency(@order.subtotal)
47
-
48
- - if @order.tax_rate.blank?
49
- -# Nothing to do. We can't display Tax, Total or Credit Card Surcharge (which is taxed) yet.
50
-
51
- - elsif @order.tax_rate.present? && @order.surcharge_percent.to_f > 0.0
52
- %tr
53
- %th.tax{colspan: 2}
54
- Tax (#{rate_to_percentage(@order.tax_rate)})
55
- %td.price.tax-price
56
- = price_to_currency(@order.tax)
57
-
58
- %tr
59
- %th.amount-owing{colspan: 2}
60
- Amount owing before Credit Card Processing Fee
61
- %td.price.amount-owing-price
62
- = price_to_currency(@order.amount_owing)
63
-
64
- %tr
65
- %th.surcharge{colspan: 2}
66
- Credit Card Processing Fee (#{rate_to_percentage(@order.surcharge_percent)}) on #{price_to_currency(@order.amount_owing)}
67
- %td.price.surcharge-price
68
- = price_to_currency(@order.surcharge)
69
-
70
- %tr
71
- %th.surcharge-tax{colspan: 2}
72
- Tax (#{rate_to_percentage(@order.tax_rate)}) on Credit Card Processing Fee
73
- %td.price.surcharge-tax-price
74
- = price_to_currency(@order.surcharge_tax)
75
-
76
- %tr
77
- %th.total{colspan: 2}
78
- Total amount charged to credit card
79
- %td.price.total-price
80
- = price_to_currency(@order.total)
81
-
82
- - elsif @order.tax_rate.present? && !(@order.surcharge_percent.to_f > 0.0)
83
- %tr
84
- %th.tax{colspan: 2}
85
- Tax (#{rate_to_percentage(@order.tax_rate)})
86
- %td.price.tax-price
87
- = price_to_currency(@order.tax)
88
-
89
- %tr
90
- %th.total{colspan: 2}
91
- Total
92
- %td.total-price
93
- = price_to_currency(@order.total)
94
-
95
- %hr
96
-
97
- %p{style: "text-align: center;"}
98
- - if @event.delayed_payment? && @order.delayed? && @order.deferred?
99
- = link_to('View or modify your registration', effective_events.event_event_registration_url(@event, @event_registration))
100
- - else
101
- = link_to('View your registration', effective_events.event_event_registration_url(@event, @event_registration))