Esempio n. 1
0
             $convertCharsetErrorMsg = '';
             $fileHandle = fopen($_SESSION['CRM_IMPORT_FILE'], 'rb');
             $fileContents = fread($fileHandle, filesize($_SESSION['CRM_IMPORT_FILE']));
             fclose($fileHandle);
             //HACK: Remove UTF-8 BOM
             if ($fileEncoding === 'utf-8' && substr($fileContents, 0, 3) === "") {
                 $fileContents = substr($fileContents, 3);
             }
             $fileContents = CharsetConverter::ConvertCharset($fileContents, $fileEncoding, SITE_CHARSET, $convertCharsetErrorMsg);
             $fileHandle = fopen($_SESSION['CRM_IMPORT_FILE'], 'wb');
             fwrite($fileHandle, $fileContents);
             fclose($fileHandle);
         }
     }
     $_SESSION['CRM_IMPORT_DEFAULT_RESPONSIBLE_ID'] = isset($_POST['IMPORT_DEFAULT_RESPONSIBLE_ID']) ? $_POST['IMPORT_DEFAULT_RESPONSIBLE_ID'] : '';
     $_SESSION['CRM_IMPORT_IMPORT_NAME_FORMAT'] = isset($_POST['IMPORT_NAME_FORMAT']) && \Bitrix\Crm\Format\PersonNameFormatter::isDefined($_POST['IMPORT_NAME_FORMAT']) ? intval($_POST['IMPORT_NAME_FORMAT']) : \Bitrix\Crm\Format\PersonNameFormatter::FirstLast;
     if ($_POST['IMPORT_FILE_SEPORATOR'] == 'semicolon') {
         $_SESSION['CRM_IMPORT_FILE_SEPORATOR'] = ';';
     } elseif ($_POST['IMPORT_FILE_SEPORATOR'] == 'comma') {
         $_SESSION['CRM_IMPORT_FILE_SEPORATOR'] = ',';
     } elseif ($_POST['IMPORT_FILE_SEPORATOR'] == 'tab') {
         $_SESSION['CRM_IMPORT_FILE_SEPORATOR'] = "\t";
     } elseif ($_POST['IMPORT_FILE_SEPORATOR'] == 'space') {
         $_SESSION['CRM_IMPORT_FILE_SEPORATOR'] = ' ';
     }
     $error = __CrmImportPrepareFieldBindingTab($arResult, $arRequireFields);
     if ($error !== '') {
         ShowError($error);
     }
 }
 $arResult['STEP'] = 2;