artfully_ose 1.2.0.pre.21 → 1.2.0.pre.23
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +8 -8
- data/app/assets/javascripts/change-membership.js +8 -4
- data/app/assets/javascripts/custom/show.js +13 -8
- data/app/assets/javascripts/locationselector.js +1 -1
- data/app/assets/javascripts/store/store.js +7 -0
- data/app/assets/stylesheets/application.sass +21 -1
- data/app/assets/stylesheets/sass/_tags.sass +13 -2
- data/app/controllers/discounts_controller.rb +8 -1
- data/app/controllers/events_controller.rb +29 -13
- data/app/controllers/events_pass_types_controller.rb +75 -0
- data/app/controllers/imports_controller.rb +10 -3
- data/app/controllers/membership_types_controller.rb +1 -0
- data/app/controllers/pass_types_controller.rb +42 -0
- data/app/controllers/passes_controller.rb +13 -0
- data/app/controllers/passes_kits_controller.rb +25 -0
- data/app/controllers/passes_reports_controller.rb +5 -0
- data/app/controllers/sales_controller.rb +0 -2
- data/app/controllers/searches_controller.rb +10 -3
- data/app/controllers/sections_controller.rb +1 -1
- data/app/controllers/segments_controller.rb +4 -4
- data/app/controllers/shows_controller.rb +21 -47
- data/app/controllers/store/checkouts_controller.rb +6 -1
- data/app/controllers/store/orders_controller.rb +2 -0
- data/app/controllers/store/passes_controller.rb +9 -0
- data/app/controllers/store/store_controller.rb +7 -2
- data/app/helpers/link_helper.rb +10 -0
- data/app/mailers/reports_mailer.rb +5 -4
- data/app/models/cart.rb +21 -16
- data/app/models/checkout.rb +6 -1
- data/app/models/daily_membership_report.rb +1 -1
- data/app/models/daily_pass_report.rb +48 -0
- data/app/models/database_views/item_view.rb +69 -19
- data/app/models/event.rb +5 -0
- data/app/models/events_pass_type.rb +16 -0
- data/app/models/ext/integrations.rb +1 -1
- data/app/models/ext/preprocessor.rb +1 -0
- data/app/models/import.rb +18 -15
- data/app/models/imports/donations_import.rb +1 -1
- data/app/models/imports/events_import.rb +33 -28
- data/app/models/item.rb +13 -3
- data/app/models/job/daily_email_report_job.rb +8 -2
- data/app/models/job/order_processor.rb +10 -1
- data/app/models/job/show_creator.rb +2 -1
- data/app/models/kit.rb +1 -1
- data/app/models/kits/passes_kit.rb +62 -0
- data/app/models/membership.rb +19 -6
- data/app/models/membership_change.rb +18 -7
- data/app/models/membership_comp.rb +1 -0
- data/app/models/membership_type.rb +1 -1
- data/app/models/order.rb +18 -9
- data/app/models/order_handler.rb +22 -0
- data/app/models/organization.rb +7 -0
- data/app/models/pass.rb +45 -0
- data/app/models/pass_type.rb +19 -0
- data/app/models/person.rb +4 -0
- data/app/models/search.rb +170 -63
- data/app/models/section.rb +2 -0
- data/app/models/show.rb +26 -2
- data/app/models/show_touch.rb +12 -0
- data/app/models/ticket.rb +6 -0
- data/app/models/ticket/pricing.rb +1 -0
- data/app/models/ticket/reports.rb +16 -0
- data/app/models/ticket/sale_transitions.rb +4 -0
- data/app/models/ticket/transfers.rb +4 -1
- data/app/presenters/event_presenter.rb +1 -1
- data/app/views/discounts/_form.html.haml +1 -1
- data/app/views/events/_menu.html.haml +4 -13
- data/app/views/events/_share_and_sell.haml +2 -1
- data/app/views/events_pass_types/_form.html.haml +25 -0
- data/app/views/events_pass_types/edit.html.haml +22 -0
- data/app/views/events_pass_types/index.html.haml +43 -0
- data/app/views/events_pass_types/new.html.haml +22 -0
- data/app/views/imports/index.html.haml +2 -2
- data/app/views/layouts/_menu.html.haml +2 -1
- data/app/views/layouts/storefront.html.haml +3 -1
- data/app/views/membership_cancellations/_form.html.haml +1 -1
- data/app/views/membership_cancellations/_processing.html.haml +1 -3
- data/app/views/membership_types/index.html.haml +1 -1
- data/app/views/memberships/index.html.haml +16 -25
- data/app/views/orders/_item_table.haml +2 -2
- data/app/views/pass_types/_form.html.haml +70 -0
- data/app/views/pass_types/_pass_type_fees.html.haml +48 -0
- data/app/views/pass_types/edit.html.haml +4 -0
- data/app/views/pass_types/index.html.haml +32 -0
- data/app/views/pass_types/new.html.haml +4 -0
- data/app/views/passes/index.html.haml +40 -0
- data/app/views/passes_kits/edit.html.haml +30 -0
- data/app/views/passes_reports/index.html.haml +2 -0
- data/app/views/people/_header.html.haml +6 -1
- data/app/views/reports_mailer/daily.html.haml +19 -0
- data/app/views/searches/_form.html.haml +17 -1
- data/app/views/shared/_show_time_and_calendar.html.haml +21 -0
- data/app/views/shared/_tags.html.haml +2 -2
- data/app/views/shows/_controls.html.haml +4 -4
- data/app/views/shows/_glance.html.haml +0 -4
- data/app/views/shows/_sections_table.html.haml +6 -4
- data/app/views/shows/_work_with.html.haml +2 -2
- data/app/views/shows/index.html.haml +79 -20
- data/app/views/shows/new.html.haml +1 -21
- data/app/views/statements/_passes_table.html.haml +25 -0
- data/app/views/statements/show.html.haml +4 -1
- data/app/views/store/checkouts/thanks.html.haml +13 -5
- data/app/views/store/orders/show.html.haml +26 -1
- data/app/views/store/passes/index.html.haml +33 -0
- data/config/locales/en.yml +2 -0
- data/config/routes.rb +8 -2
- data/db/migrate/20140207135731_update_items_view.rb +38 -0
- data/db/migrate/20140210154723_add_cached_stats.rb +5 -0
- data/db/migrate/20140218202726_cache_stats.rb +7 -0
- data/db/migrate/20140304171625_passes_ahoy.rb +52 -0
- data/db/migrate/20140304174807_add_passes_kit.rb +5 -0
- data/db/migrate/20140307144454_add_events_pass_types.rb +9 -0
- data/db/migrate/20140307193350_add_pass_id_to_cart.rb +7 -0
- data/db/migrate/20140314162422_add_total_paid_to_membership.rb +13 -0
- data/db/migrate/20140319191237_add_show_dates_to_advanced_search.rb +6 -0
- data/db/migrate/20140328172333_add_cols_to_events_pass_types.rb +6 -0
- data/db/migrate/20140328174217_add_deleted_at_to_ept.rb +9 -0
- data/db/migrate/20140328185432_add_active_to_ept.rb +5 -0
- data/db/migrate/20140328192612_add_pass_type_id_to_search.rb +5 -0
- data/lib/artfully_ose.rb +3 -3
- data/lib/artfully_ose/version.rb +1 -1
- data/spec/factories/kit_factories.rb +5 -0
- data/spec/factories/membership_factories.rb +1 -0
- metadata +45 -6
@@ -3,7 +3,7 @@ class ItemView < ActiveRecord::Base
|
|
3
3
|
self.primary_key = 'id'
|
4
4
|
|
5
5
|
has_many :items, :foreign_key => 'order_id'
|
6
|
-
|
6
|
+
belongs_to :person, :foreign_key => 'person_id'
|
7
7
|
has_many :shows, :foreign_key => 'show_id'
|
8
8
|
|
9
9
|
set_watch_for :created_at, :local_to => :self, :as => :organization
|
@@ -15,38 +15,88 @@ class ItemView < ActiveRecord::Base
|
|
15
15
|
"exports/Artfully-Ticket-Sales-Export-#{organization.id}.csv"
|
16
16
|
end
|
17
17
|
|
18
|
+
def self.donations_export_filename_for(organization)
|
19
|
+
"exports/Artfully-Donations-Export-#{organization.id}.csv"
|
20
|
+
end
|
21
|
+
|
18
22
|
comma :donation do
|
19
23
|
created_at_local_to_organization("Date")
|
20
|
-
|
21
|
-
first_name("First Name")
|
22
|
-
last_name("Last Name")
|
23
|
-
address1("Address1")
|
24
|
-
address2("Address2")
|
25
|
-
city("City")
|
26
|
-
state("State")
|
27
|
-
zip("Zip")
|
24
|
+
|
28
25
|
payment_method("Payment Method")
|
29
26
|
price("Deductible Amount") { |cents| ((cents || 0) / 100.00) }
|
30
27
|
nongift_amount("Non-Deductible Amount") { |cents| ((cents || 0) / 100.00) }
|
31
28
|
special_instructions("Special Instructions")
|
32
|
-
notes("Notes")
|
29
|
+
notes("Notes")
|
30
|
+
|
31
|
+
person("Email") { |person| person.email }
|
32
|
+
person("Salutation") { |person| person.salutation }
|
33
|
+
person("First Name") { |person| person.first_name }
|
34
|
+
person("Middle Name") { |person| person.middle_name }
|
35
|
+
person("Last Name") { |person| person.last_name }
|
36
|
+
person("Suffix") { |person| person.suffix }
|
37
|
+
person("Title") { |person| person.title }
|
38
|
+
person("Type") { |person| person.type }
|
39
|
+
person("Subtype") { |person| person.subtype }
|
40
|
+
person("Company Name") { |person| person.company_name }
|
41
|
+
|
42
|
+
person("Address 1") { |person| person.address && person.address.address1 }
|
43
|
+
person("Address 2") { |person| person.address && person.address.address2 }
|
44
|
+
person("City") { |person| person.address && person.address.city }
|
45
|
+
person("State") { |person| person.address && person.address.state }
|
46
|
+
person("Zip") { |person| person.address && person.address.zip }
|
47
|
+
person("Country") { |person| person.address && person.address.country }
|
48
|
+
person("Phone1 type") { |person| person.phones[0] && person.phones[0].kind }
|
49
|
+
person("Phone1 number") { |person| person.phones[0] && person.phones[0].number }
|
50
|
+
person("Phone2 type") { |person| person.phones[1] && person.phones[1].kind }
|
51
|
+
person("Phone2 number") { |person| person.phones[1] && person.phones[1].number }
|
52
|
+
person("Phone3 type") { |person| person.phones[2] && person.phones[2].kind }
|
53
|
+
person("Phone3 number") { |person| person.phones[2] && person.phones[2].number }
|
54
|
+
person("Website") { |person| person.website }
|
55
|
+
person("Twitter Handle") { |person| person.twitter_handle }
|
56
|
+
person("Facebook URL") { |person| person.facebook_url }
|
57
|
+
person("Linked In Url") { |person| person.linked_in_url }
|
58
|
+
person("Tags") { |person| person.tags.join("|") }
|
59
|
+
person("Do Not Email") { |person| person.do_not_email }
|
33
60
|
end
|
34
61
|
|
35
62
|
comma :ticket_sale do
|
36
63
|
created_at_local_to_organization("Date of Purchase")
|
37
|
-
|
38
|
-
first_name("First Name")
|
39
|
-
last_name("Last Name")
|
40
|
-
address1("Address1")
|
41
|
-
address2("Address2")
|
42
|
-
city("City")
|
43
|
-
state("State")
|
44
|
-
zip("Zip")
|
64
|
+
|
45
65
|
event_name("Performance Title")
|
46
66
|
datetime_local_to_organization("Performance Date-Time")
|
47
67
|
payment_method("Payment Method")
|
48
68
|
price("Ticket Price") { |cents| number_to_currency(cents.to_f/100) }
|
49
69
|
special_instructions("Special Instructions")
|
50
|
-
notes("Notes")
|
70
|
+
notes("Notes")
|
71
|
+
|
72
|
+
person("Email") { |person| person.email }
|
73
|
+
person("Salutation") { |person| person.salutation }
|
74
|
+
person("First Name") { |person| person.first_name }
|
75
|
+
person("Middle Name") { |person| person.middle_name }
|
76
|
+
person("Last Name") { |person| person.last_name }
|
77
|
+
person("Suffix") { |person| person.suffix }
|
78
|
+
person("Title") { |person| person.title }
|
79
|
+
person("Type") { |person| person.type }
|
80
|
+
person("Subtype") { |person| person.subtype }
|
81
|
+
person("Company Name") { |person| person.company_name }
|
82
|
+
|
83
|
+
person("Address 1") { |person| person.address && person.address.address1 }
|
84
|
+
person("Address 2") { |person| person.address && person.address.address2 }
|
85
|
+
person("City") { |person| person.address && person.address.city }
|
86
|
+
person("State") { |person| person.address && person.address.state }
|
87
|
+
person("Zip") { |person| person.address && person.address.zip }
|
88
|
+
person("Country") { |person| person.address && person.address.country }
|
89
|
+
person("Phone1 type") { |person| person.phones[0] && person.phones[0].kind }
|
90
|
+
person("Phone1 number") { |person| person.phones[0] && person.phones[0].number }
|
91
|
+
person("Phone2 type") { |person| person.phones[1] && person.phones[1].kind }
|
92
|
+
person("Phone2 number") { |person| person.phones[1] && person.phones[1].number }
|
93
|
+
person("Phone3 type") { |person| person.phones[2] && person.phones[2].kind }
|
94
|
+
person("Phone3 number") { |person| person.phones[2] && person.phones[2].number }
|
95
|
+
person("Website") { |person| person.website }
|
96
|
+
person("Twitter Handle") { |person| person.twitter_handle }
|
97
|
+
person("Facebook URL") { |person| person.facebook_url }
|
98
|
+
person("Linked In Url") { |person| person.linked_in_url }
|
99
|
+
person("Tags") { |person| person.tags.join("|") }
|
100
|
+
person("Do Not Email") { |person| person.do_not_email }
|
51
101
|
end
|
52
102
|
end
|
data/app/models/event.rb
CHANGED
@@ -20,6 +20,8 @@ class Event < ActiveRecord::Base
|
|
20
20
|
has_many :shows, :order => :datetime
|
21
21
|
has_many :tickets, :through => :shows
|
22
22
|
has_many :discounts
|
23
|
+
has_many :events_pass_types
|
24
|
+
has_many :pass_types, :through => :events_pass_types
|
23
25
|
validate :validate_contact_phone
|
24
26
|
validates :contact_email, :presence => true, :email => true
|
25
27
|
validates :name, :presence => true
|
@@ -52,6 +54,9 @@ class Event < ActiveRecord::Base
|
|
52
54
|
|
53
55
|
delegate :time_zone, :to => :venue
|
54
56
|
|
57
|
+
ANY_EVENT_TEXT = "(Any Event)"
|
58
|
+
ANY_EVENT_ID = "-1"
|
59
|
+
|
55
60
|
def free?
|
56
61
|
is_free?
|
57
62
|
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
class EventsPassType < ActiveRecord::Base
|
2
|
+
include OhNoes::Destroy
|
3
|
+
|
4
|
+
belongs_to :organization
|
5
|
+
belongs_to :event
|
6
|
+
belongs_to :pass_type
|
7
|
+
|
8
|
+
attr_accessible :event, :pass_type, :excluded_shows, :ticket_types
|
9
|
+
|
10
|
+
validates :event, :presence => true
|
11
|
+
validates :organization, :presence => true
|
12
|
+
validates :pass_type, :presence => true
|
13
|
+
|
14
|
+
serialize :ticket_types, Set
|
15
|
+
serialize :excluded_shows, Set
|
16
|
+
end
|
@@ -39,7 +39,7 @@ module Ext
|
|
39
39
|
def self.included(base)
|
40
40
|
base.class_eval do
|
41
41
|
after_create do
|
42
|
-
[TicketingKit,RegularDonationKit,MembershipKit].each do |klass|
|
42
|
+
[TicketingKit,RegularDonationKit,MembershipKit,PassesKit].each do |klass|
|
43
43
|
kit = klass.new
|
44
44
|
kit.state = 'activated'
|
45
45
|
kit.organization = self
|
data/app/models/import.rb
CHANGED
@@ -171,21 +171,24 @@ class Import < ActiveRecord::Base
|
|
171
171
|
end
|
172
172
|
|
173
173
|
def create_person(parsed_row)
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
-
|
180
|
-
|
181
|
-
|
182
|
-
|
183
|
-
|
184
|
-
|
185
|
-
|
186
|
-
|
187
|
-
|
188
|
-
|
174
|
+
if !attach_person(parsed_row).naming_details_available?
|
175
|
+
person = self.organization.dummy
|
176
|
+
elsif !parsed_row.email.blank?
|
177
|
+
person = Person.first_or_create({:email => parsed_row.email, :organization => self.organization}.merge(parsed_row.person_attributes), {}) do |p|
|
178
|
+
p.import = self
|
179
|
+
end
|
180
|
+
person.update_from_import(attach_person(parsed_row))
|
181
|
+
person.skip_commit = true
|
182
|
+
person.save
|
183
|
+
else
|
184
|
+
person = attach_person(parsed_row)
|
185
|
+
if !person.save
|
186
|
+
self.reload
|
187
|
+
fail!(RowError.new(person.errors.full_messages.join(", ")), parsed_row.row)
|
188
|
+
end
|
189
|
+
end
|
190
|
+
person
|
191
|
+
end
|
189
192
|
|
190
193
|
class RowError < ArgumentError
|
191
194
|
end
|
@@ -50,7 +50,7 @@ class DonationsImport < Import
|
|
50
50
|
end
|
51
51
|
|
52
52
|
def create_contribution(parsed_row, person)
|
53
|
-
Rails.logger.info("Import #{id} DONATION_IMPORT: Creating contribution")
|
53
|
+
Rails.logger.info("Processing Import [#{id}] DONATION_IMPORT: Creating contribution")
|
54
54
|
validate_amounts(parsed_row)
|
55
55
|
amount = parsed_row.amount
|
56
56
|
deductible_amount = parsed_row.unparsed_deductible_amount.blank? ? amount - parsed_row.nongift_amount : parsed_row.deductible_amount
|
@@ -16,6 +16,11 @@ class EventsImport < Import
|
|
16
16
|
order = create_order(parsed_row, person, event, show, ticket)
|
17
17
|
actions = create_actions(parsed_row, person, event, show, order)
|
18
18
|
end
|
19
|
+
|
20
|
+
def imported!
|
21
|
+
@imported_shows.values.each {|show| show.delay.refresh_stats}
|
22
|
+
super
|
23
|
+
end
|
19
24
|
|
20
25
|
def rollback_events
|
21
26
|
Event.where(:import_id => self.id).all.each {|e| e.destroy}
|
@@ -28,7 +33,7 @@ class EventsImport < Import
|
|
28
33
|
end
|
29
34
|
|
30
35
|
def row_valid?(parsed_row)
|
31
|
-
Rails.logger.info("Import #{id} EVENT_IMPORT: Validating Row")
|
36
|
+
Rails.logger.info("Processing Import [#{id}] EVENT_IMPORT: Validating Row")
|
32
37
|
raise Import::RowError, "No Event Name included in this row: #{parsed_row.row}" unless parsed_row.event_name
|
33
38
|
raise Import::RowError, "No Show Date included in this row: #{parsed_row.row}" unless parsed_row.show_date
|
34
39
|
raise Import::RowError, "Please include a payment method in this row: #{parsed_row.row}" if parsed_row.payment_method.blank?
|
@@ -39,34 +44,34 @@ class EventsImport < Import
|
|
39
44
|
end
|
40
45
|
|
41
46
|
def create_chart(parsed_row, event, show)
|
42
|
-
Rails.logger.info("Import #{id} EVENT_IMPORT: Creating chart")
|
47
|
+
Rails.logger.info("Processing Import [#{id}] EVENT_IMPORT: Creating chart")
|
43
48
|
chart = show.chart || show.create_chart({ :name => event.name, :skip_create_first_section => true })
|
44
|
-
Rails.logger.info("Import #{id} EVENT_IMPORT: Using chart:")
|
45
|
-
Rails.logger.info("Import #{id} EVENT_IMPORT: #{chart.inspect}")
|
49
|
+
Rails.logger.info("Processing Import [#{id}] EVENT_IMPORT: Using chart:")
|
50
|
+
Rails.logger.info("Processing Import [#{id}] EVENT_IMPORT: #{chart.inspect}")
|
46
51
|
amount = parsed_row.amount || 0
|
47
|
-
Rails.logger.info("Import #{id} EVENT_IMPORT: Amount is [#{amount}]")
|
52
|
+
Rails.logger.info("Processing Import [#{id}] EVENT_IMPORT: Amount is [#{amount}]")
|
48
53
|
section = chart.sections.first || chart.sections.build(:name => event.name, :capacity => 1)
|
49
54
|
section.skip_create_first_ticket_type = true
|
50
|
-
Rails.logger.info("Import #{id} EVENT_IMPORT: Using section:")
|
51
|
-
Rails.logger.info("Import #{id} EVENT_IMPORT: #{section.inspect}")
|
52
|
-
Rails.logger.info("Import #{id} EVENT_IMPORT: Bumping section capacity")
|
55
|
+
Rails.logger.info("Processing Import [#{id}] EVENT_IMPORT: Using section:")
|
56
|
+
Rails.logger.info("Processing Import [#{id}] EVENT_IMPORT: #{section.inspect}")
|
57
|
+
Rails.logger.info("Processing Import [#{id}] EVENT_IMPORT: Bumping section capacity")
|
53
58
|
section.capacity = section.capacity + 1 unless section.new_record?
|
54
|
-
Rails.logger.info("Import #{id} EVENT_IMPORT: Saving section")
|
59
|
+
Rails.logger.info("Processing Import [#{id}] EVENT_IMPORT: Saving section")
|
55
60
|
section.save
|
56
61
|
ticket_type = section.ticket_types.where(:price => amount).first || section.ticket_types.create({:name => event.name, :price => amount, :limit => 0})
|
57
62
|
ticket_type.limit = ticket_type.limit + 1
|
58
63
|
ticket_type.save
|
59
|
-
Rails.logger.info("Import #{id} EVENT_IMPORT: #{section.inspect}")
|
60
|
-
Rails.logger.info("Import #{id} EVENT_IMPORT: Saving chart")
|
64
|
+
Rails.logger.info("Processing Import [#{id}] EVENT_IMPORT: #{section.inspect}")
|
65
|
+
Rails.logger.info("Processing Import [#{id}] EVENT_IMPORT: Saving chart")
|
61
66
|
chart.save
|
62
|
-
Rails.logger.info("Import #{id} EVENT_IMPORT: #{show.inspect}")
|
67
|
+
Rails.logger.info("Processing Import [#{id}] EVENT_IMPORT: #{show.inspect}")
|
63
68
|
saved = show.save(:validate => false)
|
64
|
-
Rails.logger.info("Import #{id} EVENT_IMPORT: Show saved[#{saved}]")
|
69
|
+
Rails.logger.info("Processing Import [#{id}] EVENT_IMPORT: Show saved[#{saved}]")
|
65
70
|
chart
|
66
71
|
end
|
67
72
|
|
68
73
|
def create_event(parsed_row, person)
|
69
|
-
Rails.logger.info("Import #{id} EVENT_IMPORT: Creating event")
|
74
|
+
Rails.logger.info("Processing Import [#{id}] EVENT_IMPORT: Creating event")
|
70
75
|
event = Event.where(:name => parsed_row.event_name).where(:organization_id => self.organization).first
|
71
76
|
return event if event
|
72
77
|
|
@@ -80,9 +85,9 @@ class EventsImport < Import
|
|
80
85
|
event.contact_email = self.organization.email || self.user.email
|
81
86
|
event.import = self
|
82
87
|
event.save!
|
83
|
-
Rails.logger.info("Import #{id} EVENT_IMPORT: Created event #{event.inspect}")
|
88
|
+
Rails.logger.info("Processing Import [#{id}] EVENT_IMPORT: Created event #{event.inspect}")
|
84
89
|
unless event.charts.empty?
|
85
|
-
Rails.logger.info("Import #{id} EVENT_IMPORT: Default event chart created #{event.charts.first.inspect}")
|
90
|
+
Rails.logger.info("Processing Import [#{id}] EVENT_IMPORT: Default event chart created #{event.charts.first.inspect}")
|
86
91
|
end
|
87
92
|
event
|
88
93
|
end
|
@@ -92,7 +97,7 @@ class EventsImport < Import
|
|
92
97
|
end
|
93
98
|
|
94
99
|
def existing_show(show_date, event_name)
|
95
|
-
Rails.logger.info("Import #{id} EVENT_IMPORT: Checking existing show")
|
100
|
+
Rails.logger.info("Processing Import [#{id}] EVENT_IMPORT: Checking existing show")
|
96
101
|
@imported_shows ||= {}
|
97
102
|
show = @imported_shows[show_key(show_date, event_name)]
|
98
103
|
end
|
@@ -108,26 +113,26 @@ class EventsImport < Import
|
|
108
113
|
end
|
109
114
|
|
110
115
|
def new_show(parsed_row, event)
|
111
|
-
Rails.logger.info("Import #{id} EVENT_IMPORT: Creating new show")
|
116
|
+
Rails.logger.info("Processing Import [#{id}] EVENT_IMPORT: Creating new show")
|
112
117
|
show = Show.new
|
113
118
|
show.datetime = time_zone_parser.parse(eight_pm?(parsed_row.show_date))
|
114
119
|
show.event = event
|
115
120
|
show.organization = self.organization
|
116
121
|
show.state = "unpublished" #Hacky end-around state machine here because we don't have a chart yet
|
117
122
|
show.save(:validate => false)
|
118
|
-
Rails.logger.info("Import #{id} EVENT_IMPORT: Show saved #{show.inspect}")
|
123
|
+
Rails.logger.info("Processing Import [#{id}] EVENT_IMPORT: Show saved #{show.inspect}")
|
119
124
|
|
120
125
|
@imported_shows[show_key(parsed_row.show_date, event.name)] = show
|
121
126
|
show
|
122
127
|
end
|
123
128
|
|
124
129
|
def create_show(parsed_row, event)
|
125
|
-
Rails.logger.info("Import #{id} EVENT_IMPORT: Creating show")
|
130
|
+
Rails.logger.info("Processing Import [#{id}] EVENT_IMPORT: Creating show")
|
126
131
|
return existing_show(parsed_row.show_date, event) || new_show(parsed_row, event)
|
127
132
|
end
|
128
133
|
|
129
134
|
def create_actions(parsed_row, person, event, show, order)
|
130
|
-
Rails.logger.info("Import #{id} EVENT_IMPORT: Creating actions")
|
135
|
+
Rails.logger.info("Processing Import [#{id}] EVENT_IMPORT: Creating actions")
|
131
136
|
go_action = GoAction.for(show, person) do |go_action|
|
132
137
|
go_action.import = self
|
133
138
|
go_action.save
|
@@ -141,28 +146,28 @@ class EventsImport < Import
|
|
141
146
|
end
|
142
147
|
|
143
148
|
def create_ticket(parsed_row, person, event, show, chart)
|
144
|
-
Rails.logger.info("Import #{id} EVENT_IMPORT: Creating ticket")
|
149
|
+
Rails.logger.info("Processing Import [#{id}] EVENT_IMPORT: Creating ticket")
|
145
150
|
amount = parsed_row.amount || 0
|
146
|
-
Rails.logger.info("Import #{id} EVENT_IMPORT: Amount is [#{amount}]")
|
151
|
+
Rails.logger.info("Processing Import [#{id}] EVENT_IMPORT: Amount is [#{amount}]")
|
147
152
|
section = chart.sections.first
|
148
|
-
Rails.logger.info("Import #{id} EVENT_IMPORT: Section is [#{section.inspect}]")
|
153
|
+
Rails.logger.info("Processing Import [#{id}] EVENT_IMPORT: Section is [#{section.inspect}]")
|
149
154
|
ticket_type = section.ticket_types.where(:price => amount).first
|
150
155
|
|
151
156
|
raise Import::RuntimeError, 'No section found for ticket' unless section
|
152
157
|
|
153
158
|
ticket = Ticket.build_one(show, section,1, true)
|
154
159
|
ticket.ticket_type = ticket_type
|
155
|
-
Rails.logger.info("Import #{id} EVENT_IMPORT: Ticket built [#{ticket.inspect}]")
|
160
|
+
Rails.logger.info("Processing Import [#{id}] EVENT_IMPORT: Ticket built [#{ticket.inspect}]")
|
156
161
|
ticket.sell_to person
|
157
|
-
Rails.logger.info("Import #{id} EVENT_IMPORT: Ticket sold to [#{person.inspect}]")
|
162
|
+
Rails.logger.info("Processing Import [#{id}] EVENT_IMPORT: Ticket sold to [#{person.inspect}]")
|
158
163
|
ticket.sold_price = amount
|
159
164
|
ticket.save
|
160
|
-
Rails.logger.info("Import #{id} EVENT_IMPORT: Ticket saved [#{ticket.inspect}]")
|
165
|
+
Rails.logger.info("Processing Import [#{id}] EVENT_IMPORT: Ticket saved [#{ticket.inspect}]")
|
161
166
|
ticket
|
162
167
|
end
|
163
168
|
|
164
169
|
def create_order(parsed_row, person, event, show, ticket)
|
165
|
-
Rails.logger.info("Import #{id} EVENT_IMPORT: Creating order")
|
170
|
+
Rails.logger.info("Processing Import [#{id}] EVENT_IMPORT: Creating order")
|
166
171
|
order_key = [show.id.to_s,person.id.to_s,parsed_row.payment_method].join('-')
|
167
172
|
@imported_orders ||= {}
|
168
173
|
order = @imported_orders[order_key] || ImportedOrder.new
|
data/app/models/item.rb
CHANGED
@@ -12,6 +12,7 @@ class Item < ActiveRecord::Base
|
|
12
12
|
belongs_to :reseller_order, :class_name => "Reseller::Order"
|
13
13
|
belongs_to :product, :polymorphic => true
|
14
14
|
belongs_to :discount
|
15
|
+
belongs_to :pass
|
15
16
|
|
16
17
|
attr_accessible :order_id, :product_type, :state, :price, :realized_price, :net, :nongift_amount
|
17
18
|
|
@@ -19,7 +20,7 @@ class Item < ActiveRecord::Base
|
|
19
20
|
attr_accessor :per_item_processing_charge
|
20
21
|
|
21
22
|
validates_presence_of :product_type, :price, :realized_price, :net
|
22
|
-
validates_inclusion_of :product_type, :in => %( Ticket Donation Membership )
|
23
|
+
validates_inclusion_of :product_type, :in => %( Ticket Donation Membership Pass)
|
23
24
|
|
24
25
|
scope :donation, where(:product_type => "Donation")
|
25
26
|
|
@@ -40,6 +41,10 @@ class Item < ActiveRecord::Base
|
|
40
41
|
product_type == "Membership"
|
41
42
|
end
|
42
43
|
|
44
|
+
def pass?
|
45
|
+
product_type == "Pass"
|
46
|
+
end
|
47
|
+
|
43
48
|
def self.donations_by(person)
|
44
49
|
Item.donation.joins(:order).where('orders.person_id' => person.id)
|
45
50
|
end
|
@@ -94,7 +99,8 @@ class Item < ActiveRecord::Base
|
|
94
99
|
def product=(product)
|
95
100
|
set_product_details_from product
|
96
101
|
set_prices_from product
|
97
|
-
set_discount_from product
|
102
|
+
set_discount_from product
|
103
|
+
set_pass_from product
|
98
104
|
set_show_from product if product.respond_to? :show_id
|
99
105
|
self.state = "purchased"
|
100
106
|
self.product_id = if product then product.id end
|
@@ -257,7 +263,11 @@ class Item < ActiveRecord::Base
|
|
257
263
|
end
|
258
264
|
|
259
265
|
def set_discount_from(prod)
|
260
|
-
self.discount = prod.discount
|
266
|
+
self.discount = prod.discount if prod.respond_to?(:discount)
|
267
|
+
end
|
268
|
+
|
269
|
+
def set_pass_from(prod)
|
270
|
+
self.pass = prod.pass if prod.respond_to?(:pass)
|
261
271
|
end
|
262
272
|
|
263
273
|
def set_prices_from(prod)
|
@@ -4,12 +4,18 @@ class DailyEmailReportJob
|
|
4
4
|
date ||= 1.day.ago
|
5
5
|
|
6
6
|
Organization.where(:id => organization_ids_to_email(date)).receiving_sales_email.each do |org|
|
7
|
+
Rails.logger.info("DAILY SALES for org [#{org.id}]")
|
7
8
|
tickets = DailyTicketReport.new(org, date)
|
8
9
|
donations = DailyDonationReport.new(org, date)
|
9
10
|
membership_report = DailyMembershipReport.new(org, date)
|
11
|
+
pass_report = DailyPassReport.new(org, date)
|
10
12
|
|
11
|
-
next if tickets.rows.empty? &&
|
12
|
-
|
13
|
+
next if tickets.rows.empty? &&
|
14
|
+
donations.rows.empty? &&
|
15
|
+
tickets.exchange_rows.empty? &&
|
16
|
+
pass_report.rows.empty? &&
|
17
|
+
!membership_report.send?
|
18
|
+
ReportsMailer.delay.daily(tickets, donations, membership_report, pass_report)
|
13
19
|
end
|
14
20
|
end
|
15
21
|
|