2

I just had a report that someone is having trouble seeing the list of exported batches (civicrm/financial/financialbatches?reset=1&batchStatus=5) and it seems to have started just recently -- likely after I upgraded to CiviCRM 5.6 (I also recently upgraded from PHP 7.0 to PHP 7.1 but I reverted that as a test and still had the error). The strange part is that there is no error in viewing the list of Open or Closed batches, just the Exported batches. There are a lot of exported batches -- could the volume of batches be an issue here?

The only error I've been able to track down is the popup error:

DataTables warning: table id=crm-batch-selector-5 - Ajax error. For more information about this error, please see http://datatables.net/tn/7

...and the one in the Drupal watchdog log:

Notice: Trying to get property of non-object in CRM_Batch_BAO_Batch::getBatchList() (line 335 of /path-to-site/sites/all/modules/civicrm/CRM/Batch/BAO/Batch.php).


  • Drupal 7
  • CiviCRM 5.6.0
  • PHP 7.1

2 Answers 2

3

Okay, solved. There was something awry with the latest Batch in that it had been exported, but the file didn't exist in the custom directory/filesystem. I changed that last batch status directly in the database from 5 (exported) to 2 (closed) and now the screens all load as usual.

I suppose line 335 of /path-to-site/sites/all/modules/civicrm/CRM/Batch/BAO/Batch.php is trying to load information about this non-existent file and causes the error somehow, but I don't fully understand how.

EDIT: The error recurred when we tried to re-export the problem batch, but I was able to get a more helpful error message this time:

Error: [] operator not supported for strings in CRM_Financial_BAO_ExportFormat_CSV->formatHeaders() (line 166 of /path-to-site/sites/all/modules/civicrm/CRM/Financial/BAO/ExportFormat/CSV.php).

So this is in fact a PHP 7.1 bug. Issue in lab is here. PR is here.

1
  • 1
    Above patch is merged & will be in the 5.8 release
    – user4278
    Commented Oct 18, 2018 at 6:11
3

I got a similar DataTables warning recently that prevented me from viewing exported batches. I was also able to change the batch status and see them in the 'closed' list. [running CiviCRM 5.13.5 and php 7.2 on WordPress]

The problem turned out to be that I had recently deleted activities, including the export batch activities. Apparently, if so much as one export batch activity has been deleted, the list of exported batches will fail with a DataTables warning.

I was able to fix the problem by manually changing the status of all exported batches to closed, then re-exporting them, thereby recreating activity records for the exported batches (fortunately, only 12 large batches of imported donations as we are still in the setup phase). I deleting the activity record for just one exported batch to verify that the problem is caused by one or more missing activity records for exported batches.

This seems like a bug, since an activity record probably shouldn't be required to view the exported batch list (other type of activity can be safely deleted). I think the export activity record is somehow being used to link to the exported files in the [civicrm.files]/custom/ directory (though the exported files themselves can apparently be deleted without trouble if no longer needed).

The actual functionality of the batches did not seem to be impaired (new batches and exports worked and I could search contributions on batch criteria).

4
  • Do you know how to apply patches? If so, could you please apply this patch and report back if it fixes your problem? github.com/civicrm/civicrm-core/pull/14367 Commented Aug 23, 2019 at 19:35
  • OK, I just replicated your problem and can confirm that this patch fixes it. If you know how, you can apply it now to solve your problem immediately. If not, I'll link this conversation to the patch in the hopes that it will aid the case for getting it included in CiviCRM. Commented Aug 23, 2019 at 19:39
  • Thanks Jon. I haven't learned how to apply a patch yet, but since you confirmed that it fixes my issue, I just won't delete batch activities for the time being... Commented Aug 25, 2019 at 1:05
  • 1
    It just got merged into Civi 5.18, which comes out the first weekend in October. You can upgrade then! Commented Aug 26, 2019 at 13:15

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.