@optimiser/common 1.0.234 → 1.0.238

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.
Files changed (2) hide show
  1. package/dist/lib/utility.js +101 -5
  2. package/package.json +1 -1
@@ -206,7 +206,7 @@ function GetPageFieldData(pageName, db, mdb, msp_d, next, callback) {
206
206
  else {
207
207
  db.collection("ObjectSchema").findOne({ 'Name': pageData.ObjectName }, function (err, objectData) {
208
208
  return __awaiter(this, void 0, void 0, function () {
209
- var removeFieldsFromFilter, j, filterData, _loop_2, i, g, group, childObjectSchema, _loop_3, i, _loop_4, i, idObject, idObject_1;
209
+ var removeFieldsFromFilter, j, filterData, _loop_2, i, g, group, childObjectSchema, _loop_3, i, _loop_4, i, createdByObj, modByObj, createdDateObj, modDateObj, idObject, idObject_1;
210
210
  return __generator(this, function (_a) {
211
211
  switch (_a.label) {
212
212
  case 0:
@@ -277,6 +277,82 @@ function GetPageFieldData(pageName, db, mdb, msp_d, next, callback) {
277
277
  g++;
278
278
  return [3 /*break*/, 1];
279
279
  case 5:
280
+ createdByObj = {
281
+ Name: "CreatedBy",
282
+ DisplayName: "Created By",
283
+ ApiName: "CreatedBy",
284
+ HideON: "both",
285
+ Sequence: 100,
286
+ UniqueID: "CreatedBy",
287
+ Schema: {
288
+ Name: "CreatedBy",
289
+ DisplayName: "Created By",
290
+ HideON: "both",
291
+ ApiName: "CreatedBy",
292
+ UIDataType: "lookup",
293
+ LookupObject: "User",
294
+ LookupFields: [
295
+ "FirstName",
296
+ "LastName"
297
+ ],
298
+ ExtraLookupFields: [
299
+ "UserStatus",
300
+ "IsAppUser"
301
+ ]
302
+ }
303
+ };
304
+ modByObj = {
305
+ Name: "ModifiedBy",
306
+ DisplayName: "Modified By",
307
+ ApiName: "ModifiedBy",
308
+ HideON: "both",
309
+ Sequence: 101,
310
+ UniqueID: "ModifiedBy",
311
+ Schema: {
312
+ Name: "ModifiedBy",
313
+ DisplayName: "Modified By",
314
+ HideON: "both",
315
+ ApiName: "ModifiedBy",
316
+ UIDataType: "lookup",
317
+ LookupObject: "User",
318
+ LookupFields: [
319
+ "FirstName",
320
+ "LastName"
321
+ ],
322
+ ExtraLookupFields: [
323
+ "UserStatus",
324
+ "IsAppUser"
325
+ ]
326
+ }
327
+ };
328
+ createdDateObj = {
329
+ Name: "CreatedDate",
330
+ DisplayName: "Created Date",
331
+ UniqueID: "CreatedDate",
332
+ Sequence: 102,
333
+ HideON: "both",
334
+ Schema: {
335
+ Name: "CreatedDate",
336
+ HideON: "both",
337
+ DisplayName: "Created Date",
338
+ ApiName: "CreatedDate",
339
+ UIDataType: "datetime"
340
+ }
341
+ };
342
+ modDateObj = {
343
+ Name: "ModifiedDate",
344
+ DisplayName: "Modified Date",
345
+ UniqueID: "ModifiedDate",
346
+ HideON: "both",
347
+ Sequence: 103,
348
+ Schema: {
349
+ Name: "ModifiedDate",
350
+ HideON: "both",
351
+ DisplayName: "Modified Date",
352
+ ApiName: "ModifiedDate",
353
+ UIDataType: "datetime"
354
+ }
355
+ };
280
356
  if (pageData.Fields && pageData.Type == "ObjectGrid") {
281
357
  idObject = {
282
358
  Name: "_id",
@@ -287,6 +363,15 @@ function GetPageFieldData(pageName, db, mdb, msp_d, next, callback) {
287
363
  Width: 100
288
364
  };
289
365
  pageData.Fields.splice(0, 0, idObject);
366
+ //By Kashish : To handle System Info Fields in Grid
367
+ if (!pageData.Fields.find(function (x) { return x.Name == 'CreatedBy'; }) && !['CompanySessionLogList', 'CompanyTransactionLogsList'].includes(pageData.PageName) && pageData.ObjectName != 'Task')
368
+ pageData.Fields.push(createdByObj);
369
+ if (!pageData.Fields.find(function (x) { return x.Name == 'CreatedDate'; }) && !['CompanySessionLogList', 'CompanyTransactionLogsList'].includes(pageData.PageName))
370
+ pageData.Fields.push(createdDateObj);
371
+ if (!pageData.Fields.find(function (x) { return x.Name == 'ModifiedBy'; }) && !['CompanySessionLogList', 'CompanyTransactionLogsList'].includes(pageData.PageName))
372
+ pageData.Fields.push(modByObj);
373
+ if (!pageData.Fields.find(function (x) { return x.Name == 'ModifiedDate'; }) && !['CompanySessionLogList', 'CompanyTransactionLogsList'].includes(pageData.PageName))
374
+ pageData.Fields.push(modDateObj);
290
375
  }
291
376
  if (pageData.Fields && pageData.Type == "ObjectDetail") {
292
377
  idObject_1 = {
@@ -294,14 +379,16 @@ function GetPageFieldData(pageName, db, mdb, msp_d, next, callback) {
294
379
  Sequence: 0,
295
380
  UIDataType: "objectid",
296
381
  UniqueID: "_id",
297
- DisplayName: "ID"
382
+ DisplayName: "ID",
383
+ HideON: "both"
298
384
  };
299
385
  pageData.Fields == pageData.Fields.map(function (s) {
300
386
  if (s.Schema && s.Schema.UIDataType == "collection") {
301
387
  s.Schema.Fields.splice(0, 0, idObject_1);
302
- }
303
- else {
304
- s;
388
+ //By Kashish : To handle System Info Fields
389
+ if (createdByObj && createdDateObj && modByObj && modDateObj) {
390
+ s.Schema.Fields.splice(-1, 0, createdByObj.Schema, createdDateObj.Schema, modByObj.Schema, modDateObj.Schema);
391
+ }
305
392
  }
306
393
  });
307
394
  }
@@ -3814,6 +3901,15 @@ function CheckPageAuthentication(pageData, msp_d, db, mdb, next) {
3814
3901
  });
3815
3902
  }
3816
3903
  exports.CheckPageAuthentication = CheckPageAuthentication;
3904
+ /*
3905
+ * Created by: Shahzaib as on 08-12-21
3906
+ * This is a common function and used to remove fields from Advanced/Report filter.
3907
+ * @param1: filter condition object from DB
3908
+ * @param2: fields name
3909
+ * @param3: identifier in string, like- Name or UniqueID
3910
+ * Desc: This is a common function and used to remove fields from Advanced/Report filter.
3911
+ * return value: array.
3912
+ */
3817
3913
  function RemoveFieldsFromFilters(condition, fields, identifier) {
3818
3914
  if (condition != undefined && condition.Filters.length > 0) {
3819
3915
  fields.forEach(function (fld) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@optimiser/common",
3
- "version": "1.0.234",
3
+ "version": "1.0.238",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "scripts": {