alsmanager_lib 3.0.35 → 3.0.37

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 +72 -3
  2. package/package.json +1 -1
package/lib/modules.js CHANGED
@@ -5745,8 +5745,10 @@ function getDevicesNotAllocatedComboSQLite(id_site, id_place, sel_type, sel_make
5745
5745
  query += "left join device_site ds on d.id = ds.id_device ";
5746
5746
  query += "left join site_destinations sd on ds.id_site = sd.id_site ";
5747
5747
  query += "left join device_consegne dc on d.id = dc.id_device ";
5748
+ query += "left join consegna_bene cb on d.id = cb.id_bene "
5748
5749
  query += "where (d.is_removed is null or d.is_removed = 0) "
5749
5750
  query += "and (dc.id_consegna is null) ";
5751
+ query += "and (cb.id is null or (cb.tipo_bene = 'DEVICE' and cb.stato_restituzione = 2)) ";
5750
5752
  query += "and (ds.id_place is null ";
5751
5753
  query += "or ((ds.date_in <= date('now') and ds.date_out >= date('now') and sd.type = 'MAGAZZINO')) and (ds.id_place <> '" + id_place + "' and ds.id_site <> " + id_site + ")) ";
5752
5754
  if (sel_type_str.trim() != '') {
@@ -5786,8 +5788,10 @@ function getDevicesNotAllocatedComboMySQL(id_site, id_place, sel_type, sel_maker
5786
5788
  query += "left join device_site ds on d.id = ds.id_device ";
5787
5789
  query += "left join site_destinations sd on ds.id_site = sd.id_site ";
5788
5790
  query += "left join device_consegne dc on d.id = dc.id_device ";
5791
+ query += "left join consegna_bene cb on d.id = cb.id_bene "
5789
5792
  query += "where (d.is_removed is null or d.is_removed = 0) "
5790
5793
  query += "and (dc.id_consegna is null) ";
5794
+ query += "and (cb.id is null or (cb.tipo_bene = 'DEVICE' and cb.stato_restituzione = 2)) ";
5791
5795
  query += "and (ds.id_place is null ";
5792
5796
  query += "or ((ds.date_in <= CURDATE() and ds.date_out >= CURDATE() and sd.type = 'MAGAZZINO')) and (ds.id_place <> :id_place and ds.id_site <> :id_site)) ";
5793
5797
  if (sel_type_str.trim() != '') {
@@ -5827,8 +5831,10 @@ function getDevicesNotAllocatedComboMySQL2(id_site, id_place, sel_type, sel_make
5827
5831
  query += "left join device_site ds on d.id = ds.id_device ";
5828
5832
  query += "left join site_destinations sd on ds.id_site = sd.id_site ";
5829
5833
  query += "left join device_consegne dc on d.id = dc.id_device ";
5834
+ query += "left join consegna_bene cb on d.id = cb.id_bene "
5830
5835
  query += "where (d.is_removed is null or d.is_removed = 0) "
5831
5836
  query += "and (dc.id_consegna is null) ";
5837
+ query += "and (cb.id is null or (cb.tipo_bene = 'DEVICE' and cb.stato_restituzione = 2)) ";
5832
5838
  query += "and (ds.id_place is null ";
5833
5839
  query += "or ((ds.date_in <= CURDATE() and ds.date_out >= CURDATE() and sd.type = 'MAGAZZINO')) and (ds.id_place <> '" + id_place + "' and ds.id_site <> " + id_site + ")) ";
5834
5840
  if (sel_type_str.trim() != '') {
@@ -8168,9 +8174,9 @@ function selectSoftwaresInDepositoSQLite(inv_code) {
8168
8174
  query += "else concat(s.id,'(ID)') ";
8169
8175
  query += "end as Codice ";
8170
8176
  query += "from softwares s ";
8171
- query += "left join consegna_beni cb on d.id = cb.id_bene "
8172
- query += "where (inv_ict3_number = '" + inv_code + "' or ";
8173
- query += "serial_no = '" + inv_code + "')";
8177
+ query += "left join consegna_beni cb on s.id = cb.id_bene "
8178
+ query += "where (s.inv_ict3_number = '" + inv_code + "' or ";
8179
+ query += "s.serial_no = '" + inv_code + "')";
8174
8180
  query += "and (cb.id is null or (cb.tipo_bene = 'SOFTWARE' and cb.stato_restituzione = 2))";
8175
8181
  return query;
8176
8182
  }
@@ -8206,6 +8212,68 @@ function selectSoftwaresInDeposito(db_used, inv_code) {
8206
8212
  return query;
8207
8213
  }
8208
8214
 
8215
+ function getSoftwaresNotAllocatedComboSQLite() {
8216
+ var query = "SELECT s.id, s.platform, s.maker as Marca, s.model as Modello, ";
8217
+ query += "case ";
8218
+ query += "when s.no_inventario is not null and s.no_inventario > 0 then concat(s.id, '(ID)', ' - ', s.platform, ' - ', s.maker, ' - ', s.model) ";
8219
+ query += "when s.inv_ict3_number != '' and s.inv_ict3_number is not null then concat(s.inv_ict3_number, ' - ', s.platform, ' - ', s.maker, ' - ', s.model) ";
8220
+ query += "when s.serial_no != '' and s.serial_no is not null then concat(s.serial_no,'(S/N)', ' - ', s.platform, ' - ', s.maker, ' - ', s.model) ";
8221
+ query += "else '' "
8222
+ query += "end as Descrizione ";
8223
+ query += "from Softwares s ";
8224
+ query += "left join consegna_bene cb on s.id = cb.id_bene "
8225
+ query += "where (s.is_removed is null or s.is_removed = 0) "
8226
+ query += "and (cb.id is null or (cb.tipo_bene = 'SOFTWARE' and cb.stato_restituzione = 2)) ";
8227
+ return query;
8228
+ }
8229
+
8230
+ function getSoftwaresNotAllocatedComboMySQL() {
8231
+ var query = "SELECT s.id, s.platform, s.maker as Marca, s.model as Modello, ";
8232
+ query += "case ";
8233
+ query += "when s.no_inventario is not null and s.no_inventario > 0 then concat(s.id, '(ID)', ' - ', s.platform, ' - ', s.maker, ' - ', s.model) ";
8234
+ query += "when s.inv_ict3_number != '' and s.inv_ict3_number is not null then concat(s.inv_ict3_number, ' - ', s.platform, ' - ', s.maker, ' - ', s.model) ";
8235
+ query += "when s.serial_no != '' and s.serial_no is not null then concat(s.serial_no,'(S/N)', ' - ', s.platform, ' - ', s.maker, ' - ', s.model) ";
8236
+ query += "else '' "
8237
+ query += "end as Descrizione ";
8238
+ query += "from Softwares s ";
8239
+ query += "left join consegna_bene cb on s.id = cb.id_bene "
8240
+ query += "where (s.is_removed is null or s.is_removed = 0) "
8241
+ query += "and (cb.id is null or (cb.tipo_bene = 'SOFTWARE' and cb.stato_restituzione = 2)) ";
8242
+ return query;
8243
+ }
8244
+
8245
+ function getSoftwaresNotAllocatedComboMySQL2() {
8246
+ var query = "SELECT s.id, s.platform, s.maker as Marca, s.model as Modello, ";
8247
+ query += "case ";
8248
+ query += "when s.no_inventario is not null and s.no_inventario > 0 then concat(s.id, '(ID)', ' - ', s.platform, ' - ', s.maker, ' - ', s.model) ";
8249
+ query += "when s.inv_ict3_number != '' and s.inv_ict3_number is not null then concat(s.inv_ict3_number, ' - ', s.platform, ' - ', s.maker, ' - ', s.model) ";
8250
+ query += "when s.serial_no != '' and s.serial_no is not null then concat(s.serial_no,'(S/N)', ' - ', s.platform, ' - ', s.maker, ' - ', s.model) ";
8251
+ query += "else '' "
8252
+ query += "end as Descrizione ";
8253
+ query += "from Softwares s ";
8254
+ query += "left join consegna_bene cb on s.id = cb.id_bene "
8255
+ query += "where (s.is_removed is null or s.is_removed = 0) "
8256
+ query += "and (cb.id is null or (cb.tipo_bene = 'SOFTWARE' and cb.stato_restituzione = 2)) ";
8257
+ return query;
8258
+ }
8259
+
8260
+ function getSoftwaresNotAllocatedCombo(db_used) {
8261
+ var query = "";
8262
+ if (db_used) {
8263
+ switch (db_used) {
8264
+ case 'SQLITE':
8265
+ query = getSoftwaresNotAllocatedComboSQLite();
8266
+ break;
8267
+ case 'MYSQL':
8268
+ query = getSoftwaresNotAllocatedComboMySQL();
8269
+ break;
8270
+ case 'MYSQL2':
8271
+ query = getSoftwaresNotAllocatedComboMySQL2();
8272
+ break;
8273
+ }
8274
+ }
8275
+ return query;
8276
+ }
8209
8277
 
8210
8278
  //get connection types
8211
8279
  function getConnectionTypesSQLite() {
@@ -14080,6 +14148,7 @@ module.exports = {
14080
14148
  selectSoftwarePerConsegna,
14081
14149
  selectSoftwareConsegna,
14082
14150
  selectSoftwaresInDeposito,
14151
+ getSoftwaresNotAllocatedCombo,
14083
14152
  //
14084
14153
  selectDeviceInDeposito,
14085
14154
  queryDeviceStatusCombo,
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.35",
7
+ "version": "3.0.37",
8
8
  "description": "Funzioni per ALSManager",
9
9
  "license": "ISC",
10
10
  "author": "Luca Cattani",