add parameter filter to all apis
This commit is contained in:
parent
a79e534099
commit
6fd9521f08
13 changed files with 69 additions and 1 deletions
|
@ -56,6 +56,11 @@ function _civicrm_api3_twingle_campaign_Create_spec(array &$spec) {
|
|||
*/
|
||||
function civicrm_api3_twingle_campaign_Create(array $params): array {
|
||||
|
||||
// filter parameters
|
||||
$allowed_params = [];
|
||||
_civicrm_api3_twingle_campaign_Create_spec($allowed_params);
|
||||
$params = array_intersect_key($params, $allowed_params);
|
||||
|
||||
// instantiate TwingleCampaign
|
||||
$campaign = new TwingleCampaign($params);
|
||||
|
||||
|
|
|
@ -68,6 +68,11 @@ function _civicrm_api3_twingle_event_Delete_spec(array &$spec) {
|
|||
*/
|
||||
function civicrm_api3_twingle_event_Delete(array $params): array {
|
||||
|
||||
// filter parameters
|
||||
$allowed_params = [];
|
||||
_civicrm_api3_twingle_event_Delete_spec($allowed_params);
|
||||
$params = array_intersect_key($params, $allowed_params);
|
||||
|
||||
$result_values = [];
|
||||
$events = [];
|
||||
$errors_occurred = 0;
|
||||
|
|
|
@ -98,6 +98,12 @@ function _civicrm_api3_twingle_event_Get_spec(array &$spec) {
|
|||
*
|
||||
*/
|
||||
function civicrm_api3_twingle_event_Get(array $params): array {
|
||||
|
||||
// filter parameters
|
||||
$allowed_params = [];
|
||||
_civicrm_api3_twingle_event_Get_spec($allowed_params);
|
||||
$params = array_intersect_key($params, $allowed_params);
|
||||
|
||||
$custom_field_mapping = Cache::getInstance()->getCustomFieldMapping();
|
||||
$custom_field_mapping_reverse = array_flip($custom_field_mapping);
|
||||
|
||||
|
|
|
@ -97,6 +97,11 @@ function _civicrm_api3_twingle_event_Getsingle_spec(array &$spec) {
|
|||
*/
|
||||
function civicrm_api3_twingle_event_Getsingle(array $params): array {
|
||||
|
||||
// filter parameters
|
||||
$allowed_params = [];
|
||||
_civicrm_api3_twingle_event_Getsingle_spec($allowed_params);
|
||||
$params = array_intersect_key($params, $allowed_params);
|
||||
|
||||
$returnValues = civicrm_api3('TwingleEvent', 'get', $params);
|
||||
$count = $returnValues['count'];
|
||||
|
||||
|
|
|
@ -77,6 +77,11 @@ function _civicrm_api3_twingle_event_Sync_spec(array &$spec) {
|
|||
*/
|
||||
function civicrm_api3_twingle_event_Sync(array $params): array {
|
||||
|
||||
// filter parameters
|
||||
$allowed_params = [];
|
||||
_civicrm_api3_twingle_event_Sync_spec($allowed_params);
|
||||
$params = array_intersect_key($params, $allowed_params);
|
||||
|
||||
// If call provides an API key, use it instead of the API key set
|
||||
// on the extension settings page
|
||||
$apiKey = empty($params['twingle_api_key'])
|
||||
|
|
|
@ -55,6 +55,12 @@ function _civicrm_api3_twingle_form_Get_spec(array &$spec) {
|
|||
*
|
||||
*/
|
||||
function civicrm_api3_twingle_form_Get(array $params): array {
|
||||
|
||||
// filter parameters
|
||||
$allowed_params = [];
|
||||
_civicrm_api3_twingle_form_Get_spec($allowed_params);
|
||||
$params = array_intersect_key($params, $allowed_params);
|
||||
|
||||
$returnValues = [];
|
||||
|
||||
// Get custom fields
|
||||
|
|
|
@ -53,6 +53,12 @@ function _civicrm_api3_twingle_form_Getsingle_spec(array &$spec) {
|
|||
* @see civicrm_api3_create_success
|
||||
*/
|
||||
function civicrm_api3_twingle_form_Getsingle(array $params): array {
|
||||
|
||||
// filter parameters
|
||||
$allowed_params = [];
|
||||
_civicrm_api3_twingle_form_Getsingle_spec($allowed_params);
|
||||
$params = array_intersect_key($params, $allowed_params);
|
||||
|
||||
$returnValues = civicrm_api3('TwingleForm', 'get', $params);
|
||||
$count = $returnValues['count'];
|
||||
|
||||
|
|
|
@ -88,6 +88,11 @@ function _civicrm_api3_twingle_project_Create_spec(array &$spec) {
|
|||
*/
|
||||
function civicrm_api3_twingle_project_Create($params): array {
|
||||
|
||||
// filter parameters
|
||||
$allowed_params = [];
|
||||
_civicrm_api3_twingle_project_Create_spec($allowed_params);
|
||||
$params = array_intersect_key($params, $allowed_params);
|
||||
|
||||
// instantiate project
|
||||
$project = new TwingleProject($params, 'TWINGLE');
|
||||
|
||||
|
|
|
@ -59,6 +59,11 @@ function _civicrm_api3_twingle_project_Delete_spec(array &$spec) {
|
|||
*/
|
||||
function civicrm_api3_twingle_project_Delete(array $params): array {
|
||||
|
||||
// filter parameters
|
||||
$allowed_params = [];
|
||||
_civicrm_api3_twingle_project_Delete_spec($allowed_params);
|
||||
$params = array_intersect_key($params, $allowed_params);
|
||||
|
||||
$result_values = [];
|
||||
$error_occurred = FALSE;
|
||||
|
||||
|
|
|
@ -107,6 +107,11 @@ function _civicrm_api3_twingle_project_Get_spec(array &$spec) {
|
|||
*/
|
||||
function civicrm_api3_twingle_project_Get(array $params): array {
|
||||
|
||||
// filter parameters
|
||||
$allowed_params = [];
|
||||
_civicrm_api3_twingle_project_Get_spec($allowed_params);
|
||||
$params = array_intersect_key($params, $allowed_params);
|
||||
|
||||
$custom_field_mapping = Cache::getInstance()->getCustomFieldMapping();
|
||||
$custom_field_mapping_reverse = array_flip($custom_field_mapping);
|
||||
|
||||
|
|
|
@ -103,6 +103,12 @@ function _civicrm_api3_twingle_project_Getsingle_spec(array &$spec) {
|
|||
* @see civicrm_api3_create_success
|
||||
*/
|
||||
function civicrm_api3_twingle_project_Getsingle(array $params): array {
|
||||
|
||||
// filter parameters
|
||||
$allowed_params = [];
|
||||
_civicrm_api3_twingle_project_Getsingle_spec($allowed_params);
|
||||
$params = array_intersect_key($params, $allowed_params);
|
||||
|
||||
$returnValues = civicrm_api3('TwingleProject', 'get', $params);
|
||||
$count = $returnValues['count'];
|
||||
|
||||
|
|
|
@ -68,6 +68,11 @@ function _civicrm_api3_twingle_project_Sync_spec(array &$spec) {
|
|||
*/
|
||||
function civicrm_api3_twingle_project_Sync(array $params): array {
|
||||
|
||||
// filter parameters
|
||||
$allowed_params = [];
|
||||
_civicrm_api3_twingle_project_Sync_spec($allowed_params);
|
||||
$params = array_intersect_key($params, $allowed_params);
|
||||
|
||||
// If call provides an API key, use it instead of the API key set
|
||||
// on the extension settings page
|
||||
$apiKey = empty($params['twingle_api_key'])
|
||||
|
|
|
@ -51,8 +51,12 @@ function _civicrm_api3_twingle_sync_Sync_spec(array &$spec) {
|
|||
*/
|
||||
function civicrm_api3_twingle_sync_Sync(array $params): array {
|
||||
|
||||
// filter parameters
|
||||
$allowed_params = [];
|
||||
_civicrm_api3_twingle_sync_Sync_spec($allowed_params);
|
||||
$params = array_intersect_key($params, $allowed_params);
|
||||
|
||||
$result_values = [];
|
||||
unset($params['sequential']);
|
||||
|
||||
// Synchronize all TwingleProject campaigns
|
||||
$projects = civicrm_api3(
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue