alsmanager_lib 3.0.236 → 3.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/lib/modules.js +25 -18
  2. package/package.json +1 -1
package/lib/modules.js CHANGED
@@ -10018,7 +10018,7 @@ function selectDeviceConsegna(db_used, id_consegna, id_device) {
10018
10018
 
10019
10019
 
10020
10020
  function selectDeviceInDepositoSQLite(inv_code) {
10021
- var query = "SELECT d.id, d.type as Tipo, d.manifacturer as Marca, d.model as Modello, ";
10021
+ var query = "SELECT distinct d.id, d.type as Tipo, d.manifacturer as Marca, d.model as Modello, ";
10022
10022
  query += "case ";
10023
10023
  query += "when inv_ict3_number != '' and inv_ict3_number is not null then inv_ict3_number ";
10024
10024
  query += "when inv_pnrr_number != '' and inv_pnrr_number is not null then inv_pnrr_number ";
@@ -10040,7 +10040,7 @@ function selectDeviceInDepositoSQLite(inv_code) {
10040
10040
  return query;
10041
10041
  }
10042
10042
  function selectDeviceInDepositoMySQL(inv_code) {
10043
- var query = "SELECT d.id, d.type as Tipo, d.manifacturer as Marca, d.model as Modello, ";
10043
+ var query = "SELECT distinct d.id, d.type as Tipo, d.manifacturer as Marca, d.model as Modello, ";
10044
10044
  query += "case ";
10045
10045
  query += "when inv_ict3_number != '' and inv_ict3_number is not null then inv_ict3_number ";
10046
10046
  query += "when inv_pnrr_number != '' and inv_pnrr_number is not null then inv_pnrr_number ";
@@ -10181,7 +10181,7 @@ function selectSoftwareConsegna(db_used, id_consegna, id_software) {
10181
10181
  }
10182
10182
 
10183
10183
  function selectSoftwaresInDepositoSQLite(inv_code) {
10184
- var query = "SELECT s.id, s.support, s.platform, s.version, s.license_type, s.maker, s.model, ";
10184
+ var query = "SELECT distinct s.id, s.support, s.platform, s.version, s.license_type, s.maker, s.model, ";
10185
10185
  query += "case ";
10186
10186
  query += "when s.inv_ict3_number != '' and s.inv_ict3_number is not null then s.inv_ict3_number ";
10187
10187
  query += "when s.serial_no != '' and s.serial_no is not null then concat(s.serial_no,'(S/N)') ";
@@ -10195,7 +10195,7 @@ function selectSoftwaresInDepositoSQLite(inv_code) {
10195
10195
  return query;
10196
10196
  }
10197
10197
  function selectSoftwaresInDepositoMySQL(inv_code) {
10198
- var query = "SELECT s.id, s.support, s.platform, s.version, s.license_type, s.maker, s.model, ";
10198
+ var query = "SELECT distinct s.id, s.support, s.platform, s.version, s.license_type, s.maker, s.model, ";
10199
10199
  query += "case ";
10200
10200
  query += "when s.inv_ict3_number != '' and s.inv_ict3_number is not null then s.inv_ict3_number ";
10201
10201
  query += "when s.serial_no != '' and s.serial_no is not null then concat(s.serial_no,'(S/N)') ";
@@ -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;
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.236",
7
+ "version": "3.0.238",
8
8
  "description": "Funzioni per ALSManager",
9
9
  "license": "ISC",
10
10
  "author": "Luca Cattani",