artfully_ose 1.2.0 → 1.3.0.pre1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (577) hide show
  1. checksums.yaml +5 -13
  2. data/app/assets/images/actions/open.png +0 -0
  3. data/app/assets/images/actions/pledge.png +0 -0
  4. data/app/assets/images/actions/pledge.psd +0 -0
  5. data/app/assets/images/glyphish/gray/cancel.png +0 -0
  6. data/app/assets/images/loading_gray.gif +0 -0
  7. data/app/assets/javascripts/application.js +30 -4
  8. data/app/assets/javascripts/baseball_card.js.coffee +235 -0
  9. data/app/assets/javascripts/boxoffice.js +12 -49
  10. data/app/assets/javascripts/contributions.js +264 -0
  11. data/app/assets/javascripts/custom/advanced_searches.js +142 -0
  12. data/app/assets/javascripts/custom/endless-scroll.js +1 -1
  13. data/app/assets/javascripts/custom/job-monitor.js +73 -0
  14. data/app/assets/javascripts/custom/kits-config.js +0 -2
  15. data/app/assets/javascripts/custom/mailchimp.js +14 -0
  16. data/app/assets/javascripts/custom/people.js +31 -2
  17. data/app/assets/javascripts/custom/person-finder.js +34 -0
  18. data/app/assets/javascripts/custom/searches.js +12 -0
  19. data/app/assets/javascripts/custom/user-finder.js +111 -0
  20. data/app/assets/javascripts/households.js +12 -5
  21. data/app/assets/javascripts/ical.js +138 -0
  22. data/app/assets/javascripts/jquery-lib/jquery.timeago.js +221 -0
  23. data/app/assets/javascripts/locationselector.js +1 -1
  24. data/app/assets/javascripts/memberships.js +24 -0
  25. data/app/assets/javascripts/relationships.js +10 -0
  26. data/app/assets/javascripts/search.js +22 -0
  27. data/app/assets/javascripts/store/sliding-wizard.js +2 -2
  28. data/app/assets/javascripts/store/store.js +51 -6
  29. data/app/assets/javascripts/tags.js +44 -0
  30. data/app/assets/stylesheets/application.sass +331 -32
  31. data/app/assets/stylesheets/bootstrap-overrides.css +24 -9
  32. data/app/assets/stylesheets/boxoffice.css.scss +0 -4
  33. data/app/assets/stylesheets/sass/_campaigns.sass +43 -0
  34. data/app/assets/stylesheets/sass/_tags.sass +10 -1
  35. data/app/assets/stylesheets/sass/fa-color.css.scss +13 -0
  36. data/app/assets/stylesheets/sass/store.sass +7 -7
  37. data/app/concerns/cart_finder.rb +10 -0
  38. data/app/concerns/oh_noes.rb +1 -1
  39. data/app/controllers/actions_controller.rb +5 -5
  40. data/app/controllers/addresses_controller.rb +1 -1
  41. data/app/controllers/advanced_search_segments_controller.rb +97 -0
  42. data/app/controllers/advanced_searches_controller.rb +118 -0
  43. data/app/controllers/appeals_controller.rb +63 -0
  44. data/app/controllers/artfully_ose_controller.rb +20 -2
  45. data/app/controllers/campaigns_controller.rb +90 -0
  46. data/app/controllers/charts_controller.rb +8 -2
  47. data/app/controllers/console_sales_controller.rb +21 -23
  48. data/app/controllers/contributions_controller.rb +74 -43
  49. data/app/controllers/converts_controller.rb +21 -0
  50. data/app/controllers/delete_ticket_types_controller.rb +35 -0
  51. data/app/controllers/events_pass_types_controller.rb +10 -2
  52. data/app/controllers/export_controller.rb +4 -4
  53. data/app/controllers/households_controller.rb +63 -15
  54. data/app/controllers/imports_controller.rb +13 -10
  55. data/app/controllers/job_monitors_controller.rb +9 -0
  56. data/app/controllers/members/people_controller.rb +7 -5
  57. data/app/controllers/members/sessions_controller.rb +1 -0
  58. data/app/controllers/membership_comps_controller.rb +5 -20
  59. data/app/controllers/memberships_controller.rb +2 -2
  60. data/app/controllers/merges_controller.rb +7 -6
  61. data/app/controllers/mobile/users_controller.rb +18 -6
  62. data/app/controllers/notes_controller.rb +5 -1
  63. data/app/controllers/orders_controller.rb +30 -13
  64. data/app/controllers/organizations_controller.rb +8 -0
  65. data/app/controllers/passes_kits_controller.rb +2 -4
  66. data/app/controllers/people_controller.rb +105 -17
  67. data/app/controllers/pledges_controller.rb +64 -0
  68. data/app/controllers/preview_rows_controller.rb +29 -0
  69. data/app/controllers/regular_donation_kits_controller.rb +11 -6
  70. data/app/controllers/sales_controller.rb +72 -40
  71. data/app/controllers/searches_controller.rb +37 -6
  72. data/app/controllers/segments_controller.rb +33 -2
  73. data/app/controllers/settlements_controller.rb +13 -7
  74. data/app/controllers/shows_controller.rb +58 -24
  75. data/app/controllers/statements_controller.rb +2 -2
  76. data/app/controllers/store/checkouts_controller.rb +43 -26
  77. data/app/controllers/store/donations_controller.rb +27 -11
  78. data/app/controllers/store/memberships_controller.rb +37 -4
  79. data/app/controllers/store/orders_controller.rb +26 -10
  80. data/app/controllers/store/passes_controller.rb +30 -3
  81. data/app/controllers/tags_controller.rb +42 -0
  82. data/app/controllers/ticket_types_controller.rb +9 -2
  83. data/app/controllers/tickets_controller.rb +6 -4
  84. data/app/controllers/unacknowledged_gifts_controller.rb +45 -0
  85. data/app/controllers/user_memberships_controller.rb +47 -8
  86. data/app/helpers/advanced_searches_helper.rb +252 -0
  87. data/app/helpers/artfully_ose_helper.rb +33 -4
  88. data/app/helpers/checkouts_helper.rb +16 -0
  89. data/app/helpers/mailchimp_lists_for_search_helper.rb +21 -0
  90. data/app/helpers/orders_helper.rb +11 -0
  91. data/app/helpers/people_helper.rb +28 -1
  92. data/app/helpers/relationships_helper.rb +6 -0
  93. data/app/helpers/sales_helper.rb +3 -1
  94. data/app/helpers/searches_helper.rb +3 -1
  95. data/app/helpers/segments_helper.rb +3 -0
  96. data/app/mailers/order_mailer.rb +8 -1
  97. data/app/mailers/producer_mailer.rb +39 -0
  98. data/app/mailers/reports_mailer.rb +6 -1
  99. data/app/models/ability.rb +15 -8
  100. data/app/models/action.rb +33 -4
  101. data/app/models/actions/change_action.rb +3 -1
  102. data/app/models/actions/comp_action.rb +3 -1
  103. data/app/models/actions/convert_action.rb +19 -0
  104. data/app/models/actions/do_action.rb +3 -1
  105. data/app/models/actions/exchange_action.rb +3 -1
  106. data/app/models/actions/get_action.rb +3 -1
  107. data/app/models/actions/give_action.rb +8 -2
  108. data/app/models/actions/go_action.rb +3 -1
  109. data/app/models/actions/hear_action.rb +15 -1
  110. data/app/models/actions/join_action.rb +3 -1
  111. data/app/models/actions/mailchimp_hear_action.rb +17 -0
  112. data/app/models/actions/pledge_action.rb +19 -0
  113. data/app/models/actions/refund_action.rb +3 -1
  114. data/app/models/actions/say_action.rb +3 -1
  115. data/app/models/actions/system_action.rb +17 -0
  116. data/app/models/address.rb +76 -31
  117. data/app/models/advanced_search.rb +434 -0
  118. data/app/models/advanced_search_segment.rb +12 -0
  119. data/app/models/appeal.rb +106 -0
  120. data/app/models/box_office.rb +1 -1
  121. data/app/models/budget_restriction.rb +9 -0
  122. data/app/models/campaign.rb +141 -0
  123. data/app/models/cart.rb +39 -4
  124. data/app/models/chart.rb +2 -2
  125. data/app/models/checkout.rb +54 -10
  126. data/app/models/comp.rb +7 -5
  127. data/app/models/company.rb +2 -0
  128. data/app/models/console_sale.rb +26 -0
  129. data/app/models/contribution.rb +327 -62
  130. data/app/models/convert.rb +62 -0
  131. data/app/models/daily_membership_report.rb +1 -1
  132. data/app/models/database_views/item_view.rb +91 -49
  133. data/app/models/discount.rb +1 -1
  134. data/app/models/discounts/discount_type.rb +2 -1
  135. data/app/models/donation.rb +27 -2
  136. data/app/models/donation_search.rb +188 -10
  137. data/app/models/door_list.rb +39 -2
  138. data/app/models/event.rb +31 -15
  139. data/app/models/ext.rb +3 -3
  140. data/app/models/ext/delayed_indexing.rb +41 -1
  141. data/app/models/ext/integrations.rb +6 -0
  142. data/app/models/forwarding_job_monitor.rb +2 -0
  143. data/app/models/household.rb +1 -1
  144. data/app/models/import.rb +39 -8
  145. data/app/models/imports/donations_import.rb +110 -19
  146. data/app/models/imports/events_import.rb +3 -2
  147. data/app/models/imports/mappings.rb +991 -0
  148. data/app/models/imports/memberships_import.rb +218 -20
  149. data/app/models/imports/people_import.rb +9 -1
  150. data/app/models/imports/rollback.rb +9 -0
  151. data/app/models/imports/validations.rb +7 -0
  152. data/app/models/individual.rb +3 -1
  153. data/app/models/item.rb +55 -17
  154. data/app/models/job/acknowledge_job.rb +23 -0
  155. data/app/models/job/checkout_processor.rb +1 -1
  156. data/app/models/job/convert_order_processor.rb +14 -0
  157. data/app/models/job/daily_email_report_job.rb +1 -12
  158. data/app/models/job/destroy_show_job.rb +1 -6
  159. data/app/models/job/destroy_tag_job.rb +18 -0
  160. data/app/models/job/door_list_generator_job.rb +33 -0
  161. data/app/models/job/door_list_mailer_job.rb +15 -0
  162. data/app/models/job/email_organization_sales_report_job.rb +32 -0
  163. data/app/models/job/expire_ticket_job.rb +19 -2
  164. data/app/models/job/export_people_job.rb +47 -0
  165. data/app/models/job/export_settlements_job.rb +24 -0
  166. data/app/models/job/geocode_address_job.rb +2 -7
  167. data/app/models/job/mailchimp_sync_job.rb +61 -3
  168. data/app/models/job/merge_job.rb +19 -0
  169. data/app/models/job/order_export_job.rb +36 -0
  170. data/app/models/job/order_mailer_job.rb +1 -2
  171. data/app/models/job/order_processor.rb +17 -6
  172. data/app/models/job/person_lifetime_value_job.rb +1 -0
  173. data/app/models/job/search_export_job.rb +33 -0
  174. data/app/models/job/suggest_households_by_address_job.rb +29 -0
  175. data/app/models/job/suggest_households_by_spouse_job.rb +22 -0
  176. data/app/models/job_monitor.rb +14 -0
  177. data/app/models/kit.rb +35 -8
  178. data/app/models/kits/campaigns_kit.rb +27 -0
  179. data/app/models/kits/mailchimp_kit.rb +548 -124
  180. data/app/models/kits/membership_kit.rb +14 -6
  181. data/app/models/kits/passes_kit.rb +14 -6
  182. data/app/models/kits/regular_donation_kit.rb +29 -2
  183. data/app/models/{relationships_kit.rb → kits/relationships_kit.rb} +3 -7
  184. data/app/models/kits/scannable_tickets_kit.rb +0 -5
  185. data/app/models/kits/sponsored_donation_kit.rb +2 -12
  186. data/app/models/kits/ticketing_kit.rb +9 -1
  187. data/app/models/linking_job_monitor.rb +2 -0
  188. data/app/models/list_grouping.rb +10 -0
  189. data/app/models/member.rb +35 -23
  190. data/app/models/member_number_generator.rb +2 -0
  191. data/app/models/membership.rb +23 -14
  192. data/app/models/membership_change.rb +17 -1
  193. data/app/models/membership_comp.rb +48 -23
  194. data/app/models/membership_comp_job.rb +7 -0
  195. data/app/models/membership_type.rb +13 -7
  196. data/app/models/monitorable.rb +19 -0
  197. data/app/models/note.rb +10 -1
  198. data/app/models/order.rb +170 -21
  199. data/app/models/order_handler.rb +13 -2
  200. data/app/models/orders/convert_order.rb +11 -0
  201. data/app/models/organization.rb +87 -9
  202. data/app/models/parsed_row.rb +142 -67
  203. data/app/models/pass.rb +13 -7
  204. data/app/models/pass_type.rb +17 -4
  205. data/app/models/passes_report.rb +6 -3
  206. data/app/models/payment.rb +16 -6
  207. data/app/models/payments/cash_payment.rb +1 -0
  208. data/app/models/payments/check_payment.rb +1 -5
  209. data/app/models/payments/comp_payment.rb +0 -1
  210. data/app/models/payments/credit_card_payment.rb +2 -7
  211. data/app/models/permission.rb +28 -0
  212. data/app/models/person.rb +503 -94
  213. data/app/models/phone.rb +3 -0
  214. data/app/models/redis_manager.rb +39 -0
  215. data/app/models/relationship.rb +31 -4
  216. data/app/models/relationship_builder.rb +0 -3
  217. data/app/models/rolling_membership_type.rb +5 -1
  218. data/app/models/s3_coordinator.rb +21 -0
  219. data/app/models/sale.rb +7 -4
  220. data/app/models/scheduled_pledge_payment.rb +69 -0
  221. data/app/models/search.rb +236 -24
  222. data/app/models/section.rb +6 -4
  223. data/app/models/show.rb +21 -12
  224. data/app/models/show_validator.rb +45 -0
  225. data/app/models/soft_credit.rb +126 -0
  226. data/app/models/subscribed_list.rb +52 -0
  227. data/app/models/suggested_household.rb +8 -2
  228. data/app/models/ticket.rb +35 -10
  229. data/app/models/ticket/locker.rb +25 -0
  230. data/app/models/ticket_summary.rb +1 -1
  231. data/app/models/ticket_type.rb +14 -2
  232. data/app/models/user.rb +42 -3
  233. data/app/models/user_membership.rb +57 -3
  234. data/app/models/valuation/lifetime_donations.rb +2 -2
  235. data/app/models/valuation/lifetime_pledges.rb +35 -0
  236. data/app/models/valuation/lifetime_value.rb +5 -1
  237. data/app/models/valuation_query.rb +109 -0
  238. data/app/models/venue.rb +8 -0
  239. data/app/views/actions/_action.html.haml +1 -1
  240. data/app/views/actions/_form.html.haml +2 -2
  241. data/app/views/actions/give/_show.html.haml +1 -1
  242. data/app/views/actions/pledge/_show.html.haml +8 -0
  243. data/app/views/actions/shared/_show.html.haml +1 -1
  244. data/app/views/addresses/_address.html.haml +3 -1
  245. data/app/views/advanced_search_segments/_advanced_searches_results.html.haml +15 -0
  246. data/app/views/advanced_search_segments/index.html.haml +18 -0
  247. data/app/views/advanced_search_segments/show.html.haml +46 -0
  248. data/app/views/advanced_searches/_form.html.haml +61 -0
  249. data/app/views/advanced_searches/_hit.html.haml +10 -0
  250. data/app/views/advanced_searches/_household.html.haml +7 -0
  251. data/app/views/advanced_searches/_new_condition.html.haml +3 -0
  252. data/app/views/advanced_searches/_people_count.html.erb +3 -0
  253. data/app/views/advanced_searches/_people_list.html.haml +5 -0
  254. data/app/views/advanced_searches/filters/_action.html.haml +12 -0
  255. data/app/views/advanced_searches/filters/_birthday.html.haml +9 -0
  256. data/app/views/advanced_searches/filters/_discount_code.html.haml +7 -0
  257. data/app/views/advanced_searches/filters/_donated.html.haml +17 -0
  258. data/app/views/advanced_searches/filters/_email.html.haml +7 -0
  259. data/app/views/advanced_searches/filters/_has_purchased_for.html.haml +9 -0
  260. data/app/views/advanced_searches/filters/_keyword.html.haml +9 -0
  261. data/app/views/advanced_searches/filters/_lifetime_value.html.haml +13 -0
  262. data/app/views/advanced_searches/filters/_limit_results.html.haml +7 -0
  263. data/app/views/advanced_searches/filters/_location.html.haml +11 -0
  264. data/app/views/advanced_searches/filters/_mailchimp_group.html.haml +8 -0
  265. data/app/views/advanced_searches/filters/_mailchimp_list.html.haml +8 -0
  266. data/app/views/advanced_searches/filters/_membership_ended.html.haml +9 -0
  267. data/app/views/advanced_searches/filters/_membership_started.html.haml +9 -0
  268. data/app/views/advanced_searches/filters/_membership_status.html.haml +8 -0
  269. data/app/views/advanced_searches/filters/_membership_type.html.haml +8 -0
  270. data/app/views/advanced_searches/filters/_orders.html.haml +10 -0
  271. data/app/views/advanced_searches/filters/_pass_type.html.haml +9 -0
  272. data/app/views/advanced_searches/filters/_relationships.html.haml +8 -0
  273. data/app/views/advanced_searches/filters/_segment.html.haml +8 -0
  274. data/app/views/advanced_searches/filters/_tagging.html.haml +9 -0
  275. data/app/views/advanced_searches/new.html.haml +12 -0
  276. data/app/views/advanced_searches/show.html.haml +107 -0
  277. data/app/views/advanced_searches/shows_for_org.html.haml +1 -0
  278. data/app/views/advanced_searches/ticket_types_for_org.html.haml +1 -0
  279. data/app/views/advanced_searches/update.js.erb +9 -0
  280. data/app/views/appeals/_form.html.haml +113 -0
  281. data/app/views/appeals/_header.html.haml +6 -0
  282. data/app/views/appeals/_heard_action.html.haml +16 -0
  283. data/app/views/appeals/edit.html.haml +8 -0
  284. data/app/views/appeals/new.html.haml +6 -0
  285. data/app/views/campaigns/_campaign_donations.html.haml +19 -0
  286. data/app/views/campaigns/_campaign_stats.html.haml +28 -0
  287. data/app/views/campaigns/_form.html.haml +48 -0
  288. data/app/views/campaigns/_header.html.haml +6 -0
  289. data/app/views/campaigns/edit.html.haml +6 -0
  290. data/app/views/campaigns/index.html.haml +33 -0
  291. data/app/views/campaigns/new.html.haml +6 -0
  292. data/app/views/campaigns/show.html.haml +132 -0
  293. data/app/views/console_sales/_cart.html.haml +3 -2
  294. data/app/views/console_sales/_payment.html.haml +14 -1
  295. data/app/views/console_sales/new.html.haml +11 -6
  296. data/app/views/contributions/_form.html.haml +139 -37
  297. data/app/views/contributions/_header.html.haml +5 -0
  298. data/app/views/contributions/_match_eligible.html.haml +24 -0
  299. data/app/views/contributions/_pledge_payment.html.haml +22 -0
  300. data/app/views/contributions/_search.html.haml +30 -0
  301. data/app/views/contributions/_soft_credit.html.haml +25 -0
  302. data/app/views/contributions/edit.html.haml +5 -8
  303. data/app/views/contributions/find_person.html.haml +16 -15
  304. data/app/views/contributions/index.html.haml +61 -24
  305. data/app/views/contributions/new.html.haml +5 -5
  306. data/app/views/converts/_grouped_form.html.haml +11 -0
  307. data/app/views/converts/new.html.haml +35 -0
  308. data/app/views/delete_ticket_types/_cannot_destroy_modal.html.haml +11 -0
  309. data/app/views/delete_ticket_types/_cannot_destroy_modal.rb +0 -0
  310. data/app/views/delete_ticket_types/_confirm_destroy_modal.html.haml +13 -0
  311. data/app/views/delete_ticket_types/show.html.haml +4 -0
  312. data/app/views/discounts/_form.html.haml +1 -1
  313. data/app/views/events/_day_date_show.html.haml +4 -2
  314. data/app/views/events/_glance.html.haml +12 -12
  315. data/app/views/events/_header.html.haml +1 -1
  316. data/app/views/events/_list.html.haml +1 -1
  317. data/app/views/events/_menu.html.haml +26 -21
  318. data/app/views/events/_section_fields.html.haml +1 -1
  319. data/app/views/events/_tax_deductible_message.html.haml +3 -0
  320. data/app/views/events/_ticket_type_fields.html.haml +13 -3
  321. data/app/views/events/index.html.haml +2 -1
  322. data/app/views/events/messages.html.haml +12 -10
  323. data/app/views/events/show.html.haml +6 -6
  324. data/app/views/events/temp_discount_form.html.haml +1 -1
  325. data/app/views/events_pass_types/_form.html.haml +1 -1
  326. data/app/views/events_pass_types/new.html.haml +1 -2
  327. data/app/views/households/_edit_modal.html.haml +9 -4
  328. data/app/views/households/_form.html.haml +6 -1
  329. data/app/views/households/_header.html.haml +9 -18
  330. data/app/views/households/confirm.html.haml +43 -0
  331. data/app/views/households/new.html.haml +3 -1
  332. data/app/views/households/show.html.haml +2 -1
  333. data/app/views/households/suggested.html.haml +10 -27
  334. data/app/views/imports/_export_links.html.haml +2 -2
  335. data/app/views/imports/donations/_new.html.haml +49 -6
  336. data/app/views/imports/donations/_pending.html.haml +69 -22
  337. data/app/views/imports/donations/_preview.html.haml +23 -0
  338. data/app/views/imports/events/_new.html.haml +8 -8
  339. data/app/views/imports/index.html.haml +26 -21
  340. data/app/views/imports/memberships/_approved.html.haml +16 -0
  341. data/app/views/imports/memberships/_caching.html.haml +17 -0
  342. data/app/views/imports/memberships/_failed.html.haml +5 -0
  343. data/app/views/imports/memberships/_imported.html.haml +45 -0
  344. data/app/views/imports/memberships/_importing.html.haml +20 -0
  345. data/app/views/imports/memberships/_invalid.html.haml +5 -0
  346. data/app/views/imports/memberships/_new.html.haml +155 -0
  347. data/app/views/imports/memberships/_pending.html.haml +85 -0
  348. data/app/views/imports/memberships/_preview_rows.html.haml +38 -0
  349. data/app/views/imports/people/_new.html.haml +81 -15
  350. data/app/views/imports/shared/_inspect_modal.html.haml +10 -1
  351. data/app/views/imports/shared/_new_sidebar.html.haml +12 -0
  352. data/app/views/imports/show.html.haml +0 -3
  353. data/app/views/index/_action.html.haml +4 -3
  354. data/app/views/index/_recent_activity.html.haml +14 -7
  355. data/app/views/index/dashboard.html.haml +27 -14
  356. data/app/views/job_monitors/_job_monitor_show.html.haml +34 -0
  357. data/app/views/job_monitors/_linking_job_monitor_show.html.haml +31 -0
  358. data/app/views/job_monitors/show.html.haml +1 -0
  359. data/app/views/layouts/_google_analytics.html.haml +9 -11
  360. data/app/views/layouts/_menu.html.haml +5 -3
  361. data/app/views/layouts/application.html.haml +12 -4
  362. data/app/views/layouts/devise_layout.html.haml +1 -1
  363. data/app/views/layouts/storefront.html.haml +7 -10
  364. data/app/views/members/index/index.html.haml +82 -4
  365. data/app/views/members/mailer/_invitation_body.html.haml +2 -2
  366. data/app/views/members/passwords/new.html.haml +13 -0
  367. data/app/views/members/sessions/new.html.haml +1 -1
  368. data/app/views/membership_comps/confirm.html.haml +10 -8
  369. data/app/views/membership_comps/create.html.haml +1 -3
  370. data/app/views/membership_kits/edit.html.haml +6 -0
  371. data/app/views/membership_types/_form.html.haml +1 -1
  372. data/app/views/membership_types/index.html.haml +11 -3
  373. data/app/views/memberships/index.html.haml +122 -109
  374. data/app/views/merges/find_person.html.haml +5 -3
  375. data/app/views/merges/new.html.haml +13 -4
  376. data/app/views/notes/_note.html.haml +3 -3
  377. data/app/views/order_mailer/confirmation_for.html.haml +1 -0
  378. data/app/views/order_mailer/confirmation_for.text.haml +1 -0
  379. data/app/views/orders/_assignable_donations.html.haml +25 -0
  380. data/app/views/orders/_assignable_pledges.html.haml +26 -0
  381. data/app/views/orders/_item_table.haml +20 -8
  382. data/app/views/orders/_order_sidebar.html.haml +37 -7
  383. data/app/views/orders/membership.html.haml +2 -2
  384. data/app/views/orders/passes.html.haml +4 -4
  385. data/app/views/orders/sales.html.haml +5 -5
  386. data/app/views/orders/show.html.haml +26 -7
  387. data/app/views/organizations/_form.html.haml +0 -5
  388. data/app/views/pass_types/index.html.haml +13 -5
  389. data/app/views/passes/index.html.haml +50 -39
  390. data/app/views/passes_kits/edit.html.haml +6 -0
  391. data/app/views/passes_reports/index.html.haml +1 -1
  392. data/app/views/pdfs/member.html.haml +1 -1
  393. data/app/views/pdfs/member_card_generator/blanks_usa_idc6.html.haml +1 -1
  394. data/app/views/pdfs/order.html.haml +5 -3
  395. data/app/views/people/_address_fields.html.haml +40 -0
  396. data/app/views/people/_convert_to_company_modal.html.haml +3 -0
  397. data/app/views/people/_edit_modal.html.haml +121 -38
  398. data/app/views/people/_form.html.haml +8 -14
  399. data/app/views/people/_header.html.haml +11 -16
  400. data/app/views/people/_list.html.haml +3 -9
  401. data/app/views/people/_mailchimp_group.html.haml +3 -0
  402. data/app/views/people/_phone_fields.html.haml +1 -1
  403. data/app/views/people/_relationship_fields.html.haml +10 -5
  404. data/app/views/people/_work_with_menu.html.haml +14 -8
  405. data/app/views/people/index.html.haml +10 -9
  406. data/app/views/people/new.html.haml +18 -4
  407. data/app/views/people/pledges.html.haml +13 -0
  408. data/app/views/people/show.html.haml +96 -45
  409. data/app/views/pledges/_none_scheduled_payment_table.html.haml +17 -0
  410. data/app/views/pledges/_receive_pledge.html.haml +87 -0
  411. data/app/views/pledges/_scheduled_payments_table.html.haml +18 -0
  412. data/app/views/pledges/index.html.haml +47 -0
  413. data/app/views/preview_rows/index.html.haml +1 -0
  414. data/app/views/producer_mailer/donation_notification.html.haml +9 -0
  415. data/app/views/producer_mailer/donation_notification.text.erb +8 -0
  416. data/app/views/producer_mailer/door_list_notification.html.haml +10 -0
  417. data/app/views/producer_mailer/door_list_notification.text.erb +6 -0
  418. data/app/views/producer_mailer/mailchimp_kit_initial_sync_notification.html.haml +2 -2
  419. data/app/views/regular_donation_kits/edit.html.haml +29 -1
  420. data/app/views/relationships/index.html.haml +1 -1
  421. data/app/views/sales/_boxoffice.html.haml +15 -5
  422. data/app/views/sales/_doorlist.html.haml +2 -2
  423. data/app/views/sales/new.html.haml +2 -2
  424. data/app/views/searches/_company.html.haml +7 -0
  425. data/app/views/searches/_form.html.haml +75 -8
  426. data/app/views/searches/_household.html.haml +2 -2
  427. data/app/views/searches/_individual.html.haml +7 -0
  428. data/app/views/searches/show.html.haml +59 -23
  429. data/app/views/segments/index.html.haml +1 -1
  430. data/app/views/segments/show.html.haml +36 -1
  431. data/app/views/shared/_baseball_card.html.haml +40 -0
  432. data/app/views/shared/_tags.html.haml +10 -8
  433. data/app/views/shows/_empty_ticket_table.html.haml +12 -0
  434. data/app/views/shows/_sections_table.html.haml +78 -69
  435. data/app/views/shows/_ticket_table.html.haml +10 -7
  436. data/app/views/shows/index.html.haml +95 -85
  437. data/app/views/statements/_shows.html.haml +1 -1
  438. data/app/views/store/checkouts/_event_information.html.haml +89 -0
  439. data/app/views/store/checkouts/_shopping_cart_display.haml +8 -0
  440. data/app/views/store/checkouts/_thanks.html.haml +40 -0
  441. data/app/views/store/checkouts/create.html.haml +1 -0
  442. data/app/views/store/checkouts/shopping_cart_display/_discounts.haml +8 -0
  443. data/app/views/store/checkouts/shopping_cart_display/_donations.haml +15 -0
  444. data/app/views/store/checkouts/{_membership_info.html.haml → shopping_cart_display/_membership_info.html.haml} +0 -0
  445. data/app/views/store/checkouts/shopping_cart_display/_memberships.haml +8 -0
  446. data/app/views/store/checkouts/shopping_cart_display/_passes.haml +9 -0
  447. data/app/views/store/checkouts/shopping_cart_display/_tickets.haml +10 -0
  448. data/app/views/store/checkouts/shopping_cart_display/_total.haml +10 -0
  449. data/app/views/store/donations/index.html.haml +4 -0
  450. data/app/views/store/events/_contact_info.html.haml +8 -0
  451. data/app/views/store/events/_venue.html.haml +14 -7
  452. data/app/views/store/events/calendar.html.haml +2 -9
  453. data/app/views/store/events/show.html.haml +2 -9
  454. data/app/views/store/events/single_show.html.haml +3 -3
  455. data/app/views/store/memberships/index.html.haml +3 -3
  456. data/app/views/store/orders/blank.html.erb +34 -0
  457. data/app/views/store/orders/show.html.haml +15 -6
  458. data/app/views/store/passes/index.html.haml +3 -3
  459. data/app/views/store/shared/_small_donate_form.html.haml +21 -18
  460. data/app/views/tags/_edit_modal.html.haml +16 -0
  461. data/app/views/tags/index.html.haml +23 -0
  462. data/app/views/unacknowledged_gifts/_heard_action.html.haml +10 -0
  463. data/app/views/unacknowledged_gifts/index.html.haml +76 -0
  464. data/app/views/user_memberships/_list.html.haml +147 -24
  465. data/config/initializers/delayed_job_config.rb +10 -1
  466. data/config/routes.rb +85 -9
  467. data/db/migrate/20140422193345_add_email_copy_to_pass_type.rb +1 -1
  468. data/db/migrate/20140616045851_add_birthdate_to_search.rb +7 -0
  469. data/db/migrate/20140623131025_create_campaigns.rb +27 -0
  470. data/db/migrate/20140627120214_create_appeals.rb +28 -0
  471. data/db/migrate/20140630151406_add_deleted_at_to_campaigns.rb +9 -0
  472. data/db/migrate/20140701124100_add_segment_id_and_notes_to_appeals.rb +12 -0
  473. data/db/migrate/20140702115815_add_campaign_id_and_appeal_id_to_donations.rb +14 -0
  474. data/db/migrate/20140702121928_add_materials_to_appeals.rb +11 -0
  475. data/db/migrate/20140702150521_add_deleted_at_to_appeals.rb +9 -0
  476. data/db/migrate/20140709151816_add_campaign_id_and_appeal_id_to_orders.rb +14 -0
  477. data/db/migrate/20140723133850_remove_campaign_id_and_apeal_id_from_orders.rb +11 -0
  478. data/db/migrate/20140723134923_add_commitment_date_to_donations.rb +6 -0
  479. data/db/migrate/20140730141515_add_match_eligible_to_donations.rb +15 -0
  480. data/db/migrate/20140818141140_create_soft_credits.rb +12 -0
  481. data/db/migrate/20140903140113_add_pledge_to_donations.rb +9 -0
  482. data/db/migrate/20140904183953_add_destroyed_at_to_relationships.rb +7 -0
  483. data/db/migrate/20140905080503_create_scheduled_pledge_payments.rb +16 -0
  484. data/db/migrate/20140909150251_add_org_to_suggested_household.rb +7 -0
  485. data/db/migrate/20141007114614_add_order_id_to_donations.rb +15 -0
  486. data/db/migrate/20141021134013_add_lifetime_pledges_to_people.rb +5 -0
  487. data/db/migrate/20141027191307_default_overwrite_member_addresses_to_false.rb +5 -0
  488. data/db/migrate/20141031193839_update_relations.rb +9 -0
  489. data/db/migrate/20141126183258_add_mailchimp_status_fields_to_people.rb +6 -0
  490. data/db/migrate/20141126184811_add_processing_at_to_ticket.rb +5 -0
  491. data/db/migrate/20141127135743_add_import_to_campaigns.rb +6 -0
  492. data/db/migrate/20141128143944_add_fiscal_year_to_donations.rb +5 -0
  493. data/db/migrate/20141128151407_remove_fiscal_year_from_scheduled_pledge_payments.rb +3 -0
  494. data/db/migrate/20141204164400_add_more_indexes_to_actions.rb +7 -0
  495. data/db/migrate/20141204171612_add_indexes_to_charts.rb +12 -0
  496. data/db/migrate/20141204172658_add_hide_on_recent_activity_to_actions.rb +5 -0
  497. data/db/migrate/20141204173004_add_indexes_to_ept.rb +9 -0
  498. data/db/migrate/20141204211933_remove_membership_counts_from_members.rb +13 -0
  499. data/db/migrate/20141205202030_create_subscribed_lists.rb +19 -0
  500. data/db/migrate/20141208225228_add_mailchimp_lists_to_searches.rb +5 -0
  501. data/db/migrate/20141210162329_add_bounced_to_subscribed_lists.rb +5 -0
  502. data/db/migrate/20141211165307_add_external_reference_to_actions.rb +5 -0
  503. data/db/migrate/20141212172119_add_not_mailchimp_lists_to_searches.rb +5 -0
  504. data/db/migrate/20141229204605_normalize_states_in_addresses.rb +11 -0
  505. data/db/migrate/20150113091344_add_fiscal_to_organizations.rb +11 -0
  506. data/db/migrate/20150113091434_create_budget_restrictions.rb +14 -0
  507. data/db/migrate/20150113091503_add_budget_restriction_to_campaigns.rb +14 -0
  508. data/db/migrate/20150129091354_add_campaign_to_searches.rb +13 -0
  509. data/db/migrate/20150203174456_create_list_groupings.rb +12 -0
  510. data/db/migrate/20150203222451_add_groupings_to_searches.rb +6 -0
  511. data/db/migrate/20150219153827_add_roles_to_user_memberships.rb +13 -0
  512. data/db/migrate/20150223145657_add_daily_sales_to_user_membership.rb +13 -0
  513. data/db/migrate/20150318171857_create_advanced_searches.rb +16 -0
  514. data/db/migrate/20150319185940_add_org_id_index_to_orders.rb +5 -0
  515. data/db/migrate/20150325085516_add_received_amount_to_donations.rb +16 -0
  516. data/db/migrate/20150325173053_add_pass_index_to_tickets.rb +5 -0
  517. data/db/migrate/20150331084817_add_creator_id_to_orders.rb +11 -0
  518. data/db/migrate/20150406162656_index_tickets_on_action_id.rb +5 -0
  519. data/db/migrate/20150408123349_add_donor_instructions_to_orders.rb +9 -0
  520. data/db/migrate/20150408125600_add_index_to_imports.rb +5 -0
  521. data/db/migrate/20150414193419_add_index_to_phone.rb +5 -0
  522. data/db/migrate/20150414193646_add_index_to_taggings.rb +5 -0
  523. data/db/migrate/20150415113013_add_nickname_to_people.rb +11 -0
  524. data/db/migrate/20150420143707_add_indexes_to_donations.rb +7 -0
  525. data/db/migrate/20150421092302_add_kind_to_addresses.rb +11 -0
  526. data/db/migrate/20150513154513_add_name_to_advanced_search.rb +5 -0
  527. data/db/migrate/20150518131946_add_receive_donation_notification_to_user_memberships.rb +9 -0
  528. data/db/migrate/20150520182350_remove_name_from_advanced_search.rb +9 -0
  529. data/db/migrate/20150520202900_create_advanced_search_segments.rb +9 -0
  530. data/db/migrate/20150520210658_add_advanced_search_id_to_advanced_search_segment.rb +5 -0
  531. data/db/migrate/20150521183507_add_organization_id_to_advanced_search_segment.rb +5 -0
  532. data/db/migrate/20150602204548_add_index_on_deleted_at.rb +5 -0
  533. data/db/migrate/20150711143014_add_receive_door_list_to_user_memberships.rb +10 -0
  534. data/db/migrate/20150716000301_create_job_monitors_table.rb +12 -0
  535. data/db/migrate/20150807005404_re_refresh_show_stats.rb +8 -0
  536. data/db/migrate/20150810133417_convert_business_to_work.rb +5 -0
  537. data/db/migrate/20150812135205_update_notes_nulls.rb +9 -0
  538. data/db/migrate/20150813202745_index_household_id.rb +6 -0
  539. data/db/migrate/20150814075653_add_maiden_name_to_people.rb +9 -0
  540. data/db/migrate/20150911203530_normalize_countries_in_addresses.rb +11 -0
  541. data/db/migrate/20150922155253_add_advanced_search_segment_id_to_membership_types.rb +5 -0
  542. data/db/migrate/20150922155308_add_advanced_search_segment_id_to_pass_types.rb +5 -0
  543. data/db/migrate/20151006180702_add_deleted_at_to_ticket_types.rb +5 -0
  544. data/db/migrate/20151009175206_add_receipt_details_to_ticket_types.rb +5 -0
  545. data/db/migrate/20151112174723_index_list_groupings.rb +5 -0
  546. data/lib/artfully_ose/common_abilities.rb +80 -57
  547. data/lib/artfully_ose/version.rb +1 -1
  548. data/lib/tasks/artfully_ose.rake +46 -4
  549. data/spec/factories/action_factories.rb +2 -0
  550. data/spec/factories/address_factories.rb +2 -2
  551. data/spec/factories/advanced_search_factories.rb +45 -0
  552. data/spec/factories/advanced_search_segment_factories.rb +6 -0
  553. data/spec/factories/advanced_segment_factories.rb +6 -0
  554. data/spec/factories/campaign_factories.rb +20 -0
  555. data/spec/factories/cart_factories.rb +24 -0
  556. data/spec/factories/chart_factories.rb +4 -0
  557. data/spec/factories/event_factories.rb +6 -0
  558. data/spec/factories/item_factories.rb +23 -1
  559. data/spec/factories/kit_factories.rb +27 -3
  560. data/spec/factories/member_factories.rb +8 -1
  561. data/spec/factories/membership_factories.rb +12 -0
  562. data/spec/factories/membership_type_factories.rb +18 -0
  563. data/spec/factories/note_factories.rb +7 -0
  564. data/spec/factories/order_factories.rb +7 -0
  565. data/spec/factories/pass_factories.rb +6 -0
  566. data/spec/factories/payments_factories.rb +1 -1
  567. data/spec/factories/person_factories.rb +46 -4
  568. data/spec/factories/scheduled_pledge_payment_factories.rb +10 -0
  569. data/spec/factories/show_factories.rb +8 -3
  570. data/spec/factories/soft_credit_factories.rb +8 -0
  571. data/spec/factories/ticket_factories.rb +22 -9
  572. data/spec/factories/user_factories.rb +16 -8
  573. metadata +342 -59
  574. data/app/controllers/comps_controller.rb +0 -47
  575. data/app/models/household_suggester.rb +0 -58
  576. data/app/views/searches/_person.html.haml +0 -10
  577. data/app/views/store/checkouts/thanks.html.haml +0 -134
