@managesome/eposmatic-toolkit 0.2.596 → 0.2.597
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.
|
@@ -304,12 +304,15 @@ function getGroupedInventoryCategories(categories, items) {
|
|
|
304
304
|
uncategorizedItems.push(item);
|
|
305
305
|
}
|
|
306
306
|
}
|
|
307
|
-
// Add each category with its items, sorted by category sort_id
|
|
307
|
+
// Add each category with its items, sorted by category sort_id. Match items
|
|
308
|
+
// by category _id OR ref_id: synced categories carry a fresh per-target _id
|
|
309
|
+
// (≠ ref_id) while items store that category _id, so a ref_id-only lookup
|
|
310
|
+
// would omit those items from the group.
|
|
308
311
|
const sortedCategories = [...categories].sort((a, b) => a.sort_id - b.sort_id);
|
|
309
312
|
for (const cat of sortedCategories) {
|
|
310
313
|
result.push({
|
|
311
314
|
category: cat,
|
|
312
|
-
items: itemsByCategory[cat.ref_id] || [],
|
|
315
|
+
items: itemsByCategory[cat.ref_id] || itemsByCategory[cat._id] || [],
|
|
313
316
|
});
|
|
314
317
|
}
|
|
315
318
|
// Append uncategorized items as a synthetic category (ref_id: null so the API receives null, not a fake string)
|