Details
-
Type: Sub-task
-
Status: Done/Fixed
-
Priority: Major
-
Resolution: Fixed/Completed
-
Affects Version/s: 4.4.2
-
Fix Version/s: 4.5
-
Component/s: CiviContribute
-
Labels:None
Description
Overview
=======
Add the ability to set an optional Soft Credit Type for each soft credit. Read the overview in 1st section of this wiki page: http://wiki.civicrm.org/confluence/display/CRM/Soft+Credit+Enhancements+-+Phase+2
1. Meta-data
===========
- New civicrm_option_group :
- name = soft_credit_type
- title = Soft Credit Types
- is_reserved and is_active = TRUE
- Populate option values for this group - options marked '(reserved)' should have is_reserved = TRUE)
- In Honor of (reserved)
- In Memory (reserved)
- PCP (reserved)
- Solicited (reserved) - this is the default option_value row for the group
- Donor-advised Fund
- Foundation Affiliate
- Household
- Matched Gift
- Workplace Giving
- 3rd-party Service
- Add item to navigation menu to manage Soft Credit Types (option group):
- Administer > CiviContribute > Soft Credit Types
(place this after 'Accepted Credit Cards' in the navigation structure - and above the 'break' in that submenu)
- Insert all of above for new sites
- Insert all of above for upgrades
2. Schema
=========
- Add column to civicrm_contribution_soft table:
soft_credit_type_id INT Default NULL Implicit foreign key to civicrm_option_value.value where option group name is soft_credit_type
- Upgrades:
- Add new column
- Set value to the value of the 'PCP' soft credit type for all contribution_soft rows where pcp_id value is NOT NULL. All other rows will have soft_credit_type_id = NULL.
Forms and Pages
==============
- New Contribution (back office) form - Soft Credit pane:
- Add 'Type' (soft_credit_type_id) drop-down field after the Amount field (for each 'row'). Type is not required - but if an option value in the soft_credit_type group has is_default set then use that as the default for the drop-down
- If 'Credit to a Personal Campaign Page' is used (pcp_made_through), then the soft_credit_type_id is automatically set to the value of the 'PCP' option_value row (the soft_credit_type_id drop-down is NOT shown in the Soft Credit pane in this mode).
NOTE: We should probably not set a default for soft_credit_type_id until we know the user is entering a soft credit. We could trigger setting the default client-side at the same time as we populate the default soft credit amount (see templates/CRM/Contribute/Form/SoftCredit.js)
- Edit Contribution (back office) - Soft Credit pane:
- Ensure that any existing soft credit type values are loaded into the form (setDefaults)
- View Contribution (back office) - Soft Credit pane:
- Add soft credit type display (using 'label') to the right of the amount
- Online contributions (associated with a PCP):
- Whenever a contribution_soft record is recorded via online contribution postProcess (i.e. a PCP_ID has been set for the contribution), set civicrm_contribution_soft.soft_credit_type_id = the value of the 'PCP' option_value row.
- Soft Credit selector (contact Contributions tab - templates/CRM/Contribute/Page/ContributionSoft.tpl)
- Add 'Soft Credit Type' column after 'Amount' column.
- Change column header for financial type from 'Type' to 'Financial Type'
- Batch Data Entry:
- Extend the existing Soft Credit 'pseudo-field' to include 'Type' (soft_credit_type_id) drop-down field after the Amount field. Type is not required - but if an option value in the soft_credit_type group has is_default set then use that as the default for the drop-down.
- Web tests
- Extend back office create / edit / view contribution web tests to include at least one case where soft_credit_type_id is entered and verified in Edit (set defaults) and View page.
Reports
======
- Contribution Summary - Add "Soft Credit Type" as a Filter
- Contribution Details - Add "Soft Credit Type" as an optional Column AND as a Filter
- Soft Credits - Add "Soft Credit Type" as an optional Column AND as a Filter
API
=====
- ContributionSoft
- add support for 'optional' soft_credit_type_id to create_spec
- ensure _get returns the soft_credit_type_id
- Contribution
- it looks like civicrm_api3_contribution_get return soft credit data, so check that CRM_Contribute_BAO_ContributionSoft::getSoftContribution also fetches soft_credit_type_id
NOTE: It looks like chaining is recommended approach for creating soft credit records when creating a contribution, so I don't think we need to add support for soft_credit_type_id in contribution create API.
- API Unit Tests
- extend unit tests for soft credit create and get to include soft_credit_type_id
- extend unit test for contribution get to include soft_credit_type_id
Attachments
Issue Links
- is supplemented by
-
CRM-15387 Legacy contribution create with soft credit should set the default soft credit type
- Done/Fixed