Commit 5fa39c68 authored by Edzelopez's avatar Edzelopez
Browse files

Merge pull request #235 from Edzelopez/test

RG-216 Fixed bugs for grantprograms for 4.4
parents 7edbcadd d5fa69d9
......@@ -201,7 +201,10 @@ class CRM_Grant_Form_Task_GrantPayment extends CRM_Core_Form
$details[$dao->id]['currency'] = $dao->currency;
$contactGrants[$dao->grant_id] = $dao->id;
$grantAmount[$dao->id] += $dao->total_amount;
if (!array_key_exists($dao->id, $grantAmount)) {
$grantAmount[$dao->id] = 0;
}
$grantAmount[$dao->id] += $dao->total_amount;
if ( !$this->_prid ) {
$grantProgramSql = "SELECT is_auto_email FROM civicrm_grant_program WHERE id = ".$dao->grant_program_id;
$mailParams[$dao->grant_id]['is_auto_email'] = CRM_Grant_DAO_GrantProgram::singleValueQuery( $grantProgramSql );
......@@ -276,18 +279,19 @@ class CRM_Grant_Form_Task_GrantPayment extends CRM_Core_Form
$downloadNamePDF .= '.pdf';
$fileName = CRM_Utils_File::makeFileName( $downloadNamePDF );
$files[] = $fileName = CRM_Grant_BAO_GrantPayment::makePDF($fileName, $grantPayment );
$grantPayments += $grantPayment;
}
$downloadNameCSV = check_plain('grantPayment');
$downloadNameCSV .= '_'.date('Ymdhis');
$this->assign('grantPayment', $grantPayment);
$this->assign('grantPayment', $grantPayments);
$downloadNameCSV .= '.csv';
$fileName = CRM_Utils_File::makeFileName( $downloadNameCSV );
$config = CRM_Core_Config::singleton();
$file_name = $config->customFileUploadDir . $fileName;
foreach($grantAmount as $id => $value) {
$grantPayment[$id]['amount'] = $value;
$grantPayments[$id]['amount'] = $value;
}
CRM_Grant_BAO_GrantPayment::createCSV($file_name, $grantPayment);
CRM_Grant_BAO_GrantPayment::createCSV($file_name, $grantPayments);
$files[] = $fileName;
$this->assign('date', date('Y-m-d'));
......
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