alsmanager_lib 3.0.129 → 3.0.131

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 +88 -12
  2. package/package.json +1 -1
package/lib/modules.js CHANGED
@@ -2818,7 +2818,7 @@ function queryDeviceModelsByFilter(db_used, manifacturer, dev_type) {
2818
2818
 
2819
2819
  //end of Manage models
2820
2820
  //Infos from details
2821
- function queryOSByFilter(tipo) {
2821
+ function queryOSByFilter(tipo, date_ref) {
2822
2822
  var query = "select distinct dt.os as os from devices d ";
2823
2823
  query += "left join device_pc dt on d.id = dt.id_device ";
2824
2824
  query += "where d.type = '" + tipo + "' ";
@@ -5946,10 +5946,10 @@ function getDevicesNotAllocatedComboSQLite(id_site, id_place, sel_type, sel_make
5946
5946
  query += "from devices d ";
5947
5947
  query += "left join device_site ds on d.id = ds.id_device ";
5948
5948
  query += "left join site_destinations sd on ds.id_site = sd.id_site ";
5949
- query += "left join device_consegne dc on d.id = dc.id_device ";
5949
+ //query += "left join device_consegne dc on d.id = dc.id_device ";
5950
5950
  query += "left join consegna_beni cb on d.id = cb.id_bene "
5951
5951
  query += "where (d.is_removed is null or d.is_removed = 0) "
5952
- query += "and ((dc.id_consegna is null) or (cb.id is null or (cb.tipo_bene = 'DEVICE' and cb.stato_restituzione = 2))) ";
5952
+ query += "and ((cb.id_consegna is null) or (cb.id is null or (cb.tipo_bene = 'DEVICE' and cb.stato_restituzione = 2))) ";
5953
5953
  query += "and (ds.id_place is null ";
5954
5954
  query += "or ((ds.date_in <= date('now') and ds.date_out >= date('now') and sd.type in ('MAGAZZINO', 'CARRELLO DISPOSITIVI'))) and (ds.id_place <> '" + id_place + "' and ds.id_site <> " + id_site + ")) ";
5955
5955
  if (sel_type_str.trim() != '') {
@@ -5988,10 +5988,10 @@ function getDevicesNotAllocatedComboMySQL(id_site, id_place, sel_type, sel_maker
5988
5988
  query += "from devices d ";
5989
5989
  query += "left join device_site ds on d.id = ds.id_device ";
5990
5990
  query += "left join site_destinations sd on ds.id_site = sd.id_site ";
5991
- query += "left join device_consegne dc on d.id = dc.id_device ";
5991
+ //query += "left join device_consegne dc on d.id = dc.id_device ";
5992
5992
  query += "left join consegna_beni cb on d.id = cb.id_bene "
5993
5993
  query += "where (d.is_removed is null or d.is_removed = 0) "
5994
- query += "and ((dc.id_consegna is null) or (cb.id is null or (cb.tipo_bene = 'DEVICE' and cb.stato_restituzione = 2))) ";
5994
+ query += "and ((cb.id_consegna is null) or (cb.id is null or (cb.tipo_bene = 'DEVICE' and cb.stato_restituzione = 2))) ";
5995
5995
  query += "and (ds.id_place is null ";
5996
5996
  query += "or ((ds.date_in <= CURDATE() and ds.date_out >= CURDATE() and sd.type in ('MAGAZZINO', 'CARRELLO DISPOSITIVI'))) and (ds.id_place <> :id_place and ds.id_site <> :id_site)) ";
5997
5997
  if (sel_type_str.trim() != '') {
@@ -6030,7 +6030,7 @@ function getDevicesNotAllocatedComboMySQL2(id_site, id_place, sel_type, sel_make
6030
6030
  query += "from devices d ";
6031
6031
  query += "left join device_site ds on d.id = ds.id_device ";
6032
6032
  query += "left join site_destinations sd on ds.id_site = sd.id_site ";
6033
- query += "left join device_consegne dc on d.id = dc.id_device ";
6033
+ //query += "left join device_consegne dc on d.id = dc.id_device ";
6034
6034
  query += "left join consegna_beni cb on d.id = cb.id_bene "
6035
6035
  query += "where (d.is_removed is null or d.is_removed = 0) "
6036
6036
  query += "and ((dc.id_consegna is null) or (cb.id is null or (cb.tipo_bene = 'DEVICE' and cb.stato_restituzione = 2))) ";
@@ -7182,8 +7182,72 @@ function esistonoBeniDaRestituire(id_consegna) {
7182
7182
  }
7183
7183
 
7184
7184
  //End Creazione email sollecito consegna
7185
+ // Beni in Limbo
7186
+ function getBeniInLimbo(data_ref_da, data_ref_a) {
7187
+ /*
7188
+ CREATE TABLE "beni_limbo" (
7189
+ "id" INTEGER,
7190
+ "id_bene" INTEGER,
7191
+ "tipo_bene" TEXT,
7192
+ "id_doc" INTEGER,
7193
+ "data_rilievo" TEXT,
7194
+ "note" TEXT,
7195
+ PRIMARY KEY("id" AUTOINCREMENT)
7196
+ )
7197
+ */
7198
+ var query = "select b.id, d.manifacturer, d.model, b.tipo_bene, b.id_doc, b.data_rilievo, b.note from beni_limbo b ";
7199
+ query += "join device d on d.id = b.id_bene ";
7200
+ if (data_ref_da) {
7201
+ query += "and b.data_rilievo <= " + data_ref_da + " ";
7202
+ }
7203
+ if (data_ref_a) {
7204
+ query += "and b.data_rilievo >= " + data_ref_a + " ";
7205
+ }
7206
+ return query;
7207
+ }
7185
7208
 
7209
+ function getBeneInLimboById(id_limbo) {
7210
+ var query = "select b.id, b.id_bene, b.tipo_bene, b.id_doc, b.data_rilievo, b.note from beni_limbo b ";
7211
+ query += "where b.id = " + id_limbo;
7212
+ return query;
7213
+ }
7186
7214
 
7215
+ function getBeneInLimboByIdBene(id_bene) {
7216
+ var query = "select b.id, b.id_bene, b.tipo_bene, b.id_doc, b.data_rilievo, b.note from beni_limbo b ";
7217
+ query += "where b.id_bene = " + id_bene;
7218
+ return query;
7219
+ }
7220
+
7221
+ function writeBeneInLimbo(id_bene, tipo_bene, id_doc, data_rilievo, note) {
7222
+ var query = "insert into beni_limbo (id_bene, tipo_bene, id_doc, data_rilievo, note) value (";
7223
+ var dr_str = convertDateToStringDB(data_rilievo);
7224
+ query += id_bene + ", ";
7225
+ query += "'" + tipo_bene + "', ";
7226
+ query += id_doc + ", ";
7227
+ query += "'" + dr_str + "', ";
7228
+ query += "'" + note + "'";
7229
+ return query;
7230
+ }
7231
+
7232
+ function updateBeneInLimbo(id_limbo, id_bene, tipo_bene, id_doc, data_rilievo, note) {
7233
+ var query = "update beni_limbo set ";
7234
+ var dr_str = convertDateToStringDB(data_rilievo);
7235
+ query += "id_bene = " + id_bene + ", ";
7236
+ query += "tipo_bene = '" + tipo_bene + "', ";
7237
+ query += "id_doc = " + id_doc + ", ";
7238
+ query += "data_rilievo = '" + dr_str + "', ";
7239
+ query += "note = '" + note + "'";
7240
+ query += "where id = " + id_limbo;
7241
+ return query;
7242
+ }
7243
+
7244
+ function deleteBeneInLimbo(id_limbo) {
7245
+ var query = "delete from beni_limbo b ";
7246
+ query += "where b.id = " + id_limbo;
7247
+ return query;
7248
+ }
7249
+
7250
+ //End Beni in Limbo
7187
7251
  // Beni in consegna
7188
7252
  function queryConsegneByIdDeviceSQLite(id_device) {
7189
7253
  var query = "select c.data_consegna as Consegna, ";
@@ -7195,7 +7259,8 @@ function queryConsegneByIdDeviceSQLite(id_device) {
7195
7259
  query += "when c.stato_restituzione = 4 then 'Parti mancanti' ";
7196
7260
  query += "else '' ";
7197
7261
  query += "end as Stato, ";
7198
- query += "c.note as Note from device_consegne dc ";
7262
+ //query += "c.note as Note from device_consegne dc ";
7263
+ query += "c.note as Note from consegna_beni dc ";
7199
7264
  query += "inner join consegne c on c.id = dc.id_consegna ";
7200
7265
  query += "where dc.id_device = " + id_device;
7201
7266
  return query;
@@ -7211,7 +7276,8 @@ function queryConsegneByIdDeviceMySQL(id_device) {
7211
7276
  query += "when c.stato_restituzione = 4 then 'Parti mancanti' ";
7212
7277
  query += "else '' ";
7213
7278
  query += "end as Stato, ";
7214
- query += "c.note as Note from device_consegne dc ";
7279
+ //query += "c.note as Note from device_consegne dc ";
7280
+ query += "c.note as Note from consegna_beni dc ";
7215
7281
  query += "inner join consegne c on c.id = dc.id_consegna ";
7216
7282
  query += "where dc.id_device = :id_device";
7217
7283
  return query;
@@ -8018,7 +8084,7 @@ function insertConsegnaDeviceMySQL(id_consegna, id_device, note){
8018
8084
  query += ")";
8019
8085
  return query;
8020
8086
  }
8021
-
8087
+ // NOT YET USED
8022
8088
  function insertConsegnaDevice(db_used, id_consegna, id_device, note) {
8023
8089
  var query = "";
8024
8090
  if (db_used) {
@@ -8054,7 +8120,7 @@ function updateConsegnaDeviceMySQL(id_devcons, id_consegna, id_device, note){
8054
8120
  query += "where id = :id_devcons";
8055
8121
  return query;
8056
8122
  }
8057
-
8123
+ // NOT YET USED
8058
8124
  function updateConsegnaDevice(db_used, id_devcons, id_consegna, id_device, note) {
8059
8125
  var query = "";
8060
8126
  if (db_used) {
@@ -8085,6 +8151,7 @@ function removeConsegnaDeviceMySQL(id_devcons){
8085
8151
  query += "and id_device = :id_device";
8086
8152
  return query;
8087
8153
  }
8154
+ // NOT YET USED
8088
8155
  function removeConsegnaDevice(db_used, id_consegna, id_device) {
8089
8156
  var query = "";
8090
8157
  if (db_used) {
@@ -8469,6 +8536,8 @@ function selectDevicePerConsegnaMySQL(id_consegna) {
8469
8536
  query += " where dc.id_consegna = :id_consegna";
8470
8537
  return query;
8471
8538
  }
8539
+
8540
+ // NOT YET USED
8472
8541
  function selectDevicePerConsegna(db_used, id_consegna) {
8473
8542
  var query = "";
8474
8543
  if (db_used) {
@@ -8519,7 +8588,7 @@ function selectDeviceConsegnaMySQL(id_consegna, id_device) {
8519
8588
  return query;
8520
8589
  }
8521
8590
 
8522
-
8591
+ // NOT YET USED
8523
8592
  function selectDeviceConsegna(db_used, id_consegna, id_device) {
8524
8593
  var query = "";
8525
8594
  if (db_used) {
@@ -8682,7 +8751,7 @@ function selectSoftwareConsegnaMySQL(id_consegna, id_software) {
8682
8751
  return query;
8683
8752
  }
8684
8753
 
8685
-
8754
+ // NOT YET USED
8686
8755
  function selectSoftwareConsegna(db_used, id_consegna, id_software) {
8687
8756
  var query = "";
8688
8757
  if (db_used) {
@@ -15286,6 +15355,13 @@ module.exports = {
15286
15355
  queryDocumentsDismissioneIdDevice,
15287
15356
  getDevicesInDismissione,
15288
15357
  //
15358
+ getBeniInLimbo,
15359
+ getBeneInLimboById,
15360
+ getBeneInLimboByIdBene,
15361
+ writeBeneInLimbo,
15362
+ updateBeneInLimbo,
15363
+ deleteBeneInLimbo,
15364
+ //
15289
15365
  assignCategoryFromDB,
15290
15366
  getBeniConsumoByIdDevice,
15291
15367
  queryConsegneByIdDevice,
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.129",
7
+ "version": "3.0.131",
8
8
  "description": "Funzioni per ALSManager",
9
9
  "license": "ISC",
10
10
  "author": "Luca Cattani",