Type: New Feature
Affects Version/s: None
Fix Version/s: 1.3
This task will allow users to manually add 'offline' contributions, as well as edit existing contribution records. All features described here should be conditonally available based on the site's config->enableComponents setting (array must include CiviContribute).
For this phase, users will be allowed to ADD an (offline) contribution from the scope of an existing contact record only. The UPDATE option will be available from contact/view/contribution AND from the Find Contribution search results. (This limitation is due to the fact that we need to have a contact 'handle' in order to create a new contribution record.)
1. If CiviContribute is enabled, add tab (local task)/page to civicrm/contact scope - 'Contributions'
1.1 Contributions page contains selector table with browsable list of Contributions linked to this contact.
NOTE: We should share the browse/selector code for this page with the 'Find Contributions' results selector (
CRM-564). In this case the record set would be filtered on contact_id. The table display columns and actions can be the same as in the search EXCEPT the 'Name' (contributor contact display name) column would be suppressed in this 'view'. CRM-564 specifies the columns and actions for this selector table.
1.2 Include a Contributions Summary section below the selector table with the following elements (this section is hidden if the contact has not made any contributions):
Total Contributed YTD: $x,xxx.xx
Total Contributed (since inception): $x,xxx.xx
Avg Contribution Amount: $xxx.xx
1.3 This page includes a link "» Record New Contribution" which invokes the add contribution form.
1.4 Add a new collapsed section to the Contact Summary page which shows the last 3 contributions made by this contact in date order descending. Include a link to 'View All Contributions..." in this table if there are more than 3 for this contact. Include the same totals as 1.2 above, and a link for "» Record New Contribution" below the table. [This new section mirrors the existing Relationships section in layout/elements. Columns and actions should match the selector table on the dedicated Contribution tab (above).]
2. Form: Add/Update Contribution
2.1 This form can be invoked from the Find Contributions results selector (action=update), and from contact/view contributions selectors. In either case, use the same 'path' but make sure the userContext is stored so that the user is taken back to where they came from after completing an add or update operation.
2.2. Form contains all defined core Contribution fields plus any custom_group fields where civicrm_custom_group.extends = 'Contribution'.
2.3 In update mode, most fields are frozen IF the contribution was originally made 'online'. We can determine this by checking for the existence of one or more financial_trxn records where entity_table = 'civicrm_contribution' and entity_id = this ID. For this case, the only editable fields are:
- Receipt Date
- Cancel Date
- Cancel Reason
- Thank-you Date
2.4 Post process code needs to insert or update a contribution record. We also need to insert an activity_history for some cases. Insert_contribution code has already been implemented by Piotr for the Import Contributiions functionality. We should invoke the same function(s) for this insert case.
Update contribution logic also needs to insert an activity history record (linked to the same contribution record/callback) if any of the following fields are modified:
- If a Cancel Date is set -> insert activity history record with the following elements:
- module = CiviContribute
- activity_type = "Contribution Cancelled"
- activity_summary = "Contribution of $amount cancelled." + "$cancel_reason" [append cancel reason if one is entered by the user]
- If a Thank-you Date is set -> insert activity history as follows:
- module = CiviContribute
- activity_type = "Contribution Thank-you Sent"
- activity_summary = "For contribution of $amount."