rez_core 4.0.152 → 4.0.154

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": "4.0.152",
3
+ "version": "4.0.154",
4
4
  "description": "",
5
5
  "author": "",
6
6
  "private": false,
@@ -91,6 +91,7 @@ export class ActionDataRepository extends EntityServiceImpl {
91
91
  status: FORM_STATUS_TO_BE_SENT,
92
92
  action_id: act.id,
93
93
  created_date: istDate,
94
+ pdf_template: act.pdf_template
94
95
  };
95
96
 
96
97
  const createdEntity = await super.createEntity(
@@ -154,6 +154,29 @@ export class TaskService extends EntityServiceImpl {
154
154
  loggedInUser.organization_id,
155
155
  ]);
156
156
 
157
+ const oldStatusQuery = `
158
+ SELECT *
159
+ FROM frm_wf_task_data
160
+ WHERE id = ?
161
+ AND organization_id = ?
162
+ LIMIT 1;
163
+ `;
164
+
165
+ const [oldRow] = await this.dataSource.query(oldStatusQuery, [
166
+ entityData.id,
167
+ loggedInUser.organization_id,
168
+ ]);
169
+
170
+ const oldStatusRows = await this.dataSource.query(taskStatusQuery, [
171
+ oldRow.status,
172
+ loggedInUser.organization_id,
173
+ ]);
174
+
175
+ const isStatusChanged =
176
+ statusRows.length > 0 &&
177
+ oldStatusRows.length > 0 &&
178
+ statusRows[0].name !== oldStatusRows[0].name;
179
+
157
180
  const isCompletedStatus =
158
181
  statusRows.length > 0 &&
159
182
  statusRows[0].name?.toLowerCase() === 'completed';
@@ -183,20 +206,7 @@ export class TaskService extends EntityServiceImpl {
183
206
  }
184
207
 
185
208
  try {
186
- // Always log edit
187
- const editLogData = {
188
- mapped_entity_id: updatedEntity.mapped_entity_id,
189
- mapped_entity_type: updatedEntity.mapped_entity_type,
190
- title: `Task edited`,
191
- description: `${updatedEntity.code} was edited`,
192
- category: ACTIVITY_CATEGORIES.TASK,
193
- action: 'edit',
194
- appcode: loggedInUser.appcode,
195
- };
196
-
197
- await this.activityLogService.logActivity(editLogData, loggedInUser);
198
-
199
- if (isCompletedStatus) {
209
+ if (isCompletedStatus && isStatusChanged) {
200
210
  const completedLogData = {
201
211
  mapped_entity_id: updatedEntity.mapped_entity_id,
202
212
  mapped_entity_type: updatedEntity.mapped_entity_type,
@@ -211,6 +221,18 @@ export class TaskService extends EntityServiceImpl {
211
221
  completedLogData,
212
222
  loggedInUser,
213
223
  );
224
+ } else {
225
+ const editLogData = {
226
+ mapped_entity_id: updatedEntity.mapped_entity_id,
227
+ mapped_entity_type: updatedEntity.mapped_entity_type,
228
+ title: `Task edited`,
229
+ description: `${updatedEntity.code} was edited`,
230
+ category: ACTIVITY_CATEGORIES.TASK,
231
+ action: 'edit',
232
+ appcode: loggedInUser.appcode,
233
+ };
234
+
235
+ await this.activityLogService.logActivity(editLogData, loggedInUser);
214
236
  }
215
237
  } catch (error) {
216
238
  console.error(