The open alternative to Salesforce, designed for AI.
TypeScript crmcrm-systemcustomergood-first-issuegraphqlhacktoberfestjavascriptmarketingmonoreponestjsopen-sourcepostgresqlreactreactjssalestypescriptweb
fix(front): keep additional phones and country code when importing a phone without calling code (#26399)
Belkouche3b584994d88d
diff --git a/packages/twenty-front/src/modules/object-record/spreadsheet-import/utils/__tests__/buildRecordFromImportedStructuredRow.test.ts b/packages/twenty-front/src/modules/object-record/spreadsheet-import/utils/__tests__/buildRecordFromImportedStructuredRow.test.tsindex 66efb47c88e..e42d67b96b5 100644--- a/packages/twenty-front/src/modules/object-record/spreadsheet-import/utils/__tests__/buildRecordFromImportedStructuredRow.test.ts+++ b/packages/twenty-front/src/modules/object-record/spreadsheet-import/utils/__tests__/buildRecordFromImportedStructuredRow.test.ts@@ -457,6 +457,40 @@ describe('buildRecordFromImportedStructuredRow', () => {});});+ it('should keep the other phone sub-fields when the calling code is missing', () => {+ const importedStructuredRow: ImportedStructuredRow = {+ 'Primary Phone Number (phoneField)': '0612345678',+ 'Primary Phone Country Code (phoneField)': 'FR',+ 'Additional Phones (phoneField)':+ '[{"number": "0698765432", "callingCode": "+33", "countryCode": "FR"}]',+ };++ const result = buildRecordFromImportedStructuredRow({+ importedStructuredRow,+ fieldMetadataItems: fields,+ spreadsheetImportFields: [],+ });++ expect(result).toEqual({+ phoneField: {+ primaryPhoneNumber: '+33612345678',+ primaryPhoneCountryCode: 'FR',+ primaryPhoneCallingCode: '+33',+ additionalPhones: [+ {+ number: '0698765432',+ callingCode: '+33',+ countryCode: 'FR',+ },+ ],+ },+ createdBy: {+ source: 'IMPORT',+ context: {},+ },+ });+ });+it('should successfully build a record from imported structured row with relation composite subfield', () => {const importedStructuredRow: ImportedStructuredRow = {'emailField (relationField)': '[email protected]',diff --git a/packages/twenty-front/src/modules/object-record/spreadsheet-import/utils/buildRecordFromImportedStructuredRow.ts b/packages/twenty-front/src/modules/object-record/spreadsheet-import/utils/buildRecordFromImportedStructuredRow.tsindex 59498a64d5a..5331d1ec5d8 100644--- a/packages/twenty-front/src/modules/object-record/spreadsheet-import/utils/buildRecordFromImportedStructuredRow.ts+++ b/packages/twenty-front/src/modules/object-record/spreadsheet-import/utils/buildRecordFromImportedStructuredRow.ts@@ -303,11 +303,13 @@ export const buildRecordFromImportedStructuredRow = ({);recordToBuild[field.name] = {+ ...compositeData,primaryPhoneNumber: parsedNumber,primaryPhoneCallingCode: `+${parsedCountryCallingCode}`,};} catch {recordToBuild[field.name] = {+ ...compositeData,primaryPhoneNumber,primaryPhoneCallingCode:stripSimpleQuotesFromString(