Exemplo n.º 1
0
 public function loadAdditionalFields($entity)
 {
     parent::loadAdditionalFields($entity);
     $sentCount = $this->getEntityManager()->getRepository('CampaignLogRecord')->where(array('campaignId' => $entity->id, 'action' => 'Sent'))->count();
     $entity->set('sentCount', $sentCount);
     $openedCount = $this->getEntityManager()->getRepository('CampaignLogRecord')->where(array('campaignId' => $entity->id, 'action' => 'Opened'))->count();
     $entity->set('openedCount', $openedCount);
     $clickedCount = $this->getEntityManager()->getRepository('CampaignLogRecord')->where(array('campaignId' => $entity->id, 'action' => 'Clicked'))->count();
     $entity->set('clickedCount', $clickedCount);
     $optedOutCount = $this->getEntityManager()->getRepository('CampaignLogRecord')->where(array('campaignId' => $entity->id, 'action' => 'Opted Out'))->count();
     $entity->set('optedOutCount', $optedOutCount);
     $bouncedCount = $this->getEntityManager()->getRepository('CampaignLogRecord')->where(array('campaignId' => $entity->id, 'action' => 'Bounced'))->count();
     $entity->set('bouncedCount', $bouncedCount);
     $leadCreatedCount = $this->getEntityManager()->getRepository('Lead')->where(array('campaignId' => $entity->id))->count();
     $entity->set('leadCreatedCount', $leadCreatedCount);
     $entity->set('revenueCurrency', $this->getConfig()->get('defaultCurrency'));
     $params = array('select' => array('SUM:amountConverted'), 'whereClause' => array('status' => 'Closed Won', 'campaignId' => $entity->id), 'groupBy' => array('opportunity.campaignId'));
     $this->getEntityManager()->getRepository('Opportunity')->handleSelectParams($params);
     $sql = $this->getEntityManager()->getQuery()->createSelectQuery('Opportunity', $params);
     $pdo = $this->getEntityManager()->getPDO();
     $sth = $pdo->prepare($sql);
     $sth->execute();
     if ($row = $sth->fetch(\PDO::FETCH_ASSOC)) {
         $revenue = floatval($row['SUM:amountConverted']);
         if ($revenue > 0) {
             $entity->set('revenue', $revenue);
         }
     }
 }
Exemplo n.º 2
0
 public function loadAdditionalFields(Entity $entity)
 {
     parent::loadAdditionalFields($entity);
     $importedCount = $this->getRepository()->countRelated($entity, 'imported');
     $duplicateCount = $this->getRepository()->countRelated($entity, 'duplicates');
     $updatedCount = $this->getRepository()->countRelated($entity, 'updated');
     $entity->set(array('importedCount' => $importedCount, 'duplicateCount' => $duplicateCount, 'updatedCount' => $updatedCount));
 }
Exemplo n.º 3
0
 public function loadAdditionalFields(Entity $entity)
 {
     parent::loadAdditionalFields($entity);
     $this->loadRemindersField($entity);
 }
Exemplo n.º 4
0
 public function loadAdditionalFieldsForList(Entity $entity)
 {
     parent::loadAdditionalFields($entity);
     $this->loadEntryCountField($entity);
 }
Exemplo n.º 5
0
 public function loadAdditionalFields(Entity $entity)
 {
     parent::loadAdditionalFields($entity);
     $this->loadFromField($entity);
     $this->loadToField($entity);
     $this->loadCcField($entity);
     $this->loadBccField($entity);
     $this->loadNameHash($entity);
     $this->loadUserColumnFields($entity);
 }