示例#1
0
 protected function checkRemovePossibility()
 {
     parent::checkRemovePossibility();
     $em = $this->em();
     $query = $em->createQuery('SELECT r FROM \\ru\\nazarov\\crm\\entities\\Report r JOIN r.contact c JOIN c.person p WHERE p=:pers');
     $query->setMaxResults(1);
     $query->setParameter('pers', $this->_item->getId());
     if (count($query->getResult()) > 0) {
         throw new \ru\nazarov\crm\exceptions\ErrorException('Cannot remove person: remove at first all reports with this person, then try to remove person again.');
     }
 }
示例#2
0
 protected function checkRemovePossibility()
 {
     parent::checkRemovePossibility();
     $em = $this->em();
     $sq = $em->createQuery('SELECT a FROM \\ru\\nazarov\\crm\\entities\\Application a JOIN a.supplier s WHERE s=:sup');
     $sq->setMaxResults(1);
     $sq->setParameter('sup', $this->_item->getId());
     $cq = $em->createQuery('SELECT a FROM \\ru\\nazarov\\crm\\entities\\Application a JOIN a.client c WHERE c=:cli');
     $cq->setMaxResults(1);
     $cq->setParameter('cli', $this->_item->getId());
     if (count($sq->getResult()) > 0 || count($cq->getResult()) > 0) {
         throw new \ru\nazarov\crm\exceptions\ErrorException('Cannot remove organization: at first remove all requests with organization, then try to remove once again');
     }
 }
示例#3
0
 public function __construct()
 {
     parent::__construct('\\ru\\nazarov\\crm\\entities\\Offer', 'Invalid offer id', '/?action=offers_list');
 }
示例#4
0
 public function __construct()
 {
     parent::__construct('\\ru\\nazarov\\crm\\entities\\Application', 'Invalid request id', '/?action=apps_list');
 }
示例#5
0
 public function __construct()
 {
     parent::__construct('\\ru\\nazarov\\crm\\entities\\Report', 'Invalid report id', '/?action=reports_list');
 }
示例#6
0
 public function __construct()
 {
     parent::__construct('\\ru\\nazarov\\crm\\entities\\StoreItem', 'Invalid store item id', '/?action=store');
 }