@@ -3,7 +3,7 @@ class Section < ActiveRecord::Base
3
3
  attr_accessor :skip_create_first_ticket_type
4
4
  foundry :with => lambda { { :section_id => id, :count => capacity } }
5
5
 
6
- attr_accessible :name, :capacity, :price, :chart_id, :old_mongo_id, :description, :ticket_types_attributes, :members
6
+ attr_accessible :name, :capacity, :price, :chart_id, :description, :ticket_types_attributes, :members
7
7
  delegate :show, :to => :chart
8
8
 
9
9
  has_many :ticket_types, :order => 'price DESC'
@@ -60,10 +60,12 @@ class Section < ActiveRecord::Base
60
60
  types << ticket_types.storefront
61
61
  unless member.nil?
62
62
 
63
- #Add "unrestricted member" ticket_types that aren't tied to a particular membership type
64
- types << ticket_types.members.select{|ticket_type| !ticket_type.member_ticket?} unless member.nil?
63
+ # Add ticket types that are visible to members but *do not* have a membership
64
+ # type assigned. This is a case where a producer wants to show a ticket type to all members
65
+ # but not restrict that ticket type to a particular set of members
66
+ types << ticket_types.members.select{|ticket_type| !ticket_type.member_ticket?}
65
67
 
66
- #Now add member ticket_types that apply to this particular member
68
+ # Now add member ticket_types that apply to this particular member
67
69
  membership_type_ids = member.nil? ? [] : member.current_membership_types.collect(&:id)
