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.
- checksums.yaml +5 -13
- data/app/assets/images/actions/open.png +0 -0
- data/app/assets/images/actions/pledge.png +0 -0
- data/app/assets/images/actions/pledge.psd +0 -0
- data/app/assets/images/glyphish/gray/cancel.png +0 -0
- data/app/assets/images/loading_gray.gif +0 -0
- data/app/assets/javascripts/application.js +30 -4
- data/app/assets/javascripts/baseball_card.js.coffee +235 -0
- data/app/assets/javascripts/boxoffice.js +12 -49
- data/app/assets/javascripts/contributions.js +264 -0
- data/app/assets/javascripts/custom/advanced_searches.js +142 -0
- data/app/assets/javascripts/custom/endless-scroll.js +1 -1
- data/app/assets/javascripts/custom/job-monitor.js +73 -0
- data/app/assets/javascripts/custom/kits-config.js +0 -2
- data/app/assets/javascripts/custom/mailchimp.js +14 -0
- data/app/assets/javascripts/custom/people.js +31 -2
- data/app/assets/javascripts/custom/person-finder.js +34 -0
- data/app/assets/javascripts/custom/searches.js +12 -0
- data/app/assets/javascripts/custom/user-finder.js +111 -0
- data/app/assets/javascripts/households.js +12 -5
- data/app/assets/javascripts/ical.js +138 -0
- data/app/assets/javascripts/jquery-lib/jquery.timeago.js +221 -0
- data/app/assets/javascripts/locationselector.js +1 -1
- data/app/assets/javascripts/memberships.js +24 -0
- data/app/assets/javascripts/relationships.js +10 -0
- data/app/assets/javascripts/search.js +22 -0
- data/app/assets/javascripts/store/sliding-wizard.js +2 -2
- data/app/assets/javascripts/store/store.js +51 -6
- data/app/assets/javascripts/tags.js +44 -0
- data/app/assets/stylesheets/application.sass +331 -32
- data/app/assets/stylesheets/bootstrap-overrides.css +24 -9
- data/app/assets/stylesheets/boxoffice.css.scss +0 -4
- data/app/assets/stylesheets/sass/_campaigns.sass +43 -0
- data/app/assets/stylesheets/sass/_tags.sass +10 -1
- data/app/assets/stylesheets/sass/fa-color.css.scss +13 -0
- data/app/assets/stylesheets/sass/store.sass +7 -7
- data/app/concerns/cart_finder.rb +10 -0
- data/app/concerns/oh_noes.rb +1 -1
- data/app/controllers/actions_controller.rb +5 -5
- data/app/controllers/addresses_controller.rb +1 -1
- data/app/controllers/advanced_search_segments_controller.rb +97 -0
- data/app/controllers/advanced_searches_controller.rb +118 -0
- data/app/controllers/appeals_controller.rb +63 -0
- data/app/controllers/artfully_ose_controller.rb +20 -2
- data/app/controllers/campaigns_controller.rb +90 -0
- data/app/controllers/charts_controller.rb +8 -2
- data/app/controllers/console_sales_controller.rb +21 -23
- data/app/controllers/contributions_controller.rb +74 -43
- data/app/controllers/converts_controller.rb +21 -0
- data/app/controllers/delete_ticket_types_controller.rb +35 -0
- data/app/controllers/events_pass_types_controller.rb +10 -2
- data/app/controllers/export_controller.rb +4 -4
- data/app/controllers/households_controller.rb +63 -15
- data/app/controllers/imports_controller.rb +13 -10
- data/app/controllers/job_monitors_controller.rb +9 -0
- data/app/controllers/members/people_controller.rb +7 -5
- data/app/controllers/members/sessions_controller.rb +1 -0
- data/app/controllers/membership_comps_controller.rb +5 -20
- data/app/controllers/memberships_controller.rb +2 -2
- data/app/controllers/merges_controller.rb +7 -6
- data/app/controllers/mobile/users_controller.rb +18 -6
- data/app/controllers/notes_controller.rb +5 -1
- data/app/controllers/orders_controller.rb +30 -13
- data/app/controllers/organizations_controller.rb +8 -0
- data/app/controllers/passes_kits_controller.rb +2 -4
- data/app/controllers/people_controller.rb +105 -17
- data/app/controllers/pledges_controller.rb +64 -0
- data/app/controllers/preview_rows_controller.rb +29 -0
- data/app/controllers/regular_donation_kits_controller.rb +11 -6
- data/app/controllers/sales_controller.rb +72 -40
- data/app/controllers/searches_controller.rb +37 -6
- data/app/controllers/segments_controller.rb +33 -2
- data/app/controllers/settlements_controller.rb +13 -7
- data/app/controllers/shows_controller.rb +58 -24
- data/app/controllers/statements_controller.rb +2 -2
- data/app/controllers/store/checkouts_controller.rb +43 -26
- data/app/controllers/store/donations_controller.rb +27 -11
- data/app/controllers/store/memberships_controller.rb +37 -4
- data/app/controllers/store/orders_controller.rb +26 -10
- data/app/controllers/store/passes_controller.rb +30 -3
- data/app/controllers/tags_controller.rb +42 -0
- data/app/controllers/ticket_types_controller.rb +9 -2
- data/app/controllers/tickets_controller.rb +6 -4
- data/app/controllers/unacknowledged_gifts_controller.rb +45 -0
- data/app/controllers/user_memberships_controller.rb +47 -8
- data/app/helpers/advanced_searches_helper.rb +252 -0
- data/app/helpers/artfully_ose_helper.rb +33 -4
- data/app/helpers/checkouts_helper.rb +16 -0
- data/app/helpers/mailchimp_lists_for_search_helper.rb +21 -0
- data/app/helpers/orders_helper.rb +11 -0
- data/app/helpers/people_helper.rb +28 -1
- data/app/helpers/relationships_helper.rb +6 -0
- data/app/helpers/sales_helper.rb +3 -1
- data/app/helpers/searches_helper.rb +3 -1
- data/app/helpers/segments_helper.rb +3 -0
- data/app/mailers/order_mailer.rb +8 -1
- data/app/mailers/producer_mailer.rb +39 -0
- data/app/mailers/reports_mailer.rb +6 -1
- data/app/models/ability.rb +15 -8
- data/app/models/action.rb +33 -4
- data/app/models/actions/change_action.rb +3 -1
- data/app/models/actions/comp_action.rb +3 -1
- data/app/models/actions/convert_action.rb +19 -0
- data/app/models/actions/do_action.rb +3 -1
- data/app/models/actions/exchange_action.rb +3 -1
- data/app/models/actions/get_action.rb +3 -1
- data/app/models/actions/give_action.rb +8 -2
- data/app/models/actions/go_action.rb +3 -1
- data/app/models/actions/hear_action.rb +15 -1
- data/app/models/actions/join_action.rb +3 -1
- data/app/models/actions/mailchimp_hear_action.rb +17 -0
- data/app/models/actions/pledge_action.rb +19 -0
- data/app/models/actions/refund_action.rb +3 -1
- data/app/models/actions/say_action.rb +3 -1
- data/app/models/actions/system_action.rb +17 -0
- data/app/models/address.rb +76 -31
- data/app/models/advanced_search.rb +434 -0
- data/app/models/advanced_search_segment.rb +12 -0
- data/app/models/appeal.rb +106 -0
- data/app/models/box_office.rb +1 -1
- data/app/models/budget_restriction.rb +9 -0
- data/app/models/campaign.rb +141 -0
- data/app/models/cart.rb +39 -4
- data/app/models/chart.rb +2 -2
- data/app/models/checkout.rb +54 -10
- data/app/models/comp.rb +7 -5
- data/app/models/company.rb +2 -0
- data/app/models/console_sale.rb +26 -0
- data/app/models/contribution.rb +327 -62
- data/app/models/convert.rb +62 -0
- data/app/models/daily_membership_report.rb +1 -1
- data/app/models/database_views/item_view.rb +91 -49
- data/app/models/discount.rb +1 -1
- data/app/models/discounts/discount_type.rb +2 -1
- data/app/models/donation.rb +27 -2
- data/app/models/donation_search.rb +188 -10
- data/app/models/door_list.rb +39 -2
- data/app/models/event.rb +31 -15
- data/app/models/ext.rb +3 -3
- data/app/models/ext/delayed_indexing.rb +41 -1
- data/app/models/ext/integrations.rb +6 -0
- data/app/models/forwarding_job_monitor.rb +2 -0
- data/app/models/household.rb +1 -1
- data/app/models/import.rb +39 -8
- data/app/models/imports/donations_import.rb +110 -19
- data/app/models/imports/events_import.rb +3 -2
- data/app/models/imports/mappings.rb +991 -0
- data/app/models/imports/memberships_import.rb +218 -20
- data/app/models/imports/people_import.rb +9 -1
- data/app/models/imports/rollback.rb +9 -0
- data/app/models/imports/validations.rb +7 -0
- data/app/models/individual.rb +3 -1
- data/app/models/item.rb +55 -17
- data/app/models/job/acknowledge_job.rb +23 -0
- data/app/models/job/checkout_processor.rb +1 -1
- data/app/models/job/convert_order_processor.rb +14 -0
- data/app/models/job/daily_email_report_job.rb +1 -12
- data/app/models/job/destroy_show_job.rb +1 -6
- data/app/models/job/destroy_tag_job.rb +18 -0
- data/app/models/job/door_list_generator_job.rb +33 -0
- data/app/models/job/door_list_mailer_job.rb +15 -0
- data/app/models/job/email_organization_sales_report_job.rb +32 -0
- data/app/models/job/expire_ticket_job.rb +19 -2
- data/app/models/job/export_people_job.rb +47 -0
- data/app/models/job/export_settlements_job.rb +24 -0
- data/app/models/job/geocode_address_job.rb +2 -7
- data/app/models/job/mailchimp_sync_job.rb +61 -3
- data/app/models/job/merge_job.rb +19 -0
- data/app/models/job/order_export_job.rb +36 -0
- data/app/models/job/order_mailer_job.rb +1 -2
- data/app/models/job/order_processor.rb +17 -6
- data/app/models/job/person_lifetime_value_job.rb +1 -0
- data/app/models/job/search_export_job.rb +33 -0
- data/app/models/job/suggest_households_by_address_job.rb +29 -0
- data/app/models/job/suggest_households_by_spouse_job.rb +22 -0
- data/app/models/job_monitor.rb +14 -0
- data/app/models/kit.rb +35 -8
- data/app/models/kits/campaigns_kit.rb +27 -0
- data/app/models/kits/mailchimp_kit.rb +548 -124
- data/app/models/kits/membership_kit.rb +14 -6
- data/app/models/kits/passes_kit.rb +14 -6
- data/app/models/kits/regular_donation_kit.rb +29 -2
- data/app/models/{relationships_kit.rb → kits/relationships_kit.rb} +3 -7
- data/app/models/kits/scannable_tickets_kit.rb +0 -5
- data/app/models/kits/sponsored_donation_kit.rb +2 -12
- data/app/models/kits/ticketing_kit.rb +9 -1
- data/app/models/linking_job_monitor.rb +2 -0
- data/app/models/list_grouping.rb +10 -0
- data/app/models/member.rb +35 -23
- data/app/models/member_number_generator.rb +2 -0
- data/app/models/membership.rb +23 -14
- data/app/models/membership_change.rb +17 -1
- data/app/models/membership_comp.rb +48 -23
- data/app/models/membership_comp_job.rb +7 -0
- data/app/models/membership_type.rb +13 -7
- data/app/models/monitorable.rb +19 -0
- data/app/models/note.rb +10 -1
- data/app/models/order.rb +170 -21
- data/app/models/order_handler.rb +13 -2
- data/app/models/orders/convert_order.rb +11 -0
- data/app/models/organization.rb +87 -9
- data/app/models/parsed_row.rb +142 -67
- data/app/models/pass.rb +13 -7
- data/app/models/pass_type.rb +17 -4
- data/app/models/passes_report.rb +6 -3
- data/app/models/payment.rb +16 -6
- data/app/models/payments/cash_payment.rb +1 -0
- data/app/models/payments/check_payment.rb +1 -5
- data/app/models/payments/comp_payment.rb +0 -1
- data/app/models/payments/credit_card_payment.rb +2 -7
- data/app/models/permission.rb +28 -0
- data/app/models/person.rb +503 -94
- data/app/models/phone.rb +3 -0
- data/app/models/redis_manager.rb +39 -0
- data/app/models/relationship.rb +31 -4
- data/app/models/relationship_builder.rb +0 -3
- data/app/models/rolling_membership_type.rb +5 -1
- data/app/models/s3_coordinator.rb +21 -0
- data/app/models/sale.rb +7 -4
- data/app/models/scheduled_pledge_payment.rb +69 -0
- data/app/models/search.rb +236 -24
- data/app/models/section.rb +6 -4
- data/app/models/show.rb +21 -12
- data/app/models/show_validator.rb +45 -0
- data/app/models/soft_credit.rb +126 -0
- data/app/models/subscribed_list.rb +52 -0
- data/app/models/suggested_household.rb +8 -2
- data/app/models/ticket.rb +35 -10
- data/app/models/ticket/locker.rb +25 -0
- data/app/models/ticket_summary.rb +1 -1
- data/app/models/ticket_type.rb +14 -2
- data/app/models/user.rb +42 -3
- data/app/models/user_membership.rb +57 -3
- data/app/models/valuation/lifetime_donations.rb +2 -2
- data/app/models/valuation/lifetime_pledges.rb +35 -0
- data/app/models/valuation/lifetime_value.rb +5 -1
- data/app/models/valuation_query.rb +109 -0
- data/app/models/venue.rb +8 -0
- data/app/views/actions/_action.html.haml +1 -1
- data/app/views/actions/_form.html.haml +2 -2
- data/app/views/actions/give/_show.html.haml +1 -1
- data/app/views/actions/pledge/_show.html.haml +8 -0
- data/app/views/actions/shared/_show.html.haml +1 -1
- data/app/views/addresses/_address.html.haml +3 -1
- data/app/views/advanced_search_segments/_advanced_searches_results.html.haml +15 -0
- data/app/views/advanced_search_segments/index.html.haml +18 -0
- data/app/views/advanced_search_segments/show.html.haml +46 -0
- data/app/views/advanced_searches/_form.html.haml +61 -0
- data/app/views/advanced_searches/_hit.html.haml +10 -0
- data/app/views/advanced_searches/_household.html.haml +7 -0
- data/app/views/advanced_searches/_new_condition.html.haml +3 -0
- data/app/views/advanced_searches/_people_count.html.erb +3 -0
- data/app/views/advanced_searches/_people_list.html.haml +5 -0
- data/app/views/advanced_searches/filters/_action.html.haml +12 -0
- data/app/views/advanced_searches/filters/_birthday.html.haml +9 -0
- data/app/views/advanced_searches/filters/_discount_code.html.haml +7 -0
- data/app/views/advanced_searches/filters/_donated.html.haml +17 -0
- data/app/views/advanced_searches/filters/_email.html.haml +7 -0
- data/app/views/advanced_searches/filters/_has_purchased_for.html.haml +9 -0
- data/app/views/advanced_searches/filters/_keyword.html.haml +9 -0
- data/app/views/advanced_searches/filters/_lifetime_value.html.haml +13 -0
- data/app/views/advanced_searches/filters/_limit_results.html.haml +7 -0
- data/app/views/advanced_searches/filters/_location.html.haml +11 -0
- data/app/views/advanced_searches/filters/_mailchimp_group.html.haml +8 -0
- data/app/views/advanced_searches/filters/_mailchimp_list.html.haml +8 -0
- data/app/views/advanced_searches/filters/_membership_ended.html.haml +9 -0
- data/app/views/advanced_searches/filters/_membership_started.html.haml +9 -0
- data/app/views/advanced_searches/filters/_membership_status.html.haml +8 -0
- data/app/views/advanced_searches/filters/_membership_type.html.haml +8 -0
- data/app/views/advanced_searches/filters/_orders.html.haml +10 -0
- data/app/views/advanced_searches/filters/_pass_type.html.haml +9 -0
- data/app/views/advanced_searches/filters/_relationships.html.haml +8 -0
- data/app/views/advanced_searches/filters/_segment.html.haml +8 -0
- data/app/views/advanced_searches/filters/_tagging.html.haml +9 -0
- data/app/views/advanced_searches/new.html.haml +12 -0
- data/app/views/advanced_searches/show.html.haml +107 -0
- data/app/views/advanced_searches/shows_for_org.html.haml +1 -0
- data/app/views/advanced_searches/ticket_types_for_org.html.haml +1 -0
- data/app/views/advanced_searches/update.js.erb +9 -0
- data/app/views/appeals/_form.html.haml +113 -0
- data/app/views/appeals/_header.html.haml +6 -0
- data/app/views/appeals/_heard_action.html.haml +16 -0
- data/app/views/appeals/edit.html.haml +8 -0
- data/app/views/appeals/new.html.haml +6 -0
- data/app/views/campaigns/_campaign_donations.html.haml +19 -0
- data/app/views/campaigns/_campaign_stats.html.haml +28 -0
- data/app/views/campaigns/_form.html.haml +48 -0
- data/app/views/campaigns/_header.html.haml +6 -0
- data/app/views/campaigns/edit.html.haml +6 -0
- data/app/views/campaigns/index.html.haml +33 -0
- data/app/views/campaigns/new.html.haml +6 -0
- data/app/views/campaigns/show.html.haml +132 -0
- data/app/views/console_sales/_cart.html.haml +3 -2
- data/app/views/console_sales/_payment.html.haml +14 -1
- data/app/views/console_sales/new.html.haml +11 -6
- data/app/views/contributions/_form.html.haml +139 -37
- data/app/views/contributions/_header.html.haml +5 -0
- data/app/views/contributions/_match_eligible.html.haml +24 -0
- data/app/views/contributions/_pledge_payment.html.haml +22 -0
- data/app/views/contributions/_search.html.haml +30 -0
- data/app/views/contributions/_soft_credit.html.haml +25 -0
- data/app/views/contributions/edit.html.haml +5 -8
- data/app/views/contributions/find_person.html.haml +16 -15
- data/app/views/contributions/index.html.haml +61 -24
- data/app/views/contributions/new.html.haml +5 -5
- data/app/views/converts/_grouped_form.html.haml +11 -0
- data/app/views/converts/new.html.haml +35 -0
- data/app/views/delete_ticket_types/_cannot_destroy_modal.html.haml +11 -0
- data/app/views/delete_ticket_types/_cannot_destroy_modal.rb +0 -0
- data/app/views/delete_ticket_types/_confirm_destroy_modal.html.haml +13 -0
- data/app/views/delete_ticket_types/show.html.haml +4 -0
- data/app/views/discounts/_form.html.haml +1 -1
- data/app/views/events/_day_date_show.html.haml +4 -2
- data/app/views/events/_glance.html.haml +12 -12
- data/app/views/events/_header.html.haml +1 -1
- data/app/views/events/_list.html.haml +1 -1
- data/app/views/events/_menu.html.haml +26 -21
- data/app/views/events/_section_fields.html.haml +1 -1
- data/app/views/events/_tax_deductible_message.html.haml +3 -0
- data/app/views/events/_ticket_type_fields.html.haml +13 -3
- data/app/views/events/index.html.haml +2 -1
- data/app/views/events/messages.html.haml +12 -10
- data/app/views/events/show.html.haml +6 -6
- data/app/views/events/temp_discount_form.html.haml +1 -1
- data/app/views/events_pass_types/_form.html.haml +1 -1
- data/app/views/events_pass_types/new.html.haml +1 -2
- data/app/views/households/_edit_modal.html.haml +9 -4
- data/app/views/households/_form.html.haml +6 -1
- data/app/views/households/_header.html.haml +9 -18
- data/app/views/households/confirm.html.haml +43 -0
- data/app/views/households/new.html.haml +3 -1
- data/app/views/households/show.html.haml +2 -1
- data/app/views/households/suggested.html.haml +10 -27
- data/app/views/imports/_export_links.html.haml +2 -2
- data/app/views/imports/donations/_new.html.haml +49 -6
- data/app/views/imports/donations/_pending.html.haml +69 -22
- data/app/views/imports/donations/_preview.html.haml +23 -0
- data/app/views/imports/events/_new.html.haml +8 -8
- data/app/views/imports/index.html.haml +26 -21
- data/app/views/imports/memberships/_approved.html.haml +16 -0
- data/app/views/imports/memberships/_caching.html.haml +17 -0
- data/app/views/imports/memberships/_failed.html.haml +5 -0
- data/app/views/imports/memberships/_imported.html.haml +45 -0
- data/app/views/imports/memberships/_importing.html.haml +20 -0
- data/app/views/imports/memberships/_invalid.html.haml +5 -0
- data/app/views/imports/memberships/_new.html.haml +155 -0
- data/app/views/imports/memberships/_pending.html.haml +85 -0
- data/app/views/imports/memberships/_preview_rows.html.haml +38 -0
- data/app/views/imports/people/_new.html.haml +81 -15
- data/app/views/imports/shared/_inspect_modal.html.haml +10 -1
- data/app/views/imports/shared/_new_sidebar.html.haml +12 -0
- data/app/views/imports/show.html.haml +0 -3
- data/app/views/index/_action.html.haml +4 -3
- data/app/views/index/_recent_activity.html.haml +14 -7
- data/app/views/index/dashboard.html.haml +27 -14
- data/app/views/job_monitors/_job_monitor_show.html.haml +34 -0
- data/app/views/job_monitors/_linking_job_monitor_show.html.haml +31 -0
- data/app/views/job_monitors/show.html.haml +1 -0
- data/app/views/layouts/_google_analytics.html.haml +9 -11
- data/app/views/layouts/_menu.html.haml +5 -3
- data/app/views/layouts/application.html.haml +12 -4
- data/app/views/layouts/devise_layout.html.haml +1 -1
- data/app/views/layouts/storefront.html.haml +7 -10
- data/app/views/members/index/index.html.haml +82 -4
- data/app/views/members/mailer/_invitation_body.html.haml +2 -2
- data/app/views/members/passwords/new.html.haml +13 -0
- data/app/views/members/sessions/new.html.haml +1 -1
- data/app/views/membership_comps/confirm.html.haml +10 -8
- data/app/views/membership_comps/create.html.haml +1 -3
- data/app/views/membership_kits/edit.html.haml +6 -0
- data/app/views/membership_types/_form.html.haml +1 -1
- data/app/views/membership_types/index.html.haml +11 -3
- data/app/views/memberships/index.html.haml +122 -109
- data/app/views/merges/find_person.html.haml +5 -3
- data/app/views/merges/new.html.haml +13 -4
- data/app/views/notes/_note.html.haml +3 -3
- data/app/views/order_mailer/confirmation_for.html.haml +1 -0
- data/app/views/order_mailer/confirmation_for.text.haml +1 -0
- data/app/views/orders/_assignable_donations.html.haml +25 -0
- data/app/views/orders/_assignable_pledges.html.haml +26 -0
- data/app/views/orders/_item_table.haml +20 -8
- data/app/views/orders/_order_sidebar.html.haml +37 -7
- data/app/views/orders/membership.html.haml +2 -2
- data/app/views/orders/passes.html.haml +4 -4
- data/app/views/orders/sales.html.haml +5 -5
- data/app/views/orders/show.html.haml +26 -7
- data/app/views/organizations/_form.html.haml +0 -5
- data/app/views/pass_types/index.html.haml +13 -5
- data/app/views/passes/index.html.haml +50 -39
- data/app/views/passes_kits/edit.html.haml +6 -0
- data/app/views/passes_reports/index.html.haml +1 -1
- data/app/views/pdfs/member.html.haml +1 -1
- data/app/views/pdfs/member_card_generator/blanks_usa_idc6.html.haml +1 -1
- data/app/views/pdfs/order.html.haml +5 -3
- data/app/views/people/_address_fields.html.haml +40 -0
- data/app/views/people/_convert_to_company_modal.html.haml +3 -0
- data/app/views/people/_edit_modal.html.haml +121 -38
- data/app/views/people/_form.html.haml +8 -14
- data/app/views/people/_header.html.haml +11 -16
- data/app/views/people/_list.html.haml +3 -9
- data/app/views/people/_mailchimp_group.html.haml +3 -0
- data/app/views/people/_phone_fields.html.haml +1 -1
- data/app/views/people/_relationship_fields.html.haml +10 -5
- data/app/views/people/_work_with_menu.html.haml +14 -8
- data/app/views/people/index.html.haml +10 -9
- data/app/views/people/new.html.haml +18 -4
- data/app/views/people/pledges.html.haml +13 -0
- data/app/views/people/show.html.haml +96 -45
- data/app/views/pledges/_none_scheduled_payment_table.html.haml +17 -0
- data/app/views/pledges/_receive_pledge.html.haml +87 -0
- data/app/views/pledges/_scheduled_payments_table.html.haml +18 -0
- data/app/views/pledges/index.html.haml +47 -0
- data/app/views/preview_rows/index.html.haml +1 -0
- data/app/views/producer_mailer/donation_notification.html.haml +9 -0
- data/app/views/producer_mailer/donation_notification.text.erb +8 -0
- data/app/views/producer_mailer/door_list_notification.html.haml +10 -0
- data/app/views/producer_mailer/door_list_notification.text.erb +6 -0
- data/app/views/producer_mailer/mailchimp_kit_initial_sync_notification.html.haml +2 -2
- data/app/views/regular_donation_kits/edit.html.haml +29 -1
- data/app/views/relationships/index.html.haml +1 -1
- data/app/views/sales/_boxoffice.html.haml +15 -5
- data/app/views/sales/_doorlist.html.haml +2 -2
- data/app/views/sales/new.html.haml +2 -2
- data/app/views/searches/_company.html.haml +7 -0
- data/app/views/searches/_form.html.haml +75 -8
- data/app/views/searches/_household.html.haml +2 -2
- data/app/views/searches/_individual.html.haml +7 -0
- data/app/views/searches/show.html.haml +59 -23
- data/app/views/segments/index.html.haml +1 -1
- data/app/views/segments/show.html.haml +36 -1
- data/app/views/shared/_baseball_card.html.haml +40 -0
- data/app/views/shared/_tags.html.haml +10 -8
- data/app/views/shows/_empty_ticket_table.html.haml +12 -0
- data/app/views/shows/_sections_table.html.haml +78 -69
- data/app/views/shows/_ticket_table.html.haml +10 -7
- data/app/views/shows/index.html.haml +95 -85
- data/app/views/statements/_shows.html.haml +1 -1
- data/app/views/store/checkouts/_event_information.html.haml +89 -0
- data/app/views/store/checkouts/_shopping_cart_display.haml +8 -0
- data/app/views/store/checkouts/_thanks.html.haml +40 -0
- data/app/views/store/checkouts/create.html.haml +1 -0
- data/app/views/store/checkouts/shopping_cart_display/_discounts.haml +8 -0
- data/app/views/store/checkouts/shopping_cart_display/_donations.haml +15 -0
- data/app/views/store/checkouts/{_membership_info.html.haml → shopping_cart_display/_membership_info.html.haml} +0 -0
- data/app/views/store/checkouts/shopping_cart_display/_memberships.haml +8 -0
- data/app/views/store/checkouts/shopping_cart_display/_passes.haml +9 -0
- data/app/views/store/checkouts/shopping_cart_display/_tickets.haml +10 -0
- data/app/views/store/checkouts/shopping_cart_display/_total.haml +10 -0
- data/app/views/store/donations/index.html.haml +4 -0
- data/app/views/store/events/_contact_info.html.haml +8 -0
- data/app/views/store/events/_venue.html.haml +14 -7
- data/app/views/store/events/calendar.html.haml +2 -9
- data/app/views/store/events/show.html.haml +2 -9
- data/app/views/store/events/single_show.html.haml +3 -3
- data/app/views/store/memberships/index.html.haml +3 -3
- data/app/views/store/orders/blank.html.erb +34 -0
- data/app/views/store/orders/show.html.haml +15 -6
- data/app/views/store/passes/index.html.haml +3 -3
- data/app/views/store/shared/_small_donate_form.html.haml +21 -18
- data/app/views/tags/_edit_modal.html.haml +16 -0
- data/app/views/tags/index.html.haml +23 -0
- data/app/views/unacknowledged_gifts/_heard_action.html.haml +10 -0
- data/app/views/unacknowledged_gifts/index.html.haml +76 -0
- data/app/views/user_memberships/_list.html.haml +147 -24
- data/config/initializers/delayed_job_config.rb +10 -1
- data/config/routes.rb +85 -9
- data/db/migrate/20140422193345_add_email_copy_to_pass_type.rb +1 -1
- data/db/migrate/20140616045851_add_birthdate_to_search.rb +7 -0
- data/db/migrate/20140623131025_create_campaigns.rb +27 -0
- data/db/migrate/20140627120214_create_appeals.rb +28 -0
- data/db/migrate/20140630151406_add_deleted_at_to_campaigns.rb +9 -0
- data/db/migrate/20140701124100_add_segment_id_and_notes_to_appeals.rb +12 -0
- data/db/migrate/20140702115815_add_campaign_id_and_appeal_id_to_donations.rb +14 -0
- data/db/migrate/20140702121928_add_materials_to_appeals.rb +11 -0
- data/db/migrate/20140702150521_add_deleted_at_to_appeals.rb +9 -0
- data/db/migrate/20140709151816_add_campaign_id_and_appeal_id_to_orders.rb +14 -0
- data/db/migrate/20140723133850_remove_campaign_id_and_apeal_id_from_orders.rb +11 -0
- data/db/migrate/20140723134923_add_commitment_date_to_donations.rb +6 -0
- data/db/migrate/20140730141515_add_match_eligible_to_donations.rb +15 -0
- data/db/migrate/20140818141140_create_soft_credits.rb +12 -0
- data/db/migrate/20140903140113_add_pledge_to_donations.rb +9 -0
- data/db/migrate/20140904183953_add_destroyed_at_to_relationships.rb +7 -0
- data/db/migrate/20140905080503_create_scheduled_pledge_payments.rb +16 -0
- data/db/migrate/20140909150251_add_org_to_suggested_household.rb +7 -0
- data/db/migrate/20141007114614_add_order_id_to_donations.rb +15 -0
- data/db/migrate/20141021134013_add_lifetime_pledges_to_people.rb +5 -0
- data/db/migrate/20141027191307_default_overwrite_member_addresses_to_false.rb +5 -0
- data/db/migrate/20141031193839_update_relations.rb +9 -0
- data/db/migrate/20141126183258_add_mailchimp_status_fields_to_people.rb +6 -0
- data/db/migrate/20141126184811_add_processing_at_to_ticket.rb +5 -0
- data/db/migrate/20141127135743_add_import_to_campaigns.rb +6 -0
- data/db/migrate/20141128143944_add_fiscal_year_to_donations.rb +5 -0
- data/db/migrate/20141128151407_remove_fiscal_year_from_scheduled_pledge_payments.rb +3 -0
- data/db/migrate/20141204164400_add_more_indexes_to_actions.rb +7 -0
- data/db/migrate/20141204171612_add_indexes_to_charts.rb +12 -0
- data/db/migrate/20141204172658_add_hide_on_recent_activity_to_actions.rb +5 -0
- data/db/migrate/20141204173004_add_indexes_to_ept.rb +9 -0
- data/db/migrate/20141204211933_remove_membership_counts_from_members.rb +13 -0
- data/db/migrate/20141205202030_create_subscribed_lists.rb +19 -0
- data/db/migrate/20141208225228_add_mailchimp_lists_to_searches.rb +5 -0
- data/db/migrate/20141210162329_add_bounced_to_subscribed_lists.rb +5 -0
- data/db/migrate/20141211165307_add_external_reference_to_actions.rb +5 -0
- data/db/migrate/20141212172119_add_not_mailchimp_lists_to_searches.rb +5 -0
- data/db/migrate/20141229204605_normalize_states_in_addresses.rb +11 -0
- data/db/migrate/20150113091344_add_fiscal_to_organizations.rb +11 -0
- data/db/migrate/20150113091434_create_budget_restrictions.rb +14 -0
- data/db/migrate/20150113091503_add_budget_restriction_to_campaigns.rb +14 -0
- data/db/migrate/20150129091354_add_campaign_to_searches.rb +13 -0
- data/db/migrate/20150203174456_create_list_groupings.rb +12 -0
- data/db/migrate/20150203222451_add_groupings_to_searches.rb +6 -0
- data/db/migrate/20150219153827_add_roles_to_user_memberships.rb +13 -0
- data/db/migrate/20150223145657_add_daily_sales_to_user_membership.rb +13 -0
- data/db/migrate/20150318171857_create_advanced_searches.rb +16 -0
- data/db/migrate/20150319185940_add_org_id_index_to_orders.rb +5 -0
- data/db/migrate/20150325085516_add_received_amount_to_donations.rb +16 -0
- data/db/migrate/20150325173053_add_pass_index_to_tickets.rb +5 -0
- data/db/migrate/20150331084817_add_creator_id_to_orders.rb +11 -0
- data/db/migrate/20150406162656_index_tickets_on_action_id.rb +5 -0
- data/db/migrate/20150408123349_add_donor_instructions_to_orders.rb +9 -0
- data/db/migrate/20150408125600_add_index_to_imports.rb +5 -0
- data/db/migrate/20150414193419_add_index_to_phone.rb +5 -0
- data/db/migrate/20150414193646_add_index_to_taggings.rb +5 -0
- data/db/migrate/20150415113013_add_nickname_to_people.rb +11 -0
- data/db/migrate/20150420143707_add_indexes_to_donations.rb +7 -0
- data/db/migrate/20150421092302_add_kind_to_addresses.rb +11 -0
- data/db/migrate/20150513154513_add_name_to_advanced_search.rb +5 -0
- data/db/migrate/20150518131946_add_receive_donation_notification_to_user_memberships.rb +9 -0
- data/db/migrate/20150520182350_remove_name_from_advanced_search.rb +9 -0
- data/db/migrate/20150520202900_create_advanced_search_segments.rb +9 -0
- data/db/migrate/20150520210658_add_advanced_search_id_to_advanced_search_segment.rb +5 -0
- data/db/migrate/20150521183507_add_organization_id_to_advanced_search_segment.rb +5 -0
- data/db/migrate/20150602204548_add_index_on_deleted_at.rb +5 -0
- data/db/migrate/20150711143014_add_receive_door_list_to_user_memberships.rb +10 -0
- data/db/migrate/20150716000301_create_job_monitors_table.rb +12 -0
- data/db/migrate/20150807005404_re_refresh_show_stats.rb +8 -0
- data/db/migrate/20150810133417_convert_business_to_work.rb +5 -0
- data/db/migrate/20150812135205_update_notes_nulls.rb +9 -0
- data/db/migrate/20150813202745_index_household_id.rb +6 -0
- data/db/migrate/20150814075653_add_maiden_name_to_people.rb +9 -0
- data/db/migrate/20150911203530_normalize_countries_in_addresses.rb +11 -0
- data/db/migrate/20150922155253_add_advanced_search_segment_id_to_membership_types.rb +5 -0
- data/db/migrate/20150922155308_add_advanced_search_segment_id_to_pass_types.rb +5 -0
- data/db/migrate/20151006180702_add_deleted_at_to_ticket_types.rb +5 -0
- data/db/migrate/20151009175206_add_receipt_details_to_ticket_types.rb +5 -0
- data/db/migrate/20151112174723_index_list_groupings.rb +5 -0
- data/lib/artfully_ose/common_abilities.rb +80 -57
- data/lib/artfully_ose/version.rb +1 -1
- data/lib/tasks/artfully_ose.rake +46 -4
- data/spec/factories/action_factories.rb +2 -0
- data/spec/factories/address_factories.rb +2 -2
- data/spec/factories/advanced_search_factories.rb +45 -0
- data/spec/factories/advanced_search_segment_factories.rb +6 -0
- data/spec/factories/advanced_segment_factories.rb +6 -0
- data/spec/factories/campaign_factories.rb +20 -0
- data/spec/factories/cart_factories.rb +24 -0
- data/spec/factories/chart_factories.rb +4 -0
- data/spec/factories/event_factories.rb +6 -0
- data/spec/factories/item_factories.rb +23 -1
- data/spec/factories/kit_factories.rb +27 -3
- data/spec/factories/member_factories.rb +8 -1
- data/spec/factories/membership_factories.rb +12 -0
- data/spec/factories/membership_type_factories.rb +18 -0
- data/spec/factories/note_factories.rb +7 -0
- data/spec/factories/order_factories.rb +7 -0
- data/spec/factories/pass_factories.rb +6 -0
- data/spec/factories/payments_factories.rb +1 -1
- data/spec/factories/person_factories.rb +46 -4
- data/spec/factories/scheduled_pledge_payment_factories.rb +10 -0
- data/spec/factories/show_factories.rb +8 -3
- data/spec/factories/soft_credit_factories.rb +8 -0
- data/spec/factories/ticket_factories.rb +22 -9
- data/spec/factories/user_factories.rb +16 -8
- metadata +342 -59
- data/app/controllers/comps_controller.rb +0 -47
- data/app/models/household_suggester.rb +0 -58
- data/app/views/searches/_person.html.haml +0 -10
- data/app/views/store/checkouts/thanks.html.haml +0 -134
data/app/models/phone.rb
CHANGED
@@ -0,0 +1,39 @@
|
|
1
|
+
#
|
2
|
+
# Manages our Redis connection
|
3
|
+
# Eventually this class can be expanded to do some smart things
|
4
|
+
#
|
5
|
+
# Get a connection with `RedisManager.connection`
|
6
|
+
#
|
7
|
+
class RedisManager
|
8
|
+
cattr_accessor :redis
|
9
|
+
|
10
|
+
def self.connection
|
11
|
+
@@redis ||= Redis.new(:url => (ENV["REDISTOGO_URL"] || "redis://localhost:6379/"))
|
12
|
+
end
|
13
|
+
|
14
|
+
def self.burst_key(key)
|
15
|
+
"burst:#{key}"
|
16
|
+
end
|
17
|
+
|
18
|
+
#
|
19
|
+
# Useful for situations where a ton of things happen (like a bunch of new actions)
|
20
|
+
# and you want one thing to happen after that (like rebuilding the action feed)
|
21
|
+
#
|
22
|
+
# Situations like these are unsuitable for after_create callbacks
|
23
|
+
# because 1000 new actions will kick off 1000 rebuild jobs
|
24
|
+
#
|
25
|
+
# key: The unique identifier for this burst. "rebuild_feed"
|
26
|
+
# duration_in_seconds: seconds before clearing the key and allowing another burst
|
27
|
+
#
|
28
|
+
# Example:
|
29
|
+
#
|
30
|
+
# RedisManager.burst_job("rebuild_feed") { RebuildFeedJob.enqueue (...) }
|
31
|
+
#
|
32
|
+
def self.burst_job(key, duration_in_seconds = 10)
|
33
|
+
burst_val = self.connection.get(burst_key(key))
|
34
|
+
if !burst_val.present?
|
35
|
+
self.connection.set(burst_key(key), 1, {:ex => duration_in_seconds, :nx => true})
|
36
|
+
yield
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
data/app/models/relationship.rb
CHANGED
@@ -1,15 +1,23 @@
|
|
1
1
|
class Relationship < ActiveRecord::Base
|
2
|
-
|
2
|
+
include OhNoes::Destroy
|
3
|
+
attr_accessible :person, :person_id, :relation, :relation_id, :other, :other_id, :starred, :inverse, :relation_id, :other_id
|
3
4
|
|
4
5
|
belongs_to :person
|
5
6
|
belongs_to :other, :class_name => 'Person'
|
6
|
-
belongs_to :inverse, :class_name => 'Relationship', :dependent => :
|
7
|
-
has_one :inverse_relationship, :class_name => 'Relationship', :
|
7
|
+
belongs_to :inverse, :class_name => 'Relationship', :dependent => :delete, :foreign_key => :inverse_id
|
8
|
+
has_one :inverse_relationship, :class_name => 'Relationship', :foreign_key => :inverse_id
|
8
9
|
belongs_to :relation
|
9
10
|
|
10
11
|
validates_with RelationshipValidator
|
11
12
|
|
12
13
|
after_create :assign_company_name
|
14
|
+
after_create :ensure_inverse_exists
|
15
|
+
|
16
|
+
after_save :ensure_sane_inverse
|
17
|
+
|
18
|
+
after_save do |record|
|
19
|
+
Delayed::Job.enqueue(SuggestHouseholdsBySpouseJob.new(record.id), :queue => :suggested_households) if(record.relation.description == 'spouse to')
|
20
|
+
end
|
13
21
|
|
14
22
|
def assign_company_name
|
15
23
|
return unless relation.description == 'employed by'
|
@@ -47,9 +55,28 @@ class Relationship < ActiveRecord::Base
|
|
47
55
|
end
|
48
56
|
end
|
49
57
|
|
50
|
-
def
|
58
|
+
def copy_to(new_person)
|
59
|
+
Relationship.create(:person => new_person, :other => other, :relation => relation)
|
60
|
+
end
|
61
|
+
|
62
|
+
def involves?(person)
|
63
|
+
return [person_id, other_id].include?(person.id)
|
64
|
+
end
|
65
|
+
|
66
|
+
def is_inverse_of?(other)
|
67
|
+
person_id == other.other_id && other_id == other.person_id && relation_id == other.relation.inverse_id
|
68
|
+
end
|
69
|
+
|
70
|
+
private
|
71
|
+
|
72
|
+
def ensure_inverse_exists
|
73
|
+
return if inverse.present?
|
51
74
|
create_inverse(:relation => relation.inverse, :person => other, :other => person, :inverse => self)
|
52
75
|
save
|
53
76
|
end
|
54
77
|
|
78
|
+
def ensure_sane_inverse
|
79
|
+
return if inverse.is_inverse_of?(self)
|
80
|
+
inverse.update_attributes(:person_id => other_id, :other_id => person_id, :relation_id => relation.inverse_id)
|
81
|
+
end
|
55
82
|
end
|
@@ -3,9 +3,6 @@ class RelationshipBuilder
|
|
3
3
|
ActiveRecord::Base.transaction do
|
4
4
|
relationship = person.relationships.create(:other => other, :relation => relation)
|
5
5
|
relationship.save!
|
6
|
-
inverse = other.relationships.create(:other => person, :relation => relation.inverse, :inverse => relationship)
|
7
|
-
inverse.save!
|
8
|
-
relationship.update_attribute(:inverse_id, inverse.id)
|
9
6
|
relationship
|
10
7
|
end
|
11
8
|
end
|
@@ -6,6 +6,10 @@ class RollingMembershipType < MembershipType
|
|
6
6
|
end
|
7
7
|
|
8
8
|
def ends_at
|
9
|
-
self.duration.nil? ? nil : DateTime.now +
|
9
|
+
self.duration.nil? ? nil : DateTime.now + duration_in_seconds
|
10
|
+
end
|
11
|
+
|
12
|
+
def duration_in_seconds
|
13
|
+
self.duration.send(self.period.downcase)
|
10
14
|
end
|
11
15
|
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
class S3Coordinator
|
2
|
+
attr_reader :bucket
|
3
|
+
|
4
|
+
def initialize
|
5
|
+
@s3 = AWS::S3.new(
|
6
|
+
:access_key_id => Rails.configuration.s3.access_key_id,
|
7
|
+
:secret_access_key => Rails.configuration.s3.secret_access_key
|
8
|
+
)
|
9
|
+
@bucket = @s3.buckets[Rails.configuration.s3.bucket]
|
10
|
+
end
|
11
|
+
|
12
|
+
def create_file(filename, csv_string, content_type = 'text/csv')
|
13
|
+
bucket.objects.create("#{filename}", csv_string, { :acl => :private, :content_type => content_type} )
|
14
|
+
end
|
15
|
+
|
16
|
+
def download_link(filename, time)
|
17
|
+
object = bucket.objects[filename]
|
18
|
+
url = object.url_for(:read, :expires => time)
|
19
|
+
url.to_s
|
20
|
+
end
|
21
|
+
end
|
data/app/models/sale.rb
CHANGED
@@ -12,7 +12,7 @@ class Sale
|
|
12
12
|
@notes = notes
|
13
13
|
|
14
14
|
#When coming from a browser, all keys and values in @quantities are STRINGS
|
15
|
-
@quantities = quantities
|
15
|
+
@quantities = (quantities || {})
|
16
16
|
@cart = cart
|
17
17
|
@tickets = []
|
18
18
|
|
@@ -23,6 +23,7 @@ class Sale
|
|
23
23
|
if valid?
|
24
24
|
case payment
|
25
25
|
when CompPayment
|
26
|
+
puts payment.customer.inspect
|
26
27
|
@sale_made = comp_tickets(payment)
|
27
28
|
else
|
28
29
|
@sale_made = sell_tickets(payment)
|
@@ -41,6 +42,8 @@ class Sale
|
|
41
42
|
end
|
42
43
|
|
43
44
|
def load_tickets
|
45
|
+
return if @quantities.nil?
|
46
|
+
|
44
47
|
@quantities.keys.each do |ticket_type_id|
|
45
48
|
amount_requested = @quantities[ticket_type_id].to_i
|
46
49
|
if amount_requested > 0
|
@@ -58,7 +61,7 @@ class Sale
|
|
58
61
|
|
59
62
|
def has_tickets?
|
60
63
|
unless non_zero_quantities?
|
61
|
-
errors.add(:base, "Please select a number of tickets to purchase") and return false
|
64
|
+
errors.add(:base, "Please select a number of tickets to purchase. If you're trying to process a single donaiton, please use the Sales Console") and return false
|
62
65
|
end
|
63
66
|
errors.add(:base, "no tickets were added") unless @tickets.size > 0
|
64
67
|
@tickets.size > 0
|
@@ -67,7 +70,7 @@ class Sale
|
|
67
70
|
private
|
68
71
|
|
69
72
|
def comp_tickets(payment)
|
70
|
-
@comp = Comp.new(tickets
|
73
|
+
@comp = Comp.new(tickets, [], [], payment.customer, payment.benefactor, notes)
|
71
74
|
@comp.submit
|
72
75
|
@buyer = @comp.recipient
|
73
76
|
@order = @comp.order
|
@@ -78,7 +81,7 @@ class Sale
|
|
78
81
|
def sell_tickets(payment)
|
79
82
|
checkout = BoxOffice::Checkout.new(cart, payment, notes)
|
80
83
|
begin
|
81
|
-
success = checkout.
|
84
|
+
success = checkout.process
|
82
85
|
@buyer = checkout.person
|
83
86
|
@order = checkout.order
|
84
87
|
if !success
|
@@ -0,0 +1,69 @@
|
|
1
|
+
class ScheduledPledgePayment < ActiveRecord::Base
|
2
|
+
attr_accessible :amount_received
|
3
|
+
belongs_to :person
|
4
|
+
belongs_to :organization
|
5
|
+
belongs_to :donation
|
6
|
+
belongs_to :order
|
7
|
+
|
8
|
+
scope :received, lambda { where('amount_received IS NOT NULL') }
|
9
|
+
scope :not_received, lambda { where('amount_received IS NULL') }
|
10
|
+
|
11
|
+
def self.update_pledge_payments(db_pledge_payments, curr_pledge_payments, organization_id, order_id, donation_id, person_id)
|
12
|
+
new_pledge_payments = db_pledge_payments.empty? ? curr_pledge_payments : []
|
13
|
+
deleted_pledge_payment_ids = Set.new
|
14
|
+
updated_pledge_payments = Set.new
|
15
|
+
|
16
|
+
db_pledge_payments.each do |db_pp|
|
17
|
+
deleted_pledge_payment_ids << db_pp.id if db_pp.id > 0 #mark temporary all as deleted
|
18
|
+
curr_pledge_payments.each do |curr_pp|
|
19
|
+
deleted_pledge_payment_ids.delete(db_pp.id) if curr_pp.id.to_i == db_pp.id.to_i #remove from deleted list presented only
|
20
|
+
if curr_pp.id.to_i == db_pp.id.to_i
|
21
|
+
db_pp.amount = curr_pp.amount
|
22
|
+
db_pp.date = curr_pp.date
|
23
|
+
updated_pledge_payments << db_pp
|
24
|
+
elsif curr_pp.id.to_i < 0
|
25
|
+
new_pledge_payments << curr_pp #all with negative id are new
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
save_all(new_pledge_payments.uniq, organization_id, order_id, donation_id, person_id)
|
31
|
+
|
32
|
+
updated_pledge_payments.each do |pp| #update existing records
|
33
|
+
pp.save!
|
34
|
+
end
|
35
|
+
|
36
|
+
ScheduledPledgePayment.where(:id => deleted_pledge_payment_ids.to_a()).destroy_all # destroy deleted records
|
37
|
+
end
|
38
|
+
|
39
|
+
def self.save_all(pledge_payments, organization_id, order_id, donation_id, person_id)
|
40
|
+
pledge_payments.each do |pp|
|
41
|
+
next if !pp.amount && !pp.date
|
42
|
+
pp.id = nil if pp.id.to_i <= 0
|
43
|
+
pp.organization_id = organization_id
|
44
|
+
pp.order_id = order_id
|
45
|
+
pp.donation_id = donation_id
|
46
|
+
pp.person_id = person_id
|
47
|
+
pp.save!
|
48
|
+
end
|
49
|
+
end
|
50
|
+
|
51
|
+
def self.build_pledge_payments(pledge_payments_hash = nil)
|
52
|
+
pledge_payments = []
|
53
|
+
pledge_payments_hash.each do |id, pp|
|
54
|
+
pledge_payment = ScheduledPledgePayment.new
|
55
|
+
pledge_payment.id = id
|
56
|
+
pledge_payment.date = pp[:date]
|
57
|
+
pledge_payment.amount = pp[:amount]
|
58
|
+
pledge_payments << pledge_payment
|
59
|
+
end
|
60
|
+
pledge_payments
|
61
|
+
end
|
62
|
+
|
63
|
+
def self.default_pledge_payment
|
64
|
+
pledge_payment = ScheduledPledgePayment.new
|
65
|
+
pledge_payment.id = -Time.now.to_i
|
66
|
+
pledge_payment
|
67
|
+
end
|
68
|
+
|
69
|
+
end
|
data/app/models/search.rb
CHANGED
@@ -5,6 +5,8 @@ class Search < ActiveRecord::Base
|
|
5
5
|
belongs_to :membership_type
|
6
6
|
belongs_to :pass_type
|
7
7
|
belongs_to :relation
|
8
|
+
belongs_to :campaign
|
9
|
+
belongs_to :appeal
|
8
10
|
|
9
11
|
validates_presence_of :organization_id
|
10
12
|
|
@@ -12,13 +14,25 @@ class Search < ActiveRecord::Base
|
|
12
14
|
:has_purchased_for, :event_id,
|
13
15
|
:tagging, :person_subtype,
|
14
16
|
:min_lifetime_value, :max_lifetime_value,
|
17
|
+
:gift_type, :campaign_id, :appeal_id,
|
15
18
|
:min_donations_amount, :max_donations_amount,
|
16
19
|
:min_donations_date, :max_donations_date, :discount_code,
|
17
20
|
:membership_status, :pass_type_id, :pass_type, :membership_type_id, :membership_type,
|
18
21
|
:relation_id, :output_individuals, :output_households, :output_companies,
|
19
22
|
:show_date_start, :show_date_end,
|
20
23
|
:min_membership_start_date, :max_membership_start_date,
|
21
|
-
:min_membership_end_date, :max_membership_end_date
|
24
|
+
:min_membership_end_date, :max_membership_end_date,
|
25
|
+
|
26
|
+
:mailchimp_lists, :not_mailchimp_lists,
|
27
|
+
:groupings, :not_groupings,
|
28
|
+
:birth_day, :birth_month, :birth_year,
|
29
|
+
:has_donated
|
30
|
+
|
31
|
+
|
32
|
+
serialize :mailchimp_lists, Array
|
33
|
+
serialize :not_mailchimp_lists, Array
|
34
|
+
serialize :groupings, Hash
|
35
|
+
serialize :not_groupings, Hash
|
22
36
|
|
23
37
|
ANY_EVENT = -1
|
24
38
|
ANY_MEMBERSHIP_TYPE = -1
|
@@ -78,16 +92,24 @@ class Search < ActiveRecord::Base
|
|
78
92
|
unless discount_code.blank?
|
79
93
|
conditions << ((discount_code == Discount::ALL_DISCOUNTS_STRING) ? c.call("Used any discount code") : ("Used discount code #{discount_code}."))
|
80
94
|
end
|
81
|
-
|
82
|
-
|
95
|
+
unless ([gift_type, campaign_id, appeal_id, min_donations_amount, max_donations_amount, min_donations_date, max_donations_date].all?(&:blank?) && (has_donated == true))
|
96
|
+
donation_type = gift_type.present? ? (Donation::GIFT_TYPES[gift_type]).downcase.pluralize : "gifts"
|
83
97
|
if min_donations_amount.present? && max_donations_amount.present?
|
84
|
-
string = "Made between $#{min_donations_amount} and $#{max_donations_amount} in
|
98
|
+
string = "Made between $#{min_donations_amount} and $#{max_donations_amount} in #{donation_type}"
|
85
99
|
elsif min_donations_amount.present?
|
86
|
-
string = "Made a total minimum of $#{min_donations_amount} in
|
100
|
+
string = "Made a total minimum of $#{min_donations_amount} in #{donation_type}"
|
87
101
|
elsif max_donations_amount.present?
|
88
|
-
string = "Made no more than $#{max_donations_amount} in total
|
102
|
+
string = "Made no more than $#{max_donations_amount} in total #{donation_type}"
|
103
|
+
elsif (has_donated == false)
|
104
|
+
string = "Have not donated"
|
89
105
|
else
|
90
|
-
string = "Made any
|
106
|
+
string = "Made any #{donation_type}"
|
107
|
+
end
|
108
|
+
|
109
|
+
if campaign_id.present? && appeal_id.present?
|
110
|
+
string << " for appeal #{appeal.name}"
|
111
|
+
elsif campaign_id.present?
|
112
|
+
string << " for campaign #{campaign.name}"
|
91
113
|
end
|
92
114
|
|
93
115
|
if min_donations_date.present? && max_donations_date.present?
|
@@ -149,6 +171,68 @@ class Search < ActiveRecord::Base
|
|
149
171
|
if searching_passes?
|
150
172
|
conditions << c.call("Have a current #{pass_type.passerize}.")
|
151
173
|
end
|
174
|
+
|
175
|
+
if searching_birthday?
|
176
|
+
if birth_day.blank?
|
177
|
+
conditions << c.call("Have a birthday in: " + output_birthday(birth_month, birth_day, birth_year))
|
178
|
+
else
|
179
|
+
conditions << c.call("Have a birthday on: " + output_birthday(birth_month, birth_day, birth_year))
|
180
|
+
end
|
181
|
+
end
|
182
|
+
|
183
|
+
if mailchimp_lists.present?
|
184
|
+
mailchimp_kit = organization.kits.mailchimp
|
185
|
+
|
186
|
+
mailchimp_lists.each do |list_id|
|
187
|
+
list = mailchimp_kit.attached_lists.detect { |list| list[:list_id] == list_id }
|
188
|
+
conditions << c.call("Are subscribed to #{list[:list_name]}") if list
|
189
|
+
end
|
190
|
+
end
|
191
|
+
|
192
|
+
if not_mailchimp_lists.present?
|
193
|
+
mailchimp_kit = organization.kits.mailchimp
|
194
|
+
|
195
|
+
not_mailchimp_lists.each do |list_id|
|
196
|
+
list = mailchimp_kit.attached_lists.detect { |list| list[:list_id] == list_id }
|
197
|
+
conditions << c.call("Are not subscribed to #{list[:list_name]}") if list
|
198
|
+
end
|
199
|
+
end
|
200
|
+
|
201
|
+
if groupings.present?
|
202
|
+
mailchimp_kit = organization.kits.mailchimp
|
203
|
+
|
204
|
+
groupings.each do |grouping_id, groups|
|
205
|
+
list = mailchimp_kit.attached_lists.detect do |list|
|
206
|
+
list.fetch(:groups, []).any? do |grouping|
|
207
|
+
grouping["id"] == grouping_id.to_i
|
208
|
+
end
|
209
|
+
end
|
210
|
+
next unless list
|
211
|
+
grouping = list.fetch(:groups, []).detect do |grouping|
|
212
|
+
grouping["id"] == grouping_id.to_i
|
213
|
+
end
|
214
|
+
next unless grouping
|
215
|
+
conditions << c.call("Are subscribed to the groups #{groups.join(", ")} in the grouping #{grouping["name"]} for list #{list[:list_name]}")
|
216
|
+
end
|
217
|
+
end
|
218
|
+
|
219
|
+
if not_groupings.present?
|
220
|
+
mailchimp_kit = organization.kits.mailchimp
|
221
|
+
|
222
|
+
not_groupings.each do |grouping_id, groups|
|
223
|
+
list = mailchimp_kit.attached_lists.detect do |list|
|
224
|
+
list.fetch(:groups, []).any? do |grouping|
|
225
|
+
grouping["id"] == grouping_id.to_i
|
226
|
+
end
|
227
|
+
end
|
228
|
+
next unless list
|
229
|
+
grouping = list.fetch(:groups, []).detect do |grouping|
|
230
|
+
grouping["id"] == grouping_id.to_i
|
231
|
+
end
|
232
|
+
next unless grouping
|
233
|
+
conditions << c.call("Are not subscribed to the groups #{groups.join(", ")} in the grouping #{grouping["name"]} for list #{list[:list_name]}")
|
234
|
+
end
|
235
|
+
end
|
152
236
|
|
153
237
|
categories << "individuals" if output_individuals
|
154
238
|
|
@@ -185,17 +269,62 @@ class Search < ActiveRecord::Base
|
|
185
269
|
@offset ||= datetime.in_time_zone(ActiveSupport::TimeZone.create(self.organization.time_zone)).formatted_offset
|
186
270
|
end
|
187
271
|
|
272
|
+
def include_group?(grouping_id, group)
|
273
|
+
return false unless groupings
|
274
|
+
groupings.fetch(grouping_id.to_s, []).include?(group)
|
275
|
+
end
|
276
|
+
|
277
|
+
def not_include_group?(grouping_id, group)
|
278
|
+
return false unless not_groupings
|
279
|
+
not_groupings.fetch(grouping_id.to_s, []).include?(group)
|
280
|
+
end
|
281
|
+
|
282
|
+
def include_mailchimp_list?(list_id)
|
283
|
+
return false unless mailchimp_lists
|
284
|
+
mailchimp_lists.include?(list_id)
|
285
|
+
end
|
286
|
+
|
287
|
+
def include_not_mailchimp_list?(list_id)
|
288
|
+
return false unless not_mailchimp_lists
|
289
|
+
not_mailchimp_lists.include?(list_id)
|
290
|
+
end
|
291
|
+
|
188
292
|
private
|
293
|
+
|
294
|
+
def birth_year?
|
295
|
+
birth_year.present?
|
296
|
+
end
|
297
|
+
|
298
|
+
def birth_month_and_day?
|
299
|
+
birth_month.present? && birth_day.present?
|
300
|
+
end
|
301
|
+
|
302
|
+
def birth_month?
|
303
|
+
birth_month.present?
|
304
|
+
end
|
189
305
|
|
190
306
|
def find_people
|
191
307
|
column_names = Person.column_names.collect {|cn| "people.#{cn}" }
|
192
308
|
|
193
309
|
people = Person.where(:organization_id => organization_id)
|
194
310
|
people = people.where(:dummy => false)
|
311
|
+
|
312
|
+
if birth_year?
|
313
|
+
people = people.where("birth_year = ?", birth_year)
|
314
|
+
end
|
315
|
+
|
316
|
+
if birth_month_and_day?
|
317
|
+
people = people.where("birth_month = ? AND birth_day = ?", birth_month, birth_day)
|
318
|
+
end
|
319
|
+
|
320
|
+
if birth_month?
|
321
|
+
people = people.where("birth_month = ?", birth_month) unless birth_month_and_day?
|
322
|
+
end
|
323
|
+
|
195
324
|
people = people.order('ordered_last_names ASC')
|
196
325
|
|
197
326
|
people = people.tagged_with(tagging) unless tagging.blank?
|
198
|
-
people = people.joins(:
|
327
|
+
people = people.joins(:addresses) unless zip.blank? && state.blank?
|
199
328
|
|
200
329
|
people = add_event_query(people, column_names)
|
201
330
|
|
@@ -209,31 +338,52 @@ class Search < ActiveRecord::Base
|
|
209
338
|
people = (discount_code == Discount::ALL_DISCOUNTS_STRING) ? people.where("items.discount_id is not null") : people.where("discounts.code = ?", discount_code)
|
210
339
|
end
|
211
340
|
|
212
|
-
|
213
|
-
|
214
|
-
|
215
|
-
|
216
|
-
|
217
|
-
|
218
|
-
|
219
|
-
people = people.
|
220
|
-
|
221
|
-
|
341
|
+
if(has_donated == false)
|
342
|
+
|
343
|
+
#this will return all people w/ no donations, and people who have not donated within a designated time window
|
344
|
+
people_subquery_donations = Item.joins("INNER JOIN orders ON orders.id = items.order_id")
|
345
|
+
.where("orders.person_id = people.id AND items.product_type = 'Donation'")
|
346
|
+
people_subquery_donations = people_subquery_donations.where('orders.created_at > ?', min_donations_date) if min_donations_date.present?
|
347
|
+
people_subquery_donations = people_subquery_donations.where('orders.created_at < ?', max_donations_date + 1.day) if max_donations_date.present?
|
348
|
+
people = people.where("NOT EXISTS (#{people_subquery_donations.to_sql})")
|
349
|
+
|
350
|
+
else
|
351
|
+
unless [gift_type, campaign_id, appeal_id, min_donations_amount, max_donations_amount, min_donations_date, max_donations_date].all?(&:blank?)
|
352
|
+
people = people.joins(:orders => [:items, :donation])
|
353
|
+
people = people.where('orders.created_at >= ?', min_donations_date) unless min_donations_date.blank?
|
354
|
+
people = people.where('orders.created_at <= ?', max_donations_date + 1.day) unless max_donations_date.blank?
|
355
|
+
people = people.where("items.product_type = 'Donation'")
|
356
|
+
people = people.where('donations.campaign_id = ?', campaign_id) unless campaign_id.blank?
|
357
|
+
people = people.where('donations.appeal_id = ?', appeal_id) unless appeal_id.blank?
|
358
|
+
if gift_type == 'pledge'
|
359
|
+
people = people.where('donations.pledge=?', true)
|
360
|
+
elsif gift_type == 'donation'
|
361
|
+
people = people.where('donations.pledge=? AND orders.parent_id IS NULL', false)
|
362
|
+
elsif gift_type == 'pledge_payment'
|
363
|
+
people = people.where('donations.pledge=? AND orders.parent_id IS NOT NULL', false)
|
364
|
+
end
|
365
|
+
|
366
|
+
people = people.group('people.id')
|
367
|
+
if min_donations_amount.blank?
|
368
|
+
people = people.having('SUM(items.price + items.nongift_amount) >= 1')
|
369
|
+
else
|
370
|
+
people = people.having('SUM(items.price + items.nongift_amount) >= ?', min_donations_amount * 100.0)
|
371
|
+
end
|
372
|
+
people = people.having('SUM(items.price + items.nongift_amount) <= ?', max_donations_amount * 100.0) unless max_donations_amount.blank?
|
222
373
|
end
|
223
|
-
people = people.having("SUM(items.price + items.nongift_amount) <= ?", max_donations_amount * 100.0) unless max_donations_amount.blank?
|
224
374
|
end
|
225
375
|
|
226
376
|
### MEMBERSHIP ##
|
227
377
|
if searching_membership?
|
228
378
|
people = people.joins('LEFT JOIN members ON members.person_id = people.id')
|
229
|
-
people = people.joins('LEFT JOIN memberships ON memberships.member_id = members.id
|
379
|
+
people = people.joins('LEFT JOIN memberships ON memberships.member_id = members.id')
|
230
380
|
people = people.joins('LEFT JOIN membership_types ON membership_types.id = memberships.membership_type_id')
|
231
381
|
end
|
232
382
|
|
233
383
|
if membership_status.present?
|
234
|
-
people = people.merge(
|
235
|
-
people = people.merge(
|
236
|
-
people = people.merge(
|
384
|
+
people = people.joins('LEFT JOIN memberships ON memberships.member_id = members.id').merge(Membership.current) if membership_status == 'Current'
|
385
|
+
people = people.joins('LEFT JOIN memberships ON memberships.member_id = members.id').merge(Membership.lapsed) if membership_status == 'Lapsed'
|
386
|
+
people = people.joins('LEFT JOIN memberships ON memberships.member_id = members.id').merge(Membership.past) if membership_status == 'Past'
|
237
387
|
people = people.where('members.id IS NULL') if membership_status == 'None'
|
238
388
|
end
|
239
389
|
|
@@ -271,7 +421,53 @@ class Search < ActiveRecord::Base
|
|
271
421
|
people = people.joins('left join relationships on people.id = relationships.person_id')
|
272
422
|
people = people.where(:relationships => {:relation_id => relation_id})
|
273
423
|
end
|
274
|
-
|
424
|
+
|
425
|
+
if mailchimp_lists.present?
|
426
|
+
people = people.joins(:subscribed_lists).
|
427
|
+
where(:subscribed_lists => { :list_id => mailchimp_lists })
|
428
|
+
end
|
429
|
+
|
430
|
+
if not_mailchimp_lists.present?
|
431
|
+
list_sql = not_mailchimp_lists.map do |list_id|
|
432
|
+
"list_id = ?"
|
433
|
+
end.join(" OR ")
|
434
|
+
people = people.where("not exists (select 1 from subscribed_lists where subscribed_lists.person_id = people.id and (#{list_sql}))", *not_mailchimp_lists)
|
435
|
+
end
|
436
|
+
|
437
|
+
if groupings.present?
|
438
|
+
people = people.joins(:subscribed_lists => [:groupings])
|
439
|
+
|
440
|
+
sql = []
|
441
|
+
sql_args = []
|
442
|
+
groupings.each do |grouping_id, groups|
|
443
|
+
group_sql = groups.map do |group|
|
444
|
+
"list_groupings.`group` = ?"
|
445
|
+
end.join(" OR ")
|
446
|
+
sql << "(list_groupings.mailchimp_id = ? AND (#{group_sql}))"
|
447
|
+
sql_args.concat([grouping_id, *groups])
|
448
|
+
end
|
449
|
+
|
450
|
+
people = people.where(sql.join(" OR "), *sql_args)
|
451
|
+
end
|
452
|
+
|
453
|
+
if not_groupings.present?
|
454
|
+
subquery = ListGrouping.joins(:subscribed_list).
|
455
|
+
where("subscribed_lists.person_id = people.id")
|
456
|
+
|
457
|
+
sql = []
|
458
|
+
sql_args = []
|
459
|
+
not_groupings.each do |grouping_id, groups|
|
460
|
+
group_sql = groups.map do |group|
|
461
|
+
"list_groupings.`group` = ?"
|
462
|
+
end.join(" OR ")
|
463
|
+
sql << "(list_groupings.mailchimp_id = ? AND (#{group_sql}))"
|
464
|
+
sql_args.concat([grouping_id, *groups])
|
465
|
+
end
|
466
|
+
|
467
|
+
subquery = subquery.where(sql.join(" OR "), *sql_args)
|
468
|
+
people = people.where("NOT EXISTS (#{subquery.to_sql})")
|
469
|
+
end
|
470
|
+
|
275
471
|
column_names << "lower(people.last_name) AS ordered_last_names"
|
276
472
|
people.select(column_names).group("people.id")
|
277
473
|
end
|
@@ -403,4 +599,20 @@ class Search < ActiveRecord::Base
|
|
403
599
|
:max_membership_end_date
|
404
600
|
].any? { |s| send(s).present? }
|
405
601
|
end
|
602
|
+
|
603
|
+
def searching_birthday?
|
604
|
+
[
|
605
|
+
:birth_month,
|
606
|
+
:birth_day,
|
607
|
+
:birth_year
|
608
|
+
].any? { |s| send(s).present? }
|
609
|
+
end
|
610
|
+
|
611
|
+
def output_birthday(birth_month, birth_day, birth_year)
|
612
|
+
birthday = []
|
613
|
+
birthday << Date::MONTHNAMES[birth_month] if birth_month.present?
|
614
|
+
birthday << birth_day.to_s if birth_day.present?
|
615
|
+
birthday << birth_year.to_s if birth_year.present?
|
616
|
+
birthday.join(', ')
|
617
|
+
end
|
406
618
|
end
|