Skip to content

Commit

Permalink
Fix more entities to support custom fields (via api)
Browse files Browse the repository at this point in the history
  • Loading branch information
eileenmcnaughton committed Feb 21, 2018
1 parent 52c3070 commit 5136291
Show file tree
Hide file tree
Showing 34 changed files with 122 additions and 47 deletions.
2 changes: 1 addition & 1 deletion api/v3/AclRole.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
* API result array
*/
function civicrm_api3_acl_role_create($params) {
return _civicrm_api3_basic_create(_civicrm_api3_get_BAO(__FUNCTION__), $params, 'AclRole');
return _civicrm_api3_basic_create(_civicrm_api3_get_BAO(__FUNCTION__), $params, 'EntityRole');
}

/**
Expand Down
2 changes: 1 addition & 1 deletion api/v3/CaseContact.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
* @return array
*/
function civicrm_api3_case_contact_create($params) {
return _civicrm_api3_basic_create(_civicrm_api3_get_BAO(__FUNCTION__), $params);
return _civicrm_api3_basic_create(_civicrm_api3_get_BAO(__FUNCTION__), $params, 'CaseContact');
}

/**
Expand Down
2 changes: 1 addition & 1 deletion api/v3/ContributionProduct.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
* @return array
*/
function civicrm_api3_contribution_product_create($params) {
return _civicrm_api3_basic_create(_civicrm_api3_get_BAO(__FUNCTION__), $params);
return _civicrm_api3_basic_create(_civicrm_api3_get_BAO(__FUNCTION__), $params, 'ContributionProduct');
}

/**
Expand Down
2 changes: 1 addition & 1 deletion api/v3/ContributionSoft.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
* API result array
*/
function civicrm_api3_contribution_soft_create($params) {
return _civicrm_api3_basic_create(_civicrm_api3_get_BAO(__FUNCTION__), $params);
return _civicrm_api3_basic_create(_civicrm_api3_get_BAO(__FUNCTION__), $params, 'ContributionSoft');
}

/**
Expand Down
6 changes: 1 addition & 5 deletions api/v3/Dashboard.php
Original file line number Diff line number Diff line change
Expand Up @@ -73,11 +73,7 @@ function _civicrm_api3_dashboard_create_spec(&$params) {
* @return array
*/
function civicrm_api3_dashboard_get($params) {
// NEVER COPY THIS. No idea why a newish api would not use basic_get.
$bao = new CRM_Core_BAO_Dashboard();
_civicrm_api3_dao_set_filter($bao, $params, TRUE);
$dashlets = _civicrm_api3_dao_to_array($bao, $params, TRUE, 'Dashboard');
return civicrm_api3_create_success($dashlets, $params, 'Dashboard', 'get', $bao);
return _civicrm_api3_basic_get(_civicrm_api3_get_BAO(__FUNCTION__), $params);
}

/**
Expand Down
2 changes: 1 addition & 1 deletion api/v3/DashboardContact.php
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ function civicrm_api3_dashboard_contact_create($params) {
if ($errors !== NULL) {
return $errors;
}
return _civicrm_api3_basic_create(_civicrm_api3_get_BAO(__FUNCTION__), $params);
return _civicrm_api3_basic_create(_civicrm_api3_get_BAO(__FUNCTION__), $params, 'DashboardContact');
}

/**
Expand Down
2 changes: 1 addition & 1 deletion api/v3/EntityBatch.php
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ function _civicrm_api3_entity_batch_create_spec(&$params) {
* @return array
*/
function civicrm_api3_entity_batch_create($params) {
return _civicrm_api3_basic_create(_civicrm_api3_get_BAO(__FUNCTION__), $params);
return _civicrm_api3_basic_create(_civicrm_api3_get_BAO(__FUNCTION__), $params, 'EntityBatch');
}

/**
Expand Down
2 changes: 1 addition & 1 deletion api/v3/EntityFinancialTrxn.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
* @return array
*/
function civicrm_api3_entity_financial_trxn_create($params) {
return _civicrm_api3_basic_create(_civicrm_api3_get_BAO(__FUNCTION__), $params);
return _civicrm_api3_basic_create(_civicrm_api3_get_BAO(__FUNCTION__), $params, 'EntityFinancialTrxn');
}

/**
Expand Down
2 changes: 1 addition & 1 deletion api/v3/Im.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
* @return array
*/
function civicrm_api3_im_create($params) {
return _civicrm_api3_basic_create(_civicrm_api3_get_BAO(__FUNCTION__), $params, 'IM');
return _civicrm_api3_basic_create(_civicrm_api3_get_BAO(__FUNCTION__), $params, 'Im');
}

/**
Expand Down
2 changes: 1 addition & 1 deletion api/v3/Job.php
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ function _civicrm_api3_job_create_spec(&$params) {
* @return array
*/
function civicrm_api3_job_create($params) {
return _civicrm_api3_basic_create(_civicrm_api3_get_BAO(__FUNCTION__), $params);
return _civicrm_api3_basic_create(_civicrm_api3_get_BAO(__FUNCTION__), $params, 'Job');
}