68
70
  types << ticket_types.select{|ticket_type| ticket_type.members && membership_type_ids.include?(ticket_type.membership_type_id) }
69
71
  end
@@ -6,7 +6,7 @@ class Show < ActiveRecord::Base
6
6
  include Ext::Integrations::Show
7
7
  include Ext::Uuid
8
8
 
9
- attr_accessible :datetime, :event_id, :chart_id, :organization_id, :old_mongo_id, :cached_stats
9
+ attr_accessible :datetime, :event_id, :chart_id, :organization_id, :cached_stats
10
10
  store :cached_stats, :accessors => [ :capacity, :on_sale, :off_sale, :open, :sold, :comped, :local_datetime, :offset, :time_zone, :iana_time_zone ]
11
11
 
12
12
 
@@ -45,7 +45,9 @@ class Show < ActiveRecord::Base
45
45
 
46
46
  delegate :free?, :to => :event
47
47
 
48
- state_machine do
48
+ ANY_SHOW_ID = "-1"
49
+
50
+ state_machine :auto_scopes => true do
49
51
 
50
52
  #pending and built are deprecated, left in only because we have shows in production which are built
51
53
  state :pending
@@ -75,8 +77,7 @@ class Show < ActiveRecord::Base
75
77
  .where(:pass_type_id => pass.pass_type.id).first
