예제 #1
0
 protected function GetUserFields($entity_id, $value_id = 0, $LANG = false, $user_id = false)
 {
     $result = $this->cUFM->GetUserFields($entity_id, $value_id, $LANG, $user_id);
     // remove invoice reserved fields
     if ($entity_id === CCrmInvoice::GetUserFieldEntityID()) {
         foreach (CCrmInvoice::GetUserFieldsReserved() as $ufId) {
             if (isset($result[$ufId])) {
                 unset($result[$ufId]);
             }
         }
     }
     return $result;
 }
예제 #2
0
    if (isset($entityFields['FM']) && is_array($entityFields['FM']) && empty($entityFields['FM'])) {
        $entityFields['FM']['PHONE']['n0'] = array('VALUE' => '', 'VALUE_TYPE' => 'WORK');
        $entityFields['FM']['EMAIL']['n0'] = array('VALUE' => '', 'VALUE_TYPE' => 'WORK');
    }
}
if (isset($entityFields['FM'])) {
    $entityContext['MULTI_FIELDS_OPTIONS'] = array('STUB' => GetMessage('CRM_ENTITY_QPV_MULTI_FIELD_NOT_ASSIGNED'), 'ENABLE_SIP' => true, 'SIP_PARAMS' => array('ENTITY_TYPE' => 'CRM_' . $entityTypeName, 'ENTITY_ID' => $entityID));
    foreach ($entityFields['FM'] as $typeID => $multiFields) {
        $entityData[$typeID] = __CrmQuickPanelViewPrepareMultiFields($multiFields, $entityTypeName, $entityID, $typeID);
    }
}
if ($ufEntityID !== '') {
    $arUserFields = $USER_FIELD_MANAGER->GetUserFields($ufEntityID, $entityID, LANGUAGE_ID);
    // remove invoice reserved fields
    if ($ufEntityID === CCrmInvoice::GetUserFieldEntityID()) {
        foreach (CCrmInvoice::GetUserFieldsReserved() as $ufId) {
            if (isset($arUserFields[$ufId])) {
                unset($arUserFields[$ufId]);
            }
        }
    }
    foreach ($arUserFields as $fieldName => &$arUserField) {
        $editable = $enableInstantEdit && isset($arUserField['EDIT_IN_LIST']) && $arUserField['EDIT_IN_LIST'] === 'Y';
        if ($arUserField['MULTIPLE'] === 'Y') {
            continue;
        }
        $userTypeID = $arUserField['USER_TYPE']['USER_TYPE_ID'];
        $value = isset($arUserField['VALUE']) ? $arUserField['VALUE'] : '';
        $caption = isset($formFieldNames[$fieldName]) ? $formFieldNames[$fieldName] : '';
        if ($caption === '') {
            $caption = isset($arUserField['EDIT_FORM_LABEL']) ? $arUserField['EDIT_FORM_LABEL'] : $fieldName;
예제 #3
0
 protected static function prepareUFInfo()
 {
     if (!is_array(self::$arUFId) || count(self::$arUFId) <= 0 || is_array(self::$ufInfo)) {
         return;
     }
     /** @global CUserTypeManager $USER_FIELD_MANAGER */
     global $USER_FIELD_MANAGER;
     $allowedUserTypes = array('string', 'datetime', 'enumeration', 'double', 'integer', 'boolean');
     self::$ufInfo = array();
     self::$ufEnumerations = array();
     foreach (self::$arUFId as $ufId) {
         $arUserFields = $USER_FIELD_MANAGER->GetUserFields($ufId, 0, LANGUAGE_ID);
         // remove invoice reserved fields
         if ($ufId === CCrmInvoice::GetUserFieldEntityID()) {
             foreach (CCrmInvoice::GetUserFieldsReserved() as $id) {
                 if (isset($arUserFields[$id])) {
                     unset($arUserFields[$id]);
                 }
             }
         }
         if (is_array($arUserFields) && count($arUserFields) > 0) {
             foreach ($arUserFields as $field) {
                 if (isset($field['FIELD_NAME']) && substr($field['FIELD_NAME'], 0, 3) === 'UF_' && (!isset($field['MULTIPLE']) || $field['MULTIPLE'] !== 'Y') && isset($field['USER_TYPE_ID']) && in_array($field['USER_TYPE_ID'], $allowedUserTypes, true)) {
                     self::$ufInfo[$ufId][$field['FIELD_NAME']] = $field;
                     if ($field['USER_TYPE_ID'] === 'datetime') {
                         self::$ufInfo[$ufId][$field['FIELD_NAME'] . self::UF_DATETIME_SHORT_POSTFIX] = $field;
                     }
                     if ($field['USER_TYPE_ID'] === 'enumeration' && isset($field['USER_TYPE']) && is_array($field['USER_TYPE']) && isset($field['USER_TYPE']['CLASS_NAME']) && !empty($field['USER_TYPE']['CLASS_NAME']) && is_callable(array($field['USER_TYPE']['CLASS_NAME'], 'GetList'))) {
                         self::$ufEnumerations[$ufId][$field['FIELD_NAME']] = array();
                         $rsEnum = call_user_func_array(array($field['USER_TYPE']['CLASS_NAME'], 'GetList'), array($field));
                         while ($ar = $rsEnum->GetNext()) {
                             self::$ufEnumerations[$ufId][$field['FIELD_NAME']][$ar['ID']] = $ar;
                         }
                         unset($rsEnum, $ar);
                     }
                 }
             }
         }
     }
 }