Fix PHP Warnings. Replace fatal with statusBounce. Mark appendBreadCrumbs parameter...
authorMatthew Wire <mjw@mjwconsult.co.uk>
Tue, 22 Aug 2017 11:30:31 +0000 (12:30 +0100)
committerMatthew Wire <mjw@mjwconsult.co.uk>
Tue, 22 Aug 2017 20:32:17 +0000 (21:32 +0100)
CRM/Financial/BAO/ExportFormat/CSV.php
CRM/Financial/Form/BatchTransaction.php
CRM/Financial/Form/Export.php
CRM/Financial/Page/BatchTransaction.php
CRM/Utils/System.php

index 20ed7a03eb65c0b42d4ce08a2719483b2db629a8..fcb0d05c349b1aa20f5d3605a6449abc0f24d3c0 100644 (file)
@@ -139,7 +139,9 @@ class CRM_Financial_BAO_ExportFormat_CSV extends CRM_Financial_BAO_ExportFormat
     $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) {
index 76a92a22a3e85b2c0aba80d6cfdd646430108d9b..f5ee8bbe73ecd440699ee252cf2bf15cea24f403 100644 (file)
@@ -54,7 +54,7 @@ class CRM_Financial_Form_BatchTransaction extends CRM_Contribute_Form {
     // 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');
index 31e3b3b1e464cf36cae9f9143412174fd29a2bf5..46034b1708e4106a5e3efb0bde2749e82c888178 100644 (file)
@@ -97,7 +97,8 @@ class CRM_Financial_Form_Export extends CRM_Core_Form {
 
     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);
       }
     }
 
index 1ff920f68a0f1f50960521311474e99c347aad3a..7ea60f07b307817b50215bf471be0224dbae39c1 100644 (file)
@@ -97,6 +97,7 @@ class CRM_Financial_Page_BatchTransaction extends CRM_Core_Page_Basic {
     $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');
     }
index bee39e8e0becf3289be2ac6bb4115ed0f279b7cb..b68356c0e587cb2bfc93d4decc6c25999080f91a 100644 (file)
@@ -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.