Skip to content

SPIKE Move Donations from FamilyID to PersonID

Robert Spencer edited this page Jun 13, 2024 · 8 revisions

SPIKE Move Donations from FamilyID to PersonID

Synopsis

Donations are currently tracked by the giving family. This causes difficulty with IRS reporting of donations made by members living in the same household, but filing taxes separately.

Success Criteria

  • All pledges (past and future) are assigned to an account. Accounts may be owned by families or persons.
  • Tax reports are updated to reflect accounts
  • A Family Giving report is created to show all donations from accounts owned by members of the family.
  • PledgeEditor is deprecated in favor of double-entry splits from a donor account to a designated fund account.
  • FamilyView is updated to display total giving from all accounts owned by all members of the family.
  • PersonView is updated to display the person's giving (borrow logic from existing FamilyView)
  • Split-Fund donations remain intact (i.e. a single payment can be split between multiple donation funds)
  • All donation database interactions are handled via the ORM. All Legacy SQL Concatenated strings are removed.
  • Permissions are respected
    • Only members with bFinance, or self are able to see donations.

Related Issues

Related Tables

  • autopayment_aut
  • deposit_dep
  • donationfund_fun
  • egive_egv
  • family_fam
  • person_per
  • pledge_plg

Pages Affected

  • eGive.php
  • SelectDelete.php
  • ZeroGivers.php
  • VotingMembers.php
  • TaxReport.php
  • ReminderReport.php
  • PledgeSummary.php
  • FamilyPledgeSummary.php
  • AdvancedDeposit.php
  • PledgeEditor.php
  • PledgeDetails.php
  • PledgeDelete.php
  • Functions.php
  • FamilyView.php
  • FinancialService.php
  • FinancialReports.php

ORM Models Affected

  • Family
  • Person
  • Pledge
  • Deposit
  • DonationFund

Anticipated Pain Points

  • pledge_plg uses "groupkey" to "group" split pledges across different funds. This key includes the family id. Will need a migration script to update these group keys.
  • This database migration will be complex, and possibly beyond what's reasonable within MySQL. A PHP-based upgrade script will probably be necessary. Tracking in #2983
  • The double entry framework will create an "assets" account that will only grow since the users are not creating "expense" journal entries. As journal entries from donor accounts to donation funds accrue without related expenses, the donation fund accounts will not be accurate if/when expense tracking is created. This will require a journal entry to "zero-out" or "balance" the relevant donation fund accounts.

Plan

New Schema

Four new tables will be necessary for this adjustment, and to pave the way for a future complete double-entry accounting platform.

This schema change is inspired by the GNUCash schema implementation and relationship graph

New Table: Accounts

  • Accounts may be:
    • Donor accounts (INCOME)
    • Donation Funds (ASSET)

New Table: Account Owners

  • This table links accounts to the account owner(s).
  • An account may be owned by one or more person, a group, or a family.

New Table: Transactions

  • Transactions "link together" individual splits (or payments)
  • This table will clean-up the ugly "group key" issue we have now.
  • All transactions must have two or more splits with credits and debits being equal.

New Table: Splits

  • Each split represents either a credit or a debit from an account

Upgrade Script

  1. Create new tables defined above
  2. Create new account for each family
  3. Create account owner link to that family.
  4. If system has "bEnableNonDeductible" enabled, create secondary account for the family for non-deductible contributions. Link ownership
  5. Iterate through each pledge
    1. Lookup family account (and optionally non-deductible account)
    2. Lookup the donation fund account
    3. Create a transaction to which all splits are linked.
    4. Create a split debiting the family account for the tax-deductible value
    5. Create a split crediting the donation fund account for the tax-deductible value
    6. Create a split debiting the family account for the NON tax-deductible value
    7. Create a split crediting the donation fund account for the NON tax-deductible value
Clone this wiki locally