CiviCRM Community Forums (archive)

*

News:

Have a question about CiviCRM?
Get it answered quickly at the new
CiviCRM Stack Exchange Q+A site

This forum was archived on 25 November 2017. Learn more.
How to get involved.
What to do if you think you've found a bug.



  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Developer Discussion »
  • APIs and Hooks (Moderator: Donald Lobo) »
  • civix generate:report - how is the report registered?
Pages: [1]

Author Topic: civix generate:report - how is the report registered?  (Read 687 times)

Tony Horrocks

  • I post occasionally
  • **
  • Posts: 110
  • Karma: 7
    • Fabriko Limited
  • CiviCRM version: 4.5.x
  • CMS version: Drupal 7
civix generate:report - how is the report registered?
July 10, 2015, 07:17:30 am
I'm developing an extension with a report and I'm using civix generate:report.

It generates the files. I'm disabling and uninstalling the extension, re-installing it, but the report is not appearing anywhere obvious.

Can anyone shed any light here?

Thanks
Tony Horrocks
Author of the CiviCRM CookBook https://www.packtpub.com/web-development/civicrm-cookbook

totten

  • Administrator
  • Ask me questions
  • *****
  • Posts: 695
  • Karma: 64
Re: civix generate:report - how is the report registered?
July 10, 2015, 01:59:17 pm
Civi's report system is actually broken up into two layers -- ReportTemplates provide code and define overall structure/behavior/layout (e.g. "join data from the contact table, membership table, and contribution table"). ReportInstances provide specific options to feed into the templates (eg "display the first name and last name but skip the middle name, and sort by ID"). However, when speaking informally, we might say "Report" without clarifying whether we mean ReportTemplate or ReportInstance.

The  "civix generate:report" command produces a ReportTemplate. The ReportTemplate is registered using the *.mgd.php file (and it does require a system.flush or reinstall to load). However, to see/use a report, one must also create a ReportInstance. The typical way is to navigate to "Reports =>All Reports => New Report".

(Aside: It should be possible to register a ReportInstance using an *.mgd.php file and the ReportInstance API, but this would imply that the ReportInstance should always be there. But the intention of the whole template/instance split is that admins can add/remove/tweak instances.)

Tony Horrocks

  • I post occasionally
  • **
  • Posts: 110
  • Karma: 7
    • Fabriko Limited
  • CiviCRM version: 4.5.x
  • CMS version: Drupal 7
Re: civix generate:report - how is the report registered?
July 11, 2015, 02:35:05 am
OK I get it.

One thing I'm noticing is that even after a reinstall and system flush, the report does not appear. Hence my original post. I was looking under membership reports where it was supposed to be.

It DOES appear as an option when you click New Member Report though.

It this expected behaviour or a bug?
Tony Horrocks
Author of the CiviCRM CookBook https://www.packtpub.com/web-development/civicrm-cookbook

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Developer Discussion »
  • APIs and Hooks (Moderator: Donald Lobo) »
  • civix generate:report - how is the report registered?

This forum was archived on 2017-11-26.