now bitrix is strange need test tomorrow

This commit is contained in:
Pavel 2024-10-22 23:59:45 +03:00
parent b0fdafa3b4
commit f4b739015e
2 changed files with 36 additions and 37 deletions

@ -647,7 +647,7 @@ func (m *Methods) CheckFieldRule(ctx context.Context, token string, msg models.K
newFields = append(newFields, model.BitrixField{
BitrixID: fmt.Sprintf("%d", createdID),
EntityID: entity,
FieldName: field.FieldName,
FieldName: "UF_CRM_" + strings.ToUpper(field.FieldName),
EditFromLabel: field.EditFormLabel,
FieldType: field.UserTypeID,
})
@ -667,7 +667,7 @@ func (m *Methods) CheckFieldRule(ctx context.Context, token string, msg models.K
newFields = append(newFields, model.BitrixField{
BitrixID: fmt.Sprintf("%d", createdID),
EntityID: model.FieldTypeContact,
FieldName: contactField.FieldName,
FieldName: "UF_CRM_" + strings.ToUpper(contactField.FieldName),
EditFromLabel: contactField.EditFormLabel,
FieldType: contactField.UserTypeID,
})

@ -47,11 +47,9 @@ func TestGetListFields(t *testing.T) {
// fmt.Println(result)
//}
//
//fieldAnswer := make(map[string]string)
//fieldAnswer["UF_CRM_1727099993"] = "field1"
//fieldAnswer["UF_CRM_1727099994"] = "field2"
//fieldAnswer["UF_CRM_1727099994"] = "field3"
//fieldAnswer["UF_CRM_1726835607006"] = "field4"
fieldAnswer := make(map[string]string)
fieldAnswer["UF_CRM_CSC0TEL6PVUM0J68N5RG"] = "field1"
//
//createContactReq := models.CreateContactReq{
// Fields: models.ContactFields{
@ -95,30 +93,31 @@ func TestGetListFields(t *testing.T) {
// fmt.Println(err)
//}
//
//createDealReq := models.CreatingDealReq{
// Fields: models.CreateDealFields{
// Title: "ТЕСТ ОТ ГОУ АПИ 10/10",
// TypeID: "SALE",
// StageID: "NEW",
// CompanyID: companyResult,
// ContactIDs: []int32{contactResult},
// Opened: "Y",
// AssignedByID: 1,
// CategoryID: 1,
// SourceID: "CALL",
// UtmSource: "UtmSource",
// UtmMedium: "UtmMedium",
// UtmCampaign: "UtmCampaign",
// UtmContent: "UtmContent",
// UtmTerm: "UtmTerm",
// },
//}
createDealReq := models.CreatingDealReq{
Fields: models.CreateDealFields{
Title: "ТЕСТ ОТ ГОУ АПИ 10/10",
TypeID: "SALE",
StageID: "NEW",
CompanyID: 369,
ContactIDs: []int32{211},
Opened: "Y",
AssignedByID: 1,
CategoryID: 1,
SourceID: "CALL",
UtmSource: "UtmSource",
UtmMedium: "UtmMedium",
UtmCampaign: "UtmCampaign",
UtmContent: "UtmContent",
UtmTerm: "UtmTerm",
},
}
//
//reqMap = models.FormattingToMap(&createDealReq, fieldAnswer)
//result, err := b.CreatingDeal(reqMap, "ad5df5660000071b00717f920000000100000783b6e19c671e64c3655e5c7aff197e14", "b24-ld76ub.bitrix24.ru")
//if err != nil {
// fmt.Println(err)
//}
reqMap := models.FormattingToMap(&createDealReq, fieldAnswer)
result, err := b.CreatingDeal(reqMap, "59161867007232200072541200000001000007a3be721d08cbf9f847b807c4eb79a73f", "b24-s5jg6c.bitrix24.ru")
if err != nil {
fmt.Println(err)
}
fmt.Println(result)
//
//for _, tipe := range model.CategoryArr {
// result, err := b.GetListPipelines(tipe, "9d5bf9660000071b00717f9200000001000007b8da5b64a2142c5a0abcfb3e65f89b0c", "b24-ld76ub.bitrix24.ru")
@ -142,13 +141,13 @@ func TestGetListFields(t *testing.T) {
//}
//arr2 := []model.TypeStepsEntityID{model.StatusStepsEntityID, model.DealTypeStepsEntityID, model.DealStageStepsEntityID, model.SourceStepsEntityID, model.ContactTypeStepsEntityID, model.CompanyTypeStepsEntityID, model.EmployeesStepsEntityID, model.IndustryStepsEntityID, model.SmartInvoiceStageStepsEntityID, model.QuoteStatusStepsEntityID, model.HonorificStepsEntityID, model.CallListStepsEntityID, model.SmartDocumentStageStepsEntityID}
//for _, stepType := range arr2 {
result, err := b.GetListSteps("9d5bf9660000071b00717f9200000001000007b8da5b64a2142c5a0abcfb3e65f89b0c", "b24-ld76ub.bitrix24.ru")
if err != nil {
fmt.Println(err)
}
for _, i := range result.Result {
fmt.Println(i.ID)
}
//result, err := b.GetListSteps("9d5bf9660000071b00717f9200000001000007b8da5b64a2142c5a0abcfb3e65f89b0c", "b24-ld76ub.bitrix24.ru")
//if err != nil {
// fmt.Println(err)
//}
//for _, i := range result.Result {
// fmt.Println(i.ID)
//}
//}
//
//"CATEGORY_ID":"1"