Merge pull request #2102 from eileenmcnaughton/CRM-13744
[civicrm-core.git] / CRM / Case / xml / configuration.sample / SampleConfig.mysql
1 -- /**********************************************************************
2 -- *
3 -- * Configuration Data for CiviCase Component
4 -- * For: Sample Case Types - Housing Support and Adult Day Care Referral
5 -- *
6 -- **********************************************************************/
7
8 SELECT @caseCompId := id FROM `civicrm_component` where `name` like 'CiviCase';
9
10 -- /*******************************************************
11 -- *
12 -- * Case Types
13 -- *
14 -- *******************************************************/
15 SELECT @option_group_id_case_type := max(id) from civicrm_option_group where name = 'case_type';
16 SELECT @max_val := IF ( value <> 'NULL',max(value) , 0 ) from civicrm_option_value where option_group_id=@option_group_id_case_type;
17 SELECT @max_wt := IF ( value <> 'NULL',max(weight), 0 ) from civicrm_option_value where option_group_id=@option_group_id_case_type;
18
19 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, 'Housing Support', @max_val + 1, 'housing_support', NULL, 0, 0, @max_wt + 1, 'Help homeless individuals obtain temporary and long-term housing', 0, 0, 1), (@option_group_id_case_type, 'Adult Day Care Referral', @max_val + 2, 'adult_day_care_referral', NULL, 0, 0, @max_wt + 2, 'Arranging adult day care for senior individuals', 0, 0, 1);
20
21 -- /*******************************************************
22 -- *
23 -- * Case Status - Set names for Open and Closed
24 -- *
25 -- *******************************************************/
26 SELECT @csgId := max(id) from civicrm_option_group where name = 'case_status';
27 UPDATE civicrm_option_value SET name = 'Open' where option_group_id = @csgId AND label = 'Ongoing';
28 UPDATE civicrm_option_value SET name = 'Closed' where option_group_id = @csgId AND label = 'Resolved';
29
30 -- /*******************************************************
31 -- *
32 -- * Activity Types
33 -- *
34 -- *******************************************************/
35 SELECT @option_group_id_activity_type := max(id) from civicrm_option_group where name = 'activity_type';
36
37 SELECT @max_val := MAX(ROUND(op.value)) FROM civicrm_option_value op WHERE op.option_group_id = @option_group_id_activity_type;
38
39 INSERT INTO `civicrm_option_value` (`option_group_id`, `label`, `value`, `name`, `grouping`, `filter`, `is_default`, `weight`, `description`, `is_optgroup`, `is_reserved`, `is_active`, `component_id` ) VALUES (@option_group_id_activity_type, 'Medical evaluation', (SELECT @max_val := @max_val+1), 'Medical evaluation', NULL, 0, 0, (SELECT @max_val := @max_val+1), '', 0, 0, 1, @caseCompId ), (@option_group_id_activity_type, 'Mental health evaluation', (SELECT @max_val := @max_val+1), 'Mental health evaluation', NULL, 0, 0, (SELECT @max_val := @max_val+1), '', 0, 0, 1, @caseCompId ), (@option_group_id_activity_type, 'Secure temporary housing', (SELECT @max_val := @max_val+1), 'Secure temporary housing', NULL, 0, 0, (SELECT @max_val := @max_val+1), '', 0, 0, 1, @caseCompId ), (@option_group_id_activity_type, 'Income and benefits stabilization', (SELECT @max_val := @max_val+1), 'Income and benefits stabilization', NULL, 0, 0, (SELECT @max_val := @max_val+1), '', 0, 0, 1, @caseCompId ), (@option_group_id_activity_type, 'Long-term housing plan', (SELECT @max_val := @max_val+1), 'Long-term housing plan', NULL, 0, 0, (SELECT @max_val := @max_val+1), '', 0, 0, 1, @caseCompId ), (@option_group_id_activity_type, 'ADC referral', (SELECT @max_val := @max_val+1), 'ADC referral', NULL, 0, 0, (SELECT @max_val := @max_val+1), '', 0, 0, 1, @caseCompId );
40
41 -- Get Open Case id so we can add custom fields for this activity type if we need to
42 SELECT @at1 := max(value) from civicrm_option_value where name = 'Open Case';
43
44 -- /*******************************************************
45 -- *
46 -- * Relationship Types (Case Roles)
47 -- *
48 -- *******************************************************/
49
50 INSERT INTO `civicrm_relationship_type` ( name_a_b, label_a_b, name_b_a, label_b_a, description, contact_type_a, contact_type_b, is_reserved, is_active ) VALUES ('Homeless Services Coordinator is', 'Homeless Services Coordinator is', 'Homeless Services Coordinator', 'Homeless Services Coordinator', 'Homeless Services Coordinator', 'Individual', 'Individual', 0, 1), ('Health Services Coordinator is', 'Health Services Coordinator is', 'Health Services Coordinator', 'Health Services Coordinator', 'Health Services Coordinator', 'Individual', 'Individual', 0, 1), ('Senior Services Coordinator is', 'Senior Services Coordinator is', 'Senior Services Coordinator', 'Senior Services Coordinator', 'Senior Services Coordinator', 'Individual', 'Individual', 0, 1), ('Benefits Specialist is', 'Benefits Specialist is', 'Benefits Specialist', 'Benefits Specialist', 'Benefits Specialist', 'Individual', 'Individual', 0, 1);
51
52 -- /*******************************************************
53 -- *
54 -- * Case Resources Group
55 -- *
56 -- *******************************************************/
57
58 INSERT INTO `civicrm_group` (`name`, `title`, `description`, `source`, `saved_search_id`, `is_active`, `visibility`, `where_clause`, `select_tables`, `where_tables`, `group_type`, `cache_date`, `parents`, `children`, `is_hidden`) VALUES ('Case_Resources', 'Case Resources', 'Contacts in this group are listed with their phone number and email when viewing case. You also can send copies of case activities to these contacts.', NULL, NULL, 1, 'User and User Admin Only', ' ( `civicrm_group_contact-5`.group_id IN ( 5 ) AND `civicrm_group_contact-5`.status IN ("Added") ) ', 'a:10:{s:15:"civicrm_contact";i:1;s:15:"civicrm_address";i:1;s:22:"civicrm_state_province";i:1;s:15:"civicrm_country";i:1;s:13:"civicrm_email";i:1;s:13:"civicrm_phone";i:1;s:10:"civicrm_im";i:1;s:19:"civicrm_worldregion";i:1;s:25:"`civicrm_group_contact-5`";s:114:" LEFT JOIN civicrm_group_contact `civicrm_group_contact-5` ON contact_a.id = `civicrm_group_contact-5`.contact_id ";s:6:"gender";i:1;}', 'a:2:{s:15:"civicrm_contact";i:1;s:25:"`civicrm_group_contact-5`";s:114:" LEFT JOIN civicrm_group_contact `civicrm_group_contact-5` ON contact_a.id = `civicrm_group_contact-5`.contact_id ";}', '\ 12\ 1', NULL, NULL, NULL, 0);