Commit | Line | Data |
---|---|---|
63926b53 | 1 | <?php |
2 | /* | |
3 | +--------------------------------------------------------------------+ | |
a30c801b | 4 | | Copyright CiviCRM LLC. All rights reserved. | |
63926b53 | 5 | | | |
a30c801b TO |
6 | | This work is published under the GNU AGPLv3 license with some | |
7 | | permitted exceptions and without any warranty. For full license | | |
8 | | and copyright information, see https://civicrm.org/licensing | | |
63926b53 | 9 | +--------------------------------------------------------------------+ |
10 | */ | |
11 | ||
12 | /** | |
13 | * This api exposes CiviCRM (dedupe) rules. | |
14 | * | |
15 | * Rules dedupe critieria assigned to RuleGroups. | |
16 | * | |
17 | * @package CiviCRM_APIv3 | |
18 | */ | |
19 | ||
20 | /** | |
21 | * Create or update a rule. | |
22 | * | |
23 | * @param array $params | |
24 | * Array per getfields metadata. | |
25 | * | |
26 | * @return array | |
27 | * API result array | |
28 | */ | |
29 | function civicrm_api3_rule_create($params) { | |
30 | return _civicrm_api3_basic_create(_civicrm_api3_get_BAO(__FUNCTION__), $params, 'Rule'); | |
31 | } | |
32 | ||
33 | /** | |
34 | * Specify Meta data for create. | |
35 | * | |
36 | * Note that this data is retrievable via the getfields function | |
37 | * and is used for pre-filling defaults and ensuring mandatory requirements are met. | |
38 | * | |
39 | * @param array $params | |
40 | */ | |
41 | function _civicrm_api3_rule_create_spec(&$params) { | |
42 | $params['dedupe_rule_group_id']['api.required'] = TRUE; | |
43 | $params['rule_table']['api.default'] = 'civicrm_contact'; | |
44 | $params['rule_field']['api.required'] = TRUE; | |
45 | $params['rule_weight']['api.required'] = TRUE; | |
46 | } | |
47 | ||
48 | /** | |
49 | * Delete an existing Rule. | |
50 | * | |
51 | * @param array $params | |
52 | * | |
53 | * @return array | |
54 | * API result array | |
55 | */ | |
56 | function civicrm_api3_rule_delete($params) { | |
57 | return _civicrm_api3_basic_delete(_civicrm_api3_get_BAO(__FUNCTION__), $params); | |
58 | } | |
59 | ||
60 | /** | |
61 | * Get a Rule. | |
62 | * | |
63 | * @param array $params | |
64 | * Array per getfields metadata. | |
65 | * | |
66 | * @return array | |
67 | * API result array | |
68 | */ | |
69 | function civicrm_api3_rule_get($params) { | |
70 | return _civicrm_api3_basic_get(_civicrm_api3_get_BAO(__FUNCTION__), $params, TRUE, 'Rule'); | |
71 | } |