Feature #11924: using template preprocess and cleaning up the template files for reports