alsmanager_lib 3.0.23 → 3.0.25
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.
- package/lib/modules.js +350 -12
- package/package.json +1 -1
package/lib/modules.js
CHANGED
|
@@ -1225,7 +1225,7 @@ function getVoIPDevices() {
|
|
|
1225
1225
|
// End manage Voip
|
|
1226
1226
|
// Software management
|
|
1227
1227
|
function getSoftwares(db_used, maker, model, platform, licence_type) {
|
|
1228
|
-
var query = "select id, maker, model, support, platform, release_year, version, build_no, licence_type, licence_key, expired_date, is_pnrr, inv_ict3_number, serial_no ";
|
|
1228
|
+
var query = "select id, maker, model, support, platform, release_year, version, build_no, licence_type, licence_key, expired_date, is_pnrr, inv_ict3_number, serial_no, architettura ";
|
|
1229
1229
|
query += "from softwares ";
|
|
1230
1230
|
query += "where (is_removed is null or is_removed = 0) ";
|
|
1231
1231
|
if (maker) {
|
|
@@ -1243,21 +1243,21 @@ function getSoftwares(db_used, maker, model, platform, licence_type) {
|
|
|
1243
1243
|
return query;
|
|
1244
1244
|
}
|
|
1245
1245
|
function getSoftwareByCodice(db_used, codice) {
|
|
1246
|
-
var query = "select id, maker, model, support, platform, release_year, version, build_no, licence_type, licence_key, expired_date, is_pnrr, inv_ict3_number, serial_no ";
|
|
1246
|
+
var query = "select id, maker, model, support, platform, release_year, version, build_no, licence_type, licence_key, expired_date, is_pnrr, inv_ict3_number, serial_no, architettura ";
|
|
1247
1247
|
query += "from softwares ";
|
|
1248
1248
|
query += "where (is_removed is null or is_removed = 0) ";
|
|
1249
1249
|
query += "and inv_ict3_number = '" + codice + "' or serial_no = '" + codice + "'";
|
|
1250
1250
|
return query;
|
|
1251
1251
|
}
|
|
1252
1252
|
function getSoftwareById(db_used, id_sw) {
|
|
1253
|
-
var query = "select id, maker, model, support, platform, release_year, version, build_no, licence_type, licence_key, expired_date, is_pnrr, inv_ict3_number, serial_no ";
|
|
1253
|
+
var query = "select id, maker, model, support, platform, release_year, version, build_no, licence_type, licence_key, expired_date, is_pnrr, inv_ict3_number, serial_no, architettura ";
|
|
1254
1254
|
query += "from softwares ";
|
|
1255
1255
|
query += "where (is_removed is null or is_removed = 0) ";
|
|
1256
1256
|
query += "and id = " + id_sw;
|
|
1257
1257
|
return query;
|
|
1258
1258
|
}
|
|
1259
1259
|
function insertSoftware(db_used, software) {
|
|
1260
|
-
var query = "insert into softwares (maker, model, support, platform, release_year, version, build_no, licence_type, licence_key, expired_date, is_pnrr, inv_ict3_number, serial_no) values (";
|
|
1260
|
+
var query = "insert into softwares (maker, model, support, platform, release_year, version, build_no, licence_type, licence_key, expired_date, is_pnrr, inv_ict3_number, serial_no, architettura) values (";
|
|
1261
1261
|
query += "'" + software.marca + "', ";
|
|
1262
1262
|
query += "'" + software.modello + "', ";
|
|
1263
1263
|
query += "'" + software.supporto + "', ";
|
|
@@ -1270,7 +1270,8 @@ function insertSoftware(db_used, software) {
|
|
|
1270
1270
|
query += "'" + software.data_scadenza + "', ";
|
|
1271
1271
|
query += software.is_pnrr + ", ";
|
|
1272
1272
|
query += "'" + software.inventario + "', ";
|
|
1273
|
-
query += "'" + software.serial_no + "'";
|
|
1273
|
+
query += "'" + software.serial_no + "', ";
|
|
1274
|
+
query += "'" + software.architettura + "', ";
|
|
1274
1275
|
query += ")";
|
|
1275
1276
|
return query;
|
|
1276
1277
|
}
|
|
@@ -1289,7 +1290,8 @@ function updateSoftware(db_used, id_sw, software) {
|
|
|
1289
1290
|
query += "expired_date = '" + software.data_scadenza + "', ";
|
|
1290
1291
|
query += "is_pnrr = " + software.is_pnrr + ", ";
|
|
1291
1292
|
query += "inv_ict3_number = '" + software.inventario + "', ";
|
|
1292
|
-
query += "serial_no = '" + software.serial_no + "' ";
|
|
1293
|
+
query += "serial_no = '" + software.serial_no + "', ";
|
|
1294
|
+
query += "architettura = '" + software.architettura + "' ";
|
|
1293
1295
|
query += "where id = " + id_sw;
|
|
1294
1296
|
return query;
|
|
1295
1297
|
}
|
|
@@ -6646,7 +6648,7 @@ function getLastGestioneDeviceByIdDevice(db_used,id_device, date_ref) {
|
|
|
6646
6648
|
}
|
|
6647
6649
|
|
|
6648
6650
|
function queryConsegneSQLite(data_da, data_a, data_filter) {
|
|
6649
|
-
var query = "SELECT id, data_richiesta as Richiesta, data_consegna as Consegna, richiedente_adulto as Adulto, richiedente_alunno as Alunno, richiedente_genitore as Genitore, is_home as Casa, note as Note from consegne";
|
|
6651
|
+
var query = "SELECT id, data_richiesta as Richiesta, data_consegna as Consegna, richiedente_adulto as Adulto, richiedente_alunno as Alunno, richiedente_genitore as Genitore, is_home as Casa, note as Note, email_adulto, email_genitore from consegne";
|
|
6650
6652
|
query += " where (removed is null or removed = 0) ";
|
|
6651
6653
|
if (data_da || data_a) {
|
|
6652
6654
|
query += " and ";
|
|
@@ -6678,7 +6680,7 @@ function queryConsegneSQLite(data_da, data_a, data_filter) {
|
|
|
6678
6680
|
}
|
|
6679
6681
|
|
|
6680
6682
|
function queryConsegneMySQL(data_da, data_a, data_filter) {
|
|
6681
|
-
var query = "SELECT id, data_richiesta as Richiesta, data_consegna as Consegna, richiedente_adulto as Adulto, richiedente_alunno as Alunno, richiedente_genitore as Genitore, is_home as Casa, note as Note from consegne";
|
|
6683
|
+
var query = "SELECT id, data_richiesta as Richiesta, data_consegna as Consegna, richiedente_adulto as Adulto, richiedente_alunno as Alunno, richiedente_genitore as Genitore, is_home as Casa, note as Note, email_adulto, email_genitore from consegne";
|
|
6682
6684
|
query += " where (removed is null or removed = 0) ";
|
|
6683
6685
|
if (data_da || data_a) {
|
|
6684
6686
|
query += " and ";
|
|
@@ -6758,6 +6760,8 @@ function queryConsegnaById(db_used,id_consegna) {
|
|
|
6758
6760
|
return query;
|
|
6759
6761
|
}
|
|
6760
6762
|
|
|
6763
|
+
|
|
6764
|
+
// Beni in consegna
|
|
6761
6765
|
function queryConsegneByIdDeviceSQLite(id_device) {
|
|
6762
6766
|
var query = "select c.data_consegna as Consegna, ";
|
|
6763
6767
|
query += "case ";
|
|
@@ -6808,6 +6812,59 @@ function queryConsegneByIdDevice(db_used, id_device) {
|
|
|
6808
6812
|
return query;
|
|
6809
6813
|
}
|
|
6810
6814
|
|
|
6815
|
+
//
|
|
6816
|
+
function queryConsegneByIdBeneSQLite(id_bene, tipo_bene) {
|
|
6817
|
+
var query = "select c.data_consegna as Consegna, ";
|
|
6818
|
+
query += "case ";
|
|
6819
|
+
query += "when c.stato_restituzione = 0 then 'Prestito in corso' ";
|
|
6820
|
+
query += "when c.stato_restituzione = 1 then 'Non restituito' ";
|
|
6821
|
+
query += "when c.stato_restituzione = 2 then 'Restituito' ";
|
|
6822
|
+
query += "when c.stato_restituzione = 3 then 'Danneggiato' ";
|
|
6823
|
+
query += "when c.stato_restituzione = 4 then 'Parti mancanti' ";
|
|
6824
|
+
query += "else '' ";
|
|
6825
|
+
query += "end as Stato, ";
|
|
6826
|
+
query += "c.note as Note from consegna beni ";
|
|
6827
|
+
query += "inner join consegne c on c.id = dc.id_consegna ";
|
|
6828
|
+
query += "where cb.id_bene = " + id_bene + " ";
|
|
6829
|
+
query += "and cb.tipo_bene = '" + tipo_bene + "' ";
|
|
6830
|
+
return query;
|
|
6831
|
+
}
|
|
6832
|
+
|
|
6833
|
+
function queryConsegneByIdBeneMySQL(id_bene, tipo_bene) {
|
|
6834
|
+
var query = "select c.data_consegna as Consegna, ";
|
|
6835
|
+
query += "case ";
|
|
6836
|
+
query += "when c.stato_restituzione = 0 then 'Prestito in corso' ";
|
|
6837
|
+
query += "when c.stato_restituzione = 1 then 'Non restituito' ";
|
|
6838
|
+
query += "when c.stato_restituzione = 2 then 'Restituito' ";
|
|
6839
|
+
query += "when c.stato_restituzione = 3 then 'Danneggiato' ";
|
|
6840
|
+
query += "when c.stato_restituzione = 4 then 'Parti mancanti' ";
|
|
6841
|
+
query += "else '' ";
|
|
6842
|
+
query += "end as Stato, ";
|
|
6843
|
+
query += "c.note as Note from consegna_beni cb ";
|
|
6844
|
+
query += "inner join consegne c on c.id = cb.id_consegna ";
|
|
6845
|
+
query += "where cb.id_bene = :id_bene and cb.tipo_bene = :tipo_bene";
|
|
6846
|
+
return query;
|
|
6847
|
+
}
|
|
6848
|
+
|
|
6849
|
+
function queryConsegneByIdBene(db_used, id_bene, tipo_bene) {
|
|
6850
|
+
var query = "";
|
|
6851
|
+
if (db_used) {
|
|
6852
|
+
switch (db_used) {
|
|
6853
|
+
case 'SQLITE':
|
|
6854
|
+
query = queryConsegneByIdBeneSQLite(id_bene, tipo_bene);
|
|
6855
|
+
break;
|
|
6856
|
+
case 'MYSQL':
|
|
6857
|
+
query = queryConsegneByIdBeneMySQL(id_bene, tipo_bene);
|
|
6858
|
+
break;
|
|
6859
|
+
case 'MYSQL2':
|
|
6860
|
+
query = queryConsegneByIdBeneSQLite(id_bene, tipo_bene);
|
|
6861
|
+
break;
|
|
6862
|
+
}
|
|
6863
|
+
}
|
|
6864
|
+
return query;
|
|
6865
|
+
}
|
|
6866
|
+
|
|
6867
|
+
|
|
6811
6868
|
|
|
6812
6869
|
function queryDeviceStatusCombo() {
|
|
6813
6870
|
var query = "SELECT id, name from status_description order by id";
|
|
@@ -7159,6 +7216,8 @@ function createConsegnaObj(consegna) {
|
|
|
7159
7216
|
consegnaObj.alunno = "";
|
|
7160
7217
|
consegnaObj.genitore = "";
|
|
7161
7218
|
consegnaObj.note = "";
|
|
7219
|
+
consegnaObj.email_adulto = "";
|
|
7220
|
+
consegnaObj.email_genitore = "";
|
|
7162
7221
|
consegnaObj.is_home = 0;
|
|
7163
7222
|
consegnaObj.stato_res = 0;
|
|
7164
7223
|
consegnaObj.data_ric_str = "";
|
|
@@ -7205,6 +7264,10 @@ function createConsegnaObj(consegna) {
|
|
|
7205
7264
|
consegnaObj.is_home = consegna.is_home;
|
|
7206
7265
|
if (consegna.note)
|
|
7207
7266
|
consegnaObj.note = consegna.note;
|
|
7267
|
+
if (consegna.email_adulto)
|
|
7268
|
+
consegnaObj.email_adulto = consegna.email_adulto;
|
|
7269
|
+
if (consegna.email_genitore)
|
|
7270
|
+
consegnaObj.email_genitore = consegna.email_genitore;
|
|
7208
7271
|
}
|
|
7209
7272
|
return consegnaObj;
|
|
7210
7273
|
}
|
|
@@ -7217,6 +7280,8 @@ function createConsegnaMySQLObj(consegna) {
|
|
|
7217
7280
|
consegnaMySQLObj.genitore = consegnaObj.genitore;
|
|
7218
7281
|
consegnaMySQLObj.alunno = consegnaObj.alunno;
|
|
7219
7282
|
consegnaMySQLObj.note = consegnaObj.note;
|
|
7283
|
+
consegnaMySQLObj.email_adulto = consegnaObj.email_adulto;
|
|
7284
|
+
consegnaMySQLObj.email_genitore = consegnaObj.email_genitore;
|
|
7220
7285
|
consegnaMySQLObj.is_home = consegnaObj.is_home;
|
|
7221
7286
|
consegnaMySQLObj.stato_res = consegnaObj.stato_res;
|
|
7222
7287
|
consegnaMySQLObj.data_ric_str = consegnaObj.data_ric_str;
|
|
@@ -7234,7 +7299,7 @@ function insertConsegnaSQLite(consegna) {
|
|
|
7234
7299
|
var consegnaObj = createConsegnaObj(consegna);
|
|
7235
7300
|
if (consegnaObj) {
|
|
7236
7301
|
query = "insert into consegne ";
|
|
7237
|
-
query += "(data_richiesta, data_consegna, stato_restituzione, data_rientro, richiedente_adulto, richiedente_alunno, richiedente_genitore, id_place, id_site, is_home, note) ";
|
|
7302
|
+
query += "(data_richiesta, data_consegna, stato_restituzione, data_rientro, richiedente_adulto, richiedente_alunno, richiedente_genitore, id_place, id_site, is_home, note, email_adulto, email_genitore) ";
|
|
7238
7303
|
query += " values ('" + consegnaObj.data_ric_str + "',";
|
|
7239
7304
|
query += "'" + consegnaObj.data_cons_str + "',";
|
|
7240
7305
|
query += consegnaObj.stato_res + ",";
|
|
@@ -7245,7 +7310,9 @@ function insertConsegnaSQLite(consegna) {
|
|
|
7245
7310
|
query += "'" + consegnaObj.id_place + "',";
|
|
7246
7311
|
query += consegnaObj.id_site + ",";
|
|
7247
7312
|
query += consegnaObj.is_home + ",";
|
|
7248
|
-
query += "'" + consegnaObj.note + "'
|
|
7313
|
+
query += "'" + consegnaObj.note + "', ";
|
|
7314
|
+
query += "'" + consegnaObj.email_adulto + "', ";
|
|
7315
|
+
query += "'" + consegnaObj.email_genitore + "')";
|
|
7249
7316
|
}
|
|
7250
7317
|
return query;
|
|
7251
7318
|
}
|
|
@@ -7254,7 +7321,7 @@ function insertConsegnaMySQL(consegnaObj) {
|
|
|
7254
7321
|
var query = "";
|
|
7255
7322
|
if (consegnaObj) {
|
|
7256
7323
|
query = "insert into consegne ";
|
|
7257
|
-
query += "(data_richiesta, data_consegna, stato_restituzione, data_rientro, richiedente_adulto, richiedente_alunno, richiedente_genitore, id_place, id_site, is_home, note) ";
|
|
7324
|
+
query += "(data_richiesta, data_consegna, stato_restituzione, data_rientro, richiedente_adulto, richiedente_alunno, richiedente_genitore, id_place, id_site, is_home, note, email_adulto, email_genitore) ";
|
|
7258
7325
|
query += " values (:data_ric_str,";
|
|
7259
7326
|
query += ":data_cons_str,";
|
|
7260
7327
|
query += ":stato_res,";
|
|
@@ -7265,7 +7332,9 @@ function insertConsegnaMySQL(consegnaObj) {
|
|
|
7265
7332
|
query += ":id_place,";
|
|
7266
7333
|
query += ":id_site,";
|
|
7267
7334
|
query += ":is_home,";
|
|
7268
|
-
query += ":note
|
|
7335
|
+
query += ":note,";
|
|
7336
|
+
query += ":email_adulto,";
|
|
7337
|
+
query += ":email_genitore)";
|
|
7269
7338
|
}
|
|
7270
7339
|
return query;
|
|
7271
7340
|
}
|
|
@@ -7311,6 +7380,8 @@ function updateConsegnaSQLite(consegna) {
|
|
|
7311
7380
|
query += ", is_home = " + consegnaObj.is_home;
|
|
7312
7381
|
if (consegnaObj.note.trim() != '')
|
|
7313
7382
|
query += ", note = '" + consegnaObj.note + "'";
|
|
7383
|
+
query += ", email_adulto = '" + consegnaObj.email_adulto + "'";
|
|
7384
|
+
query += ", email_genitore = '" + consegnaObj.email_genitore + "'";
|
|
7314
7385
|
query += " where id = " + consegnaObj.id;
|
|
7315
7386
|
}
|
|
7316
7387
|
return query;
|
|
@@ -7339,6 +7410,8 @@ function updateConsegnaMySQL(consegna) {
|
|
|
7339
7410
|
query += ", is_home = :is_home ";
|
|
7340
7411
|
if (consegnaObj.note.trim() != '')
|
|
7341
7412
|
query += ", note = :note ";
|
|
7413
|
+
query += ", email_adulto = :email_adulto";
|
|
7414
|
+
query += ", email_genitore = :email_genitore";
|
|
7342
7415
|
query += " where id = :id ";
|
|
7343
7416
|
}
|
|
7344
7417
|
return query;
|
|
@@ -7519,6 +7592,266 @@ function removeConsegnaDevice(db_used, id_consegna, id_device) {
|
|
|
7519
7592
|
}
|
|
7520
7593
|
return query;
|
|
7521
7594
|
}
|
|
7595
|
+
// Consegna beni
|
|
7596
|
+
function insertConsegnaBeneSQLite(id_consegna, id_bene, tipo_bene, data_consegna, numero, note){
|
|
7597
|
+
var query = "insert into consegna_beni (id_consegna, id_bene, tipo_bene, data_consegna, numero, stato_restituzione, note_consegna) values ";
|
|
7598
|
+
query += "(" + id_consegna + ", ";
|
|
7599
|
+
query += id_bene + ", ";
|
|
7600
|
+
query += "'" + tipo_bene + "', ";
|
|
7601
|
+
query += "'" + data_consegna + "', ";
|
|
7602
|
+
query += numero + ", "
|
|
7603
|
+
query += "0, "
|
|
7604
|
+
query += "'" + note + "'";
|
|
7605
|
+
query += ")";
|
|
7606
|
+
return query;
|
|
7607
|
+
}
|
|
7608
|
+
|
|
7609
|
+
function insertConsegnaBeneMySQL(id_consegna, id_bene, tipo_bene, data_consegna, numero, note){
|
|
7610
|
+
var query = "insert into consegna_beni (id_consegna, id_bene, tipo_bene, data_consegna, numero, stato_restituzione, note_consegna) values ";
|
|
7611
|
+
query += "(:id_consegna, ";
|
|
7612
|
+
query += ":id_bene, ";
|
|
7613
|
+
query += ":tipo_bene, ";
|
|
7614
|
+
query += ":data_consegna, ";
|
|
7615
|
+
query += ":numero, ";
|
|
7616
|
+
query += "0, ";
|
|
7617
|
+
query += ":note ";
|
|
7618
|
+
query += ")";
|
|
7619
|
+
return query;
|
|
7620
|
+
}
|
|
7621
|
+
|
|
7622
|
+
function insertConsegnaBene(db_used, id_consegna, id_bene, tipo_bene, data_consegna, numero, note) {
|
|
7623
|
+
var query = "";
|
|
7624
|
+
if (db_used) {
|
|
7625
|
+
switch (db_used) {
|
|
7626
|
+
case 'SQLITE':
|
|
7627
|
+
query = insertConsegnaBeneSQLite(id_consegna, id_bene, tipo_bene, data_consegna, numero, note);
|
|
7628
|
+
break;
|
|
7629
|
+
case 'MYSQL':
|
|
7630
|
+
query = insertConsegnaBeneMySQL(id_consegna, id_bene, tipo_bene, data_consegna, numero, note);
|
|
7631
|
+
break;
|
|
7632
|
+
case 'MYSQL2':
|
|
7633
|
+
query = insertConsegnaBeneSQLite(id_consegna, id_bene, tipo_bene, data_consegna, numero, note);
|
|
7634
|
+
break;
|
|
7635
|
+
}
|
|
7636
|
+
}
|
|
7637
|
+
return query;
|
|
7638
|
+
}
|
|
7639
|
+
|
|
7640
|
+
function updateConsegnaBeneSQLite(id_benecons, id_consegna, id_bene, tipo_bene, data_consegna, numero, note){
|
|
7641
|
+
var query = "update consegna_beni set ";
|
|
7642
|
+
query += "id_consegna = " + id_consegna + ", ";
|
|
7643
|
+
query += "id_bene = " + id_bene + ", ";
|
|
7644
|
+
query += "tipo_bene = '" + tipo_bene + "', ";
|
|
7645
|
+
query += "data_consegna = '" + data_consegna + "', ";
|
|
7646
|
+
query += "numero = " + numero + ", ";
|
|
7647
|
+
query += "note = '" + note + "' ";
|
|
7648
|
+
query += "where id = " + id_benecons;
|
|
7649
|
+
return query;
|
|
7650
|
+
}
|
|
7651
|
+
|
|
7652
|
+
function updateConsegnaBeneMySQL(id_benecons, id_consegna, id_bene, tipo_bene, data_consegna, numero, note){
|
|
7653
|
+
var query = "update consegna_beni set ";
|
|
7654
|
+
query += "id_consegna = :id_consegna, ";
|
|
7655
|
+
query += "id_bene = :id_bene, ";
|
|
7656
|
+
query += "tipo_bene = :tipo_bene, ";
|
|
7657
|
+
query += "data_consegna = :data_consegna, ";
|
|
7658
|
+
query += "numero = :numero, ";
|
|
7659
|
+
query += "note = :note ";
|
|
7660
|
+
query += "where id = :id_benecons";
|
|
7661
|
+
return query;
|
|
7662
|
+
}
|
|
7663
|
+
|
|
7664
|
+
function updateConsegnaBene(db_used, id_benecons, id_consegna, id_bene, tipo_bene, data_consegna, numero, note) {
|
|
7665
|
+
var query = "";
|
|
7666
|
+
if (db_used) {
|
|
7667
|
+
switch (db_used) {
|
|
7668
|
+
case 'SQLITE':
|
|
7669
|
+
query = updateConsegnaBeneSQLite(id_benecons, id_consegna, id_bene, tipo_bene, data_consegna, numero, note);
|
|
7670
|
+
break;
|
|
7671
|
+
case 'MYSQL':
|
|
7672
|
+
query = updateConsegnaBeneMySQL(id_benecons, id_consegna, id_bene, tipo_bene, data_consegna, numero, note);
|
|
7673
|
+
break;
|
|
7674
|
+
case 'MYSQL2':
|
|
7675
|
+
query = updateConsegnaBeneSQLite(id_benecons, id_consegna, id_bene, tipo_bene, data_consegna, numero, note);
|
|
7676
|
+
break;
|
|
7677
|
+
}
|
|
7678
|
+
}
|
|
7679
|
+
return query;
|
|
7680
|
+
}
|
|
7681
|
+
|
|
7682
|
+
function removeConsegnaBeneSQLite(id_benecons){
|
|
7683
|
+
var query = "DELETE from consegna_beni ";
|
|
7684
|
+
query += "where id = " + id_benecons;
|
|
7685
|
+
return query;
|
|
7686
|
+
}
|
|
7687
|
+
function removeConsegnaBeneMySQL(id_benecons){
|
|
7688
|
+
var query = "DELETE from consegna_beni ";
|
|
7689
|
+
query += "where id = :id_benecons";
|
|
7690
|
+
return query;
|
|
7691
|
+
}
|
|
7692
|
+
function removeConsegnaBene(db_used, id_benecons) {
|
|
7693
|
+
var query = "";
|
|
7694
|
+
if (db_used) {
|
|
7695
|
+
switch (db_used) {
|
|
7696
|
+
case 'SQLITE':
|
|
7697
|
+
query = removeConsegnaBeneSQLite(id_benecons);
|
|
7698
|
+
break;
|
|
7699
|
+
case 'MYSQL':
|
|
7700
|
+
query = removeConsegnaBeneMySQL(id_benecons);
|
|
7701
|
+
break;
|
|
7702
|
+
case 'MYSQL2':
|
|
7703
|
+
query = removeConsegnaBeneSQLite(id_benecons);
|
|
7704
|
+
break;
|
|
7705
|
+
}
|
|
7706
|
+
}
|
|
7707
|
+
return query;
|
|
7708
|
+
}
|
|
7709
|
+
function selectBeniPerConsegnaSQLite(id_consegna) {
|
|
7710
|
+
var query = "select cb.id_bene as id, cb.numero as Numero, cb.tipo_bene as Tipologia, ";
|
|
7711
|
+
query += "case ";
|
|
7712
|
+
query += "when cd.tipo_bene = 'DEVICE' then d.type ";
|
|
7713
|
+
query += "when cd.tipo_bene = 'SOFTWARE' then s.type ";
|
|
7714
|
+
query += "when cd.tipo_bene = 'BENE_CONSUMO' then bc.type ";
|
|
7715
|
+
query += "when cd.tipo_bene = 'ALTRO' then a.type ";
|
|
7716
|
+
query += "else '' "
|
|
7717
|
+
query += "end as Tipo, ";
|
|
7718
|
+
query += "case ";
|
|
7719
|
+
query += "when cd.tipo_bene = 'DEVICE' then d.manifacturer ";
|
|
7720
|
+
query += "when cd.tipo_bene = 'SOFTWARE' then s.maker ";
|
|
7721
|
+
query += "when cd.tipo_bene = 'BENE_CONSUMO' then bc.Marca ";
|
|
7722
|
+
query += "when cd.tipo_bene = 'ALTRO' then a.manifacturer ";
|
|
7723
|
+
query += "else '' "
|
|
7724
|
+
query += "end as Marca, ";
|
|
7725
|
+
query += "case ";
|
|
7726
|
+
query += "when cd.tipo_bene = 'DEVICE' then d.model ";
|
|
7727
|
+
query += "when cd.tipo_bene = 'SOFTWARE' then s.model ";
|
|
7728
|
+
query += "when cd.tipo_bene = 'BENE_CONSUMO' then bc.Modello ";
|
|
7729
|
+
query += "when cd.tipo_bene = 'ALTRO' then a.model ";
|
|
7730
|
+
query += "else '' "
|
|
7731
|
+
query += "end as Modello, ";
|
|
7732
|
+
query += "case ";
|
|
7733
|
+
query += "when cd.tipo_bene = 'DEVICE' and d.inv_ict3_number != '' and d.inv_ict3_number is not null then d.inv_ict3_number ";
|
|
7734
|
+
query += "when cd.tipo_bene = 'DEVICE' and d.inv_pnrr_number != '' and d.inv_pnrr_number is not null then d.inv_pnrr_number ";
|
|
7735
|
+
query += "when cd.tipo_bene = 'DEVICE' and when d.inv_tn_number != '' and d.inv_tn_number is not null then concat(d.inv_tn_number,'(TN)') ";
|
|
7736
|
+
query += "when cd.tipo_bene = 'DEVICE' and d.inv_tndigit_number != '' and d.inv_tndigit_number is not null then concat(d.inv_tndigit_number,'(TNDigit)') ";
|
|
7737
|
+
query += "when cd.tipo_bene = 'DEVICE' and d.serial_no != '' and d.serial_no is not null then concat(d.serial_no,'(S/N)') ";
|
|
7738
|
+
//
|
|
7739
|
+
query += "when cd.tipo_bene = 'SOFTWARE' and s.inv_ict3_number != '' and s.inv_ict3_number is not null then s.inv_ict3_number ";
|
|
7740
|
+
query += "when cd.tipo_bene = 'SOFTWARE' and s.serial_no != '' and s.serial_no is not null then concat(s.serial_no,'(S/N)') ";
|
|
7741
|
+
//
|
|
7742
|
+
// Temporaneamente non considerato
|
|
7743
|
+
//query += "when cd.tipo_bene = 'BENE_CONSUMO' and d.inv_ict3_number != '' and d.inv_ict3_number is not null then d.inv_ict3_number ";
|
|
7744
|
+
//query += "when cd.tipo_bene = 'BENE_CONSUMO' and d.serial_no != '' and d.serial_no is not null then concat(d.serial_no,'(S/N)') ";
|
|
7745
|
+
//
|
|
7746
|
+
//query += "when cd.tipo_bene = 'SOFTWARE' and d.inv_ict3_number != '' and d.inv_ict3_number is not null then d.inv_ict3_number ";
|
|
7747
|
+
//query += "when cd.tipo_bene = 'SOFTWARE' and d.serial_no != '' and d.serial_no is not null then concat(d.serial_no,'(S/N)') ";
|
|
7748
|
+
//
|
|
7749
|
+
query += "end as Codice, ";
|
|
7750
|
+
query += "case ";
|
|
7751
|
+
query += "when cd.tipo_bene = 'DEVICE' and trim(d.inv_pnrr_number) is null then '' ";
|
|
7752
|
+
query += "when cd.tipo_bene = 'DEVICE' and trim(d.inv_pnrr_number) = '' then '' ";
|
|
7753
|
+
query += "else 'SI' ";
|
|
7754
|
+
query += "end as PNRR, cb.note_consegna as Note_cons ";
|
|
7755
|
+
query += " from consegna_beni cb";
|
|
7756
|
+
query += " left join devices d on cb.id_bene = d.id";
|
|
7757
|
+
query += " left join softwares s on cb.id_bene = s.id";
|
|
7758
|
+
query += " left join beni_consumo bc on cb.id_bene = bc.id";
|
|
7759
|
+
query += " where cb.id_consegna = " + id_consegna;
|
|
7760
|
+
return query;
|
|
7761
|
+
}
|
|
7762
|
+
|
|
7763
|
+
function selectBeniPerConsegnaMySQL(id_consegna) {
|
|
7764
|
+
var query = "select d.id, d.type as Tipo, d.manifacturer as Marca, d.model as Modello, ";
|
|
7765
|
+
query += "case ";
|
|
7766
|
+
query += "when d.inv_ict3_number != '' and d.inv_ict3_number is not null then d.inv_ict3_number ";
|
|
7767
|
+
query += "when d.inv_pnrr_number != '' and d.inv_pnrr_number is not null then d.inv_pnrr_number ";
|
|
7768
|
+
query += "when d.inv_tn_number != '' and d.inv_tn_number is not null then concat(d.inv_tn_number,'(TN)') ";
|
|
7769
|
+
query += "when d.inv_tndigit_number != '' and d.inv_tndigit_number is not null then concat(d.inv_tndigit_number,'(TNDigit)') ";
|
|
7770
|
+
query += "when d.serial_no != '' and d.serial_no is not null then concat(d.serial_no,'(S/N)') ";
|
|
7771
|
+
query += "end as Codice, ";
|
|
7772
|
+
query += "case ";
|
|
7773
|
+
query += "when trim(d.inv_pnrr_number) is null then '' ";
|
|
7774
|
+
query += "when trim(d.inv_pnrr_number) = '' then '' ";
|
|
7775
|
+
query += "else 'SI' ";
|
|
7776
|
+
query += "end as PNRR, dc.note as Note_cons ";
|
|
7777
|
+
query += " from devices d";
|
|
7778
|
+
query += " left join device_consegne dc on dc.id_device = d.id";
|
|
7779
|
+
query += " where dc.id_consegna = :id_consegna";
|
|
7780
|
+
return query;
|
|
7781
|
+
}
|
|
7782
|
+
function selectBeniPerConsegna(db_used, id_consegna) {
|
|
7783
|
+
var query = "";
|
|
7784
|
+
if (db_used) {
|
|
7785
|
+
switch (db_used) {
|
|
7786
|
+
case 'SQLITE':
|
|
7787
|
+
query = selectBeniPerConsegnaSQLite(id_consegna);
|
|
7788
|
+
break;
|
|
7789
|
+
case 'MYSQL':
|
|
7790
|
+
query = selectBeniPerConsegnaMySQL(id_consegna);
|
|
7791
|
+
break;
|
|
7792
|
+
case 'MYSQL2':
|
|
7793
|
+
query = selectBeniPerConsegnaSQLite(id_consegna);
|
|
7794
|
+
break;
|
|
7795
|
+
}
|
|
7796
|
+
}
|
|
7797
|
+
return query;
|
|
7798
|
+
}
|
|
7799
|
+
|
|
7800
|
+
function selectDeviceConsegnaSQLite(id_consegna, id_device) {
|
|
7801
|
+
var query = "select dc.id as id_dev_cons, d.id, d.type, d.manifacturer, d.model, ";
|
|
7802
|
+
query += "case ";
|
|
7803
|
+
query += "when d.inv_ict3_number != '' and d.inv_ict3_number is not null then d.inv_ict3_number ";
|
|
7804
|
+
query += "when d.inv_pnrr_number != '' and d.inv_pnrr_number is not null then d.inv_pnrr_number ";
|
|
7805
|
+
query += "when d.inv_tn_number != '' and d.inv_tn_number is not null then concat(d.inv_tn_number,'(TN)') ";
|
|
7806
|
+
query += "when d.inv_tndigit_number != '' and d.inv_tndigit_number is not null then concat(d.inv_tndigit_number,'(TNDigit)') ";
|
|
7807
|
+
query += "when d.serial_no != '' and d.serial_no is not null then concat(d.serial_no,'(S/N)') ";
|
|
7808
|
+
query += "end as codice ";
|
|
7809
|
+
query += ", dc.note as note_cons from device_consegne dc";
|
|
7810
|
+
query += " join devices d on d.id = dc.id_device";
|
|
7811
|
+
query += " where dc.id_consegna = " + id_consegna;
|
|
7812
|
+
query += " and d.id = " + id_device;
|
|
7813
|
+
return query;
|
|
7814
|
+
}
|
|
7815
|
+
|
|
7816
|
+
function selectDeviceConsegnaMySQL(id_consegna, id_device) {
|
|
7817
|
+
var query = "select dc.id as id_dev_cons, d.id, d.type, d.manifacturer, d.model, ";
|
|
7818
|
+
query += "case ";
|
|
7819
|
+
query += "when d.inv_ict3_number != '' and d.inv_ict3_number is not null then d.inv_ict3_number ";
|
|
7820
|
+
query += "when d.inv_pnrr_number != '' and d.inv_pnrr_number is not null then d.inv_pnrr_number ";
|
|
7821
|
+
query += "when d.inv_tn_number != '' and d.inv_tn_number is not null then concat(d.inv_tn_number,'(TN)') ";
|
|
7822
|
+
query += "when d.inv_tndigit_number != '' and d.inv_tndigit_number is not null then concat(d.inv_tndigit_number,'(TNDigit)') ";
|
|
7823
|
+
query += "when d.serial_no != '' and d.serial_no is not null then concat(d.serial_no,'(S/N)') ";
|
|
7824
|
+
query += "end as codice ";
|
|
7825
|
+
query += ", dc.note as note_cons from device_consegne dc";
|
|
7826
|
+
query += " join devices d on d.id = dc.id_device";
|
|
7827
|
+
query += " where dc.id_consegna = :id_consegna";
|
|
7828
|
+
query += " and d.id :id_device";
|
|
7829
|
+
return query;
|
|
7830
|
+
}
|
|
7831
|
+
|
|
7832
|
+
|
|
7833
|
+
function selectDeviceConsegna(db_used, id_consegna, id_device) {
|
|
7834
|
+
var query = "";
|
|
7835
|
+
if (db_used) {
|
|
7836
|
+
switch (db_used) {
|
|
7837
|
+
case 'SQLITE':
|
|
7838
|
+
query = selectDeviceConsegnaSQLite(id_consegna, id_device);
|
|
7839
|
+
break;
|
|
7840
|
+
case 'MYSQL':
|
|
7841
|
+
query = selectDeviceConsegnaMySQL(id_consegna, id_device);
|
|
7842
|
+
break;
|
|
7843
|
+
case 'MYSQL2':
|
|
7844
|
+
query = selectDeviceConsegnaSQLite(id_consegna, id_device);
|
|
7845
|
+
break;
|
|
7846
|
+
}
|
|
7847
|
+
}
|
|
7848
|
+
return query;
|
|
7849
|
+
}
|
|
7850
|
+
// End Consegna beni
|
|
7851
|
+
|
|
7852
|
+
|
|
7853
|
+
|
|
7854
|
+
|
|
7522
7855
|
|
|
7523
7856
|
function selectDevicePerConsegnaSQLite(id_consegna) {
|
|
7524
7857
|
var query = "select d.id, d.type as Tipo, d.manifacturer as Marca, d.model as Modello, ";
|
|
@@ -13640,6 +13973,7 @@ module.exports = {
|
|
|
13640
13973
|
assignCategoryFromDB,
|
|
13641
13974
|
getBeniConsumoByIdDevice,
|
|
13642
13975
|
queryConsegneByIdDevice,
|
|
13976
|
+
queryConsegneByIdBene,
|
|
13643
13977
|
queryFornitoriGestoriCombo,
|
|
13644
13978
|
selectGestoreById,
|
|
13645
13979
|
queryCloseGestioneDevice,
|
|
@@ -13657,6 +13991,10 @@ module.exports = {
|
|
|
13657
13991
|
insertConsegnaDevice,
|
|
13658
13992
|
updateConsegnaDevice,
|
|
13659
13993
|
removeConsegnaDevice,
|
|
13994
|
+
insertConsegnaBene,
|
|
13995
|
+
updateConsegnaBene,
|
|
13996
|
+
removeConsegnaBene,
|
|
13997
|
+
selectBeniPerConsegna,
|
|
13660
13998
|
selectDevicePerConsegna,
|
|
13661
13999
|
selectDeviceConsegna,
|
|
13662
14000
|
selectSoftwarePerConsegna,
|