Skip to content

Commit

Permalink
Fix PHP Warnings. Replace fatal with statusBounce. Mark appendBreadCr…
Browse files Browse the repository at this point in the history
…umbs parameter as array instead of string so editors don't give a warning
  • Loading branch information
mattwire committed Aug 22, 2017
1 parent 34caf21 commit 0efdabe
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 4 deletions.
4 changes: 3 additions & 1 deletion CRM/Financial/BAO/ExportFormat/CSV.php
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,9 @@ public function putFile($export) {
$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) {
Expand Down
2 changes: 1 addition & 1 deletion CRM/Financial/Form/BatchTransaction.php
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ public function preProcess() {
// 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');
Expand Down
3 changes: 2 additions & 1 deletion CRM/Financial/Form/Export.php
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,8 @@ public function preProcess() {

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);
}
}

Expand Down
1 change: 1 addition & 0 deletions CRM/Financial/Page/BatchTransaction.php
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@ public function run() {
$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');
}
Expand Down
2 changes: 1 addition & 1 deletion CRM/Utils/System.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
* @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.
Expand Down

0 comments on commit 0efdabe

Please sign in to comment.