Details
-
Type:
Sub-task
-
Status: Done/Fixed
-
Priority:
Minor
-
Resolution: Fixed/Completed
-
Affects Version/s: 3.4.1
-
Fix Version/s: 3.4.3
-
Component/s: None
-
Labels:None
Description
This issue is related to: CRM-8147
Please create pi functions (that follow api v3 standards) that do the following:
1. Get Contact + Activity fields: Given a set of fields (contact + activity + custom data) and a contact ID and a activity ID, retrieve the values of these fields from the DB. The fields are specified in the same manner as api v3. Ideally this is just a wrapper around the Contact API and the Activity API. Ensure that the contactID is either in the target or assignee list of that activity.
2. Set Contact + Activity fields: Given a set of fields (contact + activity + custom data) and their value, set the values of these fields in the DB.
3. Given a profile, generate the right set of fields for the above two calls
4.Given a profile and a set of params for creating a profile field, validate whether the field that the profile field that is being added is valid.
5. If the profile extends a specific activity due to custom fields being used, we should add this information to the group_type field. This will allow us to do checks against an aid when the profile is viewed/edited. We should also account for the profile being valid for multiple activity types
NOTES on #4: We need an api which can be called by Profile "Create Field" and Webform "Add Field" that will check whether the profile field that is being added is valid. This api needs to ensure that you can't create a profile with a mix of custom fields used for different activity types (e.g. profile can't contain a field bound to a custom field used for Activities::Surveys AND a field bound to custom field used for Activities::Meetings). There is quite a bit of similar logic (testing valid combinations of Contact, Individual, Household, etc fields) in CRM_UF_Form_Field::formRule. We should probably pull those out to a BAO an then add an api wrapper.