Details
-
Type: Improvement
-
Status: Done/Fixed
-
Priority: Trivial
-
Resolution: Fixed/Completed
-
Affects Version/s: 4.5.4
-
Fix Version/s: 4.6
-
Component/s: CiviCRM API
-
Labels:None
-
Documentation Required?:None
Description
At the moment it is possible to create campaign's throught the api.
Although when your campaign has custom fields, it's not possible to create a campaign with values for this custom fields.
Executing $result = civicrm_api3('Campaign', 'create', array(
'sequential' => 1,
'title' => "",
'custom_field' => "value custom field",
));
has the same result as if you would omit the custom field value.
This is because the basic create method is used for the api create call.
(In api/v3/Campaign.php we have)
function civicrm_api3_campaign_create($params)
If we change this code (as in other entities wich do allow custom fields) we can make this work.
function civicrm_api3_campaign_create($params)
{ $value = array(); _civicrm_api3_custom_format_params($params, $values, 'Campaign'); $params = array_merge($values, $params); $campaignBAO = CRM_Campaign_BAO_Campaign::create($params); _civicrm_api3_object_to_array($campaignBAO, $campaign[$campaignBAO->id]); return civicrm_api3_create_success($campaign, $params, 'campaign', 'create', $campaignBAO); }I'll try to make a pull request
Attachments
Issue Links
- provides patch for
-
HR-377 Test coverage for recruitment extension
- Done/Fixed