6772312ea7
The primary license of the project is changing to: AGPL-3.0-or-later WITH Web-Template-Output-Additional-Permission-3.0-or-later with some specific files to be licensed under the one of two licenses: CC0-1.0 LGPL-3.0-or-later This commit is one of the many steps to relicense the entire codebase. Documentation granting permission for this relicensing (from all past contributors who hold copyrights) is on file with Software Freedom Conservancy, Inc.
33 lines
1.3 KiB
Ruby
33 lines
1.3 KiB
Ruby
# License: AGPL-3.0-or-later WITH Web-Template-Output-Additional-Permission-3.0-or-later
|
|
class TicketMailer < BaseMailer
|
|
|
|
helper :application
|
|
|
|
# Pass in ticket_ids, event_id, and supporter
|
|
def followup(ticket_ids, charge_id=nil)
|
|
@charge = charge_id ? Charge.find(charge_id) : nil
|
|
@tickets = Ticket.where("id IN(?)", ticket_ids)
|
|
@event = @tickets.last.event
|
|
@supporter = @tickets.last.supporter
|
|
@nonprofit = @supporter.nonprofit
|
|
from = Format::Name.email_from_np(@nonprofit.name)
|
|
reply_to = @nonprofit.email.blank? ? @nonprofit.users.first.email : @nonprofit.email
|
|
mail(from: from, to: @supporter.email, reply_to: reply_to, subject: "Your tickets#{@charge ? ' and receipt ' : ' '}for: #{@event.name}")
|
|
end
|
|
|
|
def receipt_admin(ticket_ids, user_id=nil)
|
|
@tickets = Ticket.where("id IN (?)", ticket_ids)
|
|
@charge = @tickets.last.charge
|
|
@supporter = @tickets.last.supporter
|
|
@event = @tickets.last.event
|
|
@nonprofit = @event.nonprofit
|
|
recipients = QueryUsers.nonprofit_user_emails(@nonprofit.id, 'notify_events')
|
|
if user_id
|
|
em = User.find(user_id).email
|
|
return unless recipients.include?(em)
|
|
recipients = [em]
|
|
end
|
|
mail(to: recipients, subject: "Ticket redeemed for #{@event.name} - #{@supporter.name}")
|
|
end
|
|
|
|
end
|