Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CRM-21054 - Fix is_create_activities param for fetch_activities job #10846

Merged
merged 2 commits into from
Aug 12, 2017
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion CRM/Utils/Mail/EmailProcessor.php
Original file line number Diff line number Diff line change
Expand Up @@ -89,8 +89,10 @@ public static function cleanupDir($dir, $age = 5184000) {

/**
* Process the mailboxes that aren't default (ie. that aren't used by civiMail for the bounce).
* @param bool $is_create_activities
* Should activities be created?
*/
public static function processActivities() {
public static function processActivities($is_create_activities) {
$dao = new CRM_Core_DAO_MailSettings();
$dao->domain_id = CRM_Core_Config::domainID();
$dao->is_default = FALSE;
Expand Down
15 changes: 14 additions & 1 deletion api/v3/Job.php
Original file line number Diff line number Diff line change
Expand Up @@ -377,6 +377,19 @@ function _civicrm_api3_job_fetch_bounces_spec(&$params) {
);
}

/**
* Metadata for activities function.
*
* @param array $params
*/
function _civicrm_api3_job_fetch_activities_spec(&$params) {
$params['is_create_activities'] = array(
'api.default' => 0,
Copy link
Contributor Author

@jitendrapurohit jitendrapurohit Aug 10, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@eileenmcnaughton should this value be 1 ?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes - I think you are right! Will fix

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, just thinking - I think it should not be a param but rather be always set in the _fetch_activities function - since there is no point calling that fn without creating activities

'type' => CRM_Utils_Type::T_BOOLEAN,
'title' => ts('Create activities for replies?'),
);
}

/**
* Job to get mail and create activities.
*
Expand All @@ -391,7 +404,7 @@ function civicrm_api3_job_fetch_activities($params) {
}

try {
CRM_Utils_Mail_EmailProcessor::processActivities();
CRM_Utils_Mail_EmailProcessor::processActivities($params['is_create_activities']);
$values = array();
$lock->release();
return civicrm_api3_create_success($values, $params, 'Job', 'fetch_activities');
Expand Down