effective_memberships 0.9.4 → 0.9.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/datatables/admin/effective_fees_datatable.rb +8 -2
- data/app/models/concerns/effective_memberships_applicant.rb +1 -0
- data/app/models/concerns/effective_memberships_registrar.rb +5 -0
- data/app/models/effective/fee.rb +5 -1
- data/app/views/admin/fees/_form.html.haml +22 -29
- data/config/routes.rb +1 -1
- data/lib/effective_memberships/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: bea643081128f664a7c004dbc49a3e8e06f940781267f85f63c7c6d4e69fe6d1
|
4
|
+
data.tar.gz: a769c9c7216ccdc090fc8a3e6107d654e49eeca2b20a171c48769b46d27a0cb0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4553d6b65132b346f36882658baac0ae47ec8945f2f592c19fac705b2e5414d1f4597e5473d2209cdb6a6c0528768a4aa65fe75b59b9712f14ffccdc6c5203ca
|
7
|
+
data.tar.gz: f6c02642c63397a2484fb0d9cd4b3fd471767b9c1b8449528e720ac2f73946a86520094ba39bd0b7056df0544e230a0f1a3bd60ddeb64ba689431664d9c3938b
|
@@ -21,6 +21,13 @@ module Admin
|
|
21
21
|
|
22
22
|
col :fee_type, search: EffectiveMemberships.fee_types
|
23
23
|
|
24
|
+
col :period, search: { collection: EffectiveMemberships.Registrar.periods_collection } do |fee|
|
25
|
+
EffectiveMemberships.Registrar.period_end_on(date: fee.period)
|
26
|
+
end
|
27
|
+
|
28
|
+
col :category, search: { collection: EffectiveMemberships.Category.all, polymorphic: false }
|
29
|
+
col :title
|
30
|
+
|
24
31
|
col :price, as: :price
|
25
32
|
col :qb_item_name, label: 'Quickbooks Item Name'
|
26
33
|
col :tax_exempt, visible: false
|
@@ -31,9 +38,8 @@ module Admin
|
|
31
38
|
col :parent, search: :string, visible: false
|
32
39
|
end
|
33
40
|
|
34
|
-
col :purchased_order
|
41
|
+
col :purchased_order
|
35
42
|
|
36
|
-
col :category, search: { collection: EffectiveMemberships.Category.all, polymorphic: false }
|
37
43
|
col :checkout_type, search: Effective::Fee::CHECKOUT_TYPES, visible: false
|
38
44
|
|
39
45
|
unless attributes[:total] == false
|
@@ -623,6 +623,7 @@ module EffectiveMembershipsApplicant
|
|
623
623
|
category_ids = user.membership.category_ids
|
624
624
|
|
625
625
|
categories.select do |cat|
|
626
|
+
cat.can_apply_new? ||
|
626
627
|
cat.can_apply_existing? ||
|
627
628
|
(cat.can_apply_restricted? && (category_ids & cat.can_apply_restricted_ids).present?)
|
628
629
|
end
|
@@ -375,6 +375,11 @@ module EffectiveMembershipsRegistrar
|
|
375
375
|
retval
|
376
376
|
end
|
377
377
|
|
378
|
+
def periods_collection(from: nil, to: nil)
|
379
|
+
from ||= Time.zone.now - 10.years
|
380
|
+
periods(from: from, to: to).reverse.map { |period| [period_end_on(date: period), period] }
|
381
|
+
end
|
382
|
+
|
378
383
|
# This is intended to be run once per day in a rake task
|
379
384
|
# rake effective_memberships:create_fees
|
380
385
|
# Create Renewal and Late fees
|
data/app/models/effective/fee.rb
CHANGED
@@ -44,9 +44,13 @@ module Effective
|
|
44
44
|
self.with_status ||= owner.membership.statuses.first if owner.membership.statuses.length == 1
|
45
45
|
end
|
46
46
|
|
47
|
+
before_validation(if: -> { changes['title'].blank? && (changes.keys & ['period', 'category_id', 'fee_type']).present? }) do
|
48
|
+
self.title = default_title()
|
49
|
+
end
|
50
|
+
|
47
51
|
before_validation do
|
48
52
|
self.period ||= EffectiveMemberships.Registrar.current_period
|
49
|
-
self.title
|
53
|
+
self.title = default_title() if self.title.blank?
|
50
54
|
end
|
51
55
|
|
52
56
|
before_validation(if: -> { fee_type == 'Renewal' && category.present? && period.present? }) do
|
@@ -6,45 +6,38 @@
|
|
6
6
|
- collection = { 'Users' => current_user.class.sorted, 'Organizations' => EffectiveMemberships.Organization.sorted }
|
7
7
|
= f.select :owner, collection, polymorphic: true
|
8
8
|
|
9
|
+
- registrar = EffectiveMemberships.Registrar
|
9
10
|
- fee_types = EffectiveMemberships.fee_types
|
10
11
|
- membership_period_fee_types = fee_types.select { |fee_type| Effective::Fee.new(fee_type: fee_type).membership_period_fee? }
|
11
12
|
|
12
|
-
-
|
13
|
-
|
14
|
-
- else
|
15
|
-
= f.static_field :fee_type
|
16
|
-
|
17
|
-
= f.show_if_any(:fee_type, membership_period_fee_types) do
|
18
|
-
= card do
|
19
|
-
%p This is a membership period fee. It will advance the membership fees paid through period when purchased.
|
20
|
-
%p Only one membership period fee -- Prorated or Renewal -- is expected to exist per membership period.
|
21
|
-
|
22
|
-
- registrar = EffectiveMemberships.Registrar
|
23
|
-
- periods = registrar.periods(from: Time.zone.now - 10.years)
|
24
|
-
- collection = periods.reverse.map { |period| [registrar.period_end_on(date: period), period] }
|
13
|
+
- f.object.period ||= registrar.current_period
|
14
|
+
- f.object.checkout_type ||= 'Default'
|
25
15
|
|
26
|
-
|
27
|
-
|
16
|
+
- f.object.category_id ||= f.object.owner&.membership&.categories&.first&.id
|
17
|
+
- f.object.category ||= f.object.owner&.membership&.categories&.first
|
28
18
|
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
= f.date_field :late_on, hint: 'A late fee will be applied on this date unless purchased'
|
19
|
+
= f.select :period, registrar.periods_collection, label: 'Membership period'
|
20
|
+
= f.select :fee_type, fee_types
|
21
|
+
= f.select :category_id, EffectiveMemberships.Category.all
|
33
22
|
|
34
|
-
|
35
|
-
|
23
|
+
= f.show_if_any(:fee_type, membership_period_fee_types) do
|
24
|
+
%p.text-muted
|
25
|
+
This is a membership period fee. It will advance the membership fees paid through period when purchased.
|
26
|
+
%br
|
27
|
+
Only one membership period fee -- Prorated or Renewal -- is expected to exist per membership period.
|
36
28
|
|
37
|
-
- f.object.
|
38
|
-
|
29
|
+
- if f.object.category.present?
|
30
|
+
= f.show_if(:fee_type, 'Renewal') do
|
31
|
+
- if f.object.category.create_late_fees?
|
32
|
+
= f.date_field :late_on, hint: 'A late fee will be applied on this date unless purchased. Leave blank to assign the default.'
|
39
33
|
|
40
|
-
|
41
|
-
|
34
|
+
- if f.object.category.create_not_in_good_standing?
|
35
|
+
= f.date_field :not_in_good_standing_on, hint: 'The membership will be marked NIGS on this date unless purchased. Leave blank to assign the default.'
|
42
36
|
|
43
|
-
|
44
|
-
|
45
|
-
- else
|
46
|
-
= f.static_field :parent
|
37
|
+
= f.radios :checkout_type, Effective::Fee::CHECKOUT_TYPES, inline: true, label: 'Checkout wizard',
|
38
|
+
hint: 'When default, Applicant and Reinstatement fees will be charged from the applicant wizard, and all other fee types from the fee payment wizard'
|
47
39
|
|
40
|
+
= f.text_field :title, hint: 'Leave blank to assign the default', required: false
|
48
41
|
= f.price_field :price
|
49
42
|
= f.text_field :qb_item_name, label: 'Quickbooks Item Name'
|
50
43
|
= f.check_box :tax_exempt, label: 'Yes, this fee is tax exempt'
|
data/config/routes.rb
CHANGED
@@ -52,7 +52,7 @@ EffectiveMemberships::Engine.routes.draw do
|
|
52
52
|
|
53
53
|
resources :applicant_reviews, only: [:index, :show]
|
54
54
|
|
55
|
-
resources :fees
|
55
|
+
resources :fees, except: [:show]
|
56
56
|
resources :categories, only: [:index, :edit, :update]
|
57
57
|
|
58
58
|
resources :applicant_course_areas, except: [:show]
|