rez_core 4.0.39 → 4.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.
package/package.json
CHANGED
|
@@ -256,45 +256,40 @@ export class FilterService {
|
|
|
256
256
|
),
|
|
257
257
|
];
|
|
258
258
|
|
|
259
|
-
|
|
260
|
-
|
|
259
|
+
// 🧱 Build where clauses
|
|
260
|
+
const baseWhere = this.buildWhereClauses(baseFilters, attributeMetaMap);
|
|
261
261
|
|
|
262
|
-
|
|
263
|
-
// ✅ Special condition for TEMPLATE entity
|
|
264
|
-
// ✅ Special condition for TEMPLATE entity
|
|
262
|
+
// ✅ Handle TEMPLATE entity special condition
|
|
265
263
|
if (entity_type === 'TEMP' || entity_type === 'TEM') {
|
|
266
|
-
const templateTable = entityMeta?.data_source || '
|
|
264
|
+
const templateTable = entityMeta?.data_source || 'frm_wf_comm_template'; // corrected default
|
|
267
265
|
|
|
268
266
|
if (level_type === 'ORG') {
|
|
269
|
-
// ORG level → no filter
|
|
267
|
+
// ORG level → no additional filter
|
|
270
268
|
} else if (level_type === 'SCH') {
|
|
271
269
|
baseWhere.push({
|
|
272
270
|
query: `
|
|
273
271
|
(
|
|
274
|
-
(e.level_type = 'SCH' AND e.level_id =
|
|
272
|
+
(e.level_type = 'SCH' AND e.level_id = ?)
|
|
275
273
|
OR
|
|
276
274
|
(
|
|
277
275
|
e.level_type = 'ORG'
|
|
278
|
-
AND e.level_id =
|
|
276
|
+
AND e.level_id = ?
|
|
279
277
|
AND e.template_code NOT IN (
|
|
280
278
|
SELECT sub.template_code
|
|
281
279
|
FROM ${templateTable} AS sub
|
|
282
|
-
WHERE sub.level_type = 'SCH' AND sub.level_id =
|
|
280
|
+
WHERE sub.level_type = 'SCH' AND sub.level_id = ?
|
|
283
281
|
)
|
|
284
282
|
)
|
|
285
283
|
)
|
|
286
284
|
`,
|
|
287
|
-
params:
|
|
288
|
-
sch_level_id: level_id,
|
|
289
|
-
org_level_id: organization_id,
|
|
290
|
-
},
|
|
285
|
+
params: [level_id, organization_id, level_id], // positional order
|
|
291
286
|
});
|
|
292
287
|
}
|
|
293
288
|
}
|
|
294
289
|
|
|
295
|
-
|
|
290
|
+
// ✅ Default org/level clause
|
|
296
291
|
if (
|
|
297
|
-
entity_type
|
|
292
|
+
entity_type !== 'ORGP' &&
|
|
298
293
|
level_type &&
|
|
299
294
|
level_id &&
|
|
300
295
|
organization_id &&
|
|
@@ -304,11 +299,13 @@ if (
|
|
|
304
299
|
baseWhere.push({
|
|
305
300
|
query:
|
|
306
301
|
'e.organization_id = :organization_id AND e.level_type = :level_type AND e.level_id = :level_id',
|
|
307
|
-
params: { organization_id, level_type, level_id },
|
|
302
|
+
params: { organization_id, level_type, level_id }, // named params
|
|
308
303
|
});
|
|
309
304
|
}
|
|
310
305
|
|
|
311
306
|
|
|
307
|
+
|
|
308
|
+
|
|
312
309
|
if (entity_type == "USR" || entity_type == "UPR") {
|
|
313
310
|
baseWhere.push({
|
|
314
311
|
query: 'e.is_customer is NULL',
|