예제 #1
0
파일: CaseObj.php 프로젝트: chinazan/zzcrm
 public function afterCreate($entity, array $data)
 {
     parent::afterCreate($entity, $data);
     if (!empty($data['emailId'])) {
         $email = $this->getEntityManager()->getEntity('Email', $data['emailId']);
         if ($email && !$email->get('parentId')) {
             $email->set(array('parentType' => 'Case', 'parentId' => $entity->id));
             $this->getEntityManager()->saveEntity($email);
         }
     }
 }
예제 #2
0
파일: Contact.php 프로젝트: chinazan/zzcrm
 public function afterCreate($entity, array $data)
 {
     parent::afterCreate($entity, $data);
     if (!empty($data['emailId'])) {
         $email = $this->getEntityManager()->getEntity('Email', $data['emailId']);
         if ($email && !$email->get('parentId')) {
             if ($this->getConfig()->get('b2cMode')) {
                 $email->set(array('parentType' => 'Contact', 'parentId' => $entity->id));
             } else {
                 if ($entity->get('accountId')) {
                     $email->set(array('parentType' => 'Account', 'parentId' => $entity->get('accountId')));
                 }
             }
             $this->getEntityManager()->saveEntity($email);
         }
     }
 }
예제 #3
0
파일: Lead.php 프로젝트: chinazan/zzcrm
 public function afterCreate($entity, array $data)
 {
     parent::afterCreate($entity, $data);
     if (!empty($data['emailId'])) {
         $email = $this->getEntityManager()->getEntity('Email', $data['emailId']);
         if ($email && !$email->get('parentId')) {
             $email->set(array('parentType' => 'Lead', 'parentId' => $entity->id));
             $this->getEntityManager()->saveEntity($email);
         }
     }
     if ($entity->get('campaignId')) {
         $campaign = $this->getEntityManager()->getEntity('Campaign', $entity->get('campaignId'));
         if ($campaign) {
             $log = $this->getEntityManager()->getEntity('CampaignLogRecord');
             $log->set(array('action' => 'Lead Created', 'actionDate' => date('Y-m-d H:i:s'), 'parentType' => 'Lead', 'parentId' => $entity->id, 'campaignId' => $campaign->id));
             $this->getEntityManager()->saveEntity($log);
         }
     }
 }
예제 #4
0
파일: Role.php 프로젝트: chinazan/zzcrm
 public function afterCreate(Entity $entity, array $data)
 {
     parent::afterCreate($entity, $data);
     $this->clearRolesCache();
 }
예제 #5
0
파일: User.php 프로젝트: chinazan/zzcrm
 public function afterCreate(Entity $entity, array $data = array())
 {
     parent::afterCreate($entity, $data);
     // TODO: Change the autogenerated stub
     if (array_key_exists('agentId', $data)) {
         $agentId = $entity->get('agentId');
         $agentEntity = $this->getEntityManager()->getEntity('Agent', $agentId);
         $agentEntity->set(array('userId' => $entity->id));
         $this->getEntityManager()->saveEntity($agentEntity);
     }
 }