easydigitaldownloads/Easy-Digital-Downloads — pull request #2154 by NateWr (2014-03-30 01:26:18+00:00)
Title: * Limit payments count by start and end date

Start and end date filters used on the payments table will now impact
the total count of payments shown in the views (status) and pagination
UIs on the table. Previously, the total number of payments was returned,
which meant that more results would be indicated in the views and
pagination than were actually displayed in the table.

**Note**

While testing this change, I noticed that a warning is thrown when an End Date is provided but a Start Date is missing:

```Warning: date() expects parameter 2 to be long, object given in C:\Program Files (x86)\wamp\www\themeofthecrop\wp-content\plugins\Easy-Digital-Downloads\includes\class-edd-stats.php on line 516```

This commit does not cause or effect that warning. If a Start Date is entered but no End Date is provided, no warning is thrown. But no results are returned either.

While digging into this issue, I noticed this in EDD_Stats::setup_dates():

```
if( empty( $_start_date ) ) {
$this->start_date = 'this_month';
}

$this->start_date = $_start_date;
```

As far as I can tell, an empty $_start_date will still result in an empty $this->start_date. This gets passed on to EDD_Stats::convert_date(), which can not handle an empty date. I umm'd and ahh'd over this for a while, but eventually decided not to tamper with it. EDD_Stats::setup_dates() is used by the reports, I think, and I'm not very familiar with that part of the plugin. I fear any tampering on my part will have adverse consequences.