Пример #1
0
 public static function getExistedTypes($entityTypeID, $userID)
 {
     $dbResult = Entity\DuplicateIndexTable::getList(array('select' => array('TYPE_ID'), 'order' => array('TYPE_ID' => 'ASC'), 'group' => array('TYPE_ID'), 'filter' => array('=USER_ID' => $userID, '=ENTITY_TYPE_ID' => $entityTypeID)));
     $result = array();
     while ($fields = $dbResult->fetch()) {
         $result[] = intval($fields['TYPE_ID']);
     }
     return $result;
 }
 public static function checkIndex(array $params)
 {
     $entityTypeID = isset($params['ENTITY_TYPE_ID']) ? intval($params['ENTITY_TYPE_ID']) : \CCrmOwnerType::Undefined;
     if ($entityTypeID !== \CCrmOwnerType::Undefined && $entityTypeID !== \CCrmOwnerType::Lead && $entityTypeID !== \CCrmOwnerType::Contact && $entityTypeID !== \CCrmOwnerType::Company) {
         throw new Main\NotSupportedException("Entity type: '" . \CCrmOwnerType::ResolveName($entityTypeID) . "' is not supported in current context");
     }
     $userID = isset($params['USER_ID']) ? intval($params['USER_ID']) : 0;
     $listParams = array('select' => array('USER_ID', 'TYPE_ID', 'ENTITY_TYPE_ID'), 'order' => array('USER_ID' => 'ASC', 'TYPE_ID' => 'ASC', 'ENTITY_TYPE_ID' => 'ASC'), 'filter' => array('=USER_ID' => $userID, '=ENTITY_TYPE_ID' => $entityTypeID, '=TYPE_ID' => DuplicateIndexType::PERSON), 'limit' => 1);
     $dbResult = Entity\DuplicateIndexTable::getList($listParams);
     return is_array($dbResult->fetch());
 }