I'm looking for a guide regarding the creation of custom reports. It seems there are many options and data structures in the example reports, which I do not fully understand. Is there any documentation to explain how custom reports should be built? I know the flag in the database has to be set and where the report should live, but the rest is trial and error, which often doesn't work for me.
Guide or tutorial for creating custom reports
Collapse
X
-
I've been trying for hours to get this to work to no avail. Espo is reporting that the class can't be found. I cleared the cache, rebuilt the instance, restarted the application, and restarted the server. Nothing has worked.
Here is the error:
Code:[2022-03-20 23:17:13] ERROR: Slim Application Error Type: Error Code: 0 Message: Class 'Espo\Reports\Birthdays' not found ...
Code:+-------------------+---------------------------+-------------+---------------------+------------------------+ | id | name | is_internal | internal_class_name | columns | +-------------------+---------------------------+-------------+---------------------+------------------------+ | 62379f94b681cf62e | Upcoming client birthdays | 1 | Birthdays | ["name","dateOfBirth"] | +-------------------+---------------------------+-------------+---------------------+------------------------+
PHP Code:1 <?php 2 namespace Espo\Custom\Reports; 3 4 use \Espo\ORM\Entity; 5 use \Espo\Core\Exceptions\Error; 6 use \Espo\Core\Exceptions\NotFound; 7 8 class Birthdays extends \Espo\Modules\Advanced\Reports\Base 9 { 10 public function run($where = null, array $params = null) 11 { 12 13 $collection = $this->getEntityManager()->getRepository('Account')->find(); 14 15 return array( 16 'collection' => $collection, 17 'total' => $collection->count 18 ); 19 } 20 }
Here is the file:
Code:(23:37) ubuntu@host:/var/www/crm/custom/Espo/Custom/Reports $ ll total 12 drwxrwxr-x 11 www-data www-data 4096 Mar 20 22:58 .. -rw-r--r-- 1 www-data www-data 565 Mar 20 23:35 Birthdays.php drwxrwxr-x 2 www-data www-data 4096 Mar 20 23:35 .
Last edited by bandtank; 03-20-2022, 11:39 PM. -
Apparently, I did not have the class name and file name set to the correct values at the same time. Note for future readers: the class name in the database, the class name in the file, and the name of the file must match exactly. After setting all three fields to the same value and then clearing the cache through the administration menu, it started to work. I still need help understanding how to manage the report's configuration, but at least it works now.Comment
Comment