Skip to content

Commit

Permalink
fix(Agile CRM Node): Fix issue with company address not working (#6997)
Browse files Browse the repository at this point in the history
  • Loading branch information
Joffcom authored Aug 23, 2023
1 parent 0e89a65 commit 2f81652
Show file tree
Hide file tree
Showing 2 changed files with 117 additions and 22 deletions.
51 changes: 37 additions & 14 deletions packages/nodes-base/nodes/AgileCrm/AgileCrm.node.ts
Original file line number Diff line number Diff line change
Expand Up @@ -298,12 +298,16 @@ export class AgileCrm implements INodeType {
} as IDataObject);
}

if (additionalFields.address) {
properties.push({
type: 'SYSTEM',
name: 'address',
value: additionalFields.address as string,
} as IDataObject);
if (additionalFields.addressOptions) {
//@ts-ignore
additionalFields.addressOptions.addressProperties.map((property) => {
properties.push({
type: 'SYSTEM',
subtype: property.subtype as string,
name: 'address',
value: property.address as string,
} as IDataObject);
});
}

if (additionalFields.phone) {
Expand All @@ -313,6 +317,14 @@ export class AgileCrm implements INodeType {
value: additionalFields.phone as string,
} as IDataObject);
}

if (additionalFields.name) {
properties.push({
type: 'SYSTEM',
name: 'name',
value: additionalFields.name as string,
} as IDataObject);
}
}

if (additionalFields.websiteOptions) {
Expand All @@ -321,7 +333,7 @@ export class AgileCrm implements INodeType {
properties.push({
type: 'SYSTEM',
subtype: property.subtype as string,
name: 'webiste',
name: 'website',
value: property.url as string,
} as IDataObject);
});
Expand Down Expand Up @@ -450,12 +462,16 @@ export class AgileCrm implements INodeType {
} as IDataObject);
}

if (additionalFields.address) {
properties.push({
type: 'SYSTEM',
name: 'address',
value: additionalFields.address as string,
} as IDataObject);
if (additionalFields.addressOptions) {
//@ts-ignore
additionalFields.addressOptions.addressProperties.map((property) => {
properties.push({
type: 'SYSTEM',
subtype: property.subtype as string,
name: 'address',
value: property.address as string,
} as IDataObject);
});
}

if (additionalFields.phone) {
Expand All @@ -473,11 +489,18 @@ export class AgileCrm implements INodeType {
properties.push({
type: 'SYSTEM',
subtype: property.subtype as string,
name: 'webiste',
name: 'website',
value: property.url as string,
} as IDataObject);
});
}
if (additionalFields.name) {
properties.push({
type: 'SYSTEM',
name: 'name',
value: additionalFields.name as string,
} as IDataObject);
}
if (additionalFields.customProperties) {
//@ts-ignore
additionalFields.customProperties.customProperty.map((property) => {
Expand Down
88 changes: 80 additions & 8 deletions packages/nodes-base/nodes/AgileCrm/CompanyDescription.ts
Original file line number Diff line number Diff line change
Expand Up @@ -379,11 +379,47 @@ export const companyFields: INodeProperties[] = [
options: [
{
displayName: 'Address',
name: 'email',
type: 'string',
placeholder: '[email protected]',
default: '',
name: 'addressOptions',
type: 'fixedCollection',
default: {},
description: 'Company address',
typeOptions: {
multipleValues: true,
},
options: [
{
displayName: 'Address Properties',
name: 'addressProperties',
values: [
{
displayName: 'Type',
name: 'subtype',
type: 'options',
required: true,
default: '',
description: 'Type of address',
options: [
{
name: 'Postal',
value: 'postal',
},
{
name: 'Office',
value: 'office',
},
],
},
{
displayName: 'Address',
name: 'address',
type: 'string',
required: true,
default: '',
description: 'Full address',
},
],
},
],
},
{
displayName: 'Email',
Expand Down Expand Up @@ -655,11 +691,47 @@ export const companyFields: INodeProperties[] = [
options: [
{
displayName: 'Address',
name: 'email',
type: 'string',
placeholder: '[email protected]',
default: '',
name: 'addressOptions',
type: 'fixedCollection',
default: {},
description: 'Company address',
typeOptions: {
multipleValues: true,
},
options: [
{
displayName: 'Address Properties',
name: 'addressProperties',
values: [
{
displayName: 'Type',
name: 'subtype',
type: 'options',
required: true,
default: '',
description: 'Type of address',
options: [
{
name: 'Postal',
value: 'postal',
},
{
name: 'Office',
value: 'office',
},
],
},
{
displayName: 'Address',
name: 'address',
type: 'string',
required: true,
default: '',
description: 'Full address',
},
],
},
],
},
{
displayName: 'Email',
Expand Down

0 comments on commit 2f81652

Please sign in to comment.