rez_core 3.1.190 → 3.1.192

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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "rez_core",
3
- "version": "3.1.190",
3
+ "version": "3.1.192",
4
4
  "description": "",
5
5
  "author": "",
6
6
  "private": false,
@@ -56,8 +56,8 @@ export class ActionDataRepository extends EntityServiceImpl {
56
56
  } as ActionDataEntity);
57
57
  await this.actionDataRepo.save(actionData);
58
58
 
59
- // SEND LEAD FORM
60
- // if the action_category_code is 'SDFM', create a entry in cr_wf_form table
59
+ // SEND ANY FORM
60
+ // if the action_category_code is 'SDFM', create a entry in crm_lead_form table
61
61
  if (act?.action_category_code === 'SDFM') {
62
62
  const data = {
63
63
  entity_type: 'LFRM',
@@ -69,7 +69,30 @@ export class ActionDataRepository extends EntityServiceImpl {
69
69
  action_id: act.id,
70
70
  };
71
71
 
72
- super.createEntity(data as any, loggedInUser);
72
+ const createdEntity = await super.createEntity(
73
+ data as any,
74
+ loggedInUser,
75
+ );
76
+ // THEN INSERT SDFM IN RELATION TASK TABLE
77
+
78
+ let relationData = await this.dataSource.query(
79
+ `SELECT * FROM cr_entity_relation WHERE source_entity_type = ? AND target_entity_type = ?`,
80
+ [createdEntity.mapped_entity_type, createdEntity.entity_type],
81
+ );
82
+
83
+ if (relationData) {
84
+ await this.dataSource.query(
85
+ `INSERT INTO cr_entity_relation_data (organization_id, source_entity_id, source_entity_type, target_entity_id, target_entity_type, relation_type) VALUES (?, ?, ?, ?, ?,?)`,
86
+ [
87
+ loggedInUser.organization_id,
88
+ createdEntity.mapped_entity_id,
89
+ createdEntity.mapped_entity_type,
90
+ createdEntity.id,
91
+ createdEntity.entity_type,
92
+ relationData[0]?.relation_type,
93
+ ],
94
+ );
95
+ }
73
96
  }
74
97
  }
75
98
  }
@@ -144,6 +144,6 @@ export class CommTemplateRepository {
144
144
  level_type: string, appcode: string) {
145
145
  return await this.commTemplateRepository.findOne({
146
146
  where: {code, level_id, level_type, appcode}
147
- })
147
+ });
148
148
  }
149
149
  }
@@ -128,8 +128,8 @@ export class CommTemplateService extends EntityServiceImpl {
128
128
  async getResolvedTemplateMsg(payload: any) {
129
129
  let commTemplate = await this.commTemplateRepository.findByCodeAndLevelIdAndLevelTypeAndAppCode(
130
130
  payload.template_code,
131
- payload.level_type,
132
131
  payload.level_id,
132
+ payload.level_type,
133
133
  payload.appcode,
134
134
  );
135
135