repzo-sap-absjo 1.0.39 → 1.0.41

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -20,7 +20,9 @@ export const sync_price_list = async (commandEvent) => {
20
20
  _r,
21
21
  _s,
22
22
  _t,
23
- _u;
23
+ _u,
24
+ _v,
25
+ _w;
24
26
  const repzo = new Repzo(
25
27
  (_a = commandEvent.app.formData) === null || _a === void 0
26
28
  ? void 0
@@ -56,7 +58,12 @@ export const sync_price_list = async (commandEvent) => {
56
58
  // Get SAP Price Lists
57
59
  const sap_price_lists = await get_sap_price_list(
58
60
  commandEvent.app.formData.sapHostUrl,
59
- { updateAt: commandEvent.app.options_formData[bench_time_key] }
61
+ {
62
+ updateAt:
63
+ (_b = commandEvent.app.options_formData) === null || _b === void 0
64
+ ? void 0
65
+ : _b[bench_time_key],
66
+ }
60
67
  );
61
68
  result.sap_total =
62
69
  sap_price_lists === null || sap_price_lists === void 0
@@ -65,7 +72,9 @@ export const sync_price_list = async (commandEvent) => {
65
72
  await commandLog
66
73
  .addDetail(
67
74
  `${result.sap_total} Price Lists in SAP changed since ${
68
- commandEvent.app.options_formData[bench_time_key] || "ever"
75
+ ((_c = commandEvent.app.options_formData) === null || _c === void 0
76
+ ? void 0
77
+ : _c[bench_time_key]) || "ever"
69
78
  }`
70
79
  )
71
80
  .commit();
@@ -82,21 +91,21 @@ export const sync_price_list = async (commandEvent) => {
82
91
  // Get Repzo Price Lists
83
92
  const repzo_price_lists = await repzo.priceList.find({ per_page: 50000 });
84
93
  result.repzo_total =
85
- (_b =
94
+ (_d =
86
95
  repzo_price_lists === null || repzo_price_lists === void 0
87
96
  ? void 0
88
- : repzo_price_lists.data) === null || _b === void 0
97
+ : repzo_price_lists.data) === null || _d === void 0
89
98
  ? void 0
90
- : _b.length;
99
+ : _d.length;
91
100
  await commandLog
92
101
  .addDetail(
93
102
  `${
94
- (_c =
103
+ (_e =
95
104
  repzo_price_lists === null || repzo_price_lists === void 0
96
105
  ? void 0
97
- : repzo_price_lists.data) === null || _c === void 0
106
+ : repzo_price_lists.data) === null || _e === void 0
98
107
  ? void 0
99
- : _c.length
108
+ : _e.length
100
109
  } Price Lists in Repzo`
101
110
  )
102
111
  .commit();
@@ -107,21 +116,21 @@ export const sync_price_list = async (commandEvent) => {
107
116
  per_page: 50000,
108
117
  });
109
118
  result.repzo_products_total =
110
- (_d =
119
+ (_f =
111
120
  repzo_products === null || repzo_products === void 0
112
121
  ? void 0
113
- : repzo_products.data) === null || _d === void 0
122
+ : repzo_products.data) === null || _f === void 0
114
123
  ? void 0
115
- : _d.length;
124
+ : _f.length;
116
125
  await commandLog
117
126
  .addDetail(
118
127
  `${
119
- (_e =
128
+ (_g =
120
129
  repzo_products === null || repzo_products === void 0
121
130
  ? void 0
122
- : repzo_products.data) === null || _e === void 0
131
+ : repzo_products.data) === null || _g === void 0
123
132
  ? void 0
124
- : _e.length
133
+ : _g.length
125
134
  } Products in Repzo`
126
135
  )
127
136
  .commit();
@@ -131,31 +140,31 @@ export const sync_price_list = async (commandEvent) => {
131
140
  per_page: 50000,
132
141
  });
133
142
  result.repzo_total =
134
- (_f =
143
+ (_h =
135
144
  repzo_UoMs === null || repzo_UoMs === void 0
136
145
  ? void 0
137
- : repzo_UoMs.data) === null || _f === void 0
146
+ : repzo_UoMs.data) === null || _h === void 0
138
147
  ? void 0
139
- : _f.length;
148
+ : _h.length;
140
149
  await commandLog
141
150
  .addDetail(
142
151
  `${
143
- (_g =
152
+ (_j =
144
153
  repzo_UoMs === null || repzo_UoMs === void 0
145
154
  ? void 0
146
- : repzo_UoMs.data) === null || _g === void 0
155
+ : repzo_UoMs.data) === null || _j === void 0
147
156
  ? void 0
148
- : _g.length
157
+ : _j.length
149
158
  } Measure Units in Repzo`
150
159
  )
151
160
  .commit();
152
161
  if (
153
- !((_h =
162
+ !((_k =
154
163
  repzo_UoMs === null || repzo_UoMs === void 0
155
164
  ? void 0
156
- : repzo_UoMs.data) === null || _h === void 0
165
+ : repzo_UoMs.data) === null || _k === void 0
157
166
  ? void 0
158
- : _h.length)
167
+ : _k.length)
159
168
  )
160
169
  throw "MeasureUnits in Repzo was not found";
161
170
  const sap_unique_UoMs = {};
@@ -197,12 +206,12 @@ export const sync_price_list = async (commandEvent) => {
197
206
  integration_meta: { id: `${nameSpace}_${price_list_name}` },
198
207
  };
199
208
  const repzo_price_list =
200
- (_j =
209
+ (_l =
201
210
  repzo_price_lists === null || repzo_price_lists === void 0
202
211
  ? void 0
203
- : repzo_price_lists.data) === null || _j === void 0
212
+ : repzo_price_lists.data) === null || _l === void 0
204
213
  ? void 0
205
- : _j.find((pl) => {
214
+ : _l.find((pl) => {
206
215
  var _a, _b;
207
216
  return (
208
217
  ((_a =
@@ -274,32 +283,32 @@ export const sync_price_list = async (commandEvent) => {
274
283
  await commandLog
275
284
  .addDetail(
276
285
  `${
277
- (_k =
286
+ (_m =
278
287
  repzo_all_priceLists === null || repzo_all_priceLists === void 0
279
288
  ? void 0
280
- : repzo_all_priceLists.data) === null || _k === void 0
289
+ : repzo_all_priceLists.data) === null || _m === void 0
281
290
  ? void 0
282
- : _k.length
291
+ : _m.length
283
292
  } Price Lists in Repzo`
284
293
  )
285
294
  .commit();
286
295
  if (
287
- !((_l =
296
+ !((_o =
288
297
  repzo_all_priceLists === null || repzo_all_priceLists === void 0
289
298
  ? void 0
290
- : repzo_all_priceLists.data) === null || _l === void 0
299
+ : repzo_all_priceLists.data) === null || _o === void 0
291
300
  ? void 0
292
- : _l.length)
301
+ : _o.length)
293
302
  )
294
303
  throw `No Price Lists was found On Repzo`;
295
304
  for (let priceList_name in priceLists_withItems) {
296
305
  const repzo_PriceList =
297
- (_m =
306
+ (_p =
298
307
  repzo_all_priceLists === null || repzo_all_priceLists === void 0
299
308
  ? void 0
300
- : repzo_all_priceLists.data) === null || _m === void 0
309
+ : repzo_all_priceLists.data) === null || _p === void 0
301
310
  ? void 0
302
- : _m.find((pl) => {
311
+ : _p.find((pl) => {
303
312
  var _a;
304
313
  return (
305
314
  ((_a = pl.integration_meta) === null || _a === void 0
@@ -319,9 +328,9 @@ export const sync_price_list = async (commandEvent) => {
319
328
  ),
320
329
  });
321
330
  result.PL_items.failed +=
322
- ((_o = priceLists_withItems[priceList_name]) === null || _o === void 0
331
+ ((_q = priceLists_withItems[priceList_name]) === null || _q === void 0
323
332
  ? void 0
324
- : _o.length) || 0;
333
+ : _q.length) || 0;
325
334
  continue;
326
335
  }
327
336
  const repzo_price_list_items = await repzo.priceListItem.find({
@@ -390,12 +399,12 @@ export const sync_price_list = async (commandEvent) => {
390
399
  continue;
391
400
  }
392
401
  const repzo_product =
393
- (_p =
402
+ (_r =
394
403
  repzo_products === null || repzo_products === void 0
395
404
  ? void 0
396
- : repzo_products.data) === null || _p === void 0
405
+ : repzo_products.data) === null || _r === void 0
397
406
  ? void 0
398
- : _p.find((product) => {
407
+ : _r.find((product) => {
399
408
  var _a;
400
409
  return (
401
410
  ((_a =
@@ -418,12 +427,12 @@ export const sync_price_list = async (commandEvent) => {
418
427
  continue;
419
428
  }
420
429
  const repzo_product_uoms =
421
- (_q =
430
+ (_s =
422
431
  repzo_UoMs === null || repzo_UoMs === void 0
423
432
  ? void 0
424
- : repzo_UoMs.data) === null || _q === void 0
433
+ : repzo_UoMs.data) === null || _s === void 0
425
434
  ? void 0
426
- : _q.filter((uom) => {
435
+ : _s.filter((uom) => {
427
436
  var _a, _b, _c, _d;
428
437
  return (
429
438
  ((_a = uom === null || uom === void 0 ? void 0 : uom._id) ===
@@ -458,12 +467,12 @@ export const sync_price_list = async (commandEvent) => {
458
467
  // doc: priceLists_withItems[priceList_name],
459
468
  error_message: set_error(
460
469
  `Price List: ${item.PLDID} of MeasureUnit with _id: ${
461
- (_r =
470
+ (_t =
462
471
  repzo_product === null || repzo_product === void 0
463
472
  ? void 0
464
- : repzo_product.sv_measureUnit) === null || _r === void 0
473
+ : repzo_product.sv_measureUnit) === null || _t === void 0
465
474
  ? void 0
466
- : _r.toString()
475
+ : _t.toString()
467
476
  } was not found or disabled`
468
477
  ),
469
478
  });
@@ -480,12 +489,12 @@ export const sync_price_list = async (commandEvent) => {
480
489
  (item.PLITEMPRICEVALUE * 1000) / repzo_product_uom.factor
481
490
  );
482
491
  const variant =
483
- (_s =
492
+ (_u =
484
493
  repzo_product === null || repzo_product === void 0
485
494
  ? void 0
486
- : repzo_product.variants) === null || _s === void 0
495
+ : repzo_product.variants) === null || _u === void 0
487
496
  ? void 0
488
- : _s.find((variant) => {
497
+ : _u.find((variant) => {
489
498
  var _a;
490
499
  return (
491
500
  ((_a =
@@ -522,12 +531,12 @@ export const sync_price_list = async (commandEvent) => {
522
531
  };
523
532
  // console.log(data);
524
533
  const is_found_in_repzo_db =
525
- (_t =
534
+ (_v =
526
535
  repzo_price_list_items === null || repzo_price_list_items === void 0
527
536
  ? void 0
528
- : repzo_price_list_items.data) === null || _t === void 0
537
+ : repzo_price_list_items.data) === null || _v === void 0
529
538
  ? void 0
530
- : _t.find((item) => {
539
+ : _v.find((item) => {
531
540
  var _a, _b;
532
541
  return (
533
542
  ((_a =
@@ -610,10 +619,10 @@ export const sync_price_list = async (commandEvent) => {
610
619
  } catch (e) {
611
620
  //@ts-ignore
612
621
  console.error(
613
- ((_u = e === null || e === void 0 ? void 0 : e.response) === null ||
614
- _u === void 0
622
+ ((_w = e === null || e === void 0 ? void 0 : e.response) === null ||
623
+ _w === void 0
615
624
  ? void 0
616
- : _u.data) || e
625
+ : _w.data) || e
617
626
  );
618
627
  await commandLog.setStatus("fail", e).commit();
619
628
  throw e;
@@ -24,7 +24,9 @@ export const sync_product = async (commandEvent) => {
24
24
  _r,
25
25
  _s,
26
26
  _t,
27
- _u;
27
+ _u,
28
+ _v,
29
+ _w;
28
30
  const repzo = new Repzo(
29
31
  (_a = commandEvent.app.formData) === null || _a === void 0
30
32
  ? void 0
@@ -58,7 +60,12 @@ export const sync_product = async (commandEvent) => {
58
60
  const failed_docs_report = [];
59
61
  const sap_products = await get_sap_products(
60
62
  commandEvent.app.formData.sapHostUrl,
61
- { updateAt: commandEvent.app.options_formData[bench_time_key] }
63
+ {
64
+ updateAt:
65
+ (_b = commandEvent.app.options_formData) === null || _b === void 0
66
+ ? void 0
67
+ : _b[bench_time_key],
68
+ }
62
69
  );
63
70
  result.sap_total =
64
71
  sap_products === null || sap_products === void 0
@@ -67,7 +74,9 @@ export const sync_product = async (commandEvent) => {
67
74
  await commandLog
68
75
  .addDetail(
69
76
  `${result.sap_total} Items in SAP changed since ${
70
- commandEvent.app.options_formData[bench_time_key] || "ever"
77
+ ((_c = commandEvent.app.options_formData) === null || _c === void 0
78
+ ? void 0
79
+ : _c[bench_time_key]) || "ever"
71
80
  }`
72
81
  )
73
82
  .commit();
@@ -77,21 +86,21 @@ export const sync_product = async (commandEvent) => {
77
86
  withVariants: true,
78
87
  });
79
88
  result.repzo_total =
80
- (_b =
89
+ (_d =
81
90
  repzo_products === null || repzo_products === void 0
82
91
  ? void 0
83
- : repzo_products.data) === null || _b === void 0
92
+ : repzo_products.data) === null || _d === void 0
84
93
  ? void 0
85
- : _b.length;
94
+ : _d.length;
86
95
  await commandLog
87
96
  .addDetail(
88
97
  `${
89
- (_c =
98
+ (_e =
90
99
  repzo_products === null || repzo_products === void 0
91
100
  ? void 0
92
- : repzo_products.data) === null || _c === void 0
101
+ : repzo_products.data) === null || _e === void 0
93
102
  ? void 0
94
- : _c.length
103
+ : _e.length
95
104
  } Products in Repzo`
96
105
  )
97
106
  .commit();
@@ -101,12 +110,12 @@ export const sync_product = async (commandEvent) => {
101
110
  disabled: false,
102
111
  });
103
112
  result.repzo_total_taxes =
104
- (_d =
113
+ (_f =
105
114
  repzo_taxes === null || repzo_taxes === void 0
106
115
  ? void 0
107
- : repzo_taxes.data) === null || _d === void 0
116
+ : repzo_taxes.data) === null || _f === void 0
108
117
  ? void 0
109
- : _d.length;
118
+ : _f.length;
110
119
  await commandLog
111
120
  .addDetail(`${result.repzo_total_taxes} Taxes in Repzo`)
112
121
  .commit();
@@ -116,12 +125,12 @@ export const sync_product = async (commandEvent) => {
116
125
  disabled: false,
117
126
  });
118
127
  result.repzo_total_categories =
119
- (_e =
128
+ (_g =
120
129
  repzo_categories === null || repzo_categories === void 0
121
130
  ? void 0
122
- : repzo_categories.data) === null || _e === void 0
131
+ : repzo_categories.data) === null || _g === void 0
123
132
  ? void 0
124
- : _e.length;
133
+ : _g.length;
125
134
  await commandLog
126
135
  .addDetail(`${result.repzo_total_categories} Product Categories in Repzo`)
127
136
  .commit();
@@ -131,12 +140,12 @@ export const sync_product = async (commandEvent) => {
131
140
  disabled: false,
132
141
  });
133
142
  result.repzo_total_brands =
134
- (_f =
143
+ (_h =
135
144
  repzo_brands === null || repzo_brands === void 0
136
145
  ? void 0
137
- : repzo_brands.data) === null || _f === void 0
146
+ : repzo_brands.data) === null || _h === void 0
138
147
  ? void 0
139
- : _f.length;
148
+ : _h.length;
140
149
  await commandLog
141
150
  .addDetail(`${result.repzo_total_brands} Brands in Repzo`)
142
151
  .commit();
@@ -163,12 +172,12 @@ export const sync_product = async (commandEvent) => {
163
172
  });
164
173
  // Tax
165
174
  const tax =
166
- (_g =
175
+ (_j =
167
176
  repzo_taxes === null || repzo_taxes === void 0
168
177
  ? void 0
169
- : repzo_taxes.data) === null || _g === void 0
178
+ : repzo_taxes.data) === null || _j === void 0
170
179
  ? void 0
171
- : _g.find((tax) => {
180
+ : _j.find((tax) => {
172
181
  var _a;
173
182
  return (
174
183
  ((_a =
@@ -184,18 +193,18 @@ export const sync_product = async (commandEvent) => {
184
193
  continue;
185
194
  }
186
195
  const product_tax =
187
- (_h = tax === null || tax === void 0 ? void 0 : tax._id) === null ||
188
- _h === void 0
196
+ (_k = tax === null || tax === void 0 ? void 0 : tax._id) === null ||
197
+ _k === void 0
189
198
  ? void 0
190
- : _h.toString();
199
+ : _k.toString();
191
200
  // Category
192
201
  const category =
193
- (_j =
202
+ (_l =
194
203
  repzo_categories === null || repzo_categories === void 0
195
204
  ? void 0
196
- : repzo_categories.data) === null || _j === void 0
205
+ : repzo_categories.data) === null || _l === void 0
197
206
  ? void 0
198
- : _j.find((category) => {
207
+ : _l.find((category) => {
199
208
  var _a;
200
209
  return (
201
210
  ((_a =
@@ -211,20 +220,20 @@ export const sync_product = async (commandEvent) => {
211
220
  continue;
212
221
  }
213
222
  const product_category =
214
- (_k =
223
+ (_m =
215
224
  category === null || category === void 0
216
225
  ? void 0
217
- : category._id) === null || _k === void 0
226
+ : category._id) === null || _m === void 0
218
227
  ? void 0
219
- : _k.toString();
228
+ : _m.toString();
220
229
  // Brand
221
230
  const brand =
222
- (_l =
231
+ (_o =
223
232
  repzo_brands === null || repzo_brands === void 0
224
233
  ? void 0
225
- : repzo_brands.data) === null || _l === void 0
234
+ : repzo_brands.data) === null || _o === void 0
226
235
  ? void 0
227
- : _l.find((brand) => {
236
+ : _o.find((brand) => {
228
237
  var _a;
229
238
  return (
230
239
  ((_a =
@@ -236,10 +245,10 @@ export const sync_product = async (commandEvent) => {
236
245
  );
237
246
  });
238
247
  const product_brand =
239
- (_m = brand === null || brand === void 0 ? void 0 : brand._id) ===
240
- null || _m === void 0
248
+ (_p = brand === null || brand === void 0 ? void 0 : brand._id) ===
249
+ null || _p === void 0
241
250
  ? void 0
242
- : _m.toString();
251
+ : _p.toString();
243
252
  // measureUnit family
244
253
  const family = await repzo.measureunitFamily.find({
245
254
  "integration_meta.id": `${nameSpace}_${sap_product.ITEMCODE}`,
@@ -247,22 +256,22 @@ export const sync_product = async (commandEvent) => {
247
256
  });
248
257
  if (
249
258
  !(family === null || family === void 0 ? void 0 : family.data) ||
250
- ((_o =
259
+ ((_q =
251
260
  family === null || family === void 0 ? void 0 : family.data) ===
252
- null || _o === void 0
261
+ null || _q === void 0
253
262
  ? void 0
254
- : _o.length) != 1
263
+ : _q.length) != 1
255
264
  ) {
256
265
  throw `Family not found => ITEMCODE: ${sap_product.ITEMCODE}`;
257
266
  continue;
258
267
  }
259
268
  const product_family =
260
- (_q =
261
- (_p = family.data[0]) === null || _p === void 0
269
+ (_s =
270
+ (_r = family.data[0]) === null || _r === void 0
262
271
  ? void 0
263
- : _p._id) === null || _q === void 0
272
+ : _r._id) === null || _s === void 0
264
273
  ? void 0
265
- : _q.toString();
274
+ : _s.toString();
266
275
  // measureUnit
267
276
  const measureUnit = await repzo.measureunit.find({
268
277
  "integration_meta.UOMGROUPENTRY": sap_product.UOMGROUPENTRY,
@@ -276,9 +285,9 @@ export const sync_product = async (commandEvent) => {
276
285
  continue;
277
286
  }
278
287
  const product_measureUnit =
279
- (_r = measureUnit.data[0]._id) === null || _r === void 0
288
+ (_t = measureUnit.data[0]._id) === null || _t === void 0
280
289
  ? void 0
281
- : _r.toString();
290
+ : _t.toString();
282
291
  const body = {
283
292
  active: true,
284
293
  name: sap_product.ITEMDESC,
@@ -329,17 +338,17 @@ export const sync_product = async (commandEvent) => {
329
338
  continue;
330
339
  }
331
340
  if (
332
- (_s =
341
+ (_u =
333
342
  repzo_product === null || repzo_product === void 0
334
343
  ? void 0
335
- : repzo_product.variants) === null || _s === void 0
344
+ : repzo_product.variants) === null || _u === void 0
336
345
  ? void 0
337
- : _s.length
346
+ : _u.length
338
347
  ) {
339
- (_t = body === null || body === void 0 ? void 0 : body.variants) ===
340
- null || _t === void 0
348
+ (_v = body === null || body === void 0 ? void 0 : body.variants) ===
349
+ null || _v === void 0
341
350
  ? void 0
342
- : _t.forEach((variant) => {
351
+ : _v.forEach((variant) => {
343
352
  var _a;
344
353
  const hasMatch =
345
354
  (_a =
@@ -416,10 +425,10 @@ export const sync_product = async (commandEvent) => {
416
425
  } catch (e) {
417
426
  //@ts-ignore
418
427
  console.error(
419
- ((_u = e === null || e === void 0 ? void 0 : e.response) === null ||
420
- _u === void 0
428
+ ((_w = e === null || e === void 0 ? void 0 : e.response) === null ||
429
+ _w === void 0
421
430
  ? void 0
422
- : _u.data) || e
431
+ : _w.data) || e
423
432
  );
424
433
  await commandLog.setStatus("fail", e).commit();
425
434
  throw e;
@@ -6,7 +6,7 @@ import {
6
6
  set_error,
7
7
  } from "../util.js";
8
8
  export const sync_disabled_product = async (commandEvent) => {
9
- var _a, _b;
9
+ var _a, _b, _c, _d;
10
10
  const repzo = new Repzo(
11
11
  (_a = commandEvent.app.formData) === null || _a === void 0
12
12
  ? void 0
@@ -39,7 +39,12 @@ export const sync_disabled_product = async (commandEvent) => {
39
39
  const failed_docs_report = [];
40
40
  const sap_products = await get_sap_disabled_products(
41
41
  commandEvent.app.formData.sapHostUrl,
42
- { updateAt: commandEvent.app.options_formData[bench_time_key] }
42
+ {
43
+ updateAt:
44
+ (_b = commandEvent.app.options_formData) === null || _b === void 0
45
+ ? void 0
46
+ : _b[bench_time_key],
47
+ }
43
48
  );
44
49
  result.sap_total =
45
50
  sap_products === null || sap_products === void 0
@@ -48,7 +53,9 @@ export const sync_disabled_product = async (commandEvent) => {
48
53
  await commandLog
49
54
  .addDetail(
50
55
  `${result.sap_total} Disabled Products in SAP changed since ${
51
- commandEvent.app.options_formData[bench_time_key] || "ever"
56
+ ((_c = commandEvent.app.options_formData) === null || _c === void 0
57
+ ? void 0
58
+ : _c[bench_time_key]) || "ever"
52
59
  }`
53
60
  )
54
61
  .commit();
@@ -142,10 +149,10 @@ export const sync_disabled_product = async (commandEvent) => {
142
149
  } catch (e) {
143
150
  //@ts-ignore
144
151
  console.error(
145
- ((_b = e === null || e === void 0 ? void 0 : e.response) === null ||
146
- _b === void 0
152
+ ((_d = e === null || e === void 0 ? void 0 : e.response) === null ||
153
+ _d === void 0
147
154
  ? void 0
148
- : _b.data) || e
155
+ : _d.data) || e
149
156
  );
150
157
  await commandLog.setStatus("fail", e).commit();
151
158
  throw e;
@@ -2,7 +2,7 @@ import Repzo from "repzo";
2
2
  import DataSet from "data-set-query";
3
3
  import { _create, update_bench_time, set_error } from "../util.js";
4
4
  export const sync_rep = async (commandEvent) => {
5
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
5
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
6
6
  const repzo = new Repzo(
7
7
  (_a = commandEvent.app.formData) === null || _a === void 0
8
8
  ? void 0
@@ -17,7 +17,7 @@ export const sync_rep = async (commandEvent) => {
17
17
  commandEvent.command
18
18
  );
19
19
  try {
20
- // console.log("sync_rep");
20
+ console.log("sync_rep");
21
21
  const new_bench_time = new Date().toISOString();
22
22
  const bench_time_key = "bench_time_rep";
23
23
  await commandLog.load(commandEvent.sync_id);
@@ -63,6 +63,7 @@ export const sync_rep = async (commandEvent) => {
63
63
  USERCASHACCOUNT: true,
64
64
  USERCHECKACCTCODE: true,
65
65
  USERWHSCODE: true,
66
+ INVOICESTATUS: true,
66
67
  });
67
68
  db.load(sap_reps === null || sap_reps === void 0 ? void 0 : sap_reps.Users);
68
69
  const repzo_reps = await repzo.rep.find({ per_page: 50000 });
@@ -131,10 +132,13 @@ export const sync_rep = async (commandEvent) => {
131
132
  USERCASHACCOUNT: sap_rep.USERCASHACCOUNT,
132
133
  USERCHECKACCTCODE: sap_rep.USERCHECKACCTCODE,
133
134
  USERWHSCODE: sap_rep.USERWHSCODE,
135
+ INVOICESTATUS: sap_rep.INVOICESTATUS,
134
136
  id: `${nameSpace}_${sap_rep.USERID}`,
135
137
  },
136
138
  assigned_warehouse: warehouse,
137
139
  company_namespace: [nameSpace],
140
+ "settings.treating_invoice_as_proforma_for_etax":
141
+ sap_rep.INVOICESTATUS === "N" ? true : false,
138
142
  };
139
143
  if (!repzo_rep) {
140
144
  // Create
@@ -170,6 +174,10 @@ export const sync_rep = async (commandEvent) => {
170
174
  (_k = repzo_rep.integration_meta) === null || _k === void 0
171
175
  ? void 0
172
176
  : _k.USERWHSCODE,
177
+ INVOICESTATUS:
178
+ (_l = repzo_rep.integration_meta) === null || _l === void 0
179
+ ? void 0
180
+ : _l.INVOICESTATUS,
173
181
  });
174
182
  if (found_identical_docs.length) continue;
175
183
  // Update
@@ -211,10 +219,10 @@ export const sync_rep = async (commandEvent) => {
211
219
  } catch (e) {
212
220
  //@ts-ignore
213
221
  console.error(
214
- ((_l = e === null || e === void 0 ? void 0 : e.response) === null ||
215
- _l === void 0
222
+ ((_m = e === null || e === void 0 ? void 0 : e.response) === null ||
223
+ _m === void 0
216
224
  ? void 0
217
- : _l.data) || e
225
+ : _m.data) || e
218
226
  );
219
227
  await commandLog.setStatus("fail", e).commit();
220
228
  throw e;