effective_memberships 0.9.5 → 0.9.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/controllers/admin/registrar_actions_controller.rb +4 -0
- data/app/models/concerns/effective_memberships_applicant.rb +13 -7
- data/app/models/concerns/effective_memberships_owner.rb +32 -7
- data/app/models/concerns/effective_memberships_registrar.rb +102 -23
- data/app/models/effective/membership.rb +2 -3
- data/app/models/effective/membership_history.rb +6 -1
- data/app/models/effective/registrar_action.rb +11 -1
- data/app/views/admin/applicants/_form_approve.html.haml +21 -1
- data/app/views/admin/memberships/_form.html.haml +4 -0
- data/app/views/admin/memberships/_form_membership.html.haml +1 -1
- data/app/views/admin/registrar_actions/_form.html.haml +3 -0
- data/app/views/admin/registrar_actions/_form_fees_paid.html.haml +1 -0
- data/app/views/admin/registrar_actions/_form_reinstatement.html.haml +44 -0
- data/app/views/admin/registrar_actions/_form_remove.html.haml +5 -0
- data/app/views/effective/applicants/select/_apply_for_reinstatement.html.haml +1 -3
- data/app/views/effective/applicants/select.html.haml +7 -11
- data/app/views/effective/memberships/_dashboard.html.haml +1 -0
- data/lib/effective_memberships/version.rb +1 -1
- data/lib/tasks/effective_memberships_tasks.rake +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c9916218e0d606b59b230debdc5c7a70e1d3754333f786298a4b9f3cf21222ce
|
4
|
+
data.tar.gz: 7ee9f5e5f4f64ea6764c206b053a81dc0d253a596de57d2e20324e3c64b86aa4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6e6f8b7f49df86cd4461dba072f3106e3a095076d44f298ced308857e7ee86b3f91455d6823716470d6b4dccdb75ed42e8e05cc2be9bc0208e314aaef011e759
|
7
|
+
data.tar.gz: 936b9c462cede66151ae4a9d186a3b3d6aee60989f284f6157373fb043f73498e486678e09d39af0f75f648a5ace5826f66f0ec553427fbeb77375a1b5822fa9
|
@@ -14,6 +14,10 @@ module Admin
|
|
14
14
|
success: -> { "#{resource.owner} has been reclassified to #{resource.owner.membership.category}" },
|
15
15
|
redirect: -> { admin_owners_path(resource) }
|
16
16
|
|
17
|
+
submit :reinstate, 'Reinstate',
|
18
|
+
success: -> { "#{resource.owner} has been reinstated to #{resource.owner.membership.category}" },
|
19
|
+
redirect: -> { admin_owners_path(resource) }
|
20
|
+
|
17
21
|
submit :status_assign, 'Assign Status',
|
18
22
|
success: -> { "#{resource.owner} has been assigned #{resource.owner.membership.statuses_sentence}" },
|
19
23
|
redirect: -> { admin_owners_path(resource) }
|
@@ -21,6 +21,10 @@ module EffectiveMembershipsApplicant
|
|
21
21
|
[:start, :select, :summary, :billing, :checkout, :submitted]
|
22
22
|
end
|
23
23
|
|
24
|
+
# Apply to Join - Anyone can do this
|
25
|
+
# Apply to Reclassify - Must have an existing membership and category
|
26
|
+
# Apply for Reinstatement - Must have a removed membership. Membership history.
|
27
|
+
|
24
28
|
def categories
|
25
29
|
['Apply to Join', 'Apply to Reclassify', 'Apply for Reinstatement']
|
26
30
|
end
|
@@ -101,7 +105,6 @@ module EffectiveMembershipsApplicant
|
|
101
105
|
# Required for Apply to Reclassify
|
102
106
|
belongs_to :from_category, polymorphic: true, optional: true
|
103
107
|
|
104
|
-
# Required for Apply for Reinstatement
|
105
108
|
belongs_to :from_status, polymorphic: true, optional: true
|
106
109
|
|
107
110
|
has_many :applicant_reviews, -> { order(:id) }, as: :applicant, inverse_of: :applicant, dependent: :destroy
|
@@ -202,8 +205,8 @@ module EffectiveMembershipsApplicant
|
|
202
205
|
self.from_category = owner.membership.categories.first
|
203
206
|
end
|
204
207
|
|
205
|
-
if
|
206
|
-
self.
|
208
|
+
if reinstatement?
|
209
|
+
self.from_category = owner.reinstatement_membership_category
|
207
210
|
end
|
208
211
|
end
|
209
212
|
|
@@ -215,7 +218,6 @@ module EffectiveMembershipsApplicant
|
|
215
218
|
validates :user, presence: true
|
216
219
|
|
217
220
|
validates :from_category, presence: true, if: -> { reclassification? }
|
218
|
-
validates :from_status, presence: true, if: -> { reinstatement? }
|
219
221
|
|
220
222
|
validate(if: -> { reclassification? && category_id.present? }) do
|
221
223
|
errors.add(:category_id, "can't reclassify to existing category") if category_id == from_category_id
|
@@ -603,10 +605,12 @@ module EffectiveMembershipsApplicant
|
|
603
605
|
|
604
606
|
# Used by the select step
|
605
607
|
def can_apply_applicant_types_collection
|
606
|
-
if owner.blank?
|
608
|
+
if owner.blank?
|
607
609
|
['Apply to Join']
|
608
|
-
elsif owner.
|
610
|
+
elsif owner.membership_removed?
|
609
611
|
['Apply for Reinstatement', 'Apply to Join']
|
612
|
+
elsif owner.membership.blank? || owner.membership.categories.blank?
|
613
|
+
['Apply to Join']
|
610
614
|
else
|
611
615
|
['Apply to Reclassify']
|
612
616
|
end
|
@@ -848,6 +852,8 @@ module EffectiveMembershipsApplicant
|
|
848
852
|
|
849
853
|
approved!
|
850
854
|
|
855
|
+
EffectiveMemberships.Registrar.delete_fees!(owner)
|
856
|
+
|
851
857
|
if apply_to_join?
|
852
858
|
EffectiveMemberships.Registrar.register!(
|
853
859
|
owner,
|
@@ -859,7 +865,7 @@ module EffectiveMembershipsApplicant
|
|
859
865
|
elsif reclassification?
|
860
866
|
EffectiveMemberships.Registrar.reclassify!(owner, to: to_category, status: to_status)
|
861
867
|
elsif reinstatement?
|
862
|
-
EffectiveMemberships.Registrar.reinstate!(owner,
|
868
|
+
EffectiveMemberships.Registrar.reinstate!(owner, to: to_category)
|
863
869
|
else
|
864
870
|
raise('unsupported approval applicant_type')
|
865
871
|
end
|
@@ -99,6 +99,15 @@ module EffectiveMembershipsOwner
|
|
99
99
|
fees.select { |fee| fee.fee_payment_fee? && !fee.purchased? }
|
100
100
|
end
|
101
101
|
|
102
|
+
def outstanding_fee_payments
|
103
|
+
fee_payments = EffectiveMemberships.FeePayment.all
|
104
|
+
|
105
|
+
fee_payments = fee_payments.where(user: self) if self.class.respond_to?(:effective_memberships_user?)
|
106
|
+
fee_payments = fee_payments.where(organization: self) if self.class.respond_to?(:effective_memberships_organization?)
|
107
|
+
|
108
|
+
fee_payments.select { |fee_payment| fee_payment.in_progress? && fee_payment.orders.none?(&:purchased?) }
|
109
|
+
end
|
110
|
+
|
102
111
|
def outstanding_fee_payment_orders
|
103
112
|
orders.select { |order| order.parent_type.to_s.include?('FeePayment') && !order.purchased? }
|
104
113
|
end
|
@@ -121,8 +130,25 @@ module EffectiveMembershipsOwner
|
|
121
130
|
end
|
122
131
|
|
123
132
|
def membership_removed_on
|
124
|
-
|
125
|
-
|
133
|
+
removed_membership_history.start_on if membership_removed?
|
134
|
+
end
|
135
|
+
|
136
|
+
# The membership history that is removed. Has exit statuses that may affect reinstatement fees.
|
137
|
+
def removed_membership_history
|
138
|
+
membership_histories.reverse.find { |history| history.removed? } if membership_removed?
|
139
|
+
end
|
140
|
+
|
141
|
+
# The membership history we would reinstate to. Should be the one just before removed.
|
142
|
+
def reinstatement_membership_history
|
143
|
+
membership_histories.reverse.find { |history| !history.removed? } if membership_removed?
|
144
|
+
end
|
145
|
+
|
146
|
+
def reinstatement_membership_category
|
147
|
+
reinstatement_membership_history.membership_categories.first if membership_removed?
|
148
|
+
end
|
149
|
+
|
150
|
+
def reinstatement_membership_statuses
|
151
|
+
reinstatement_membership_history.membership_statuses if membership_removed?
|
126
152
|
end
|
127
153
|
|
128
154
|
def registrar_action_categories(action)
|
@@ -130,7 +156,7 @@ module EffectiveMembershipsOwner
|
|
130
156
|
end
|
131
157
|
|
132
158
|
def registrar_action_statuses(action)
|
133
|
-
EffectiveMemberships.Status.sorted.all
|
159
|
+
EffectiveMemberships.Status.sorted.all
|
134
160
|
end
|
135
161
|
|
136
162
|
def after_build_fee(fee)
|
@@ -302,9 +328,7 @@ module EffectiveMembershipsOwner
|
|
302
328
|
EffectiveMemberships.Registrar.in_good_standing!(self)
|
303
329
|
end
|
304
330
|
|
305
|
-
if membership_histories.blank?
|
306
|
-
build_membership_history()
|
307
|
-
end
|
331
|
+
build_membership_history() if membership_histories.blank?
|
308
332
|
|
309
333
|
save!
|
310
334
|
end
|
@@ -352,9 +376,10 @@ module EffectiveMembershipsOwner
|
|
352
376
|
errors = []
|
353
377
|
history = membership_histories.first
|
354
378
|
last_history = membership_histories.last
|
379
|
+
was_removed = membership_histories.any? { |history| history.removed? }
|
355
380
|
|
356
381
|
# Check membership joined on date matches first history start date
|
357
|
-
if membership.joined_on != history.start_on
|
382
|
+
if membership.joined_on != history.start_on && !was_removed
|
358
383
|
errors << "The joined date #{membership.joined_on.strftime('%F')} does not match the first history start date of #{history.start_on.strftime('%F')}. Please change the first history start date to #{membership.joined_on.strftime('%F')} or update the joined date above."
|
359
384
|
end
|
360
385
|
|
@@ -131,9 +131,12 @@ module EffectiveMembershipsRegistrar
|
|
131
131
|
membership.registration_on = date # Always new registration_on
|
132
132
|
|
133
133
|
# Assign Number (this could be nil)
|
134
|
-
number = next_membership_number(owner, to: to) if number.
|
135
|
-
|
136
|
-
|
134
|
+
number = next_membership_number(owner, to: to) if number.nil?
|
135
|
+
|
136
|
+
if number.present?
|
137
|
+
membership.number = number
|
138
|
+
membership.number_as_integer = (Integer(number) rescue nil)
|
139
|
+
end
|
137
140
|
|
138
141
|
# Assign Category
|
139
142
|
membership.build_membership_category(category: to)
|
@@ -173,11 +176,13 @@ module EffectiveMembershipsRegistrar
|
|
173
176
|
|
174
177
|
date ||= Time.zone.now
|
175
178
|
|
179
|
+
# Existing Membership
|
176
180
|
membership = owner.membership
|
177
181
|
|
178
|
-
#
|
182
|
+
# Last Changed Date
|
179
183
|
membership.registration_on = date
|
180
184
|
|
185
|
+
# Assign Category
|
181
186
|
membership.build_membership_category(category: to)
|
182
187
|
membership.membership_category(category: from).mark_for_destruction
|
183
188
|
|
@@ -195,24 +200,60 @@ module EffectiveMembershipsRegistrar
|
|
195
200
|
save!(owner, date: date)
|
196
201
|
end
|
197
202
|
|
198
|
-
def reinstate!(owner,
|
203
|
+
def reinstate!(owner, to: nil, date: nil, skip_fees: false)
|
199
204
|
raise('expecting a memberships owner') unless owner.class.respond_to?(:effective_memberships_owner?)
|
200
|
-
raise('owner must have
|
205
|
+
raise('owner must have a removed membership.') unless owner.membership_removed?
|
201
206
|
|
202
|
-
|
203
|
-
raise('
|
207
|
+
history = owner.reinstatement_membership_history
|
208
|
+
raise('owner must have a reinstatement membership history.') if history.blank?
|
204
209
|
|
210
|
+
to ||= owner.reinstatement_membership_category
|
211
|
+
raise('expecting a to memberships category') unless to.class.respond_to?(:effective_memberships_category?)
|
212
|
+
|
213
|
+
statuses = owner.reinstatement_membership_statuses
|
214
|
+
|
215
|
+
# Default Date
|
205
216
|
date ||= Time.zone.now
|
217
|
+
period = period(date: date)
|
218
|
+
period_end_on = period_end_on(date: date)
|
206
219
|
|
207
|
-
|
208
|
-
membership
|
209
|
-
membership.membership_category(category: from).mark_for_destruction if from.class.respond_to?(:effective_memberships_category?)
|
220
|
+
# Build a membership
|
221
|
+
membership = owner.build_membership
|
210
222
|
|
223
|
+
# Assign Dates
|
224
|
+
membership.joined_on = date
|
225
|
+
membership.registration_on = date
|
226
|
+
|
227
|
+
# Assign Number (this could be nil)
|
228
|
+
if history.number.present?
|
229
|
+
membership.number = history.number
|
230
|
+
membership.number_as_integer = (Integer(history.number) rescue nil)
|
231
|
+
end
|
232
|
+
|
233
|
+
# Assign Category
|
234
|
+
membership.build_membership_category(category: to)
|
235
|
+
|
236
|
+
# Assign Statuses
|
237
|
+
statuses.each do |status|
|
238
|
+
membership.build_membership_status(status: status)
|
239
|
+
end
|
240
|
+
|
241
|
+
# Assign fees paid through period
|
242
|
+
if skip_fees
|
243
|
+
membership.fees_paid_period = period
|
244
|
+
membership.fees_paid_through_period = period_end_on
|
245
|
+
end
|
246
|
+
|
247
|
+
# Or, Build Fees
|
211
248
|
unless skip_fees
|
212
249
|
fee = owner.build_prorated_fee(date: date)
|
213
250
|
# This might already be present and purchased if joined and reinstated in the same period
|
214
251
|
end
|
215
252
|
|
253
|
+
# Assign member role
|
254
|
+
add_member_role(owner)
|
255
|
+
|
256
|
+
# Save owner
|
216
257
|
save!(owner, date: date)
|
217
258
|
end
|
218
259
|
|
@@ -267,16 +308,17 @@ module EffectiveMembershipsRegistrar
|
|
267
308
|
true
|
268
309
|
end
|
269
310
|
|
270
|
-
|
311
|
+
# When you remove, you can set a status(es) which may affect reinstatement applications
|
312
|
+
def remove!(owner, statuses: nil, date: nil, notes: nil)
|
313
|
+
statuses = Array(statuses)
|
314
|
+
|
271
315
|
raise('expecting a memberships owner') unless owner.class.respond_to?(:effective_memberships_owner?)
|
272
316
|
raise('expected a member with a membership') unless owner.membership.present?
|
317
|
+
raise('expecting an membership status (optional)') if statuses.present? && statuses.any? { |status| !status.class.respond_to?(:effective_memberships_status?) }
|
273
318
|
|
274
319
|
# Date
|
275
320
|
date ||= Time.zone.now
|
276
321
|
|
277
|
-
# Remove Membership
|
278
|
-
owner.membership.mark_for_destruction
|
279
|
-
|
280
322
|
# Delete unpurchased fees and orders
|
281
323
|
owner.outstanding_fee_payment_fees.each { |fee| fee.mark_for_destruction }
|
282
324
|
owner.outstanding_fee_payment_orders.each { |order| order.mark_for_destruction }
|
@@ -284,7 +326,17 @@ module EffectiveMembershipsRegistrar
|
|
284
326
|
# Remove member role
|
285
327
|
remove_member_role(owner)
|
286
328
|
|
287
|
-
|
329
|
+
# Remove Membership
|
330
|
+
owner.membership.mark_for_destruction
|
331
|
+
|
332
|
+
# We do the save a bit differently here because we want to set the removed statuses
|
333
|
+
history = owner.build_membership_history(start_on: date, notes: notes)
|
334
|
+
|
335
|
+
if statuses.present?
|
336
|
+
history.assign_attributes(statuses: statuses.map(&:to_s), status_ids: statuses.map(&:id))
|
337
|
+
end
|
338
|
+
|
339
|
+
owner.save!
|
288
340
|
end
|
289
341
|
|
290
342
|
def not_in_good_standing!(owner, date: nil, notes: nil)
|
@@ -380,24 +432,51 @@ module EffectiveMembershipsRegistrar
|
|
380
432
|
periods(from: from, to: to).reverse.map { |period| [period_end_on(date: period), period] }
|
381
433
|
end
|
382
434
|
|
435
|
+
# Called by applicant.approve!
|
436
|
+
def delete_fees!(resource)
|
437
|
+
owner = (resource.class.respond_to?(:effective_memberships_owner?) ? resource : resource.try(:owner))
|
438
|
+
raise('expecting a memberships owner') unless owner.class.respond_to?(:effective_memberships_owner?)
|
439
|
+
|
440
|
+
# Delete unpurchased fees and orders
|
441
|
+
owner.outstanding_fee_payment_fees.each { |fee| fee.mark_for_destruction }
|
442
|
+
owner.outstanding_fee_payment_orders.each { |order| order.mark_for_destruction }
|
443
|
+
owner.save!
|
444
|
+
|
445
|
+
owner.outstanding_fee_payments.each { |fee_payment| fee_payment.destroy! }
|
446
|
+
|
447
|
+
true
|
448
|
+
end
|
449
|
+
|
383
450
|
# This is intended to be run once per day in a rake task
|
384
451
|
# rake effective_memberships:create_fees
|
385
452
|
# Create Renewal and Late fees
|
386
|
-
|
453
|
+
# Assigns NIGS
|
454
|
+
def create_all_fees!(period: nil)
|
387
455
|
period ||= current_period
|
388
456
|
memberships = Effective::Membership.deep.with_unpaid_fees_through(period)
|
389
457
|
|
458
|
+
memberships.find_each do |membership|
|
459
|
+
create_fees!(membership, period: period)
|
460
|
+
GC.start
|
461
|
+
end
|
462
|
+
|
463
|
+
true
|
464
|
+
end
|
465
|
+
|
466
|
+
def create_fees!(resource, period: nil)
|
467
|
+
period ||= current_period
|
468
|
+
|
469
|
+
membership = (resource.class.respond_to?(:effective_memberships_owner?) ? resource.membership : resource)
|
470
|
+
raise('expected a membership') unless membership.present? && membership.kind_of?(Effective::Membership)
|
471
|
+
|
390
472
|
# Create Renewal Fees
|
391
|
-
|
392
|
-
GC.start
|
473
|
+
create_renewal_fees!(membership, period: period)
|
393
474
|
|
394
475
|
# Create Late Fees
|
395
|
-
|
396
|
-
GC.start
|
476
|
+
create_late_fees!(membership, period: period)
|
397
477
|
|
398
478
|
# Update Membership Status - Assign Not In Good Standing
|
399
|
-
|
400
|
-
GC.start
|
479
|
+
create_not_in_good_standing!(membership, period: period)
|
401
480
|
|
402
481
|
true
|
403
482
|
end
|
@@ -252,9 +252,8 @@ module Effective
|
|
252
252
|
return true if paid_fees_through?(period)
|
253
253
|
|
254
254
|
# Otherwise build fees right now
|
255
|
-
EffectiveMemberships.Registrar.
|
256
|
-
EffectiveMemberships.Registrar.
|
257
|
-
EffectiveMemberships.Registrar.create_not_in_good_standing!(self, period: period)
|
255
|
+
EffectiveMemberships.Registrar.delete_fees!(self)
|
256
|
+
EffectiveMemberships.Registrar.create_fees!(self, period: period)
|
258
257
|
|
259
258
|
true
|
260
259
|
end
|
@@ -25,13 +25,18 @@ module Effective
|
|
25
25
|
serialize :status_ids, Array
|
26
26
|
|
27
27
|
scope :deep, -> { includes(:owner) }
|
28
|
-
scope :sorted, -> { order(:start_on) }
|
28
|
+
scope :sorted, -> { order(:start_on).order(:id) }
|
29
29
|
|
30
30
|
scope :removed, -> { where(removed: true) }
|
31
31
|
|
32
32
|
validates :owner, presence: true
|
33
33
|
validates :start_on, presence: true
|
34
34
|
|
35
|
+
with_options(if: -> { removed? }) do
|
36
|
+
validates :number, absence: { message: 'must be blank when removed' }
|
37
|
+
validates :category_ids, absence: { message: 'must be blank when removed' }
|
38
|
+
end
|
39
|
+
|
35
40
|
def to_s
|
36
41
|
'membership history'
|
37
42
|
end
|
@@ -17,6 +17,9 @@ module Effective
|
|
17
17
|
attr_accessor :membership_number
|
18
18
|
attr_accessor :skip_fees
|
19
19
|
|
20
|
+
# Reinstate
|
21
|
+
attr_accessor :skip_fees
|
22
|
+
|
20
23
|
# Status Change
|
21
24
|
attr_accessor :status_ids
|
22
25
|
attr_accessor :status_id
|
@@ -28,6 +31,7 @@ module Effective
|
|
28
31
|
# Mark Fees Paid - Order Attributes
|
29
32
|
attr_accessor :payment_provider
|
30
33
|
attr_accessor :payment_card
|
34
|
+
attr_accessor :purchased_at
|
31
35
|
attr_accessor :note_to_buyer
|
32
36
|
attr_accessor :note_internal
|
33
37
|
|
@@ -63,6 +67,11 @@ module Effective
|
|
63
67
|
EffectiveMemberships.Registrar.reclassify!(owner, to: category, skip_fees: skip_fees?)
|
64
68
|
end
|
65
69
|
|
70
|
+
def reinstate!
|
71
|
+
update!(current_action: :reinstate)
|
72
|
+
EffectiveMemberships.Registrar.reinstate!(owner, skip_fees: skip_fees?)
|
73
|
+
end
|
74
|
+
|
66
75
|
def status_assign!
|
67
76
|
update!(current_action: :status_assign)
|
68
77
|
EffectiveMemberships.Registrar.status_assign!(owner, status: statuses)
|
@@ -85,7 +94,7 @@ module Effective
|
|
85
94
|
|
86
95
|
def remove!
|
87
96
|
update!(current_action: :remove)
|
88
|
-
EffectiveMemberships.Registrar.remove!(owner)
|
97
|
+
EffectiveMemberships.Registrar.remove!(owner, statuses: statuses)
|
89
98
|
end
|
90
99
|
|
91
100
|
def assign_attributes(atts)
|
@@ -136,6 +145,7 @@ module Effective
|
|
136
145
|
{
|
137
146
|
payment_provider: @payment_provider.presence,
|
138
147
|
payment_card: @payment_card.presence,
|
148
|
+
purchased_at: @purchased_at.presence,
|
139
149
|
note_to_buyer: @note_to_buyer.presence,
|
140
150
|
note_internal: @note_internal.presence
|
141
151
|
}.compact
|
@@ -4,9 +4,13 @@
|
|
4
4
|
- categories = EffectiveMemberships.Category.all
|
5
5
|
= f.select :category_id, categories, label: 'Approve to'
|
6
6
|
|
7
|
+
- reinstatement = applicant.owner.reinstatement_membership_history if applicant.reinstatement?
|
8
|
+
|
7
9
|
%p
|
8
10
|
- if applicant.owner.membership&.number_was.present?
|
9
11
|
The member will keep their existing membership number: #{applicant.owner.membership.number}.
|
12
|
+
- elsif applicant.reinstatement? && reinstatement.number.present?
|
13
|
+
The member will keep their previous membership number: #{reinstatement.number}.
|
10
14
|
- else
|
11
15
|
- number = EffectiveMemberships.Registrar.next_membership_number(applicant.owner, to: applicant.category)
|
12
16
|
|
@@ -15,8 +19,11 @@
|
|
15
19
|
- else
|
16
20
|
No membership number will be assigned.
|
17
21
|
|
22
|
+
- if applicant.reinstatement?
|
23
|
+
%p The member will be reinstated with their previous status: #{badges(reinstatement.membership_statuses) || 'None'}.
|
24
|
+
|
18
25
|
%h3 Fees
|
19
|
-
%p The following
|
26
|
+
%p The following fees will be created:
|
20
27
|
- month = Time.zone.now.strftime('%B')
|
21
28
|
|
22
29
|
%ul
|
@@ -27,6 +34,19 @@
|
|
27
34
|
%li A #{month} prorated fee to the new category
|
28
35
|
%li A #{month} discount fee from their old category
|
29
36
|
|
37
|
+
- if applicant.reinstatement?
|
38
|
+
%li A #{month} prorated fee to their reinstatement category
|
39
|
+
|
40
|
+
%p The following unpurchased fees will be deleted:
|
41
|
+
- outstanding_fee_payment_fees = applicant.owner.outstanding_fee_payment_fees
|
42
|
+
|
43
|
+
%ul
|
44
|
+
- outstanding_fee_payment_fees.each do |fee|
|
45
|
+
%li= fee
|
46
|
+
|
47
|
+
- if outstanding_fee_payment_fees.blank?
|
48
|
+
%li None
|
49
|
+
|
30
50
|
%h3 Email to send
|
31
51
|
- email_templates = applicant.approve_email_templates
|
32
52
|
|
@@ -15,3 +15,7 @@
|
|
15
15
|
- if membership.blank? && owner.membership_histories.present?
|
16
16
|
= card('History') do
|
17
17
|
= render_datatable(Admin::EffectiveMembershipHistoriesDatatable.new(owner: owner), inline: true, simple: true)
|
18
|
+
|
19
|
+
- if owner.membership_removed?
|
20
|
+
- registrar_action = Effective::RegistrarAction.new(current_user: current_user, owner: owner)
|
21
|
+
= render 'admin/registrar_actions/form_reinstatement', registrar_action: registrar_action
|
@@ -23,6 +23,6 @@
|
|
23
23
|
|
24
24
|
= f.select :change_fees_paid_period, collection, label: 'Fees Paid Through', hint: 'Which period this user has fees paid through. Determines which renewal fees should be created. Setting this to a past or blank period may create a renewal fee in the current period.'
|
25
25
|
|
26
|
-
%p.text-muted To update the current membership categories, use the '
|
26
|
+
%p.text-muted To update the current membership categories or statuses, use the 'Reclassify' or 'Status Change' actions below
|
27
27
|
|
28
28
|
= f.submit 'Update Membership', border: false, center: true, 'data-confirm': "Really update #{f.object.owner}?"
|
@@ -15,3 +15,6 @@
|
|
15
15
|
.mb-4= render 'admin/registrar_actions/form_not_in_good_standing', registrar_action: registrar_action
|
16
16
|
.mb-4= render 'admin/registrar_actions/form_fees_paid', registrar_action: registrar_action
|
17
17
|
.mb-4= render 'admin/registrar_actions/form_remove', registrar_action: registrar_action
|
18
|
+
|
19
|
+
|
20
|
+
- # The reinstatement form is added by memberships/form and not here
|
@@ -31,6 +31,7 @@
|
|
31
31
|
%p An order will be created and marked as paid with the following information:
|
32
32
|
|
33
33
|
= f.select :payment_provider, EffectiveOrders.admin_payment_providers, required: true
|
34
|
+
= f.datetime_field :purchased_at, label: 'Purchased or completed'
|
34
35
|
|
35
36
|
= f.text_field :payment_card,
|
36
37
|
label: 'Payment card type, cheque or transaction number',
|
@@ -0,0 +1,44 @@
|
|
1
|
+
.card
|
2
|
+
.card-body
|
3
|
+
%h5.card-title Reinstate
|
4
|
+
|
5
|
+
= effective_form_with(model: [:admin, registrar_action], url: effective_memberships.admin_registrar_actions_path) do |f|
|
6
|
+
= f.hidden_field :owner_id
|
7
|
+
= f.hidden_field :owner_type
|
8
|
+
|
9
|
+
- removed = f.object.owner.removed_membership_history
|
10
|
+
- reinstatement = f.object.owner.reinstatement_membership_history
|
11
|
+
|
12
|
+
- raise('expected a removed membership history') unless removed.present?
|
13
|
+
- raise('expected a reinstatement membership history') unless reinstatement.present?
|
14
|
+
|
15
|
+
- period = EffectiveMemberships.Registrar.current_period
|
16
|
+
|
17
|
+
%p.text-muted
|
18
|
+
Reinstate to previous membership and optionally create fees.
|
19
|
+
|
20
|
+
%p
|
21
|
+
This member was removed on #{removed.start_on.strftime('%F')} from
|
22
|
+
= reinstatement.membership_categories.first
|
23
|
+
= badges(reinstatement.membership_statuses)
|
24
|
+
- if reinstatement.number.present?
|
25
|
+
with number #{reinstatement.number}.
|
26
|
+
|
27
|
+
= f.check_box :current_action, label: 'Yes, reinstate this member to their previous category, status and number'
|
28
|
+
|
29
|
+
= f.show_if :current_action, true do
|
30
|
+
= f.check_box :skip_fees, label: 'Yes, skip creating fees and just set the category'
|
31
|
+
|
32
|
+
= f.hide_if :skip_fees, true do
|
33
|
+
%p The following fee(s) will be created:
|
34
|
+
- month = Time.zone.now.strftime('%B')
|
35
|
+
|
36
|
+
%ul
|
37
|
+
%li A #{month} prorated fee for the #{reinstatement.membership_categories.first} category
|
38
|
+
|
39
|
+
%p The member will be required to return to the website and make a fee payment
|
40
|
+
|
41
|
+
= f.show_if :skip_fees, true do
|
42
|
+
%p No fees will be created
|
43
|
+
|
44
|
+
= f.submit 'Reinstate', border: false, center: true, 'data-confirm': "Really reinstate #{f.object.owner}?"
|
@@ -13,5 +13,10 @@
|
|
13
13
|
= f.check_box :current_action, label: 'Yes, remove this member'
|
14
14
|
|
15
15
|
= f.show_if :current_action, true do
|
16
|
+
- statuses = f.object.owner.registrar_action_statuses(:remove)
|
17
|
+
|
18
|
+
- if statuses.present?
|
19
|
+
= f.select :status_ids, statuses, label: 'Remove with status', multiple: true, hint: 'Will be assigned to the membership history and may affect fees generated for reinstatement applicants'
|
20
|
+
|
16
21
|
= f.submit 'Remove', border: false, center: true,
|
17
22
|
'data-confirm': "Really remove #{f.object.owner}?"
|
@@ -3,7 +3,8 @@
|
|
3
3
|
|
4
4
|
- categories = resource.can_apply_categories_collection()
|
5
5
|
- applicant_types = resource.can_apply_applicant_types_collection()
|
6
|
-
- existing_category = resource.owner
|
6
|
+
- existing_category = resource.owner.membership&.category
|
7
|
+
- reinstatement_category = resource.owner.reinstatement_membership_category
|
7
8
|
|
8
9
|
= card do
|
9
10
|
= effective_form_with(model: resource, url: wizard_path(step), method: :put) do |f|
|
@@ -20,11 +21,6 @@
|
|
20
21
|
= render('effective/applicants/select/apply_to_join', f: f)
|
21
22
|
= render('effective/applicants/select/categories', f: f, categories: categories)
|
22
23
|
|
23
|
-
- elsif applicant_types == ['Apply for Reinstatement']
|
24
|
-
= f.hidden_field :applicant_type, value: applicant_types.first
|
25
|
-
= f.hidden_field :category_id, value: existing_category.id
|
26
|
-
= render('effective/applicants/select/apply_for_reinstatement', f: f)
|
27
|
-
|
28
24
|
- elsif applicant_types == ['Apply to Reclassify']
|
29
25
|
= render('effective/applicants/select/apply_to_reclassify', f: f)
|
30
26
|
= render('effective/applicants/select/categories', f: f, categories: categories - [existing_category])
|
@@ -32,6 +28,11 @@
|
|
32
28
|
- else
|
33
29
|
= f.select :applicant_type, applicant_types, label: 'Apply to...'
|
34
30
|
|
31
|
+
- if applicant_types.include?('Apply for Reinstatement')
|
32
|
+
= f.show_if :applicant_type, 'Apply for Reinstatement' do
|
33
|
+
= f.hidden_field :category_id, value: reinstatement_category.id
|
34
|
+
= render('effective/applicants/select/apply_for_reinstatement', f: f)
|
35
|
+
|
35
36
|
- if applicant_types.include?('Apply to Join')
|
36
37
|
= f.show_if :applicant_type, 'Apply to Join' do
|
37
38
|
= render('effective/applicants/select/apply_to_join', f: f)
|
@@ -42,9 +43,4 @@
|
|
42
43
|
= render('effective/applicants/select/apply_to_reclassify', f: f)
|
43
44
|
= render('effective/applicants/select/categories', f: f, categories: categories - [existing_category])
|
44
45
|
|
45
|
-
- if applicant_types.include?('Apply for Reinstatement')
|
46
|
-
= f.show_if :applicant_type, 'Apply for Reinstatement' do
|
47
|
-
= f.hidden_field :category_id, value: existing_category.id
|
48
|
-
= render('effective/applicants/select/apply_for_reinstatement', f: f)
|
49
|
-
|
50
46
|
= f.save 'Save and Continue'
|
@@ -35,6 +35,7 @@
|
|
35
35
|
|
36
36
|
- if current_user.membership_removed?
|
37
37
|
%p Your membership was removed on #{current_user.membership_removed_on.strftime('%F')}.
|
38
|
+
%p You may Apply for Reinstatement to #{current_user.reinstatement_membership_category} by clicking the Apply to Join button below and then complete the wizard.
|
38
39
|
|
39
40
|
- if membership_organizations.present?
|
40
41
|
%p You are a representative for #{pluralize(membership_organizations.length, 'member organization')}.
|
@@ -11,7 +11,7 @@ namespace :effective_memberships do
|
|
11
11
|
begin
|
12
12
|
if ActiveRecord::Base.connection.table_exists?(:memberships)
|
13
13
|
EffectiveLogger.info "Running effective_memberships:create_fees scheduled task" if defined?(EffectiveLogger)
|
14
|
-
EffectiveMemberships.Registrar.
|
14
|
+
EffectiveMemberships.Registrar.create_all_fees!
|
15
15
|
end
|
16
16
|
rescue => e
|
17
17
|
ExceptionNotifier.notify_exception(e) if defined?(ExceptionNotifier)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: effective_memberships
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.9.
|
4
|
+
version: 0.9.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Code and Effect
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-
|
11
|
+
date: 2022-12-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -383,6 +383,7 @@ files:
|
|
383
383
|
- app/views/admin/registrar_actions/_form_not_in_good_standing.html.haml
|
384
384
|
- app/views/admin/registrar_actions/_form_reclassify.html.haml
|
385
385
|
- app/views/admin/registrar_actions/_form_register.html.haml
|
386
|
+
- app/views/admin/registrar_actions/_form_reinstatement.html.haml
|
386
387
|
- app/views/admin/registrar_actions/_form_remove.html.haml
|
387
388
|
- app/views/admin/registrar_actions/_form_status_change.html.haml
|
388
389
|
- app/views/admin/representatives/_form.html.haml
|