Skip to content

Commit

Permalink
+ (Event) Fixed an issue with the Obsidian Registration Entry block w…
Browse files Browse the repository at this point in the history
…here inactive Registration fees are not included for Registrants who were originally registered at a time when the fees were active. (Fixes #5776)
  • Loading branch information
jasonhendee committed Mar 6, 2024
1 parent 3bc136f commit d352c02
Showing 1 changed file with 14 additions and 4 deletions.
18 changes: 14 additions & 4 deletions Rock.Blocks/Event/RegistrationEntry.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2474,15 +2474,17 @@ private bool UpdatePersonAttributes( Person person, History.HistoryChangeList pe
// Upsert fees if not on the waiting list
if ( !isWaitlist )
{
// Include `IsActive == false` fees and fee items here, as the registrant might have
// been registered at a time when currently-inactive fees were active. If the fees
// were active at the time of registration, they still apply to this registrant.
var feeModels = context.RegistrationSettings.Fees?
.Where( f => f.IsActive )
.OrderBy( f => f.Order )
.ToList() ?? new List<RegistrationTemplateFee>();

foreach ( var feeModel in feeModels )
{
var totalFeeQuantity = 0;
var feeItemModels = feeModel.FeeItems.Where( f => f.IsActive ).ToList();
var feeItemModels = feeModel.FeeItems.ToList();

for ( var i = 0; i < feeItemModels.Count; i++ )
{
Expand Down Expand Up @@ -3983,11 +3985,19 @@ private RegistrationEntryBlockSession GetRegistrationEntryBlockSession( RockCont
}

// Add the fees
foreach ( var fee in registrationContext.RegistrationSettings.Fees.Where( f => f.IsActive ) )
foreach ( var fee in registrationContext.RegistrationSettings.Fees )
{
foreach ( var feeItem in fee.FeeItems.Where( f => f.IsActive ) )
foreach ( var feeItem in fee.FeeItems )
{
var registrantFee = registrant.Fees.FirstOrDefault( f => f.RegistrationTemplateFeeItemId == feeItem.Id );
if ( registrantFee == null && ( !fee.IsActive || !feeItem.IsActive ) )
{
// If this fee or fee item is not currently active, only add it to this registrant info
// if they already have a record of it. This means the fee or item was active when the
// registrant was added, so it still applies to them.
continue;
}

var quantity = registrantFee?.Quantity ?? 0;
registrantInfo.FeeItemQuantities[feeItem.Guid] = quantity;
}
Expand Down

0 comments on commit d352c02

Please sign in to comment.