Commit 781599d3 authored by Pradeep Nayak's avatar Pradeep Nayak

-- fixed for RG-212

parent 2e7182a3
......@@ -304,7 +304,7 @@ WHERE civicrm_contact.id = $id ";
return $grants;
}
static function sendMail($contactID, &$values, $grantStatus, $grantId = FALSE) {
static function sendMail($contactID, &$values, $grantStatus, $grantId = FALSE, $status = '') {
$value = array();
if (CRM_Utils_Array::value('is_auto_email', $values)) {
list($displayName, $email) = CRM_Contact_BAO_Contact_Location::getEmailDetails($contactID);
......@@ -340,11 +340,11 @@ WHERE civicrm_contact.id = $id ";
'source_record_id' => $grantId,
'activity_type_id'=> array_search('Grant Status Change', $activityType),
'assignee_contact_id'=> array($contactID),
'subject'=> "Grant Status Change",
'subject'=> "Grant Status Change : " . $grantStatus,
'activity_date_time'=> date('Ymdhis'),
'status_id'=> array_search('Completed', $activityStatus),
'priority_id'=> 2,
'details'=> '',
'details'=> "Grant status changed from {$status} to {$grantStatus}",
);
CRM_Activity_BAO_Activity::create($params);
}
......
......@@ -377,7 +377,7 @@ class CRM_Grant_Form_Task_GrantPayment extends CRM_Core_Form
$this->assign( 'grant_programs', $grantPrograms[$mailParams[$grantId]['grant_program_id']] );
$this->assign( 'grant_status', 'Paid' );
$this->assign( 'params', $mailParams[$grantId] );
CRM_Grant_BAO_GrantProgram::sendMail($grantContctId[$grantId], $mailParams[$grantId], 'Paid', $grantId);
CRM_Grant_BAO_GrantProgram::sendMail($grantContctId[$grantId], $mailParams[$grantId], 'Paid', $grantId, 'Approved for Payment');
}
CRM_Core_Session::setStatus( "Created ".count($details)." payments to pay for ".count($this->_approvedGrants)." grants to ".count($details)." applicants." );
}
......
......@@ -724,7 +724,7 @@ function grantprograms_civicrm_post($op, $objectName, $objectId, &$objectRef) {
$page->assign('customGroup', $customGroup);
$page->assign('customField', $customField);
$grantStatus = CRM_Core_OptionGroup::values('grant_status');
$grantStatuses = $grantStatus = CRM_Core_OptionGroup::values('grant_status');
$grantPrograms = CRM_Grant_BAO_GrantProgram::getGrantPrograms();
$grantTypes = CRM_Core_OptionGroup::values('grant_type');
$grantProgram = $grantPrograms[$params['grant_program_id']];
......@@ -746,7 +746,12 @@ function grantprograms_civicrm_post($op, $objectName, $objectId, &$objectRef) {
$smarty = CRM_Core_Smarty::singleton();
$sendMail = $smarty->get_template_vars('sendMail');
if ($sendMail) {
CRM_Grant_BAO_GrantProgram::sendMail($params['contact_id'], $params, $grantStatus, $objectId);
$previousGrant = $smarty->get_template_vars('previousGrant');
$previousStatus = '';
if (property_exists($previousGrant, 'status_id')) {
$previousStatus = $grantStatuses[$previousGrant->status_id];
}
CRM_Grant_BAO_GrantProgram::sendMail($params['contact_id'], $params, $grantStatus, $objectId, $previousStatus);
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment