alsmanager_lib 3.0.113 → 3.0.114

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 +23 -6
  2. package/package.json +1 -1
package/lib/modules.js CHANGED
@@ -11150,30 +11150,46 @@ function updateSite(id_site, id_place, mark, floor, size) {
11150
11150
  }
11151
11151
 
11152
11152
  function writeSiteDestination(id_site, id_place, date_start, date_end, name, funzione) {
11153
+ var dt_start = convertDateToStringDB(date_start);
11154
+ var dt_end = '2999-12-31';
11155
+
11153
11156
  var query = "insert into site_destinations (id_site, id_place, date_start, date_end, name, type) values ";
11154
11157
  query += "(" + id_site + ", ";
11155
11158
  query += "'" + id_place + "', ";
11156
- query += "'" + date_start + "', ";
11157
- query += "'" + date_end + "', ";
11159
+ query += "'" + dt_start + "', ";
11160
+ query += "'" + dt_end + "', ";
11158
11161
  query += "'" + name + "', ";
11159
11162
  query += "'" + funzione + "' ";
11160
11163
  return query;
11161
11164
  }
11162
11165
 
11163
11166
  function updateSiteDestination(id_site, id_place, date_start, date_end, name, funzione) {
11167
+ var dt_start = convertDateToStringDB(date_start);
11168
+ var dt_end = convertDateToStringDB(date_end);
11169
+
11164
11170
  var query = "update site_destinations set ";
11165
- query += "'" + date_start + "', ";
11166
- query += "'" + date_end + "', ";
11171
+ query += "'" + dt_start + "', ";
11172
+ query += "'" + dt_end + "' ";
11167
11173
  if (name) {
11168
- query += "name = '" + name + "', ";
11174
+ query += ", name = '" + name + "', ";
11169
11175
  }
11170
11176
  if (funzione) {
11171
- query += "type = '" + funzione + "' ";
11177
+ query += ", type = '" + funzione + "' ";
11172
11178
  }
11173
11179
  query += "where id_site = " + id_site + " and id_place = '" + id_place + "'";
11174
11180
  return query;
11175
11181
  }
11176
11182
 
11183
+ function updateSiteDestinationAfterMove(id_site, id_place, date_start_ref) {
11184
+ var dt_start = convertDateToStringDB(date_start);
11185
+ var dt_end = convertDateToStringDB(date_start_ref);
11186
+
11187
+ var query = "update site_destinations set ";
11188
+ query += "date('" + dt_end + "', '-1 day') ";
11189
+ query += "where id_site = " + id_site + " and id_place = '" + id_place + "'";
11190
+ return query;
11191
+ }
11192
+
11177
11193
  function getSiteDestinationsByIdSite(id_site, id_place) {
11178
11194
  var query = "select date_start, date_end, name, type from site_destinations ";
11179
11195
  query += "where id_site = " + id_site + " and id_place = '" + id_place + "' ";
@@ -15179,6 +15195,7 @@ module.exports = {
15179
15195
  updateSite,
15180
15196
  writeSiteDestination,
15181
15197
  updateSiteDestination,
15198
+ updateSiteDestinationAfterMove,
15182
15199
  getSiteDestinationsByIdSite,
15183
15200
  getSitesFromDevice,
15184
15201
  getSitesWithDatesFromDevice,
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.113",
7
+ "version": "3.0.114",
8
8
  "description": "Funzioni per ALSManager",
9
9
  "license": "ISC",
10
10
  "author": "Luca Cattani",