$fileName = $config->uploadDir . 'Financial_Transactions_' . $this->_batchIds . '_' . date('YmdHis') . '.' . $this->getFileExtension();
$this->_downloadFile[] = $config->customFileUploadDir . CRM_Utils_File::cleanFileName(basename($fileName));
$out = fopen($fileName, 'w');
- fputcsv($out, $export['headers']);
+ if (!empty($export['headers'])) {
+ fputcsv($out, $export['headers']);
+ }
unset($export['headers']);
if (!empty($export)) {
foreach ($export as $fields) {
// This reuses some styles from search forms
CRM_Core_Resources::singleton()->addStyleFile('civicrm', 'css/searchForm.css', 1, 'html-header');
- self::$_entityID = CRM_Utils_Request::retrieve('bid', 'Positive') ? CRM_Utils_Request::retrieve('bid', 'Positive') : $_POST['batch_id'];
+ self::$_entityID = CRM_Utils_Request::retrieve('bid', 'Positive') ? CRM_Utils_Request::retrieve('bid', 'Positive') : CRM_Utils_Array::value('batch_id', $_POST);
$this->assign('entityID', self::$_entityID);
if (isset(self::$_entityID)) {
$this->_batchStatusId = CRM_Core_DAO::getFieldValue('CRM_Batch_BAO_Batch', self::$_entityID, 'status_id');
foreach ($batchStatus as $batchStatusId) {
if ($batchStatusId == $this->_exportStatusId) {
- CRM_Core_Error::fatal(ts('You cannot exported the batches which were exported earlier.'));
+ $url = CRM_Core_Session::singleton()->readUserContext();
+ CRM_Core_Error::statusBounce(ts('You cannot export batches which have already been exported.'), $url);
}
}
$this->assign('action', $action);
self::$_entityID = CRM_Utils_Request::retrieve('bid', 'Positive');
+ $statusID = NULL;
if (isset(self::$_entityID)) {
$statusID = CRM_Core_DAO::getFieldValue('CRM_Batch_BAO_Batch', self::$_entityID, 'status_id');
}
* @method static mixed permissionDenied() Show access denied screen.
* @method static mixed logout() Log out the current user.
* @method static mixed updateCategories() Clear CMS caches related to the user registration/profile forms.
- * @method static appendBreadCrumb(string $breadCrumbs) Append an additional breadcrumb tag to the existing breadcrumbs.
+ * @method static appendBreadCrumb(array $breadCrumbs) Append an additional breadcrumb tag to the existing breadcrumbs.
* @method static resetBreadCrumb() Reset an additional breadcrumb tag to the existing breadcrumb.
* @method static addHTMLHead(string $bc) Append a string to the head of the HTML file.
* @method static string postURL(int $action) Determine the post URL for a form.