Closed (fixed)
Project:
Webform
Version:
6.x-3.17
Component:
Code
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
12 Mar 2012 at 08:46 UTC
Updated:
7 May 2012 at 19:00 UTC
As of Webform 3.16, the Submission results download option "Only new submissions since your last download
(x new since 2012-02-27)" no longer works properly: the since date is no longer being updated - it will always stay on the same value.
Comments
Comment #1
retorque commented(Below line numbers apply to 6.x-3.17)
In webform.report.inc, function webform_results_download() checks if $row_count > 0 before updating the date, but $row_count does not appear to be set anywhere in that function.
I temporarily commented out the $row_count check, and the date was updated in the database. However, the sid was set to 0 in the database, so even though the last execution date displayed correctly, my next download still produced a full list of submissions.
row_count was an element in the $export_info array, so to fix the $row_count problem, I modified line 823 to read:
if ($options['range_type'] != 'range' && $export_info['row_count'] > 0) {
On line 542, sid gets set as part of a form element in an after_build callback:
$element['#webform_download_info']['sid'] = $last_download ? $last_download['sid'] : 0;
However, this information was not added to the $export_info array, and I have not managed to completely trace back to the point where it should have been added. As a temporary solution, I added the following two lines to the beginning of webform_results_download():
sort($export_info['options']['sids'],SORT_NUMERIC);
$sid = end($export_info['options']['sids']);
I expect the sort() is probably unecessary, but I don't have time to confirm that immediately, and I expect to be removing it anyway if I can figure out where the sid should have been added to $export_info.
Comment #2
quicksketchThanks for the report! This has already been fixed in #1459130: Downloading results gets Undefined variable: row_count in webform_results_download(). It will be in the 3.18 release.