From 8f225c82c7d54f1b3e069d915eb7550fbf3a52be Mon Sep 17 00:00:00 2001 From: John Cardinal Date: Sun, 27 Mar 2022 23:26:26 +0000 Subject: [PATCH] Import added headoffice support, tests ok --- ayanova/src/views/adm-import.vue | 44 +++++++++++++++++++++++++++----- 1 file changed, 38 insertions(+), 6 deletions(-) diff --git a/ayanova/src/views/adm-import.vue b/ayanova/src/views/adm-import.vue index 428c624c..7c136e63 100644 --- a/ayanova/src/views/adm-import.vue +++ b/ayanova/src/views/adm-import.vue @@ -154,10 +154,10 @@ export default { // JSON.stringify(dat) // ); - // console.log( - // "if it was csv it should look like this:", - // Papa.unparse(dat) - // ); + console.log( + "if it was csv it should look like this:", + Papa.unparse(dat) + ); //upload the data await this.upload(dat); @@ -310,14 +310,13 @@ function cleanData(dat, atype) { //Note: convention here is any ID field that is linked object we want to support gets renamed here to replace *id with *viz if viz not already present //at back end it will attempt to match up but not create if not existing switch (atype) { - case 8: //CUSTOMER + case window.$gz.type.Customer: allowedProps.push( ...[ "Name", "Active", "Notes", "Wiki", - //"CustomFields", "Tags", "WebAddress", "AlertNotes", @@ -347,6 +346,39 @@ function cleanData(dat, atype) { ] ); break; + case window.$gz.type.HeadOffice: + allowedProps.push( + ...[ + "Name", + "Active", + "Notes", + "Wiki", + "Tags", + "WebAddress", + "TechNotes", + "AccountNumber", + "ContractViz", + "ContractExpires", + "Phone1", + "Phone2", + "Phone3", + "Phone4", + "Phone5", + "EmailAddress", + "PostAddress", + "PostCity", + "PostRegion", + "PostCountry", + "PostCode", + "Address", + "City", + "Region", + "Country", + "Latitude", + "Longitude" + ] + ); + break; } //Strip out any records that have fields not on our allowed list