diff --git a/package-lock.json b/package-lock.json index 1936b34..26cb2bc 100644 --- a/package-lock.json +++ b/package-lock.json @@ -4494,6 +4494,7 @@ "block-stream": { "version": "0.0.9", "bundled": true, + "optional": true, "requires": { "inherits": "~2.0.0" } @@ -4515,7 +4516,8 @@ }, "buffer-shims": { "version": "1.0.0", - "bundled": true + "bundled": true, + "optional": true }, "caseless": { "version": "0.12.0", @@ -4529,7 +4531,8 @@ }, "code-point-at": { "version": "1.1.0", - "bundled": true + "bundled": true, + "optional": true }, "combined-stream": { "version": "1.0.5", @@ -4545,15 +4548,18 @@ }, "console-control-strings": { "version": "1.1.0", - "bundled": true + "bundled": true, + "optional": true }, "core-util-is": { "version": "1.0.2", - "bundled": true + "bundled": true, + "optional": true }, "cryptiles": { "version": "2.0.5", "bundled": true, + "optional": true, "requires": { "boom": "2.x.x" } @@ -4616,7 +4622,8 @@ }, "extsprintf": { "version": "1.0.2", - "bundled": true + "bundled": true, + "optional": true }, "forever-agent": { "version": "0.6.1", @@ -4725,6 +4732,7 @@ "hawk": { "version": "3.1.3", "bundled": true, + "optional": true, "requires": { "boom": "2.x.x", "cryptiles": "2.x.x", @@ -4766,6 +4774,7 @@ "is-fullwidth-code-point": { "version": "1.0.0", "bundled": true, + "optional": true, "requires": { "number-is-nan": "1.0.1" } @@ -4777,7 +4786,8 @@ }, "isarray": { "version": "1.0.0", - "bundled": true + "bundled": true, + "optional": true }, "isstream": { "version": "0.1.2", @@ -4965,7 +4975,8 @@ }, "process-nextick-args": { "version": "1.0.7", - "bundled": true + "bundled": true, + "optional": true }, "punycode": { "version": "1.4.1", @@ -4998,6 +5009,7 @@ "readable-stream": { "version": "2.2.9", "bundled": true, + "optional": true, "requires": { "buffer-shims": "~1.0.0", "core-util-is": "~1.0.0", @@ -5046,7 +5058,8 @@ }, "safe-buffer": { "version": "5.0.1", - "bundled": true + "bundled": true, + "optional": true }, "semver": { "version": "5.3.0", @@ -5066,6 +5079,7 @@ "sntp": { "version": "1.0.9", "bundled": true, + "optional": true, "requires": { "hoek": "2.x.x" } @@ -5096,6 +5110,7 @@ "string-width": { "version": "1.0.2", "bundled": true, + "optional": true, "requires": { "code-point-at": "^1.0.0", "is-fullwidth-code-point": "^1.0.0", @@ -5105,6 +5120,7 @@ "string_decoder": { "version": "1.0.1", "bundled": true, + "optional": true, "requires": { "safe-buffer": "^5.0.1" } @@ -5129,6 +5145,7 @@ "tar": { "version": "2.2.1", "bundled": true, + "optional": true, "requires": { "block-stream": "*", "fstream": "^1.0.2", @@ -5178,7 +5195,8 @@ }, "util-deprecate": { "version": "1.0.2", - "bundled": true + "bundled": true, + "optional": true }, "uuid": { "version": "3.0.1", diff --git a/src/store/PosStore/syncInBackground.js b/src/store/PosStore/syncInBackground.js index 3b5ce9d..bccc6ba 100644 --- a/src/store/PosStore/syncInBackground.js +++ b/src/store/PosStore/syncInBackground.js @@ -78,6 +78,7 @@ export async function itemSync(itemObject, store) { let itemObjectResult = await store.itemStore.find(itemObject.syncObject.id); let categoryId = ""; + if (itemObject.syncObject.category !== "") { let categoryIds = await store.categoryStore.searchLengthName( itemObject.syncObject.category, @@ -107,9 +108,10 @@ export async function itemSync(itemObject, store) { : 0, sku: itemObject.syncObject.sku !== null ? itemObject.syncObject.sku : "", barcode: - itemObject.syncObject.barcode !== null - ? itemObject.syncObject.barcode - : "", + itemObject.syncObject.barcode === null || + itemObject.syncObject.barcode === undefined + ? "" + : itemObject.syncObject.barcode, colorAndShape: JSON.stringify([ { color: @@ -132,7 +134,8 @@ export async function itemSync(itemObject, store) { itemObject.syncObject.favorite !== null ? itemObject.syncObject.favorite : "", - category: categoryId, + category: + categoryId === null || categoryId === undefined ? "" : categoryId, taxes: "[]", dateUpdated: Date.now(), syncStatus: true, @@ -300,8 +303,8 @@ export async function attendantSync(attendantObject, store) { let attendantObjectResult = await store.attendantStore.find( attendantObject.syncObject.id, ); - if (attendantObjectResult) { + attendantObjectResult.edit({ _id: attendantObject.syncObject.id, user_name: