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
@@ -1,4 +1,6 @@
|
|
1
1
|
class GiveAction < Action
|
2
|
+
validates_presence_of :person_id
|
3
|
+
|
2
4
|
def self.subtypes
|
3
5
|
["Monetary", "In-Kind"]
|
4
6
|
end
|
@@ -20,7 +22,7 @@ class GiveAction < Action
|
|
20
22
|
end
|
21
23
|
|
22
24
|
def quip
|
23
|
-
"gave us
|
25
|
+
"gave us"
|
24
26
|
end
|
25
27
|
|
26
28
|
def set_params(params, person)
|
@@ -28,4 +30,8 @@ class GiveAction < Action
|
|
28
30
|
self.dollar_amount = params[:dollar_amount]
|
29
31
|
super(params, person)
|
30
32
|
end
|
31
|
-
|
33
|
+
|
34
|
+
def full_details
|
35
|
+
details
|
36
|
+
end
|
37
|
+
end
|
@@ -1,4 +1,7 @@
|
|
1
1
|
class HearAction < Action
|
2
|
+
validates_presence_of :person_id
|
3
|
+
MAILCHIMP_SENT = "Mailchimp (Sent)"
|
4
|
+
|
2
5
|
def action_type
|
3
6
|
"Hear"
|
4
7
|
end
|
@@ -12,10 +15,21 @@ class HearAction < Action
|
|
12
15
|
end
|
13
16
|
|
14
17
|
def quip
|
15
|
-
"heard from us (via #{subtype.downcase})"
|
18
|
+
subtype.nil? ? "heard from us" : "heard from us (via #{subtype.downcase})"
|
16
19
|
end
|
17
20
|
|
18
21
|
def self.subtypes
|
19
22
|
["Email", "Phone", "Postal", "Meeting", "Twitter", "Facebook", "Blog", "Press"]
|
20
23
|
end
|
24
|
+
|
25
|
+
def set_params(params, person)
|
26
|
+
super(params, person)
|
27
|
+
self.subject_id = params[:subject_id]
|
28
|
+
self.subject_type = params[:subject_type]
|
29
|
+
end
|
30
|
+
|
31
|
+
def can_wait?
|
32
|
+
(subtype == MAILCHIMP_SENT)
|
33
|
+
end
|
34
|
+
|
21
35
|
end
|
@@ -1,4 +1,6 @@
|
|
1
1
|
class SayAction < Action
|
2
|
+
validates_presence_of :person_id
|
3
|
+
|
2
4
|
def action_type
|
3
5
|
"Say"
|
4
6
|
end
|
@@ -20,4 +22,4 @@ class SayAction < Action
|
|
20
22
|
def self.subtypes
|
21
23
|
["Email", "Phone", "Postal", "Meeting", "Twitter", "Facebook", "Blog", "Press"]
|
22
24
|
end
|
23
|
-
end
|
25
|
+
end
|
data/app/models/address.rb
CHANGED
@@ -1,10 +1,30 @@
|
|
1
1
|
class Address < ActiveRecord::Base
|
2
2
|
|
3
|
-
|
4
|
-
|
3
|
+
attr_accessor :member_update
|
4
|
+
attr_accessible :address1, :address2, :city, :state, :zip, :country, :person_id,
|
5
|
+
:household_id, :kind, :is_primary, :member_update
|
5
6
|
belongs_to :person
|
6
7
|
belongs_to :household
|
7
8
|
|
9
|
+
after_save { person.solr_index! if person }
|
10
|
+
after_destroy { person.solr_index! if person }
|
11
|
+
|
12
|
+
searchable do
|
13
|
+
text :address1, :address2, :city, :state, :zip, :country
|
14
|
+
integer :person_id, stored: true
|
15
|
+
string :organization_id do
|
16
|
+
person.organization_id unless person.nil?
|
17
|
+
end
|
18
|
+
end
|
19
|
+
include Ext::DelayedIndexing
|
20
|
+
|
21
|
+
# after_save do |record|
|
22
|
+
# Delayed::Job.enqueue(SuggestHouseholdsByAddressJob.new(record.id), :queue => :suggested_households)
|
23
|
+
# end
|
24
|
+
|
25
|
+
after_save :create_update_note, :if => :member_update
|
26
|
+
after_destroy :create_delete_note, :if => :member_update
|
27
|
+
|
8
28
|
#
|
9
29
|
# Needed because widget checkouts don't yet have a person_id
|
10
30
|
#
|
@@ -12,6 +32,19 @@ class Address < ActiveRecord::Base
|
|
12
32
|
!(address1.blank? || city.blank? || state.blank? || zip.blank?)
|
13
33
|
end
|
14
34
|
|
35
|
+
def city_state
|
36
|
+
str = city
|
37
|
+
|
38
|
+
if city.present? && state.present?
|
39
|
+
str += ", "
|
40
|
+
end
|
41
|
+
|
42
|
+
if state.present?
|
43
|
+
str += state
|
44
|
+
end
|
45
|
+
str
|
46
|
+
end
|
47
|
+
|
15
48
|
def address
|
16
49
|
"#{address1} #{address2}"
|
17
50
|
end
|
@@ -26,12 +59,15 @@ class Address < ActiveRecord::Base
|
|
26
59
|
end
|
27
60
|
|
28
61
|
def is_same_as(addr)
|
29
|
-
return
|
62
|
+
return !addr.nil? &&
|
63
|
+
address1.eql?(addr.address1) &&
|
30
64
|
address2.eql?(addr.address2) &&
|
31
65
|
city.eql?(addr.city) &&
|
32
66
|
state.eql?(addr.state) &&
|
33
67
|
zip.eql?(addr.zip) &&
|
34
|
-
country.eql?(addr.country)
|
68
|
+
country.eql?(addr.country) &&
|
69
|
+
kind.eql?(addr.kind) &&
|
70
|
+
is_primary.eql?(addr.is_primary)
|
35
71
|
end
|
36
72
|
|
37
73
|
def self.from_payment(payment)
|
@@ -39,7 +75,7 @@ class Address < ActiveRecord::Base
|
|
39
75
|
end
|
40
76
|
|
41
77
|
def self.unhash(address)
|
42
|
-
(address.is_a? Hash) ? Address.new(address.except(:id, :created_at, :updated_at, :
|
78
|
+
(address.is_a? Hash) ? Address.new(address.except(:id, :created_at, :updated_at, :_destroy)) : address
|
43
79
|
end
|
44
80
|
|
45
81
|
def self.find_or_create(pers_id)
|
@@ -47,33 +83,14 @@ class Address < ActiveRecord::Base
|
|
47
83
|
where(:person_id => pers_id).first || Address.create(:person_id => pers_id)
|
48
84
|
end
|
49
85
|
|
50
|
-
def update_with_note(person, user, address, time_zone, updated_by)
|
51
|
-
old_addr = to_s()
|
52
|
-
|
53
|
-
unless is_same_as(address)
|
54
|
-
["address1", "address2", "city", "state", "zip", "country"].each do |field|
|
55
|
-
self.send("#{field}=", address.send(field))
|
56
|
-
end
|
57
|
-
|
58
|
-
if save
|
59
|
-
extra = updated_by.nil? ? "" : " from #{updated_by}"
|
60
|
-
text = "address updated#{extra}"
|
61
|
-
text = text + ", old address was: (#{old_addr})" unless old_addr.blank?
|
62
|
-
note = person.notes.create({
|
63
|
-
:occurred_at => DateTime.now.in_time_zone(time_zone),
|
64
|
-
:text => text
|
65
|
-
})
|
66
|
-
note.user = user
|
67
|
-
else
|
68
|
-
return false
|
69
|
-
end
|
70
|
-
end
|
71
|
-
|
72
|
-
true
|
73
|
-
end
|
74
|
-
|
75
86
|
def ==(other)
|
76
|
-
|
87
|
+
other.is_a?(Address) &&
|
88
|
+
address1 == other.address1 &&
|
89
|
+
address2 == other.address2 &&
|
90
|
+
city == other.city &&
|
91
|
+
state == other.state &&
|
92
|
+
zip == other.zip &&
|
93
|
+
country == other.country
|
77
94
|
end
|
78
95
|
|
79
96
|
def values_hash
|
@@ -87,5 +104,33 @@ class Address < ActiveRecord::Base
|
|
87
104
|
}
|
88
105
|
end
|
89
106
|
|
107
|
+
def self.kinds
|
108
|
+
[ "Home", "Work", "Other" ]
|
109
|
+
end
|
110
|
+
|
111
|
+
private
|
90
112
|
|
113
|
+
def create_update_note
|
114
|
+
text = "Address #{old_addr.blank? ? 'added' : 'updated'} from member dashboard"
|
115
|
+
text = text + ", old address was: (#{old_addr})" unless old_addr.blank?
|
116
|
+
create_note(text)
|
117
|
+
end
|
118
|
+
|
119
|
+
def create_delete_note
|
120
|
+
text = "Address deleted from member dashboard"
|
121
|
+
text = text + ", it was: (#{old_addr})" unless old_addr.blank?
|
122
|
+
create_note(text)
|
123
|
+
end
|
124
|
+
|
125
|
+
def create_note(text)
|
126
|
+
self.person.notes.create({
|
127
|
+
:organization_id => self.person.organization.id,
|
128
|
+
:occurred_at => DateTime.now.in_time_zone(person.organization.time_zone),
|
129
|
+
:text => text
|
130
|
+
})
|
131
|
+
end
|
132
|
+
|
133
|
+
def old_addr
|
134
|
+
"#{address1_was} #{address2_was} #{city_was} #{state_was} #{zip_was} #{country_was}"
|
135
|
+
end
|
91
136
|
end
|
@@ -0,0 +1,434 @@
|
|
1
|
+
class AdvancedSearch < ActiveRecord::Base
|
2
|
+
|
3
|
+
belongs_to :organization
|
4
|
+
belongs_to :user
|
5
|
+
has_one :advanced_search_segment
|
6
|
+
|
7
|
+
validates_presence_of :organization_id
|
8
|
+
validate :keyword_presence, on: :create
|
9
|
+
|
10
|
+
attr_accessible :search_parameters, :organization_id
|
11
|
+
|
12
|
+
serialize :search_parameters, JSON
|
13
|
+
|
14
|
+
ANY_EVENT = '-1'
|
15
|
+
ANY_SHOW = '-1'
|
16
|
+
ANY_TICKET_TYPE = '-1'
|
17
|
+
ANY_MEMBERSHIP_TYPE = '-1'
|
18
|
+
ANY_PASS_TYPE = '-1'
|
19
|
+
MAX_SOLR_RESULTS = 10**9
|
20
|
+
|
21
|
+
def length
|
22
|
+
people.length
|
23
|
+
end
|
24
|
+
|
25
|
+
def people(page=1, per_page=20)
|
26
|
+
@people ||= perform_search(page, per_page).results
|
27
|
+
end
|
28
|
+
|
29
|
+
def all_people
|
30
|
+
@people ||= perform_search(1, MAX_SOLR_RESULTS).results
|
31
|
+
end
|
32
|
+
|
33
|
+
def people_hits(page=1, per_page=20)
|
34
|
+
@people ||= perform_search(page, per_page).hits
|
35
|
+
end
|
36
|
+
|
37
|
+
def people_ids(page=1, per_page=20)
|
38
|
+
@people_ids ||= perform_search(page, per_page).hits.map {|hit| hit.stored(:id) }
|
39
|
+
end
|
40
|
+
|
41
|
+
def tag(tag)
|
42
|
+
Delayed::Job.enqueue(TagJob.new(tag, people(1, MAX_SOLR_RESULTS)))
|
43
|
+
end
|
44
|
+
|
45
|
+
def attach_action(action)
|
46
|
+
Delayed::Job.enqueue(ActionJob.new(action, people(1, MAX_SOLR_RESULTS)))
|
47
|
+
end
|
48
|
+
|
49
|
+
def search_junction
|
50
|
+
return nil unless search_parameters
|
51
|
+
|
52
|
+
if search_parameters['conjunction'] == 'all_of'
|
53
|
+
:all_of
|
54
|
+
elsif search_parameters['conjunction'] == 'any_of'
|
55
|
+
:any_of
|
56
|
+
else
|
57
|
+
nil
|
58
|
+
end
|
59
|
+
end
|
60
|
+
|
61
|
+
def perform_search(page, per_page)
|
62
|
+
# Upgrade Note: This is written against Sunspot 1.3
|
63
|
+
# and greater_than and less_than are actually
|
64
|
+
# greater_than_or_equal and less_than_or_equal_to.
|
65
|
+
# These will need to be changed for Sunspot 2.0+
|
66
|
+
|
67
|
+
Person.search do
|
68
|
+
with(:organization_id, organization_id)
|
69
|
+
with(:deleted, false)
|
70
|
+
|
71
|
+
send(search_junction) do
|
72
|
+
|
73
|
+
matching_people = Proc.new { |search, preposition, field_name|
|
74
|
+
|
75
|
+
matching_people_ids = search.hits.map {|hit| hit.stored(field_name.to_sym) }.compact.uniq
|
76
|
+
|
77
|
+
if matching_people_ids.empty?
|
78
|
+
# We need negate this query in the main search since it didn't match
|
79
|
+
send(preposition, :id).equal_to(-1)
|
80
|
+
else
|
81
|
+
send(preposition, :id).any_of(matching_people_ids)
|
82
|
+
end
|
83
|
+
|
84
|
+
}
|
85
|
+
|
86
|
+
search_parameters.each do |filter_id, filter_settings|
|
87
|
+
preposition = if filter_settings['negation-filter'] == '0'
|
88
|
+
:with
|
89
|
+
elsif filter_settings['negation-filter'] == '1'
|
90
|
+
:without
|
91
|
+
end
|
92
|
+
|
93
|
+
case filter_settings['field_type']
|
94
|
+
when 'tagging'
|
95
|
+
send(preposition, :tag_list).equal_to(filter_settings['tag'])
|
96
|
+
|
97
|
+
when 'has_purchased_for'
|
98
|
+
# Solr search the tickets for this org, event, and date range first
|
99
|
+
ticket_search = Ticket.search do
|
100
|
+
with(:organization_id, organization_id)
|
101
|
+
|
102
|
+
if filter_settings['event_id'].present?
|
103
|
+
unless filter_settings['event_id'] == ANY_EVENT
|
104
|
+
with(:event_id).equal_to(filter_settings['event_id'])
|
105
|
+
end
|
106
|
+
end
|
107
|
+
|
108
|
+
if filter_settings['show_id'].present?
|
109
|
+
unless filter_settings['show_id'] == ANY_SHOW
|
110
|
+
with(:show_id).equal_to(filter_settings['show_id'])
|
111
|
+
end
|
112
|
+
end
|
113
|
+
|
114
|
+
if filter_settings['ticket_type_id'].present?
|
115
|
+
unless filter_settings['ticket_type_id'] == ANY_TICKET_TYPE
|
116
|
+
with(:ticket_type_id).equal_to(filter_settings['ticket_type_id'])
|
117
|
+
end
|
118
|
+
end
|
119
|
+
|
120
|
+
paginate per_page: MAX_SOLR_RESULTS
|
121
|
+
end
|
122
|
+
|
123
|
+
matching_people.call(ticket_search, preposition, 'buyer_id')
|
124
|
+
|
125
|
+
when 'donated'
|
126
|
+
# Solr search the orders for this org and date range first
|
127
|
+
order_search = Order.search do
|
128
|
+
with(:organization_id, organization_id)
|
129
|
+
|
130
|
+
if filter_settings['min_donations_date'].present?
|
131
|
+
min_donations_date = Date.parse(filter_settings['min_donations_date'])
|
132
|
+
with(:created_at).greater_than(min_donations_date)
|
133
|
+
end
|
134
|
+
|
135
|
+
if filter_settings['max_donations_date'].present?
|
136
|
+
max_donations_date = Date.parse(filter_settings['max_donations_date'])
|
137
|
+
with(:created_at).less_than(max_donations_date)
|
138
|
+
end
|
139
|
+
|
140
|
+
paginate per_page: MAX_SOLR_RESULTS
|
141
|
+
end
|
142
|
+
|
143
|
+
if filter_settings['donation_lower_bound'].present?
|
144
|
+
lower_bound = filter_settings['donation_lower_bound'].to_i * 100
|
145
|
+
else
|
146
|
+
lower_bound = 1
|
147
|
+
end
|
148
|
+
|
149
|
+
if filter_settings['donation_upper_bound'].present?
|
150
|
+
upper_bound = filter_settings['donation_upper_bound'].to_i * 100
|
151
|
+
else
|
152
|
+
upper_bound = Float::INFINITY
|
153
|
+
end
|
154
|
+
|
155
|
+
# Sunspot 2+ supports grouping; for now we group by hand
|
156
|
+
people_id_donation_histogram = Hash.new(0)
|
157
|
+
order_search.hits.each do |hit|
|
158
|
+
people_id_donation_histogram[hit.stored(:person_id)] += hit.stored(:donation_amount)
|
159
|
+
end
|
160
|
+
|
161
|
+
# Reduce it down to Person IDs within the donation boundaries
|
162
|
+
matching_people_ids = people_id_donation_histogram.select do |person_id, donation_amount|
|
163
|
+
donation_amount.between?(lower_bound, upper_bound)
|
164
|
+
end.keys
|
165
|
+
|
166
|
+
# Search for the people
|
167
|
+
if matching_people_ids.empty?
|
168
|
+
send(preposition, :id).equal_to(-1) # Make this clause return false
|
169
|
+
else
|
170
|
+
send(preposition, :id).any_of(matching_people_ids)
|
171
|
+
end
|
172
|
+
|
173
|
+
when 'lifetime_value'
|
174
|
+
min_lifetime_value = filter_settings['lifetime_value_lower_bound'].to_i * 100
|
175
|
+
max_lifetime_value = filter_settings['lifetime_value_upper_bound'].to_i * 100
|
176
|
+
|
177
|
+
if filter_settings['lifetime_value_lower_bound'].present? && !filter_settings['lifetime_value_upper_bound'].present?
|
178
|
+
with(:lifetime_value).greater_than(min_lifetime_value)
|
179
|
+
end
|
180
|
+
|
181
|
+
if filter_settings['lifetime_value_upper_bound'].present? && !filter_settings['lifetime_value_lower_bound'].present?
|
182
|
+
with(:lifetime_value).less_than(max_lifetime_value)
|
183
|
+
|
184
|
+
# Set a default lower bound on non-negated upper bound searches
|
185
|
+
if preposition == :with
|
186
|
+
with(:lifetime_value).greater_than(1)
|
187
|
+
end
|
188
|
+
end
|
189
|
+
|
190
|
+
if filter_settings['lifetime_value_lower_bound'].present? && filter_settings['lifetime_value_upper_bound'].present?
|
191
|
+
with(:lifetime_value).between(min_lifetime_value..max_lifetime_value)
|
192
|
+
end
|
193
|
+
|
194
|
+
when 'discount_code'
|
195
|
+
if filter_settings['discount_code'] == Discount::ALL_DISCOUNTS_STRING
|
196
|
+
# Invert preposition here since we're not searching for presence of any discount_id
|
197
|
+
# but rather the presence of empty discount_ids.
|
198
|
+
if preposition == :with
|
199
|
+
without(:discount_ids, nil)
|
200
|
+
elsif preposition == :without
|
201
|
+
with(:discount_ids, nil)
|
202
|
+
end
|
203
|
+
else
|
204
|
+
send(preposition, :discount_ids).equal_to(filter_settings['discount_code'])
|
205
|
+
end
|
206
|
+
|
207
|
+
when 'location'
|
208
|
+
if filter_settings['zip'].present?
|
209
|
+
send(preposition, :zip).equal_to(filter_settings['zip'])
|
210
|
+
end
|
211
|
+
|
212
|
+
if filter_settings['location_state'].present?
|
213
|
+
send(preposition, :state).equal_to(filter_settings['location_state'])
|
214
|
+
end
|
215
|
+
|
216
|
+
if filter_settings['location_city'].present?
|
217
|
+
people_search = Person.search do
|
218
|
+
fulltext filter_settings['location_city'], :fields => :city
|
219
|
+
|
220
|
+
paginate per_page: MAX_SOLR_RESULTS
|
221
|
+
end
|
222
|
+
|
223
|
+
matching_people.call(people_search, preposition, 'id')
|
224
|
+
end
|
225
|
+
|
226
|
+
if filter_settings['location_country'].present?
|
227
|
+
send(preposition, :country).equal_to(filter_settings['location_country'])
|
228
|
+
end
|
229
|
+
|
230
|
+
when 'birthday'
|
231
|
+
if filter_settings['birth_year'].present?
|
232
|
+
send(preposition, :birth_year).equal_to(filter_settings['birth_year'])
|
233
|
+
end
|
234
|
+
|
235
|
+
if filter_settings['birth_month'].present?
|
236
|
+
send(preposition, :birth_month).equal_to(filter_settings['birth_month'])
|
237
|
+
end
|
238
|
+
|
239
|
+
if filter_settings['birth_day'].present?
|
240
|
+
send(preposition, :birth_day).equal_to(filter_settings['birth_day'])
|
241
|
+
end
|
242
|
+
|
243
|
+
when 'membership_started'
|
244
|
+
if filter_settings['min_membership_start_date'].present?
|
245
|
+
start_date = Date.parse(filter_settings['min_membership_start_date'])
|
246
|
+
with(:memberships_start_at).greater_than(start_date)
|
247
|
+
end
|
248
|
+
|
249
|
+
if filter_settings['max_membership_start_date'].present?
|
250
|
+
start_date = Date.parse(filter_settings['max_membership_start_date'])
|
251
|
+
with(:memberships_start_at).less_than(start_date)
|
252
|
+
end
|
253
|
+
|
254
|
+
when 'membership_ended'
|
255
|
+
if filter_settings['min_membership_end_date'].present?
|
256
|
+
end_date = Date.parse(filter_settings['min_membership_end_date'])
|
257
|
+
with(:memberships_end_at).greater_than(end_date)
|
258
|
+
end
|
259
|
+
|
260
|
+
if filter_settings['max_membership_end_date'].present?
|
261
|
+
end_date = Date.parse(filter_settings['max_membership_end_date'])
|
262
|
+
with(:memberships_end_at).less_than(end_date)
|
263
|
+
end
|
264
|
+
|
265
|
+
when 'membership_status'
|
266
|
+
send(preposition, :membership_status).equal_to(filter_settings['membership_status'])
|
267
|
+
|
268
|
+
when 'membership_type'
|
269
|
+
if filter_settings['membership_type_id'] == ANY_MEMBERSHIP_TYPE
|
270
|
+
if preposition == :without
|
271
|
+
with(:membership_types, nil)
|
272
|
+
else
|
273
|
+
without(:membership_types, nil)
|
274
|
+
end
|
275
|
+
else
|
276
|
+
send(preposition, :membership_types).equal_to(filter_settings['membership_type_id'].to_i)
|
277
|
+
end
|
278
|
+
|
279
|
+
when 'pass_type'
|
280
|
+
if filter_settings['pass_type_id'] == ANY_PASS_TYPE
|
281
|
+
if preposition == :without
|
282
|
+
with(:pass_type_ids, nil)
|
283
|
+
else
|
284
|
+
without(:pass_type_ids, nil)
|
285
|
+
end
|
286
|
+
else
|
287
|
+
send(preposition, :pass_type_ids).equal_to(filter_settings['pass_type_id'].to_i)
|
288
|
+
end
|
289
|
+
|
290
|
+
when 'relationships'
|
291
|
+
send(preposition, :relation_ids).equal_to(filter_settings['relation_id'])
|
292
|
+
|
293
|
+
when 'limit_results'
|
294
|
+
if filter_settings['limit'].present?
|
295
|
+
if %w(business foundation government nonprofit other).include?(filter_settings['limit'])
|
296
|
+
all_of do
|
297
|
+
with(:type).equal_to('Company')
|
298
|
+
with(:subtype).equal_to(filter_settings['limit'].titlecase)
|
299
|
+
end
|
300
|
+
elsif 'company' == filter_settings['limit']
|
301
|
+
with(:type).equal_to('Company')
|
302
|
+
else
|
303
|
+
with(:type).equal_to(filter_settings['limit'].titlecase)
|
304
|
+
end
|
305
|
+
end
|
306
|
+
|
307
|
+
when 'email'
|
308
|
+
if preposition == :without
|
309
|
+
with(:email, nil)
|
310
|
+
else
|
311
|
+
without(:email, nil)
|
312
|
+
end
|
313
|
+
|
314
|
+
when 'segment'
|
315
|
+
segment = AdvancedSearchSegment.find(filter_settings['advanced_search_segment_id'])
|
316
|
+
matching_people_ids = segment.advanced_search.people_hits.map {|hit| hit.stored(:id)}.compact.uniq
|
317
|
+
|
318
|
+
if matching_people_ids.empty?
|
319
|
+
send(preposition, :id).equal_to(-1)
|
320
|
+
else
|
321
|
+
send(preposition, :id).any_of(matching_people_ids)
|
322
|
+
end
|
323
|
+
|
324
|
+
when 'keyword'
|
325
|
+
if filter_settings['keyword_model'] == 'Note'
|
326
|
+
note_search = Note.search do
|
327
|
+
with(:organization_id, organization_id)
|
328
|
+
fulltext filter_settings['keyword_selection'], :fields => :text
|
329
|
+
|
330
|
+
paginate per_page: MAX_SOLR_RESULTS
|
331
|
+
end
|
332
|
+
|
333
|
+
matching_people.call(note_search, preposition, 'person_id')
|
334
|
+
|
335
|
+
elsif filter_settings['keyword_model'] == 'Action'
|
336
|
+
action_search = Action.search do
|
337
|
+
with(:organization_id, organization_id)
|
338
|
+
fulltext filter_settings['keyword_selection'], :fields => [:details, :verb]
|
339
|
+
|
340
|
+
paginate per_page: MAX_SOLR_RESULTS
|
341
|
+
end
|
342
|
+
|
343
|
+
matching_people.call(action_search, preposition, 'person_id')
|
344
|
+
|
345
|
+
elsif filter_settings['keyword_model'] == 'Address'
|
346
|
+
address_search = Address.search do
|
347
|
+
with(:organization_id, organization_id)
|
348
|
+
fulltext filter_settings['keyword_selection']
|
349
|
+
|
350
|
+
paginate per_page: MAX_SOLR_RESULTS
|
351
|
+
end
|
352
|
+
|
353
|
+
matching_people.call(address_search, preposition, 'person_id')
|
354
|
+
|
355
|
+
end
|
356
|
+
|
357
|
+
when 'orders'
|
358
|
+
order_search = Order.search do
|
359
|
+
with(:organization_id, organization_id)
|
360
|
+
if filter_settings['date_start'].present?
|
361
|
+
date_start = Date.parse(filter_settings['date_start'])
|
362
|
+
with(:created_at).greater_than(date_start)
|
363
|
+
end
|
364
|
+
|
365
|
+
if filter_settings['date_end'].present?
|
366
|
+
date_end = Date.parse(filter_settings['date_end'])
|
367
|
+
with(:created_at).less_than(date_end)
|
368
|
+
end
|
369
|
+
|
370
|
+
paginate per_page: MAX_SOLR_RESULTS
|
371
|
+
end
|
372
|
+
|
373
|
+
matching_people.call(order_search, preposition, 'person_id')
|
374
|
+
|
375
|
+
when 'action'
|
376
|
+
action_search = Action.search do
|
377
|
+
with(:organization_id, organization_id)
|
378
|
+
with(:type, filter_settings['action_type'])
|
379
|
+
if filter_settings['date_start'].present?
|
380
|
+
date_start = Date.parse(filter_settings['date_start'])
|
381
|
+
with(:created_at).greater_than(date_start)
|
382
|
+
end
|
383
|
+
|
384
|
+
if filter_settings['date_end'].present?
|
385
|
+
date_end = Date.parse(filter_settings['date_end'])
|
386
|
+
with(:created_at).less_than(date_end)
|
387
|
+
end
|
388
|
+
|
389
|
+
paginate per_page: MAX_SOLR_RESULTS
|
390
|
+
end
|
391
|
+
|
392
|
+
matching_people.call(action_search, preposition, 'person_id')
|
393
|
+
|
394
|
+
when 'mailchimp_list'
|
395
|
+
if filter_settings['mailchimp_list'].present?
|
396
|
+
send(preposition, :mailchimp_list_ids).equal_to(filter_settings['mailchimp_list'])
|
397
|
+
end
|
398
|
+
|
399
|
+
when 'mailchimp_group'
|
400
|
+
if filter_settings['mailchimp_group'].present?
|
401
|
+
send(preposition, :mailchimp_groups).equal_to(filter_settings['mailchimp_group'])
|
402
|
+
end
|
403
|
+
|
404
|
+
end
|
405
|
+
end
|
406
|
+
end
|
407
|
+
|
408
|
+
order_by(:sort_name, :asc)
|
409
|
+
|
410
|
+
paginate(page: page, per_page: per_page)
|
411
|
+
end
|
412
|
+
end
|
413
|
+
|
414
|
+
def self.for_membership_type(membership_type)
|
415
|
+
random_string = SecureRandom.hex[0..7]
|
416
|
+
AdvancedSearch.create(organization_id: membership_type.organization.id, search_parameters: {"conjunction" => "all_of", random_string => {"field_type" => "membership_type", "negation-filter" => "0", "membership_type_id" => membership_type.id}})
|
417
|
+
end
|
418
|
+
|
419
|
+
def self.for_pass(pass)
|
420
|
+
random_string = SecureRandom.hex[0..7]
|
421
|
+
AdvancedSearch.create(organization_id: pass.organization.id, search_parameters: {"conjunction" => "all_of", random_string => {"field_type" => "pass_type", "negation-filter" => "0", "pass_type_id" => pass.id}})
|
422
|
+
end
|
423
|
+
|
424
|
+
def empty_search?
|
425
|
+
search_parameters.size == 1
|
426
|
+
end
|
427
|
+
|
428
|
+
def keyword_presence
|
429
|
+
self.search_parameters.each_value do |value|
|
430
|
+
self.errors.add(:base, "Please specify a keyword") if value.is_a?(Hash) && value["keyword_selection"] == ""
|
431
|
+
end
|
432
|
+
end
|
433
|
+
|
434
|
+
end
|