76
78
 
77
79
  return false if epts.blank?
78
-
79
- return !epts.excluded_shows.include?(self.id)
80
+ return !epts.excluded_shows.include?(self.id.to_s)
80
81
  end
81
82
 
82
83
  #
@@ -85,7 +86,15 @@ class Show < ActiveRecord::Base
85
86
  def refresh_stats
86
87
  tickets.reload
87
88
 
88
- self.local_datetime = self.datetime_local_to_event.to_s unless self.event.nil?
89
+ #
90
+ # The upgrade to Ruby 2.1 left this serialization doing really funny things
91
+ # attempting to serialize this as a DateTime somehow lost time precision so
92
+ # all shows would a date but 00:00:00 UTC for showtime
93
+ #
94
+ # Thus, we have no choice but to store this as a String and parse it everywhere
95
+ # that is is needed
96
+ #
97
+ self.local_datetime = self.datetime_local_to_unscoped_event.to_s unless self.event_id.nil?
89
98
 
90
99
  self.capacity = self.glance.available.capacity
91
100
  self.on_sale = self.glance.available.on_sale
@@ -94,20 +103,20 @@ class Show < ActiveRecord::Base
94
103
  self.comped = self.glance.comped.total
95
104
  self.open = self.glance.available.open
96
105
 
