Hello esforim , emillod,
Yes with espocrm all is possible.. and what emillod ask is possible .. but not out-of-box .. so need code :
first create a field for entity :
then services :
then on your pdf .. you can loop activityList
but need code ..of course, this is my solution with my skill ... but for me not complicate for out-of-box code ..
PrintPdfPerPage
PrintPdfAsOne .. somethink like this as button
Regards
Yes with espocrm all is possible.. and what emillod ask is possible .. but not out-of-box .. so need code :
first create a field for entity :
activityList | activityList | Json Array |
PHP Code:
<?php
namespace Espo\Custom\Services;
use \Espo\ORM\Entity as Entity;
class Patient extends \Espo\Core\Templates\Services\Person
{
public function loadAdditionalFields(Entity $entity)
{
parent::loadAdditionalFields($entity);
$sql = "SELECT id, name, 'Call' as entityType, date_start as dateStart, status, description FROM `call` where parent_type='Patient' AND parent_id='" .$entity->id ."' AND deleted='0'
UNION
SELECT id, name, 'Meeting' as entityType, date_start as dateStart, status, description FROM `meeting` where parent_type='Patient' AND parent_id='" .$entity->id ."' AND deleted='0'
UNION
SELECT id, name, 'Email' as entityType, date_sent as dateStart, status, body_plain as description FROM `email` where parent_type='Patient' AND parent_id='" .$entity->id ."' AND deleted='0' AND status NOT IN ('Failed', 'Draft')
ORDER BY dateStart DESC";
$pdo = $this->getEntityManager()->getPDO();
//$GLOBALS['log']->warning( $sql);
$sth = $pdo->prepare($sql);
$sth->execute();
$row = $sth->fetchAll(\PDO::FETCH_ASSOC);
foreach ($row as $i => $v) {
$activityDataList[$i] = (object) $v;
}
$activityList = json_decode(json_encode($activityDataList, true));
$entity->set('activityList',$activityList );
//$GLOBALS['log']->warning( $entity->get('calls' ) );
}
public function loadAdditionalFieldsForPdf(Entity $entity)
{
$this->loadAdditionalFields($entity);
}
}
then on your pdf .. you can loop activityList
but need code ..of course, this is my solution with my skill ... but for me not complicate for out-of-box code ..
PrintPdfPerPage
PrintPdfAsOne .. somethink like this as button
Regards
Comment