...Человеческий поиск в разработке...
- Модуль: crm
- Путь к файлу: ~/bitrix/modules/crm/lib/import/outlookcsvfileimport.php
- Класс: Bitrix\Crm\Import\OutlookCsvFileImport
- Вызов: OutlookCsvFileImport::prepareContact
public function prepareContact(&$data) { $map = $this->headerMap; if($map === null) { throw new Main\SystemException("Invalid operation. HeaderMap is not assigned."); } $result = array(); $this->tryToMapField($this->getFiledAlias('FIRST_NAME'), 'NAME', $data, $result, $map, true); $this->tryToMapField($this->getFiledAlias('MIDDLE_NAME'), 'SECOND_NAME', $data, $result, $map, true); $this->tryToMapField($this->getFiledAlias('LAST_NAME'), 'LAST_NAME', $data, $result, $map, true); $this->tryToMapField($this->getFiledAlias('JOB_TITLE'), 'POST', $data, $result, $map, true); $this->tryToMapField($this->getFiledAlias('COMPANY'), 'COMPANY_TITLE', $data, $result, $map, true); $this->tryToMapField($this->getFiledAlias('NOTES'), 'COMMENTS', $data, $result, $map, true); $emailInfos = $this->getEmails($data); foreach($emailInfos as &$emailInfo) { $valueType = $emailInfo['VALUE_TYPE'] === 'P' ? 'WORK' : 'OTHER'; $this->addMultifieldValue('EMAIL', $valueType, $emailInfo['VALUE'], $result); } unset($emailInfo); $phoneInfos = $this->getPhones($data); foreach($phoneInfos as &$phoneInfo) { $valueType = mb_strtoupper($phoneInfo['VALUE_TYPE']); if($valueType === 'BUSINESS') { $valueType = 'WORK'; } if($valueType !== 'MOBILE' && $valueType !== 'FAX' && $valueType !== 'HOME' && $valueType !== 'HOME' && $valueType !== 'PAGER' && $valueType !== 'OTHER') { $valueType = 'OTHER'; } $this->addMultifieldValue('PHONE', $valueType, $phoneInfo['VALUE'], $result); } unset($phoneInfo); $webPageUrl = ''; if($this->tryToGetValue($this->getFiledAlias('WEB_PAGE'), $data, $webPageUrl, $map, true) && $webPageUrl !== '') { $result['WEB_WORK'] = $webPageUrl; } $addressInfos = $this->getAddresses($data); if(isset($addressInfos['Business'])) { $result['ADDRESS'] = $this->formatAddress($addressInfos['Business']); } elseif(isset($addressInfos['Home'])) { $result['ADDRESS'] = $this->formatAddress($addressInfos['Home']); } elseif(isset($addressInfos['Other'])) { $result['ADDRESS'] = $this->formatAddress($addressInfos['Other']); } return $result; }