Import added headoffice support, tests ok

This commit is contained in:
2022-03-27 23:26:26 +00:00
parent 128a2d3bc0
commit 8f225c82c7

View File

@@ -154,10 +154,10 @@ export default {
// JSON.stringify(dat) // JSON.stringify(dat)
// ); // );
// console.log( console.log(
// "if it was csv it should look like this:", "if it was csv it should look like this:",
// Papa.unparse(dat) Papa.unparse(dat)
// ); );
//upload the data //upload the data
await this.upload(dat); 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 //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 //at back end it will attempt to match up but not create if not existing
switch (atype) { switch (atype) {
case 8: //CUSTOMER case window.$gz.type.Customer:
allowedProps.push( allowedProps.push(
...[ ...[
"Name", "Name",
"Active", "Active",
"Notes", "Notes",
"Wiki", "Wiki",
//"CustomFields",
"Tags", "Tags",
"WebAddress", "WebAddress",
"AlertNotes", "AlertNotes",
@@ -347,6 +346,39 @@ function cleanData(dat, atype) {
] ]
); );
break; 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 //Strip out any records that have fields not on our allowed list