Should deprecate Financial Type on Contribution records
Overview
Contribution records have a financial type. They also have line items, each of which has a financial type. Typically, a contribution has a single line item, and the financial types of each match. But it's quite possible to have different financial types e.g. contribution and only line item could have different types which does not make sense. Also if a contribution has multiple line items of different types, what should the financial type of the contribution be?
Having financial type on the contribution harks back to simpler times before we allowed line items. But for 90%(?) of cases it doesn't matter much because they're the same. And of course there's a thousand places in core that assumes a single finanical type per contribution, and there's a thousand more in custom code and extensions.
Currently (5.26) you get an api exception if you call Order.create without setting a contribution-level financial type, which is slightly irksome when you're providing line items, not least because it forces new code to do nonsense old stuff, which can lead to developer confusion.
Nb. all the UIs that create contribution records set a financial type to something. This may or may not make sense compared with line items (e.g. it's taken from the priceset).
Proposals
-
I would like to be able to call Order.create with line items and have it pick the financial type from the first line item to use for the Contribution record. This would not affect any existing processes (with the possible exception of processes that currently crash...!)
-
I propose that over time (it will be a long time!) we move all reports/searches etc. to go the extra JOIN and inspect the line items for info on financial types instead of using the contribution's single financial type value.
Comments
This is a place to discuss it. Discussion began in mattermost