alsmanager_lib 3.0.227 → 3.0.228

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/lib/modules.js +30 -2
  2. package/package.json +1 -1
package/lib/modules.js CHANGED
@@ -13223,7 +13223,7 @@ function updateSiteDestination(id_site, id_place, date_start, date_end, name, fu
13223
13223
  return query;
13224
13224
  }
13225
13225
 
13226
- function updateSiteDestinationAfterMove(id_site, id_place, date_start, name, funzione, date_start_ref) {
13226
+ function updateSiteDestinationAfterMoveSQLite(id_site, id_place, date_start, name, funzione, date_start_ref) {
13227
13227
  var dt_end = convertDateToStringDB(date_start_ref);
13228
13228
  var dt_start = convertDateToStringDB(date_start);
13229
13229
  var query = "update site_destinations set ";
@@ -13234,6 +13234,34 @@ function updateSiteDestinationAfterMove(id_site, id_place, date_start, name, fun
13234
13234
  return query;
13235
13235
  }
13236
13236
 
13237
+ function updateSiteDestinationAfterMoveMySQL2(id_site, id_place, date_start, name, funzione, date_start_ref) {
13238
+ var dt_end = convertDateToStringDB(date_start_ref);
13239
+ var dt_start = convertDateToStringDB(date_start);
13240
+ var query = "update site_destinations set ";
13241
+ query += "date_end = DATE_SUB('" + dt_end + "', INTERVAL 1 DAY) ";
13242
+ query += "where id_site = " + id_site + " and id_place = '" + id_place + "' ";
13243
+ query += "and date_start = '" + dt_start + "' ";
13244
+ query += "and name = '" + name + "' and type = '" + funzione + "'";
13245
+ return query;
13246
+ }
13247
+
13248
+ function updateSiteDestinationAfterMove(db_used, id_site, id_place, date_start, name, funzione, date_start_ref) {
13249
+ var query = "";
13250
+ if (db_used) {
13251
+ switch (db_used) {
13252
+ case 'SQLITE':
13253
+ query = updateSiteDestinationAfterMoveSQLite(id_site, id_place, date_start, name, funzione, date_start_ref);
13254
+ break;
13255
+ case 'MYSQL':
13256
+ break;
13257
+ case 'MYSQL2':
13258
+ query = updateSiteDestinationAfterMoveMySQL2(id_site, id_place, date_start, name, funzione, date_start_ref);
13259
+ break;
13260
+ }
13261
+ }
13262
+ return query;
13263
+ }
13264
+
13237
13265
  function getSiteDestinationsByIdSite(id_site, id_place) {
13238
13266
  var query = "select date_start, date_end, name, type from site_destinations ";
13239
13267
  query += "where id_site = " + id_site + " and id_place = '" + id_place + "' ";
@@ -14388,7 +14416,7 @@ function updateSiteBySetMySQL(id_device) {
14388
14416
  return query;
14389
14417
  }
14390
14418
  function updateSiteBySetMySQL2(id_device) {
14391
- var query = "update device_site set date_out = date('now','-1 day'), date_in = date('now','-1 day') where id_device in "
14419
+ var query = "update device_site set date_out = DATE_SUB(CURDATE(), INTERVAL 1 DAY), date_in = DATE_SUB(CURDATE(), INTERVAL 1 DAY) where id_device in "
14392
14420
  query += "(select dt.id_relateddevice from device_set dt ";
14393
14421
  query += "where dt.id_maindevice = " + id_device + ") ";
14394
14422
  query += "and CURDATE() >= date_in and CURDATE() <= date_out"
package/package.json CHANGED
@@ -4,7 +4,7 @@
4
4
  ".": "./lib/modules.js",
5
5
  "./dbconn": "./lib/dbconn.js"
6
6
  },
7
- "version": "3.0.227",
7
+ "version": "3.0.228",
8
8
  "description": "Funzioni per ALSManager",
9
9
  "license": "ISC",
10
10
  "author": "Luca Cattani",