Skip to content

Financial Account List block does not list all accounts. #6923

Description

@RufenachtPW

Description

On Behalf of The Woodlands Methodist Church. The Obsidian version of the Account List block that allows reordering accounts does not list all accounts like the previous Account List block does in version 16. Similar issue (#6465) was reported and the fixed. (13e782e). The previous version 16 block would show all accounts not just top level only or children under a specific parent account. (

private IQueryable<FinancialAccount> GetAccounts( RockContext rockContext )
{
int? parentAccountId = PageParameter( "AccountId" ).AsIntegerOrNull();
bool topLevelOnly = PageParameter( "TopLevel" ).AsBoolean();
if ( parentAccountId.HasValue )
{
lActionTitle.Text = "Child Accounts".FormatAsHtmlTitle();
}
else
{
lActionTitle.Text = "List Accounts".FormatAsHtmlTitle();
}
var accountService = new FinancialAccountService( rockContext );
SortProperty sortProperty = rGridAccount.SortProperty;
var accountQuery = accountService.Queryable();
if ( parentAccountId.HasValue )
{
accountQuery = accountQuery.Where( account => account.ParentAccountId == parentAccountId.Value );
}
else if ( topLevelOnly )
{
accountQuery = accountQuery.Where( account => account.ParentAccountId == null );
}
string accountNameFilter = rAccountFilter.GetFilterPreference( "Account Name" );
if ( !string.IsNullOrEmpty( accountNameFilter ) )
{
accountQuery = accountQuery.Where( account => account.Name.Contains( accountNameFilter ) );
}
int campusId = int.MinValue;
if ( int.TryParse( rAccountFilter.GetFilterPreference( "Campus" ), out campusId ) )
{
accountQuery = accountQuery.Where( account => account.Campus.Id == campusId );
}
string publicFilter = rAccountFilter.GetFilterPreference( "Public" );
if ( !string.IsNullOrWhiteSpace( publicFilter ) )
{
accountQuery = accountQuery.Where( account => ( account.IsPublic ?? false ) == ( publicFilter == "Yes" ) );
}
string activeFilter = rAccountFilter.GetFilterPreference( "Active" );
if ( !string.IsNullOrWhiteSpace( activeFilter ) )
{
accountQuery = accountQuery.Where( account => account.IsActive == ( activeFilter == "Yes" ) );
}
string taxDeductibleFilter = rAccountFilter.GetFilterPreference( "Tax Deductible" );
if ( !string.IsNullOrWhiteSpace( taxDeductibleFilter ) )
{
accountQuery = accountQuery.Where( account => account.IsTaxDeductible == ( taxDeductibleFilter == "Yes" ) );
}
accountQuery = accountQuery.OrderBy( a => a.Order ).ThenBy( f => f.Name );
return accountQuery;
}
) This is a loss of functionality from the previous block. Woodlands used the functionality of all accounts to be able to reorder the accounts on the giving block. Because of the current functionality the child accounts get orphanded from the parent account on the give page becasue they are not included in the ordering on the account list block.

Actual Behavior

Only top level accounts can be sorted. This orphans the child accounts away from the parent account on the give page when more than one account is shown.

Expected Behavior

All accounts should be able to be sorted to truely be able to organize accounts on the external give page.

Steps to Reproduce

Image

Issue Confirmation

  • Perform a search on the Github Issues to see if your bug is already reported.
  • Reproduced the problem on a fresh install or on the demo site.

Rock Version

18.3

Client Culture Setting

en-US

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions