Type: New Feature
Affects Version/s: None
Fix Version/s: 1.5
1. Implement custom groups/custom fields/custom data for Relationships
We should be able to clone the work we did to support custom fields and data for Activities. If a custom_group extends Relationship, it's fields appear in a fieldset on the Add/Edit Relationship form/view below the new Note field (see # 3 below).
2. Note APIs
Implement APIs for Note class. In general, a Note can be attached to any class/object (via entity_table/entity_id) - so we'll need to support that. We need the following functions:
- $params is an array with entity_table, entity_id, note, and contact_id values required. modified_date defaults to current date but can be passed in $params.
- returns a single array with the created note (ID and properties)
- $params is an array with EITHER the ID of a single note to retrieve: ( 'id' => $noteID) OR to ask for all notes for a specific entity (e.g a contact or a relationship or ...) - array has ( 'entity_table' => $table, 'entity_id' => $id). A specific note ID could also be passed in this second case but then the other 2 params are redundant.
- returns a nested array of 0 or more Note(s) / Note properties.
- $params is an array with the ID of the note to delete: ( 'id' => $noteID) OR it can consist of the entity_id/entity_table combination (both required) which would delete ALL notes for the specified entity.
- returns the number of records deleted OR an error array with 2 elements:
('status' => 'Error', 'message' => $errorMsg)
- $params is an array with ID of a note to update: ( 'id' => $noteID) AND the property => value pairs "to be updated"
- returns a single array with all the note properties (updated)
3. UI support for adding a Note (civicrm_note) instance when adding or editing a Relationship. (For now we'll just support one note per relationship in the UI.)
- Add a Note field (textarea) to the Add/Edit/View Relationship Form (below End Date).
- When adding a Relationship - if the Note field is populated, create a new note record linked to the new relationship.
- When editing a Relationship - query for a Note for this relationship (entity_table = civicrm_relationship, entity_id = $thisID). Order the query by modified date DESC - so if more than one note exists for the relationship (which could happen via API inserts) - we'll grab the most recent.
- Same for viewing a Relationship