97
- unless self.event.time_zone.nil?
98
- self.offset = ActiveSupport::TimeZone.create(self.event.time_zone).parse(self.local_datetime).formatted_offset
106
+ if self.event_id.present? && self.unscoped_event.time_zone.present?
107
+ self.offset = ActiveSupport::TimeZone.create(self.unscoped_event.time_zone).parse(self.local_datetime).formatted_offset
108
+ self.time_zone = self.unscoped_event.time_zone
109
+ self.iana_time_zone = ActiveSupport::TimeZone::MAPPING[self.unscoped_event.time_zone]
99
110
  end
100
-
101
- self.time_zone = self.event.time_zone
102
- self.iana_time_zone = ActiveSupport::TimeZone::MAPPING[self.event.time_zone]
111
+
112
+ self.event.delay.refresh_stats unless self.event.nil?
103
113
 
104
114
  self.save(:validate => false)
105
- self.event.delay.refresh_stats
106
115
  self.cached_stats
107
116
  end
108
117
 
109
118
  def parsed_local_datetime
110
- @parsed_local_datetime = (DateTime.parse(self.local_datetime) rescue self.datetime_local_to_event)
119
+ @parsed_local_datetime = (DateTime.parse(self.local_datetime.to_s) rescue self.datetime_local_to_event)
111
120
  end
