Skip to content
This repository has been archived by the owner on Nov 21, 2020. It is now read-only.

Commit

Permalink
fix(customers): clearing customFieldsData when update
Browse files Browse the repository at this point in the history
close #784
  • Loading branch information
batamar committed May 20, 2020
1 parent d6aa4ec commit baa9d91
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/db/models/Customers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -257,8 +257,10 @@ export const loadClass = () => {
// Checking duplicated fields of customer
await Customers.checkDuplication(doc, _id);

// clean custom field values
doc.customFieldsData = await Fields.prepareCustomFieldsData(doc.customFieldsData);
if (doc.customFieldsData) {
// clean custom field values
doc.customFieldsData = await Fields.prepareCustomFieldsData(doc.customFieldsData);
}

if (doc.primaryEmail) {
const oldCustomer = await Customers.getCustomer(_id);
Expand Down

0 comments on commit baa9d91

Please sign in to comment.