/**
Expand Down
2 changes: 1 addition & 1 deletion api/v3/LocationType.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ function civicrm_api3_location_type_create($params) {
$params['display_name'] = $params['name'];
}

return _civicrm_api3_basic_create(_civicrm_api3_get_BAO(__FUNCTION__), $params);
return _civicrm_api3_basic_create(_civicrm_api3_get_BAO(__FUNCTION__), $params, 'LocationType');
}

/**
Expand Down
2 changes: 1 addition & 1 deletion api/v3/MailSettings.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
* API result array.
*/
function civicrm_api3_mail_settings_create($params) {
return _civicrm_api3_basic_create(_civicrm_api3_get_BAO(__FUNCTION__), $params);
return _civicrm_api3_basic_create(_civicrm_api3_get_BAO(__FUNCTION__), $params, 'MailSettings');
}

/**
Expand Down
2 changes: 1 addition & 1 deletion api/v3/MailingAB.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ function _civicrm_api3_mailing_a_b_create_spec(&$spec) {
* API Success Array
*/
function civicrm_api3_mailing_a_b_create($params) {
return _civicrm_api3_basic_create(_civicrm_api3_get_BAO(__FUNCTION__), $params);
return _civicrm_api3_basic_create(_civicrm_api3_get_BAO(__FUNCTION__), $params, 'MailingAB');
}

/**
Expand Down
2 changes: 1 addition & 1 deletion api/v3/MailingComponent.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
* API result array.
*/
function civicrm_api3_mailing_component_create($params) {
return _civicrm_api3_basic_create(_civicrm_api3_get_BAO(__FUNCTION__), $params);
return _civicrm_api3_basic_create(_civicrm_api3_get_BAO(__FUNCTION__), $params, 'Component');
}


Expand Down
2 changes: 1 addition & 1 deletion api/v3/MailingEventQueue.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ function civicrm_api3_mailing_event_queue_create($params) {
array('job_id', 'contact_id'),
FALSE
);
return _civicrm_api3_basic_create('CRM_Mailing_Event_BAO_Queue', $params);
return _civicrm_api3_basic_create('CRM_Mailing_Event_BAO_Queue', $params, 'Queue');
}

/**
Expand Down
2 changes: 1 addition & 1 deletion api/v3/MappingField.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
* @return array
*/
function civicrm_api3_mapping_field_create($params) {
return _civicrm_api3_basic_create(_civicrm_api3_get_BAO(__FUNCTION__), $params);
return _civicrm_api3_basic_create(_civicrm_api3_get_BAO(__FUNCTION__), $params, 'MappingField');
}

/**
Expand Down
2 changes: 1 addition & 1 deletion api/v3/MembershipLog.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
* API result array.
*/
function civicrm_api3_membership_log_create($params) {
return _civicrm_api3_basic_create(_civicrm_api3_get_BAO(__FUNCTION__), $params);
return _civicrm_api3_basic_create(_civicrm_api3_get_BAO(__FUNCTION__), $params, 'MembershipLog');
}

/**
Expand Down
2 changes: 1 addition & 1 deletion api/v3/MembershipPayment.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
* API result array.
*/
function civicrm_api3_membership_payment_create($params) {
return _civicrm_api3_basic_create(_civicrm_api3_get_BAO(__FUNCTION__), $params);
return _civicrm_api3_basic_create(_civicrm_api3_get_BAO(__FUNCTION__), $params, 'MembershipPayment');
}

/**
Expand Down
2 changes: 1 addition & 1 deletion api/v3/MessageTemplate.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
* @throws \API_Exception
*/
function civicrm_api3_message_template_create($params) {
return _civicrm_api3_basic_create(_civicrm_api3_get_BAO(__FUNCTION__), $params);
return _civicrm_api3_basic_create(_civicrm_api3_get_BAO(__FUNCTION__), $params, 'MessageTemplate');
}

/**
Expand Down
2 changes: 1 addition & 1 deletion api/v3/Navigation.php
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ function _civicrm_api3_navigation_create_spec(&$params) {
*/
function civicrm_api3_navigation_create($params) {
civicrm_api3_verify_one_mandatory($params, NULL, array('name', 'label'));
return _civicrm_api3_basic_create(_civicrm_api3_get_BAO(__FUNCTION__), $params);
return _civicrm_api3_basic_create(_civicrm_api3_get_BAO(__FUNCTION__), $params, 'Navigation');
}

/**
Expand Down
2 changes: 1 addition & 1 deletion api/v3/Note.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
* API result array
*/
function civicrm_api3_note_create($params) {
return _civicrm_api3_basic_create(_civicrm_api3_get_BAO(__FUNCTION__), $params);
return _civicrm_api3_basic_create(_civicrm_api3_get_BAO(__FUNCTION__), $params, 'Note');
}

