Assigning a case role that isn't already available:
We decided that for now we can add these as regular relationships, under administer civicrm -> relationship types, and then adding that relationship from the person's contact record relationships tab, and teaching users to open a contact record in a new window/tab. The difference is that in Phase 1 they won't show up on the manage case screen, and that you can't send a copy of an activity to them. However they are regular contacts and so you can send them email activities, as its own action BUT it doesn't get filed on the case (this probably isn't acceptable - need to think of something. The facility to do this is in the system - you just add &caseid=<n> to the regular email url - but I don't see an easy way to do this for the user. If we're adding code it makes sense to go the whole way and figure out how to add roles on the fly.)
The thinking is that in phase 2 we can continue to keep doing this, but the drawbacks just mentioned will go away.
If you do actually need a new type of role for a case type, see next section.
How to add a case type / case roles:
1) Add the case type. This can be done through the UI once you have a working installation.
The value needs to be unique within the option group and the weight column will determine where it appears in selection lists.
If via scripting:
SELECT @option_group_id_case_type := max(id) from civicrm_option_group where name = 'case_type';
INSERT INTO
`civicrm_option_value` (`option_group_id`, `label`, `value`, `name`, `grouping`, `filter`, `is_default`, `weight`, `description`, `is_optgroup`, `is_reserved`, `is_active`)
VALUES
(@option_group_id_case_type, 'Inpatient treatment', 1, 'inpatient_treatment', NULL, 0, 0, 4, 'Inpatient treatment case', 0, 0, 1)
2) Create an xml file in crm\case\xml\physicianhealthbc. Easiest is to copy and paste an existing similar one. The first section is all the activities you want people to be able to add to this case type, and the second section is the ones that should get prepopulated. The third section is the roles that should be available.
Note the activities are referred to by the value in the name column in the civicrm_option_value table, not the label column.
Activities can be added through the UI, but you'll need to look in the database table to get the name it used.
If on windows, copy the xml file into crm\case\xml\configuration. If on unix, it shouldn't be necessary because the configuration folder is already symlinked to physicianhealthbc.
3) If you added roles that don't already exist as relationship types somewhere, you need to also add that. You can do this in the UI the same way you add any new type of relationship.
Or via scripting:
INSERT INTO civicrm_relationship_type( name_a_b, name_b_a, description, contact_type_a, contact_type_b, is_reserved )
VALUES( 'Intake Physician is', 'Intake Physician', 'Intake Physician', 'Individual', 'Individual', 0 )
4) If you use the UI, you may want to update the physicianhealthbc.mysql file with scripting to match, or take a new snapshot of the current database. The former is more portable between servers/installations, but the latter might be easier, especially if you added activity types with custom fields.
Recording the people involved in an activity
All activities have an "assigned to" field, so for now as a general rule if you're looking for a place to record names, that would be where to do it.
