-
Notifications
You must be signed in to change notification settings - Fork 12
Allow Item(s) to be added where not currently allowed
When editing a price set contribution that has not had all of its fields used it is possible to add a new line item. But there has been no way to create a line item when creating a new contribution or when editing quick config contributions or when editing contributions that have all price set fields used. This issue allows users to add arbitrary line items in these contexts.
Currently it is not possible to add items to contributions that were created via Quick Config rather that with full price sets. Only when editing contributions created with price sets is it possible to add items, and then only for line item options in the price set that have a quantity of null or 0.
For example, for a price set with three items like this:
Suppose a contribution is created that uses two of them:
Then when editing it there will be an option to add a line item of the third, but this is the only option:
When the edits to a line item would require a change to the configuration of the price set, such as a change in the price of an option, the change is not made to the original price set fields or their option values but just to the values stored for this contribution in the line_item table, with total values flowing from that table to financial_item, entity_financial_trxn and financial_trxn.
Also recall that all quick config price sets use a single hidden placeholder price field (eg civicrm_line_item.price_field_id=1).
On the New Contribution form, whether opened from menu or for a specific contact, we want to allow Adding item(s) in addition to specifying a Total Amount or choosing a pre-existing price set:
Similarly, for a contribution created via Quick Config, we will add this option:
And for a contribution that has all of the fields in its price set used, the Add item(s) option continues to show:
In all of these cases, the Add Item form will appear similar to what appears when Quick Config contributions are used to bring up the Edit Item form: ![Add New Line Item](
It is possible to use the current schema to implement this new functionality.
Test the following:
- Use links everywhere defined to create new items.
- Verify the receipt messages.
- Edit the items and check the contribution is valid and that receipt is valid for
- New contributions
- New item on Quick Config contributions
- New item on price set contributions without all price set fields used
- New item on price set contributions with all price set fields used
- New item on price set contributions with all price set fields used then one set to qty=0.
- Create unit tests as appropriate.