bitrix/internal/models/getListFields.go

91 lines
3.0 KiB
Go

package models
import (
"strconv"
"time"
)
type FieldsType string
const (
FieldTypeLead FieldsType = "CRM_LEAD"
FieldTypeCompany FieldsType = "CRM_COMPANY"
FieldTypeContact FieldsType = "CRM_CONTACT"
FieldTypeDeal FieldsType = "CRM_DEAL"
FieldTypeInvoiceOld FieldsType = "CRM_INVOICE"
FieldTypeInvoiceNew FieldsType = "CRM_SMART_INVOICE"
FieldTypeQuote FieldsType = "CRM_QUOTE"
FieldTypeRequisite FieldsType = "CRM_REQUISITE"
)
type FieldsResponse struct {
Result []Fields `json:"result"`
Total int `json:"total"`
}
type Fields struct {
ID string `json:"ID"`
EntityID string `json:"ENTITY_ID"`
FieldName string `json:"FIELD_NAME"`
UserTypeID string `json:"USER_TYPE_ID"`
XMLID string `json:"XML_ID"`
Sort string `json:"SORT"`
Multiple string `json:"MULTIPLE"`
Mandatory string `json:"MANDATORY"`
ShowFilter string `json:"SHOW_FILTER"`
ShowInList string `json:"SHOW_IN_LIST"`
EditInList string `json:"EDIT_IN_LIST"`
IsSearchable string `json:"IS_SEARCHABLE"`
EditFormLabel string `json:"EDIT_FORM_LABEL"`
ListColumnLabel string `json:"LIST_COLUMN_LABEL"`
ListFilterLabel string `json:"LIST_FILTER_LABEL"`
ErrorMessage string `json:"ERROR_MESSAGE"`
HelpMessage string `json:"HELP_MESSAGE"`
}
type IntegerEntityType int
const (
IntegerEntityTypeLead IntegerEntityType = 1 // воронки не поддерживает
IntegerEntityTypeCompany IntegerEntityType = 4
IntegerEntityTypeContact IntegerEntityType = 3
IntegerEntityTypeDeal IntegerEntityType = 2
IntegerEntityTypeInvoiceOld IntegerEntityType = 5 // может вернуть 400
IntegerEntityTypeInvoiceNew IntegerEntityType = 31
IntegerEntityTypeQuote IntegerEntityType = 7 // воронки не поддерживает
IntegerEntityTypeRequisite IntegerEntityType = 8 // может вернуть 400
)
type NameEntityType string
const (
NameEntityTypeLead NameEntityType = "LEAD"
NameEntityTypeCompany NameEntityType = "COMPANY"
NameEntityTypeContact NameEntityType = "CONTACT"
NameEntityTypeDeal NameEntityType = "DEAL"
NameEntityTypeInvoiceOld NameEntityType = "INVOICE"
NameEntityTypeInvoiceNew NameEntityType = "SMART_INVOICE"
NameEntityTypeQuote NameEntityType = "QUOTE"
NameEntityTypeRequisite NameEntityType = "REQUISITE"
)
type AddFields struct {
FieldName string `json:"FIELD_NAME"`
EditFormLabel string `json:"EDIT_FORM_LABEL"`
ListColumnLabel string `json:"LIST_COLUMN_LABEL"`
UserTypeID string `json:"USER_TYPE_ID"` // Тип поля
XMLID string `json:"XML_ID"`
Settings map[string]interface{} `json:"SETTINGS"`
}
func (a *AddFields) GenFieldName() {
currentTime := time.Now().Unix()
currentTimeStr := strconv.FormatInt(currentTime, 10)
a.FieldName = currentTimeStr
a.XMLID = currentTimeStr
}
type AddFieldsResponse struct {
ID int64 `json:"result"`
}