repzo-sap-absjo 1.0.24 → 1.0.26

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.
package/changelog.md CHANGED
@@ -4,6 +4,7 @@
4
4
 
5
5
  ### Added
6
6
 
7
+ - [util] in method: getUniqueConcatenatedValues, also add the promotions for items.buy @maramalshen
7
8
  - [actions/***] add 2 keys in integration_meta: sync_to_sap_started & sync_to_sap_succeeded @maramalshen
8
9
  - [commands/product] assign Foreign Name (ITEMDESCF) in SAP to local_name in Repzo @maramalshen
9
10
  - [actions/payment] add the field UserId where it equals USERID of the SAP API REP @maramalshen
@@ -22,6 +23,7 @@
22
23
  - [command/price_list] fix bug in priceList-item @maramalshen
23
24
  - [actions/**] don't update integration_meta.sync_to_sap_succeeded if it is already true @maramalshen
24
25
  - [actions/create_invoice] include item.get_promotion in MEO_Serial & Promotion_Name @maramalshen
26
+ - fix bug in is_matched in client & product @maramalshen
25
27
 
26
28
  ### Removed
27
29
 
@@ -231,7 +231,7 @@ export const sync_client = async (commandEvent) => {
231
231
  paymentTerm: paymentTerm ? paymentTerm._id : undefined,
232
232
  sv_priceList: priceList ? priceList._id : undefined,
233
233
  disabled: sap_client.ACTIVE == "Y" ? false : true,
234
- payment_type: sap_client.PAYMENTTERM ? "credit" : "cash", // sap_client.CLIENTGROUP == "Cash Van"
234
+ payment_type: sap_client.PAYMENTTERM ? "credit" : "cash",
235
235
  integrated_client_balance:
236
236
  client_credit_consumed && Math.round(client_credit_consumed * 1000),
237
237
  };
@@ -366,7 +366,7 @@ const is_matched = (body_1, body_2) => {
366
366
  }
367
367
  }
368
368
  for (let i = 0; i < integration_meta_keys.length; i++) {
369
- const key = keys[i];
369
+ const key = integration_meta_keys[i];
370
370
  if (
371
371
  ((_d =
372
372
  (_c =
@@ -473,7 +473,7 @@ const is_matched = (body_1, body_2) => {
473
473
  }
474
474
  }
475
475
  for (let i = 0; i < integration_meta_keys.length; i++) {
476
- const key = keys[i];
476
+ const key = integration_meta_keys[i];
477
477
  if (
478
478
  ((_d =
479
479
  (_c =
package/lib/util.js CHANGED
@@ -198,7 +198,7 @@ export const getUniqueConcatenatedValues = function (
198
198
  delimiter,
199
199
  all_promos
200
200
  ) {
201
- var _a, _b, _c;
201
+ var _a, _b, _c, _d, _e, _f, _g;
202
202
  item.general_promotions = item.general_promotions || [];
203
203
  item.used_promotions = item.used_promotions || [];
204
204
  const allPromotions = [...item.general_promotions, ...item.used_promotions];
@@ -212,6 +212,38 @@ export const getUniqueConcatenatedValues = function (
212
212
  : _c.promotion;
213
213
  if (promo_id && all_promos[promo_id])
214
214
  allPromotions.push(all_promos[promo_id]);
215
+ } else if (
216
+ (_e =
217
+ (_d = item.promotions) === null || _d === void 0
218
+ ? void 0
219
+ : _d.bookings) === null || _e === void 0
220
+ ? void 0
221
+ : _e.length
222
+ ) {
223
+ const promos = {};
224
+ (_g =
225
+ (_f = item.promotions) === null || _f === void 0
226
+ ? void 0
227
+ : _f.bookings) === null || _g === void 0
228
+ ? void 0
229
+ : _g.forEach((booking) => {
230
+ if (
231
+ booking === null || booking === void 0 ? void 0 : booking.promotion
232
+ ) {
233
+ promos[
234
+ booking === null || booking === void 0
235
+ ? void 0
236
+ : booking.promotion
237
+ ] =
238
+ booking === null || booking === void 0
239
+ ? void 0
240
+ : booking.promotion;
241
+ }
242
+ });
243
+ for (let promo_id in promos) {
244
+ if (promo_id && all_promos[promo_id])
245
+ allPromotions.push(all_promos[promo_id]);
246
+ }
215
247
  }
216
248
  const uniqueValues = new Set(
217
249
  allPromotions.map((promotion) => promotion[key]).filter((value) => value)
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "repzo-sap-absjo",
3
3
  "description": "repzo SAP ABS jo integration",
4
- "version": "1.0.24",
4
+ "version": "1.0.26",
5
5
  "homepage": "",
6
6
  "keywords": [],
7
7
  "author": {
@@ -351,7 +351,7 @@ const is_matched = (
351
351
  }
352
352
  }
353
353
  for (let i = 0; i < integration_meta_keys.length; i++) {
354
- const key = keys[i];
354
+ const key = integration_meta_keys[i];
355
355
  if (
356
356
  body_1?.integration_meta?.[key]?.toString() !==
357
357
  body_2?.integration_meta?.[key]?.toString()
@@ -368,7 +368,7 @@ const is_matched = (
368
368
  }
369
369
  }
370
370
  for (let i = 0; i < integration_meta_keys.length; i++) {
371
- const key = keys[i];
371
+ const key = integration_meta_keys[i];
372
372
  if (
373
373
  body_1?.integration_meta?.[key]?.toString() !==
374
374
  body_2?.integration_meta?.[key]?.toString()
package/src/util.ts CHANGED
@@ -260,6 +260,17 @@ export const getUniqueConcatenatedValues = function (
260
260
  const promo_id = item.promotions.bookings?.[0]?.promotion;
261
261
  if (promo_id && all_promos[promo_id])
262
262
  allPromotions.push(all_promos[promo_id]);
263
+ } else if (item.promotions?.bookings?.length) {
264
+ const promos: { [promo_id: string]: string } = {};
265
+ item.promotions?.bookings?.forEach((booking) => {
266
+ if (booking?.promotion) {
267
+ promos[booking?.promotion] = booking?.promotion;
268
+ }
269
+ });
270
+ for (let promo_id in promos) {
271
+ if (promo_id && all_promos[promo_id])
272
+ allPromotions.push(all_promos[promo_id]);
273
+ }
263
274
  }
264
275
  const uniqueValues = new Set(
265
276
  allPromotions.map((promotion) => promotion[key]).filter((value) => value)