alsmanager_lib 3.0.237 → 3.0.239

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 +24 -17
  2. package/package.json +1 -1
package/lib/modules.js CHANGED
@@ -13087,12 +13087,13 @@ function queryFunzioneByPlaceAndFloor(db_used, id_place, piano, date_ref) {
13087
13087
 
13088
13088
  function querySitesSQLite(place, piano, funzione, date_ref) {
13089
13089
  var query = "SELECT DISTINCT sd.id_site as id, s.id_place as Plesso, sd.name as Nome, s.mark as Codice, s.floor as Piano, sd.type as Funzione from site_destinations sd";
13090
- query += " LEFT JOIN sites s ON s.id = sd.id_site"
13090
+ query += " LEFT JOIN sites s ON s.id = sd.id_site ";
13091
+ query += "where is_removed <> 1 ";
13091
13092
  if (date_ref) {
13092
- query += " where " + date_ref + " >= sd.date_start and " + date_ref + " <= sd.date_end";
13093
+ query += "and " + date_ref + " >= sd.date_start and " + date_ref + " <= sd.date_end";
13093
13094
  }
13094
13095
  else {
13095
- query += " where date('now') >= sd.date_start and date('now') <= sd.date_end";
13096
+ query += "and date('now') >= sd.date_start and date('now') <= sd.date_end";
13096
13097
  }
13097
13098
  if (place) {
13098
13099
  query += " and s.id_place = '" + place + "'";
@@ -13110,12 +13111,13 @@ function querySitesSQLite(place, piano, funzione, date_ref) {
13110
13111
 
13111
13112
  function querySitesMySQL(place, piano, funzione, date_ref) {
13112
13113
  var query = "SELECT DISTINCT sd.id_site as id, s.id_place as Plesso, sd.name as Nome, s.mark as Codice, s.floor as Piano, sd.type as Funzione from site_destinations sd ";
13113
- query += " LEFT JOIN sites s ON s.id = sd.id_site"
13114
+ query += " LEFT JOIN sites s ON s.id = sd.id_site ";
13115
+ query += "where is_removed <> 1 ";
13114
13116
  if (date_ref) {
13115
- query += " where :date_ref >= sd.date_start and :date_ref <= sd.date_end";
13117
+ query += " and :date_ref >= sd.date_start and :date_ref <= sd.date_end";
13116
13118
  }
13117
13119
  else {
13118
- query += " where CURDATE() >= sd.date_start and CURDATE() <= sd.date_end";
13120
+ query += " and CURDATE() >= sd.date_start and CURDATE() <= sd.date_end";
13119
13121
  }
13120
13122
 
13121
13123
  if (place) {
@@ -13134,12 +13136,13 @@ function querySitesMySQL(place, piano, funzione, date_ref) {
13134
13136
 
13135
13137
  function querySitesMySQL2(place, piano, funzione, date_ref) {
13136
13138
  var query = "SELECT DISTINCT sd.id_site as id, s.id_place as Plesso, sd.name as Nome, s.mark as Codice, s.floor as Piano, sd.type as Funzione from site_destinations sd";
13137
- query += " LEFT JOIN sites s ON s.id = sd.id_site"
13139
+ query += " LEFT JOIN sites s ON s.id = sd.id_site ";
13140
+ query += "where is_removed <> 1 ";
13138
13141
  if (date_ref) {
13139
- query += " where " + date_ref + " >= sd.date_start and " + date_ref + " <= sd.date_end";
13142
+ query += " and " + date_ref + " >= sd.date_start and " + date_ref + " <= sd.date_end";
13140
13143
  }
13141
13144
  else {
13142
- query += " where CURDATE() >= sd.date_start and CURDATE() <= sd.date_end";
13145
+ query += " and CURDATE() >= sd.date_start and CURDATE() <= sd.date_end";
13143
13146
  }
13144
13147
 
13145
13148
  if (place) {
@@ -13194,22 +13197,23 @@ function updateSite(id_site, id_place, mark, floor, size) {
13194
13197
  return query;
13195
13198
  }
13196
13199
 
13197
- function writeSiteDestination(id_site, id_place, date_start, date_end, name, funzione) {
13200
+ function writeSiteDestination(id_site, id_place, date_start, date_end, name, funzione, is_removed) {
13198
13201
  var dt_start = convertDateToStringDB(date_start);
13199
13202
  var dt_end = convertDateToStringDB(date_end);
13200
13203
 
13201
- var query = "insert into site_destinations (id_site, id_place, date_start, date_end, name, type) values ";
13204
+ var query = "insert into site_destinations (id_site, id_place, date_start, date_end, name, type, is_removed) values ";
13202
13205
  query += "(" + id_site + ", ";
13203
13206
  query += "'" + id_place + "', ";
13204
13207
  query += "'" + dt_start + "', ";
13205
13208
  query += "'" + dt_end + "', ";
13206
13209
  query += "'" + name + "', ";
13207
- query += "'" + funzione + "' ";
13210
+ query += "'" + funzione + "', ";
13211
+ query += is_removed + " ";
13208
13212
  query += ")";
13209
13213
  return query;
13210
13214
  }
13211
13215
 
13212
- function updateSiteDestination(id_site, id_place, date_start, date_end, name, funzione) {
13216
+ function updateSiteDestination(id_site, id_place, date_start, date_end, name, funzione, is_removed) {
13213
13217
  var dt_start = convertDateToStringDB(date_start);
13214
13218
  var dt_end = convertDateToStringDB(date_end);
13215
13219
 
@@ -13223,6 +13227,9 @@ function updateSiteDestination(id_site, id_place, date_start, date_end, name, fu
13223
13227
  query += ", type = '" + funzione + "' ";
13224
13228
  }
13225
13229
  query += "where id_site = " + id_site + " and id_place = '" + id_place + "'";
13230
+ if (is_removed) {
13231
+ query += ", is_removed = " + is_removed + " ";
13232
+ }
13226
13233
  return query;
13227
13234
  }
13228
13235
 
@@ -13266,7 +13273,7 @@ function updateSiteDestinationAfterMove(db_used, id_site, id_place, date_start,
13266
13273
  }
13267
13274
 
13268
13275
  function getSiteDestinationsByIdSite(id_site, id_place) {
13269
- var query = "select date_start, date_end, name, type from site_destinations ";
13276
+ var query = "select date_start, date_end, name, type, is_removed from site_destinations ";
13270
13277
  query += "where id_site = " + id_site + " and id_place = '" + id_place + "' ";
13271
13278
  query += "order by date_start desc ";
13272
13279
  return query;
@@ -13956,7 +13963,7 @@ function removeDeviceFromAllSites(db_used, id_device) {
13956
13963
  //Get Sites for Combo
13957
13964
  function getSitesSelectComboSQLite(id_place, tipo_aula) {
13958
13965
  var query = "select s.id, concat(p.name, ' - ', sd.name, ' - ', s.mark) as Descrizione from sites s ";
13959
- query += "join site_destinations sd on sd.id_site = s.id ";
13966
+ query += "join site_destinations sd on sd.id_site = s.id and sd.id_place = s.id_place ";
13960
13967
  query += "join places p on p.mark = s.id_place ";
13961
13968
  query += "where date('now') >= sd.date_start and date('now') <= sd.date_end ";
13962
13969
  if (id_place || tipo_aula) {
@@ -13977,7 +13984,7 @@ function getSitesSelectComboSQLite(id_place, tipo_aula) {
13977
13984
 
13978
13985
  function getSitesSelectComboMySQL(id_place, tipo_aula) {
13979
13986
  var query = "select s.id, concat(p.name, ' - ', sd.name, ' - ', s.mark) as Descrizione from sites s ";
13980
- query += "join site_destinations sd on sd.id_site = s.id ";
13987
+ query += "join site_destinations sd on sd.id_site = s.id and sd.id_place = s.id_place ";
13981
13988
  query += "join places p on p.mark = s.id_place ";
13982
13989
  query += "where CURDATE() >= sd.date_start and CURDATE() <= sd.date_end ";
13983
13990
  if (id_place || tipo_aula) {
@@ -13998,7 +14005,7 @@ function getSitesSelectComboMySQL(id_place, tipo_aula) {
13998
14005
 
13999
14006
  function getSitesSelectComboMySQL2(id_place, tipo_aula) {
14000
14007
  var query = "select s.id, concat(p.name, ' - ', sd.name, ' - ', s.mark) as Descrizione from sites s ";
14001
- query += "join site_destinations sd on sd.id_site = s.id ";
14008
+ query += "join site_destinations sd on sd.id_site = s.id and sd.id_place = s.id_place ";
14002
14009
  query += "join places p on p.mark = s.id_place ";
14003
14010
  query += "where CURDATE() >= sd.date_start and CURDATE() <= sd.date_end ";
14004
14011
  if (id_place || tipo_aula) {
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.237",
7
+ "version": "3.0.239",
8
8
  "description": "Funzioni per ALSManager",
9
9
  "license": "ISC",
10
10
  "author": "Luca Cattani",