112
121
 
113
122
  def create_and_on_sale_tickets
@@ -0,0 +1,45 @@
1
+ class ShowValidator
2
+
3
+ attr_accessor :consumer, :params
4
+
5
+ def initialize(consumer, params)
6
+ @consumer = consumer
7
+ @params = params
8
+ end
9
+
10
+ def validate(event)
11
+ if check_datetimes
12
+ consumer.datetime_error_and_redirect(event)
13
+ elsif check_charts
14
+ consumer.chart_error_and_redirect(event)
15
+ elsif check_ticket_types
16
+ consumer.ticket_type_error_and_redirect(event)
17
+ else
18
+ consumer.valid_show_succeed(params, event)
19
+ end
20
+ end
21
+
22
+ def check_datetimes
23
+ if params['show']['datetime'].blank?
24
+ true
25
+ end
26
+ end
27
+
28
+ def check_charts
29
+ if params['show']['chart'].blank? || params['show']['chart'].nil?
30
+ true
31
+ end
32
+ end
33
+
34
+ def check_ticket_types
35
+ checker = false
36
+ params['show']['chart']['sections_attributes']['0']['ticket_types_attributes'].each_value do |inner_hash|
37
+ inner_hash.each do |key, value|
38
+ if key == 'name' && value == ''
39
+ checker = true
40
+ end
41
+ end
42
+ end
43
+ checker
44
+ end
45
+ end
@@ -0,0 +1,126 @@
1
+ class SoftCredit < ActiveRecord::Base
2
+ attr_accessible :amount, :donation_id, :organization_id, :person_id
3
+ belongs_to :person
4
+ belongs_to :organization
5
+
6
+ after_save :calculate_lifetime_value
7
+ after_destroy :calculate_lifetime_value
8
+
9
+
10
+ def self.update_soft_credits(db_soft_credits, curr_soft_credits, donation_id, organization_id)
11
+ new_soft_credits = db_soft_credits.empty? ? curr_soft_credits : []
12
+ updated_soft_credits = Set.new
13
+ deleted_soft_credits = {}
14
+
15
+ db_soft_credits.each do |db_sc|
16
+ deleted_soft_credits[db_sc.id] = db_sc if db_sc.id > 0 #mark temporary all as deleted
17
+ curr_soft_credits.each do |curr_sc|
18
+ deleted_soft_credits.delete(db_sc.id) if curr_sc.id == db_sc.id #remove from deleted list presented only
19
+ if curr_sc.id == db_sc.id && db_sc.amount != curr_sc.amount
20
+ db_sc.amount = curr_sc.amount
21
+ updated_soft_credits << db_sc # if amount is changed - mark as updated
22
+ elsif curr_sc.id < 0
23
+ new_soft_credits << curr_sc #all with negative id are new
24
+ end
25
+ end
26
+ end
27
+
28
+ new_soft_credits = new_soft_credits.uniq
29
+
30
+ save_all(new_soft_credits.uniq, donation_id, organization_id)
31
+ updated_soft_credits.each do |sc| #update existing records
32
+ sc.save!
33
+ end
34
+ SoftCredit.where(:id => deleted_soft_credits.keys.to_a()).destroy_all # destroy deleted records
35
+
36
+ {:new => new_soft_credits, :updated => updated_soft_credits, :deleted => deleted_soft_credits}
37
+ end
38
+
39
+ def self.save_all(new_soft_credits, donation_id, organization_id)
40
+ new_soft_credits.each do |new_sc|
41
+ next if new_sc.person_id.to_i <= 0
42
+ new_sc.id = nil if new_sc.id.to_i <= 0
43
+ new_sc.donation_id = donation_id
44
+ new_sc.organization_id = organization_id
45
+ new_sc.save!
46
+ end
47
+ end
48
+
49
+ def self.build_soft_credits(soft_credits_hash)
50
+ soft_credits = []
51
+ soft_credits_hash.each do |id, sc|
52
+ soft_credit = SoftCredit.new
53
+ soft_credit.id = id.to_i
54
+ soft_credit.person_id = sc[:person_id].to_i
55
+ soft_credit.amount = sc[:amount].to_i
56
+ soft_credits << soft_credit
57
+ end
58
+ soft_credits
59
+ end
60
+
61
+ def self.default_soft_credit
62
+ soft_credit = SoftCredit.new
63
+ soft_credit.id = -Time.now.to_i
64
+ soft_credit
65
+ end
66
+
67
+ def build_sc_action(contribution, order)
68
+ action = GiveAction.for_organization(contribution.organization)
69
+
70
+ action.person = Person.find(person_id)
71
+ action.subject = order
72
+ action.import_id = order.import_id
73
+ action.occurred_at = contribution.occurred_at
74
+ action.creator_id = contribution.creator_id
75
+ action.details = action_details(contribution)
76
+
77
+
78
+ action
79
+ end
80
+
81
+ def action_details(contribution)
82
+ donor = Person.find(contribution.person_id)
83
+ the_amount = amount.to_i > 0 ? amount * 100 : contribution.amount
84
+ details = Contribution.number_as_cents(the_amount)
85
+ details << ' for ' << contribution.campaign.name if contribution.campaign
86
+ details << ' (soft credit for gift from ' << donor.to_s << ')'
87
+ details
88
+ end
89
+
90
+ def calculate_lifetime_value
91
+ # async on person
92
+ self.person.calculate_lifetime_value
93
+ end
94
+
95
+ def self.update_sc_actions(contr, order, sc_hash)
96
+ new_soft_credits = sc_hash[:new]
97
+ updated_soft_credits = sc_hash[:updated]
98
+ deleted_soft_credits = sc_hash[:deleted]
99
+
100
+ new_soft_credits.each do |sc|
101
+ next if sc.person_id.to_i <= 0
102
+ action = sc.build_sc_action(contr, order)
103
+ action.save!
104
+ end
105
+
106
+ updated_soft_credits.each do |sc|
107
+ person = Person.find(sc.person_id)
108
+ action = person.actions.where(:subject_type => 'Order').where(:subject_id => order.id).first
109
+ action.update_attribute(:details, sc.action_details(contr))
110
+ end
111
+
112
+ deleted_soft_credits.each do |key, sc|
113
+ person = Person.find(sc.person_id)
114
+ action = person.actions.where(:subject_type => 'Order').where(:subject_id => order.id).first
115
+ action.destroy
116
+ end
117
+ end
118
+
119
+ def self.soft_credits_by(person)
120
+ soft_credits = SoftCredit.where(:person_id => person.id)
121
+ {:count => soft_credits.count, :amount => soft_credits.sum(:amount).to_i * 100}
122
+ # amount = SoftCredit.where(:person_id => person.id).sum(:amount).to_i
123
+ # amount * 100
124
+ end
125
+
126
+ end
@@ -0,0 +1,52 @@
1
+ class SubscribedList < ActiveRecord::Base
2
+ attr_accessor :sync, :single_optin
3
+
4
+ attr_accessible :list_id, :sync, :single_optin, :confirmed, :bounced
5
+
6
+ belongs_to :person
7
+ has_many :groupings, :class_name => "ListGrouping"
8
+
9
+ validates :list_id, :presence => true, :uniqueness => { :scope => :person_id }
10
+
11
+ after_create :push_create_to_mailchimp
12
+ before_destroy :push_destroy_to_mailchimp
13
+ after_save { person.solr_index! if person }
14
+ after_destroy { person.solr_index! if person }
15
+
16
+ delegate :organization, :to => :person
17
+
18
+ after_initialize do
19
+ self.sync = true if sync.nil?
20
+ end
21
+
22
+ def self.not_bounced
23
+ where(:bounced => false)
24
+ end
25
+
26
+ private
27
+
28
+ def mailchimp_kit
29
+ organization.kits.mailchimp
30
+ end
31
+
32
+ def push_create_to_mailchimp
33
+ return unless sync
34
+ job = MailchimpSyncJob.new(mailchimp_kit, {
35
+ :type => :person_subscribe,
36
+ :person_id => person_id,
37
+ :list_id => list_id,
38
+ :single_optin => single_optin,
39
+ })
40
+ Delayed::Job.enqueue(job, :queue => "mailchimp") if !mailchimp_kit.cancelled?
41
+ end
42
+
43
+ def push_destroy_to_mailchimp
44
+ return unless sync
45
+ job = MailchimpSyncJob.new(mailchimp_kit, {
46
+ :type => :person_unsubscribe,
47
+ :person_id => person_id,
48
+ :list_id => list_id,
49
+ })
50
+ Delayed::Job.enqueue(job, :queue => "mailchimp") if !mailchimp_kit.cancelled?
51
+ end
52
+ end
@@ -1,5 +1,7 @@
1
1
  class SuggestedHousehold < ActiveRecord::Base
