Skip to content

Commit

Permalink
Merge pull request #14367 from MegaphoneJon/financial-58
Browse files Browse the repository at this point in the history
financial#58: Don't crash the View Batches page after a failed batch …
  • Loading branch information
eileenmcnaughton authored Aug 23, 2019
2 parents 98af96f + 83cab05 commit 938ed56
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions CRM/Batch/BAO/Batch.php
Original file line number Diff line number Diff line change
Expand Up @@ -334,9 +334,14 @@ public static function getBatchList(&$params) {
$aid = CRM_Core_PseudoConstant::getKey('CRM_Activity_BAO_Activity', 'activity_type_id', 'Export Accounting Batch');
$activityParams = ['source_record_id' => $values['id'], 'activity_type_id' => $aid];
$exportActivity = CRM_Activity_BAO_Activity::retrieve($activityParams, $val);
$fid = CRM_Core_DAO::getFieldValue('CRM_Core_DAO_EntityFile', $exportActivity->id, 'file_id', 'entity_id');
$fileHash = CRM_Core_BAO_File::generateFileHash($exportActivity->id, $fid);
$tokens = array_merge(['eid' => $exportActivity->id, 'fid' => $fid, 'fcs' => $fileHash], $tokens);
if ($exportActivity) {
$fid = CRM_Core_DAO::getFieldValue('CRM_Core_DAO_EntityFile', $exportActivity->id, 'file_id', 'entity_id');
$fileHash = CRM_Core_BAO_File::generateFileHash($exportActivity->id, $fid);
$tokens = array_merge(['eid' => $exportActivity->id, 'fid' => $fid, 'fcs' => $fileHash], $tokens);
}
else {
CRM_Utils_Array::remove($newLinks, 'export', 'download');
}
}
$values['action'] = CRM_Core_Action::formLink(
$newLinks,
Expand Down

0 comments on commit 938ed56

Please sign in to comment.