Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Giving Overview Error: The cast to value type 'System.Decimal' failed because the materialized value is null. #5680

Closed
2 tasks done
mkinyon opened this issue Nov 20, 2023 · 0 comments

Comments

@mkinyon
Copy link
Contributor

mkinyon commented Nov 20, 2023

Description

The Giving Overview block will cause an exception under certain giving conditions. This can happen if the Giving Automation settings are configured to have a custom list of financial accounts that are a mix of tax deductible and non tax deductible. Also, the person record that is viewed has a transaction with a single non tax deductible gift (transaction detail). See the details below on how to recreate this error.

I believe the error can be fixed by changing line 338 from this:

TotalAmountBeforeRefund = a.TransactionDetails.Where(td => td.Account.IsTaxDeductible == true).Sum( d => d.Amount ),

to:
TotalAmountBeforeRefund = a.TransactionDetails.Where(td => td.Account.IsTaxDeductible == true).Sum( d => ( decimal? ) d.Amount ) ?? 0.0M,

Actual Behavior

The block will throw the following exception.

image

Expected Behavior

To not throw an exception.

Steps to Reproduce

  • Go to Finance > Giving Alerts > Giving Automation Configuration.

  • Change the Accounts option to Custom and choose at least one account that is tax deductible and one account that is not tax deductible. (In this example, the Building Fund is NOT tax deductible.)
    image

  • Next, setup a person record with some transactions. Have some of the transactions have gifts made to the tax deductible account. Others to the non tax deductible account. (NOTE: To trigger the error, it's important that both types of gifts are not in the same transaction (multiple transaction details. There should be at least one stand alone transaction with a single non tax deductible gift.
    image

  • Go to the person record and then go to the contributions tab. The error should appear.

Issue Confirmation

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

Rock Version

v15+

Client Culture Setting

en-US

@sparkdevnetwork-service sparkdevnetwork-service added the Status: In Dev Queue This issue is being worked on, and has someone assigned. label Nov 21, 2023
@PraveenMathew92 PraveenMathew92 added Fixed in v15.4 and removed Status: In Dev Queue This issue is being worked on, and has someone assigned. labels Nov 21, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants