/**
  * @param Site $site
  * @param $limit
  * @param $offset
  * @return array
  */
 public function findBySiteNotSentToLos(Site $site, $limit, $offset)
 {
     $losConnection = $site->getSettings()->getInheritedLos();
     $siteIds = $site->getChildSiteIds();
     array_push($siteIds, $site->getId());
     if (isset($losConnection)) {
         $q = $this->createQueryBuilder('d')->leftJoin('d.loan', 'l')->where('l.site IN (:site_ids)')->andWhere('d.los_id IS NULL')->andWhere('l.los_id IS NOT NULL')->andWhere('l.deleted = 0')->setParameter('site_ids', $siteIds)->setFirstResult($offset)->setMaxResults($limit)->getQuery();
         return $q->getResult();
     } else {
         return;
     }
 }
예제 #2
0
 /**
  * @param Site $site
  */
 protected function setLosSync(Site $site)
 {
     $losConnection = $site->getSettings()->getInheritedLos();
     if (isset($losConnection)) {
         $losProvider = $losConnection->getLosProvider();
         $losClass = $losProvider->getClassName();
         if ($losClass == 'Sudoux\\MortgageBundle\\Model\\Los\\Encompass') {
             $this->losSync = new Encompass($losConnection, $this->twig, $this->container);
         } elseif ($losClass == 'Sudoux\\MortgageBundle\\Model\\Los\\MortgageBuilder') {
             $this->losSync = new MortgageBuilder($losConnection, $this->twig, $this->container);
         } elseif ($losClass == 'Sudoux\\MortgageBundle\\Model\\Los\\Destiny') {
             $this->losSync = new Destiny($losConnection, $this->twig, $this->container);
         } elseif ($losClass == 'Sudoux\\MortgageBundle\\Model\\Los\\Vantage') {
             $this->losSync = new Vantage($losConnection, $this->twig, $this->container);
         } elseif ($losClass == 'Sudoux\\MortgageBundle\\Model\\Los\\LendingQb') {
             $this->losSync = new Vantage($losConnection, $this->twig, $this->container);
         } else {
             throw new \Exception('LOS not found');
         }
         //$this->losSync = new LosSync($this->losConnection, $twig, $em, $this->site);
     }
 }
 /**
  * @param Site $site
  * @param $id
  * @return mixed
  * @throws \Doctrine\ORM\NonUniqueResultException
  */
 public function findOneBySiteAndType(Site $site, $id)
 {
     $siteIds = $site->getParentSiteIds();
     array_push($siteIds, $site->getId());
     $q = $this->createQueryBuilder('o')->where('o.site IN (:site_ids)')->leftJoin('o.branch', 'b')->andWhere('o.deleted = 0')->setParameter('site_ids', $siteIds);
     $siteBranch = $site->getSettings()->getBranch();
     $siteType = $site->getSiteType();
     $siteTypeKey = '';
     if (isset($siteType)) {
         $siteTypeKey = $siteType->getKeyName();
     }
     if (isset($siteBranch) && $siteTypeKey == 'branch') {
         $q->andWhere('o.id = :id AND b.id = :branch_id');
         $q->setParameter('id', $id);
         $q->setParameter('branch_id', $siteBranch->getId());
     } else {
         $q->andWhere('o.id = :id');
         $q->setParameter('id', $id);
     }
     $result = $q->getQuery()->getOneOrNullResult();
     return $result;
 }
예제 #4
0
 /**
  * @param ExecutionContext $context
  */
 public function isLoanOfficerValid(ExecutionContext $context)
 {
     $losConn = $this->site->getSettings()->getInheritedLos();
     if (isset($losConn)) {
         // make sure they enter an los id
         if (empty($this->los_id)) {
             $context->addViolationAtSubPath('los_id', 'This field is required.', array(), null);
         }
     }
 }
예제 #5
0
 /**
  * @param Site $site
  * @param $id
  * @return mixed
  * @throws \Doctrine\ORM\NonUniqueResultException
  */
 public function findOneBySiteAndType(Site $site, $id)
 {
     $siteIds = $site->getParentSiteIds();
     array_push($siteIds, $site->getId());
     $q = $this->createQueryBuilder('b')->where('b.site IN (:site_ids)')->andWhere('b.deleted = 0')->setParameter('site_ids', $siteIds);
     $siteBranch = $site->getSettings()->getBranch();
     if (isset($siteBranch)) {
         //$q->andWhere('b.id = :id OR b.id = :branch_id');
         // @todo - fix security issue from child branch site access to edit other branches
         $q->andWhere('b.id = :id');
         $q->setParameter('id', $id);
         //$q->setParameter('branch_id', $siteBranch->getId());
     } else {
         $q->andWhere('b.id = :id');
         $q->setParameter('id', $id);
     }
     $result = $q->getQuery()->getOneOrNullResult();
     return $result;
 }