zet-lib 3.3.4 → 3.3.5

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/lib/Form.js CHANGED
@@ -508,7 +508,9 @@ Form.field = (obj) => {
508
508
  });
509
509
  value = value || [];
510
510
  value.map((item, index) => {
511
- leftButtons += `<li><button class="btn btn-primary boxy" type="button">${obj.dataObject[item]}<input type="hidden" name='${obj.name}[]' value="${item}"></button></li>`;
511
+ if (obj.dataObject && item in obj.dataObject) {
512
+ leftButtons += `<li><button class="btn btn-primary boxy" type="button">${obj.dataObject[item]}<input type="hidden" name='${obj.name}[]' value="${item}"></button></li>`;
513
+ }
512
514
  });
513
515
 
514
516
  displayForm += `<div id="dragdrop_${obj.id}" class="row contentfields">
package/lib/zRoute.js CHANGED
@@ -5321,22 +5321,26 @@ zRoute.updateSQL = async (req, res, table, data, whereData) => {
5321
5321
  data: data,
5322
5322
  });
5323
5323
  //save to history
5324
- connection.insert({
5325
- table: "zhistory",
5326
- data: {
5327
- module_id: result.id,
5328
- module: MYMODEL.table,
5329
- data_1: JSON.stringify(result),
5330
- data_2: JSON.stringify(myresult),
5331
- data_1_date: result.updated_at,
5332
- data_2_date: data.updated_at,
5333
- created_by: userId,
5334
- updated_by: userId,
5335
- created_at: Util.now(),
5336
- updated_at: Util.now(),
5337
- company_id: res.locals.companyId,
5338
- },
5339
- });
5324
+ try {
5325
+ connection.insert({
5326
+ table: "zhistory",
5327
+ data: {
5328
+ module_id: result.id,
5329
+ module: MYMODEL.table,
5330
+ data_1: JSON.stringify(result),
5331
+ data_2: JSON.stringify(myresult),
5332
+ data_1_date: result.updated_at,
5333
+ data_2_date: data.updated_at,
5334
+ created_by: userId,
5335
+ updated_by: userId,
5336
+ created_at: Util.now(),
5337
+ updated_at: Util.now(),
5338
+ company_id: res.locals.companyId,
5339
+ },
5340
+ });
5341
+ } catch (e) {
5342
+ console.log(e)
5343
+ }
5340
5344
  zRoute.modelsCacheRenew(table, res.locals.companyId);
5341
5345
  return myresult;
5342
5346
  } else {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "zet-lib",
3
- "version": "3.3.4",
3
+ "version": "3.3.5",
4
4
  "description": "zet is a library that part of zet generator.",
5
5
  "engines": {
6
6
  "node": ">=18"