bitrix/internal/models/getListFields.go

87 lines
2.9 KiB
Go
Raw Normal View History

2024-09-20 14:41:33 +00:00
package models
2024-09-23 09:31:38 +00:00
import (
"strconv"
"time"
)
2024-09-20 14:41:33 +00:00
type FieldsType string
const (
2024-09-22 09:30:02 +00:00
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"
2024-09-20 14:41:33 +00:00
)
2024-09-22 08:50:55 +00:00
type FieldsResponse struct {
Result []Fields `json:"result"`
Total int `json:"total"`
2024-09-20 14:41:33 +00:00
}
2024-09-22 08:50:55 +00:00
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"`
2024-09-20 14:41:33 +00:00
}
2024-09-22 09:30:02 +00:00
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"
)
2024-09-23 09:31:38 +00:00
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
}