2
- attr_accessible :ids, :ignored
2
+ attr_accessible :ids, :ignored, :organization_id
3
+
4
+ belongs_to :organization
3
5
 
4
6
  def self.with_people(people)
5
7
  ids = people.map(&:id).sort.join(',')
@@ -14,11 +16,15 @@ class SuggestedHousehold < ActiveRecord::Base
14
16
  def self.find_or_create_with_people(people)
15
17
  ids = people.map(&:id).sort.join(',')
16
18
  matches = where(:ids => ids)
17
- matches.first ? matches.first : SuggestedHousehold.create_with_people(people)
19
+ matches.first ? matches.first : create_with_people(people)
18
20
  end
19
21
 
20
22
  def individuals
21
23
  Individual.where(:id => ids.split(','))
22
24
  end
23
25
 
26
+ def ignore!
27
+ update_attributes(:ignored => true)
28
+ end
29
+
24
30
  end
@@ -1,4 +1,4 @@
1
- class Ticket < ActiveRecord::Base
1
+ class Ticket < ActiveRecord::Base
2
2
  include ActiveRecord::Transitions
3
3
  include Ext::Resellable::Ticket
4
4
  include Ext::Integrations::Ticket
@@ -23,12 +23,16 @@
23
23
  belongs_to :action, :foreign_key => "validated_action_id", :class_name => "GoAction"
