TribeHR/ad_hoc_reporting — pull request #19 by ianring (2013-12-03 06:38:39+00:00)
Title: Bugfix: error when excel export had no data

delivers: https://tribehr.atlassian.net/browse/WEB-4513

This bug wasn't just in Custom Field reports; it was present whenever any Ad Hoc report had no rows. Easily reproduced, simply by applying a filter that matched no data. When the report had no rows, the Excel export barfed up an error. bork!

Refactoring the Excel rendering class wasn't hard. Now when the report has no rows, the Excel class will render a spreadsheet containing all the header rows, and the text "There is no data to show in this report" in cell A2. It's a nicer user experience.

Testing notes:
- [ ] create an ad hoc report that would produce no rows, perhaps by adding a filter that matches nothing.
- [ ] see that the report still exports to Excel, looking as described above
- [ ] no 500 errors! no crashy looking pages!
- [ ] Create an ad hoc report that would produce some rows, to see that it's still working as intended too
- [ ] Check that the isAuthorized() function in the controller is doing what it oughta, because that's new... or is it?
- [ ] check that the HTML output looks nice, and that the reports aren't broken - I changed the CSS styling to use a class name that matches some similar reports in the TribeHR app.