rez_core 4.0.230 → 4.0.232
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/package.json
CHANGED
|
@@ -215,30 +215,31 @@ export class EntityJSONService extends EntityServiceImpl {
|
|
|
215
215
|
// 5. Merge linked attributes using saved filters
|
|
216
216
|
for (const linkAttr of safeAttributes.linkedAttributes) {
|
|
217
217
|
const childEntityType = linkAttr.fla_applicable_entity_type;
|
|
218
|
-
const
|
|
218
|
+
const sourceKey = linkAttr.applicable_attribute_key; // source column = middle_name
|
|
219
|
+
const targetKey = linkAttr.attribute_key; // final JSON key = father_middle_name
|
|
219
220
|
|
|
220
|
-
if (!childEntityType || !
|
|
221
|
+
if (!childEntityType || !sourceKey || !targetKey) continue;
|
|
221
222
|
|
|
222
|
-
//
|
|
223
|
-
const mappingValue = mainData?.[
|
|
223
|
+
// value must be taken from applicable_attribute_key
|
|
224
|
+
const mappingValue = mainData?.[sourceKey] ?? null;
|
|
224
225
|
|
|
225
226
|
const value = await this.applyLinkedFilterUsingSavedFilter(
|
|
226
227
|
childEntityType,
|
|
227
|
-
linkAttr.fla_saved_filter_code,
|
|
228
|
-
|
|
228
|
+
linkAttr.fla_saved_filter_code,
|
|
229
|
+
sourceKey,
|
|
229
230
|
mappingValue,
|
|
230
|
-
|
|
231
|
+
targetKey, // IMPORTANT → write to father_middle_name
|
|
231
232
|
loggedInUser,
|
|
232
233
|
entityId
|
|
233
234
|
);
|
|
234
235
|
|
|
235
236
|
if (value !== null && value !== undefined) {
|
|
236
|
-
//
|
|
237
|
-
const flatKey = attrMap[childAttributeKey] || childAttributeKey;
|
|
237
|
+
const flatKey = targetKey; // do NOT use childAttributeKey
|
|
238
238
|
flatJson[flatKey] = value;
|
|
239
239
|
}
|
|
240
240
|
}
|
|
241
241
|
|
|
242
|
+
|
|
242
243
|
// 6. Save JSON
|
|
243
244
|
await this.dataSource.query(
|
|
244
245
|
`INSERT INTO frm_entity_json (entity_type, entity_id, json_data, created_by)
|