24
24
 
25
25
  #
26
- # This refs the ticket_type that the ticket was sold under, NOT an array of ticket types available
26
+ # This refs the ticket_type that the ticket was sold under,
27
+ # NOT an array of ticket types available
27
28
  #
28
29
  belongs_to :ticket_type
29
-
30
+
30
31
  has_many :items, :as => :product
31
32
 
33
+ after_save { buyer.solr_index! if buyer }
34
+ after_destroy { buyer.solr_index! if buyer }
35
+
32
36
  has_attached_file :qr_code, TICKET_QR_STORAGE
33
37
 
34
38
  delegate :url, :to => :qr_code, :prefix => true
@@ -48,8 +52,9 @@
48
52
 
49
53
  #Used when unlocking tickets. We don't want to unlocked sold or comped tickets.
50
54
  scope :uncommitted, where("state != 'sold'").where("state != 'comped'")
55
+ scope :sold_or_comped, where(:state => [:sold, :comped])
51
56
 
52
- state_machine do
57
+ state_machine :auto_scopes => true do
53
58
  state :off_sale
54
59
  state :on_sale
55
60
  state :sold
@@ -64,6 +69,22 @@
64
69
  event(:return_off_sale) { transitions :from => [ :comped, :sold ], :to => :off_sale }
65
70
  end
66
71
 
72
+ searchable do
73
+ integer :buyer_id, stored: true
74
+ integer :organization_id
75
+ integer :show_id
76
+ integer :event_id do
77
+ show.nil? ? nil : show.event_id
78
+ end
79
+ date :show_date do
80
+ (show.nil? || show.event.nil?) ? nil : show.datetime_local_to_event
81
+ end
82
+ integer :ticket_type_id do
83
+ ticket_type.id unless ticket_type.nil?
84
+ end
85
+ end
86
+ include Ext::DelayedIndexing
87
+
67
88
  def datetime
68
89
  show.datetime_local_to_event
69
90
  end
@@ -76,7 +97,7 @@
76
97
  end
77
98
 
78
99
  #
79
- # This is here so that Item.for can add tickets.
100
+ # This is here so that Item.for can add tickets.
80
101
  # Ticket is composing what it means to be turned into an item
81
102
  #
82
103
  def price
@@ -84,7 +105,7 @@
84
105
  end
85
106
 
86
107
  def as_json(options = {})
87
- super(options).merge!({:ticket_type => ticket_type}).except!("section_id", "buyer_id", "show_id", "ticket_type_id", "cart_id", "discount_id", "organization_id", "old_mongo_id")
108
+ super(options).merge!({:ticket_type => ticket_type}).except!("section_id", "buyer_id", "show_id", "ticket_type_id", "cart_id", "discount_id", "organization_id")
88
109
  end
89
110
 
90
111
  def self.unsold
@@ -123,13 +144,13 @@
123
144
  def settled_item
124
145
  @settled_item ||= items.select(&:settled?).first
125
146
  end
126
-
147
+
127
148
  def sold_item
128
149
  items.select(&:purchased?).first ||
129
150
  items.select(&:settled?).first ||
130
151
  items.select(&:comped?).first
131
152
  end
132
-
153
+
133
154
  def special_instructions
134
155
  sold_item.try(:order).try(:special_instructions)
135
156
  end
@@ -168,6 +189,10 @@
168
189
  !expired?
169
190
  end
170
191
 
192
+ def convertable?
193
+ !expired?
194
+ end
195
+
171
196
  def committed?
172
197
  sold? or comped?
173
198
  end
@@ -207,12 +232,12 @@
207
232
  quantity.times do
208
233
  new_tickets << build_one(show, section, quantity, on_sale)
209
234
  end
210
-
235
+
211
236
  result = Ticket.import(new_tickets)
212
237
  show.refresh_stats
213
238
  result
214
239
  end
215
-
240
+
216
241
  #
217
242
  # This method does not refresh show stats
218
243
  # Callers should do that manually with show.delay.refresh_stats