Jump to content
  • 0

Custom Reports


nereliz

Question

6 answers to this question

Recommended Posts

  • 0
19 minutes ago, Blesta Addons said:

you need to leftjoin the client_groups and select only the clients that has client_groups.company_id = (company_id)

So company_id should be manually looked in company list. It would be better to introduce :company_id tag which when will take company_id from the session to reduce human error factor. As you still have company id to load custom report itself and the SQL could be copied and pasted between different companies easily. I have quite allot add-on companies to look after.

Regards,
Nerijus B.

Link to comment
Share on other sites

  • 0

The custom report system allows you to select any data system-wide, so you can retrieve data for other companies as well if you see fit. Any tags, like one for :company_id, would have to be implemented yourself in the custom report. Even if a :company_id tag were available by default, your custom query would still need to define the appropriate joins in order to filter on it. Because of this, it is still best to define your query and all filters, including company_id, yourself. This also avoids unnecessary coupling between custom reports and current user session information of someone exporting the report. Note as well that reports can be generated via cron, and in the future there will likely be the addition for custom reports to do generated via cron, and in that case there would be no session information available to the report during creation.

Link to comment
Share on other sites

  • 0
4 minutes ago, activa said:

As i know the company_id has nothing to the session it resolved from domain !!!

The idea of a tag or var called company_id is brillant . +1 .

Hi,

Activa you can get company_id in controllers or modules using Configure::get( "Blesta.company_id" ) or there $this->Session->read( "blesta_company_id" ).  So this bit kind of already there, just then you build the SQL report you have to hard code it and do it for each add-on company. I understand you need to add all necessary JOIN statements to be able to use the company id as not all tables have this field. I thought I am missing something I can't relate. Thanks for your responses.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...