/**
Expand Down
2 changes: 1 addition & 1 deletion api/v3/OpenID.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
* API result array
*/
function civicrm_api3_open_i_d_create($params) {
return _civicrm_api3_basic_create(_civicrm_api3_get_BAO(__FUNCTION__), $params);
return _civicrm_api3_basic_create(_civicrm_api3_get_BAO(__FUNCTION__), $params, 'OpenID');
}

/**
Expand Down
2 changes: 1 addition & 1 deletion api/v3/OptionGroup.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ function civicrm_api3_option_group_get($params) {
* @return array
*/
function civicrm_api3_option_group_create($params) {
return _civicrm_api3_basic_create(_civicrm_api3_get_BAO(__FUNCTION__), $params);
return _civicrm_api3_basic_create(_civicrm_api3_get_BAO(__FUNCTION__), $params, 'OptionGroup');
}

/**
Expand Down
2 changes: 1 addition & 1 deletion api/v3/OptionValue.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
* API result array
*/
function civicrm_api3_option_value_get($params) {
return _civicrm_api3_basic_get(_civicrm_api3_get_BAO(__FUNCTION__), $params);
return _civicrm_api3_basic_get(_civicrm_api3_get_BAO(__FUNCTION__), $params, 'OptionValue');
}

/**
Expand Down
2 changes: 1 addition & 1 deletion api/v3/ParticipantStatusType.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
* participant_status array
*/
function civicrm_api3_participant_status_type_create($params) {
return _civicrm_api3_basic_create(_civicrm_api3_get_BAO(__FUNCTION__), $params);
return _civicrm_api3_basic_create(_civicrm_api3_get_BAO(__FUNCTION__), $params, 'ParticipantStatusType');
}

/**
Expand Down
2 changes: 1 addition & 1 deletion api/v3/Premium.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
* @return array
*/
function civicrm_api3_premium_create($params) {
return _civicrm_api3_basic_create(_civicrm_api3_get_BAO(__FUNCTION__), $params);
return _civicrm_api3_basic_create(_civicrm_api3_get_BAO(__FUNCTION__), $params, 'Premium');
}

/**
Expand Down
2 changes: 1 addition & 1 deletion api/v3/PrintLabel.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
* @return array
*/
function civicrm_api3_print_label_create($params) {
return _civicrm_api3_basic_create(_civicrm_api3_get_BAO(__FUNCTION__), $params);
return _civicrm_api3_basic_create(_civicrm_api3_get_BAO(__FUNCTION__), $params, 'PrintLabel');
}

/**
Expand Down
2 changes: 1 addition & 1 deletion api/v3/Product.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
* @return array
*/
function civicrm_api3_product_create($params) {
return _civicrm_api3_basic_create(_civicrm_api3_get_BAO(__FUNCTION__), $params);
return _civicrm_api3_basic_create(_civicrm_api3_get_BAO(__FUNCTION__), $params, 'Product');
}

/**
Expand Down
2 changes: 1 addition & 1 deletion api/v3/ReportInstance.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ function civicrm_api3_report_instance_get($params) {
* API result array
*/
function civicrm_api3_report_instance_create($params) {
return _civicrm_api3_basic_create(_civicrm_api3_get_BAO(__FUNCTION__), $params);
return _civicrm_api3_basic_create(_civicrm_api3_get_BAO(__FUNCTION__), $params, 'ReportInstance');
}

/**
Expand Down
2 changes: 1 addition & 1 deletion api/v3/RuleGroup.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
* API result array
*/
function civicrm_api3_rule_group_create($params) {
return _civicrm_api3_basic_create(_civicrm_api3_get_BAO(__FUNCTION__), $params);
return _civicrm_api3_basic_create(_civicrm_api3_get_BAO(__FUNCTION__), $params, 'RuleGroup');
}

/**
Expand Down
2 changes: 1 addition & 1 deletion api/v3/SavedSearch.php
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ function civicrm_api3_saved_search_create($params) {
}
}

$result = _civicrm_api3_basic_create(_civicrm_api3_get_BAO(__FUNCTION__), $params);
$result = _civicrm_api3_basic_create(_civicrm_api3_get_BAO(__FUNCTION__), $params, 'SavedSearch');
_civicrm_api3_saved_search_result_cleanup($result);
return $result;
}
Expand Down
2 changes: 1 addition & 1 deletion api/v3/SmsProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
* @return array
*/
function civicrm_api3_sms_provider_create($params) {
return _civicrm_api3_basic_create(_civicrm_api3_get_BAO(__FUNCTION__), $params);
return _civicrm_api3_basic_create(_civicrm_api3_get_BAO(__FUNCTION__), $params, 'Provider');
}

/**
Expand Down
2 changes: 1 addition & 1 deletion api/v3/StateProvince.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
* @throws \API_Exception
*/
function civicrm_api3_state_province_create($params) {
return _civicrm_api3_basic_create(_civicrm_api3_get_DAO(__FUNCTION__), $params);
return _civicrm_api3_basic_create(_civicrm_api3_get_DAO(__FUNCTION__), $params, 'StateProvince');
}

/**
Expand Down
Loading

0 comments on commit 5136291

Please sign in to comment.