add parameter filter to all apis

This commit is contained in:
Marc Michalsky forumZFD 2021-02-09 16:12:25 +01:00
parent a79e534099
commit 6fd9521f08
Signed by untrusted user who does not match committer: marc.koch
GPG key ID: 12406554CFB028B9
13 changed files with 69 additions and 1 deletions

View file

@ -56,6 +56,11 @@ function _civicrm_api3_twingle_campaign_Create_spec(array &$spec) {
*/ */
function civicrm_api3_twingle_campaign_Create(array $params): array { 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 // instantiate TwingleCampaign
$campaign = new TwingleCampaign($params); $campaign = new TwingleCampaign($params);

View file

@ -68,6 +68,11 @@ function _civicrm_api3_twingle_event_Delete_spec(array &$spec) {
*/ */
function civicrm_api3_twingle_event_Delete(array $params): array { 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 = []; $result_values = [];
$events = []; $events = [];
$errors_occurred = 0; $errors_occurred = 0;

View file

@ -98,6 +98,12 @@ function _civicrm_api3_twingle_event_Get_spec(array &$spec) {
* *
*/ */
function civicrm_api3_twingle_event_Get(array $params): array { 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 = Cache::getInstance()->getCustomFieldMapping();
$custom_field_mapping_reverse = array_flip($custom_field_mapping); $custom_field_mapping_reverse = array_flip($custom_field_mapping);

View file

@ -97,6 +97,11 @@ function _civicrm_api3_twingle_event_Getsingle_spec(array &$spec) {
*/ */
function civicrm_api3_twingle_event_Getsingle(array $params): array { 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); $returnValues = civicrm_api3('TwingleEvent', 'get', $params);
$count = $returnValues['count']; $count = $returnValues['count'];

View file

@ -77,6 +77,11 @@ function _civicrm_api3_twingle_event_Sync_spec(array &$spec) {
*/ */
function civicrm_api3_twingle_event_Sync(array $params): array { 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 // If call provides an API key, use it instead of the API key set
// on the extension settings page // on the extension settings page
$apiKey = empty($params['twingle_api_key']) $apiKey = empty($params['twingle_api_key'])

View file

@ -55,6 +55,12 @@ function _civicrm_api3_twingle_form_Get_spec(array &$spec) {
* *
*/ */
function civicrm_api3_twingle_form_Get(array $params): array { 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 = []; $returnValues = [];
// Get custom fields // Get custom fields

View file

@ -53,6 +53,12 @@ function _civicrm_api3_twingle_form_Getsingle_spec(array &$spec) {
* @see civicrm_api3_create_success * @see civicrm_api3_create_success
*/ */
function civicrm_api3_twingle_form_Getsingle(array $params): array { 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); $returnValues = civicrm_api3('TwingleForm', 'get', $params);
$count = $returnValues['count']; $count = $returnValues['count'];

View file

@ -88,6 +88,11 @@ function _civicrm_api3_twingle_project_Create_spec(array &$spec) {
*/ */
function civicrm_api3_twingle_project_Create($params): array { 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 // instantiate project
$project = new TwingleProject($params, 'TWINGLE'); $project = new TwingleProject($params, 'TWINGLE');

View file

@ -59,6 +59,11 @@ function _civicrm_api3_twingle_project_Delete_spec(array &$spec) {
*/ */
function civicrm_api3_twingle_project_Delete(array $params): array { 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 = []; $result_values = [];
$error_occurred = FALSE; $error_occurred = FALSE;

View file

@ -107,6 +107,11 @@ function _civicrm_api3_twingle_project_Get_spec(array &$spec) {
*/ */
function civicrm_api3_twingle_project_Get(array $params): array { 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 = Cache::getInstance()->getCustomFieldMapping();
$custom_field_mapping_reverse = array_flip($custom_field_mapping); $custom_field_mapping_reverse = array_flip($custom_field_mapping);

View file

@ -103,6 +103,12 @@ function _civicrm_api3_twingle_project_Getsingle_spec(array &$spec) {
* @see civicrm_api3_create_success * @see civicrm_api3_create_success
*/ */
function civicrm_api3_twingle_project_Getsingle(array $params): array { 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); $returnValues = civicrm_api3('TwingleProject', 'get', $params);
$count = $returnValues['count']; $count = $returnValues['count'];

View file

@ -68,6 +68,11 @@ function _civicrm_api3_twingle_project_Sync_spec(array &$spec) {
*/ */
function civicrm_api3_twingle_project_Sync(array $params): array { 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 // If call provides an API key, use it instead of the API key set
// on the extension settings page // on the extension settings page
$apiKey = empty($params['twingle_api_key']) $apiKey = empty($params['twingle_api_key'])

View file

@ -51,8 +51,12 @@ function _civicrm_api3_twingle_sync_Sync_spec(array &$spec) {
*/ */
function civicrm_api3_twingle_sync_Sync(array $params): array { 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 = []; $result_values = [];
unset($params['sequential']);
// Synchronize all TwingleProject campaigns // Synchronize all TwingleProject campaigns
$projects = civicrm_api3( $projects = civicrm_api3(