alsmanager_lib 3.0.202 → 3.0.204
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 +193 -14
- package/package.json +1 -1
package/lib/modules.js
CHANGED
|
@@ -1374,7 +1374,7 @@ function getUtentiByIdDeviceMySQL(id_device) {
|
|
|
1374
1374
|
}
|
|
1375
1375
|
|
|
1376
1376
|
|
|
1377
|
-
function
|
|
1377
|
+
function getUtentiByIdDeviceMYSQL2(id_device) {
|
|
1378
1378
|
var query = "select au.id, au.cognome_denominazione, au.nome, au.titolo from device_utenza du ";
|
|
1379
1379
|
query += "join anagrafica_utenze au on au.id = du.id_utenza ";
|
|
1380
1380
|
query += "where du.id_device = " + id_device + " ";
|
|
@@ -1394,7 +1394,7 @@ function getUtentiByIdDevice(db_used, id_device) {
|
|
|
1394
1394
|
query = getUtentiByIdDeviceMySQL(id_device);
|
|
1395
1395
|
break;
|
|
1396
1396
|
case 'MYSQL2':
|
|
1397
|
-
query =
|
|
1397
|
+
query = getUtentiByIdDeviceMYSQL2(id_device);
|
|
1398
1398
|
break;
|
|
1399
1399
|
}
|
|
1400
1400
|
}
|
|
@@ -1415,8 +1415,42 @@ function removeUtentePerDevice(id_dev_user) {
|
|
|
1415
1415
|
|
|
1416
1416
|
// End Anagrafica utenti
|
|
1417
1417
|
//Anagrafica docenti
|
|
1418
|
-
function
|
|
1419
|
-
var query = "select id, concat(cognome, ' ', nome, ' - ', ordine, ' - ', ruolo) as nominativo from anagrafica_docenti ";
|
|
1418
|
+
function getDocentiComboSQLite(id_place, ordine_scuola, ruolo) {
|
|
1419
|
+
var query = "select id, concat(cognome, ' ', nome, iif(ordine is not null, concat(' - ', ordine), ' '), iif(ruolo is not null, concat(' - ', ruolo), ' ')) as nominativo from anagrafica_docenti ";
|
|
1420
|
+
query += "where is_attivo = 1 "
|
|
1421
|
+
if (ordine_scuola && ordine_scuola.trim() != '') {
|
|
1422
|
+
query += "and (ordine = '" + ordine_scuola + "' or ruolo <> 'DOCENTE') ";
|
|
1423
|
+
}
|
|
1424
|
+
if (id_place && id_place.trim() != '') {
|
|
1425
|
+
query += "and (id_place = '" + id_place + "' or id_place is null) ";
|
|
1426
|
+
}
|
|
1427
|
+
if (ruolo && ruolo.trim() != '') {
|
|
1428
|
+
query += "and ruolo = '" + ruolo + "' ";
|
|
1429
|
+
}
|
|
1430
|
+
query += "order by cognome, nome";
|
|
1431
|
+
return query;
|
|
1432
|
+
}
|
|
1433
|
+
|
|
1434
|
+
|
|
1435
|
+
|
|
1436
|
+
function getDocentiComboMySQL(id_place, ordine_scuola, ruolo) {
|
|
1437
|
+
var query = "select id, concat(cognome, ' ', nome, if(ordine is not null, concat(' - ', ordine), ' '), if(ruolo is not null, concat(' - ', ruolo), ' ')) as nominativo from anagrafica_docenti ";
|
|
1438
|
+
query += "where is_attivo = 1 "
|
|
1439
|
+
if (ordine_scuola && ordine_scuola.trim() != '') {
|
|
1440
|
+
query += "and (ordine = '" + ordine_scuola + "' or ruolo <> 'DOCENTE') ";
|
|
1441
|
+
}
|
|
1442
|
+
if (id_place && id_place.trim() != '') {
|
|
1443
|
+
query += "and (id_place = '" + id_place + "' or id_place is null) ";
|
|
1444
|
+
}
|
|
1445
|
+
if (ruolo && ruolo.trim() != '') {
|
|
1446
|
+
query += "and ruolo = '" + ruolo + "' ";
|
|
1447
|
+
}
|
|
1448
|
+
query += "order by cognome, nome";
|
|
1449
|
+
return query;
|
|
1450
|
+
}
|
|
1451
|
+
|
|
1452
|
+
function getDocentiComboMySQL2(id_place, ordine_scuola, ruolo) {
|
|
1453
|
+
var query = "select id, concat(cognome, ' ', nome, if(ordine is not null, concat(' - ', ordine), ' '), if(ruolo is not null, concat(' - ', ruolo), ' ')) as nominativo from anagrafica_docenti ";
|
|
1420
1454
|
query += "where is_attivo = 1 "
|
|
1421
1455
|
if (ordine_scuola && ordine_scuola.trim() != '') {
|
|
1422
1456
|
query += "and (ordine = '" + ordine_scuola + "' or ruolo <> 'DOCENTE') ";
|
|
@@ -1431,6 +1465,24 @@ function getDocentiCombo(db_used, id_place, ordine_scuola, ruolo) {
|
|
|
1431
1465
|
return query;
|
|
1432
1466
|
}
|
|
1433
1467
|
|
|
1468
|
+
function getDocentiCombo(db_used, id_place, ordine_scuola, ruolo) {
|
|
1469
|
+
var query = "";
|
|
1470
|
+
if (db_used) {
|
|
1471
|
+
switch (db_used) {
|
|
1472
|
+
case 'SQLITE':
|
|
1473
|
+
query = getDocentiComboSQLite(id_place, ordine_scuola, ruolo);
|
|
1474
|
+
break;
|
|
1475
|
+
case 'MYSQL':
|
|
1476
|
+
query = getDocentiComboMySQL(id_place, ordine_scuola, ruolo);
|
|
1477
|
+
break;
|
|
1478
|
+
case 'MYSQL2':
|
|
1479
|
+
query = getDocentiComboMySQL2(id_place, ordine_scuola, ruolo);
|
|
1480
|
+
break;
|
|
1481
|
+
}
|
|
1482
|
+
}
|
|
1483
|
+
return query;
|
|
1484
|
+
}
|
|
1485
|
+
|
|
1434
1486
|
function getDocenteById(db_used, id_docente) {
|
|
1435
1487
|
var query = "select id, cognome, nome, email, id_place, ordine, ruolo, is_attivo from anagrafica_docenti ";
|
|
1436
1488
|
query += "where id = " + id_docente;
|
|
@@ -4943,7 +4995,7 @@ function getDevicesSelectComboMySQL(categoria, id_dev_exclude, with_properties)
|
|
|
4943
4995
|
var query = "SELECT d.id, d.type as Tipo, d.manifacturer as Marca, d.model as Modello, ";
|
|
4944
4996
|
query += "case ";
|
|
4945
4997
|
query += "when d.no_inventario is not null and d.no_inventario > 0 then concat(d.id, '(ID)', ' - ', d.type, ' - ', d.manifacturer, ' - ', d.model) ";
|
|
4946
|
-
query += "when d.inv_ict3_number != '' and d.inv_ict3_number is not null then concat(d.inv_ict3_number,
|
|
4998
|
+
query += "when d.inv_ict3_number != '' and d.inv_ict3_number is not null then concat(d.inv_ict3_number,if(d.part_of is not null and trim(d.part_of) <> '', concat('/',d.part_of),''), ' - ', d.type, ' - ', d.manifacturer, ' - ', d.model) ";
|
|
4947
4999
|
query += "when d.inv_tn_number != '' and d.inv_tn_number is not null then concat(d.inv_tn_number, '(TN)', ' - ', d.type, ' - ', d.manifacturer, ' - ', d.model) ";
|
|
4948
5000
|
query += "when d.inv_tndigit_number != '' and d.inv_tndigit_number is not null then concat(d.inv_tndigit_number,'(TNDigit)', ' - ', d.type, ' - ', d.manifacturer, ' - ', d.model) ";
|
|
4949
5001
|
query += "when d.serial_no != '' and d.serial_no is not null then concat(d.serial_no,'(S/N)', ' - ', d.type, ' - ', d.manifacturer, ' - ', d.model) ";
|
|
@@ -4966,6 +5018,44 @@ function getDevicesSelectComboMySQL(categoria, id_dev_exclude, with_properties)
|
|
|
4966
5018
|
query += "order by d.inv_ict3_number";
|
|
4967
5019
|
return query;
|
|
4968
5020
|
}
|
|
5021
|
+
|
|
5022
|
+
function getDevicesSelectComboMySQL2(categoria, id_dev_exclude, with_properties) {
|
|
5023
|
+
var query = "SELECT d.id, d.type as Tipo, d.manifacturer as Marca, d.model as Modello, ";
|
|
5024
|
+
/*
|
|
5025
|
+
(case
|
|
5026
|
+
when d.inv_ict3_number != '' and d.inv_ict3_number is not null then concat(d.inv_ict3_number, ' - ', d.type, ' - ', d.manifacturer, ' - ', d.model )
|
|
5027
|
+
when d.inv_tn_number != '' and d.inv_tn_number is not null then concat(d.inv_tn_number, '(TN)', ' - ', d.type, ' - ', d.manifacturer, ' - ', d.model )
|
|
5028
|
+
when d.inv_tndigit_number != '' and d.inv_tndigit_number is not null then concat(d.inv_tndigit_number,'(TNDigit)', ' - ', d.type, ' - ', d.manifacturer, ' - ', d.model )
|
|
5029
|
+
when d.serial_no != '' and d.serial_no is not null then concat(d.serial_no,'(S/N)', ' - ', d.type, ' - ', d.manifacturer, ' - ', d.model )
|
|
5030
|
+
end) as Descrizione
|
|
5031
|
+
*/
|
|
5032
|
+
query += "case ";
|
|
5033
|
+
query += "when d.no_inventario is not null and d.no_inventario > 0 then concat(d.id, '(ID)', ' - ', d.type, ' - ', d.manifacturer, ' - ', d.model) ";
|
|
5034
|
+
query += "when d.inv_ict3_number != '' and d.inv_ict3_number is not null then concat(d.inv_ict3_number,if(d.part_of is not null and trim(d.part_of) <> '', concat('/',d.part_of),''), ' - ', d.type, ' - ', d.manifacturer, ' - ', d.model) ";
|
|
5035
|
+
query += "when d.inv_tn_number != '' and d.inv_tn_number is not null then concat(d.inv_tn_number, '(TN)', ' - ', d.type, ' - ', d.manifacturer, ' - ', d.model) ";
|
|
5036
|
+
query += "when d.inv_tndigit_number != '' and d.inv_tndigit_number is not null then concat(d.inv_tndigit_number,'(TNDigit)', ' - ', d.type, ' - ', d.manifacturer, ' - ', d.model) ";
|
|
5037
|
+
query += "when d.serial_no != '' and d.serial_no is not null then concat(d.serial_no,'(S/N)', ' - ', d.type, ' - ', d.manifacturer, ' - ', d.model) ";
|
|
5038
|
+
query += "else '' ";
|
|
5039
|
+
query += "end as Descrizione ";
|
|
5040
|
+
query += "from devices d ";
|
|
5041
|
+
if (with_properties && with_properties > 0) {
|
|
5042
|
+
query += "left join device_properties dp on d.id = dp.id_device ";
|
|
5043
|
+
}
|
|
5044
|
+
query += "where (d.is_removed is null or d.is_removed = 0) "
|
|
5045
|
+
if (categoria && categoria.trim() != '') {
|
|
5046
|
+
query += "and d.type in (select tipo from categorie_device where categoria = '" + categoria +"') ";
|
|
5047
|
+
}
|
|
5048
|
+
if (id_dev_exclude && id_dev_exclude > 0) {
|
|
5049
|
+
query += "and d.id <> " + id_dev_exclude + " ";
|
|
5050
|
+
}
|
|
5051
|
+
if (with_properties) {
|
|
5052
|
+
query += "and dp.raw_properties is not null ";
|
|
5053
|
+
}
|
|
5054
|
+
query += "order by d.inv_ict3_number";
|
|
5055
|
+
return query;
|
|
5056
|
+
}
|
|
5057
|
+
|
|
5058
|
+
|
|
4969
5059
|
function getDevicesSelectCombo(db_used, categoria, id_dev_exclude, with_properties) {
|
|
4970
5060
|
var query = "";
|
|
4971
5061
|
if (db_used) {
|
|
@@ -4977,7 +5067,7 @@ function getDevicesSelectCombo(db_used, categoria, id_dev_exclude, with_properti
|
|
|
4977
5067
|
query = getDevicesSelectComboMySQL(categoria, id_dev_exclude, with_properties);
|
|
4978
5068
|
break;
|
|
4979
5069
|
case 'MYSQL2':
|
|
4980
|
-
query =
|
|
5070
|
+
query = getDevicesSelectComboMySQL2(categoria, id_dev_exclude, with_properties);
|
|
4981
5071
|
break;
|
|
4982
5072
|
}
|
|
4983
5073
|
}
|
|
@@ -5010,7 +5100,7 @@ function getDevicesSelectBySiteComboMySQL(id_site, dev_type) {
|
|
|
5010
5100
|
var query = "SELECT d.id, d.type as Tipo, d.manifacturer as Marca, d.model as Modello, ";
|
|
5011
5101
|
query += "case ";
|
|
5012
5102
|
query += "when d.no_inventario is not null and d.no_inventario > 0 then concat(d.id, '(ID)', ' - ', d.type, ' - ', d.manifacturer, ' - ', d.model) ";
|
|
5013
|
-
query += "when d.inv_ict3_number != '' and d.inv_ict3_number is not null then concat(d.inv_ict3_number,
|
|
5103
|
+
query += "when d.inv_ict3_number != '' and d.inv_ict3_number is not null then concat(d.inv_ict3_number,if(d.part_of is not null and trim(d.part_of) <> '', concat('/',d.part_of),''), ' - ', d.type, ' - ', d.manifacturer, ' - ', d.model) ";
|
|
5014
5104
|
query += "when d.inv_tn_number != '' and d.inv_tn_number is not null then concat(d.inv_tn_number, '(TN)', ' - ', d.type, ' - ', d.manifacturer, ' - ', d.model) ";
|
|
5015
5105
|
query += "when d.inv_tndigit_number != '' and d.inv_tndigit_number is not null then concat(d.inv_tndigit_number,'(TNDigit)', ' - ', d.type, ' - ', d.manifacturer, ' - ', d.model) ";
|
|
5016
5106
|
query += "when d.serial_no != '' and d.serial_no is not null then concat(d.serial_no,'(S/N)', ' - ', d.type, ' - ', d.manifacturer, ' - ', d.model) ";
|
|
@@ -5193,7 +5283,7 @@ function getDevicesWithPropertiesMySQL(id_device) {
|
|
|
5193
5283
|
var query = "select ";
|
|
5194
5284
|
query += "case ";
|
|
5195
5285
|
query += "when d.no_inventario is not null and d.no_inventario > 0 then concat(d.id, '(ID)') ";
|
|
5196
|
-
query += "when d.inv_ict3_number != '' and d.inv_ict3_number is not null then concat(d.inv_ict3_number,
|
|
5286
|
+
query += "when d.inv_ict3_number != '' and d.inv_ict3_number is not null then concat(d.inv_ict3_number, if(d.part_of is not null and trim(d.part_of) <> '', concat('/',d.part_of),'')) ";
|
|
5197
5287
|
query += "when d.inv_pnrr_number != '' and d.inv_pnrr_number is not null then d.inv_pnrr_number ";
|
|
5198
5288
|
query += "when d.inv_tn_number != '' and d.inv_tn_number is not null then concat(d.inv_tn_number,'(TN)') ";
|
|
5199
5289
|
query += "when d.inv_tndigit_number != '' and d.inv_tndigit_number is not null then concat(d.inv_tndigit_number,'(TNDigit)') ";
|
|
@@ -5208,6 +5298,25 @@ function getDevicesWithPropertiesMySQL(id_device) {
|
|
|
5208
5298
|
query += "order by d.id";
|
|
5209
5299
|
return query;
|
|
5210
5300
|
}
|
|
5301
|
+
function getDevicesWithPropertiesMySQL2(id_device) {
|
|
5302
|
+
var query = "select ";
|
|
5303
|
+
query += "case ";
|
|
5304
|
+
query += "when d.no_inventario is not null and d.no_inventario > 0 then concat(d.id, '(ID)') ";
|
|
5305
|
+
query += "when d.inv_ict3_number != '' and d.inv_ict3_number is not null then concat(d.inv_ict3_number, if(d.part_of is not null and trim(d.part_of) <> '', concat('/',d.part_of),'')) ";
|
|
5306
|
+
query += "when d.inv_pnrr_number != '' and d.inv_pnrr_number is not null then d.inv_pnrr_number ";
|
|
5307
|
+
query += "when d.inv_tn_number != '' and d.inv_tn_number is not null then concat(d.inv_tn_number,'(TN)') ";
|
|
5308
|
+
query += "when d.inv_tndigit_number != '' and d.inv_tndigit_number is not null then concat(d.inv_tndigit_number,'(TNDigit)') ";
|
|
5309
|
+
query += "when d.serial_no != '' and d.serial_no is not null then concat(d.serial_no,'(S/N)') ";
|
|
5310
|
+
query += "end as Codice, ";
|
|
5311
|
+
query += "d.manifacturer as Marca, d.model as Modello, d.id as Id from devices d ";
|
|
5312
|
+
query += "left join device_properties dp on d.id = dp.id_device ";
|
|
5313
|
+
query += "where dp.id_device is not null ";
|
|
5314
|
+
if (id_device > 0) {
|
|
5315
|
+
query += "and d.id = " + id_device + " ";
|
|
5316
|
+
}
|
|
5317
|
+
query += "order by d.id";
|
|
5318
|
+
return query;
|
|
5319
|
+
}
|
|
5211
5320
|
function getDevicesWithProperties(db_used, id_device) {
|
|
5212
5321
|
var query = "";
|
|
5213
5322
|
if (db_used) {
|
|
@@ -5219,7 +5328,7 @@ function getDevicesWithProperties(db_used, id_device) {
|
|
|
5219
5328
|
query = getDevicesWithPropertiesMySQL(id_device);
|
|
5220
5329
|
break;
|
|
5221
5330
|
case 'MYSQL2':
|
|
5222
|
-
query =
|
|
5331
|
+
query = getDevicesWithPropertiesMySQL2(id_device);
|
|
5223
5332
|
break;
|
|
5224
5333
|
}
|
|
5225
5334
|
}
|
|
@@ -10380,7 +10489,7 @@ function selectDismissioneDevicesByIdDismissSQLite(id_dismiss) {
|
|
|
10380
10489
|
function selectDismissioneDevicesByIdDismissMySQL(id_dismiss) {
|
|
10381
10490
|
var query = "select dm.id, ";
|
|
10382
10491
|
query += "case ";
|
|
10383
|
-
query += "when d.inv_ict3_number != '' and d.inv_ict3_number is not null then concat(d.inv_ict3_number,
|
|
10492
|
+
query += "when d.inv_ict3_number != '' and d.inv_ict3_number is not null then concat(d.inv_ict3_number,if(d.part_of is not null and trim(d.part_of) <> '', concat('/',d.part_of),'')) ";
|
|
10384
10493
|
query += "when d.inv_pnrr_number != '' and d.inv_pnrr_number is not null then d.inv_pnrr_number ";
|
|
10385
10494
|
query += "when d.inv_tn_number != '' and d.inv_tn_number is not null then concat(d.inv_tn_number,'(TN)') ";
|
|
10386
10495
|
query += "when d.inv_tndigit_number != '' and d.inv_tndigit_number is not null then concat(d.inv_tndigit_number,'(TNDigit)') ";
|
|
@@ -10397,6 +10506,26 @@ function selectDismissioneDevicesByIdDismissMySQL(id_dismiss) {
|
|
|
10397
10506
|
return query;
|
|
10398
10507
|
}
|
|
10399
10508
|
|
|
10509
|
+
function selectDismissioneDevicesByIdDismissMySQL2(id_dismiss) {
|
|
10510
|
+
var query = "select dm.id, ";
|
|
10511
|
+
query += "case ";
|
|
10512
|
+
query += "when d.inv_ict3_number != '' and d.inv_ict3_number is not null then concat(d.inv_ict3_number,if(d.part_of is not null and trim(d.part_of) <> '', concat('/',d.part_of),'')) ";
|
|
10513
|
+
query += "when d.inv_pnrr_number != '' and d.inv_pnrr_number is not null then d.inv_pnrr_number ";
|
|
10514
|
+
query += "when d.inv_tn_number != '' and d.inv_tn_number is not null then concat(d.inv_tn_number,'(TN)') ";
|
|
10515
|
+
query += "when d.inv_tndigit_number != '' and d.inv_tndigit_number is not null then concat(d.inv_tndigit_number,'(TNDigit)') ";
|
|
10516
|
+
query += "when d.serial_no != '' and d.serial_no is not null then concat(d.serial_no,'(S/N)') ";
|
|
10517
|
+
query += "end as Codice, ";
|
|
10518
|
+
query += "d.type as Tipo, d.manifacturer as Marca, d.model as Modello from device_dismissioni dm ";
|
|
10519
|
+
query += "join devices d on d.id = dm.id_device ";
|
|
10520
|
+
if (!id_dismiss || id_dismiss == 0) {
|
|
10521
|
+
query += "where dm.id_dismissione is null or dm.id_dismissione = 0";
|
|
10522
|
+
}
|
|
10523
|
+
else {
|
|
10524
|
+
query += "where dm.id_dismissione = " + id_dismiss;
|
|
10525
|
+
}
|
|
10526
|
+
return query;
|
|
10527
|
+
}
|
|
10528
|
+
|
|
10400
10529
|
function selectDismissioneDevicesByIdDismiss(db_used, id_dismiss) {
|
|
10401
10530
|
var query = "";
|
|
10402
10531
|
if (db_used) {
|
|
@@ -10408,7 +10537,7 @@ function selectDismissioneDevicesByIdDismiss(db_used, id_dismiss) {
|
|
|
10408
10537
|
query = selectDismissioneDevicesByIdDismissMySQL(id_dismiss);
|
|
10409
10538
|
break;
|
|
10410
10539
|
case 'MYSQL2':
|
|
10411
|
-
query =
|
|
10540
|
+
query = selectDismissioneDevicesByIdDismissMySQL2(id_dismiss);
|
|
10412
10541
|
break;
|
|
10413
10542
|
}
|
|
10414
10543
|
}
|
|
@@ -12839,7 +12968,7 @@ function deletePortPerSite(id_port) {
|
|
|
12839
12968
|
return query;
|
|
12840
12969
|
}
|
|
12841
12970
|
|
|
12842
|
-
function
|
|
12971
|
+
function getSwitchesSQLite(id_place) {
|
|
12843
12972
|
var query = "select d.id, dw.rete_appartenenza, concat(d.manifacturer, ' - ', d.model, ' - ', dw.rete_appartenenza) as description from devices d ";
|
|
12844
12973
|
query += "join device_site ds on ds.id_device = d.id ";
|
|
12845
12974
|
query += "join device_switch dw on dw.id_device = d.id ";
|
|
@@ -12851,6 +12980,50 @@ function getSwitches(id_place) {
|
|
|
12851
12980
|
return query;
|
|
12852
12981
|
}
|
|
12853
12982
|
|
|
12983
|
+
function getSwitchesMySQL() {
|
|
12984
|
+
var query = "select d.id, dw.rete_appartenenza, concat(d.manifacturer, ' - ', d.model, ' - ', dw.rete_appartenenza) as description from devices d ";
|
|
12985
|
+
query += "join device_site ds on ds.id_device = d.id ";
|
|
12986
|
+
query += "join device_switch dw on dw.id_device = d.id ";
|
|
12987
|
+
query += "join site_destinations sd on sd.id_site = ds.id_site ";
|
|
12988
|
+
query += "where sd.type = 'SERVER' and CURDATE() >= sd.date_start and CURDATE() <= sd.date_end ";
|
|
12989
|
+
query += "and CURDATE() >= ds.date_in and CURDATE() <= ds.date_out ";
|
|
12990
|
+
query += "and d.type = 'SWITCH' ";
|
|
12991
|
+
query += "and sd.id_place = :id_place ";
|
|
12992
|
+
return query;
|
|
12993
|
+
}
|
|
12994
|
+
|
|
12995
|
+
function getSwitchesMySQL2(id_place) {
|
|
12996
|
+
var query = "select d.id, dw.rete_appartenenza, concat(d.manifacturer, ' - ', d.model, ' - ', dw.rete_appartenenza) as description from devices d ";
|
|
12997
|
+
query += "join device_site ds on ds.id_device = d.id ";
|
|
12998
|
+
query += "join device_switch dw on dw.id_device = d.id ";
|
|
12999
|
+
query += "join site_destinations sd on sd.id_site = ds.id_site ";
|
|
13000
|
+
query += "where sd.type = 'SERVER' and CURDATE() >= sd.date_start and CURDATE() <= sd.date_end ";
|
|
13001
|
+
query += "and CURDATE() >= ds.date_in and CURDATE() <= ds.date_out ";
|
|
13002
|
+
query += "and d.type = 'SWITCH' ";
|
|
13003
|
+
query += "and sd.id_place = '" + id_place + "' ";
|
|
13004
|
+
return query;
|
|
13005
|
+
}
|
|
13006
|
+
|
|
13007
|
+
|
|
13008
|
+
function getSwitches(db_used, id_place) {
|
|
13009
|
+
var query = "";
|
|
13010
|
+
if (db_used) {
|
|
13011
|
+
switch (db_used) {
|
|
13012
|
+
case 'SQLITE':
|
|
13013
|
+
query = getSwitchesSQLite(id_place);
|
|
13014
|
+
break;
|
|
13015
|
+
case 'MYSQL':
|
|
13016
|
+
query = getSwitchesMySQL();
|
|
13017
|
+
break;
|
|
13018
|
+
case 'MYSQL2':
|
|
13019
|
+
query = getSwitchesMySQL2(id_place);
|
|
13020
|
+
break;
|
|
13021
|
+
}
|
|
13022
|
+
}
|
|
13023
|
+
return query;
|
|
13024
|
+
}
|
|
13025
|
+
|
|
13026
|
+
|
|
12854
13027
|
function getTipiPorta() {
|
|
12855
13028
|
var query = "select DISTINCT port_type from site_ports ";
|
|
12856
13029
|
query += "order by port_type";
|
|
@@ -13844,10 +14017,16 @@ function queryStatisticInventarySQLite() {
|
|
|
13844
14017
|
return query;
|
|
13845
14018
|
}
|
|
13846
14019
|
function queryStatisticInventaryMySQL() {
|
|
13847
|
-
var query = "select COUNT(
|
|
14020
|
+
var query = "select COUNT(IF(d.inv_ict3_number is not null and round(d.inv_ict3_number) > 0, 1, NULL)) as Con_Inventario, COUNT(IF(d.inv_ict3_number is null or trim(d.inv_ict3_number) = '' or round(d.inv_ict3_number) > 0, 1, NULL)) as Senza_Inventario from devices d ";
|
|
13848
14021
|
query += "where (is_removed is null or is_removed = 0) ";
|
|
13849
14022
|
return query;
|
|
13850
14023
|
}
|
|
14024
|
+
function queryStatisticInventaryMySQL2() {
|
|
14025
|
+
var query = "select COUNT(IF(d.inv_ict3_number is not null and round(d.inv_ict3_number) > 0, 1, NULL)) as Con_Inventario, COUNT(IF(d.inv_ict3_number is null or trim(d.inv_ict3_number) = '' or round(d.inv_ict3_number) > 0, 1, NULL)) as Senza_Inventario from devices d ";
|
|
14026
|
+
query += "where (is_removed is null or is_removed = 0) ";
|
|
14027
|
+
return query;
|
|
14028
|
+
}
|
|
14029
|
+
|
|
13851
14030
|
function queryStatisticInventary(db_used) {
|
|
13852
14031
|
var query = "";
|
|
13853
14032
|
if (db_used) {
|
|
@@ -13859,7 +14038,7 @@ function queryStatisticInventary(db_used) {
|
|
|
13859
14038
|
query = queryStatisticInventaryMySQL();
|
|
13860
14039
|
break;
|
|
13861
14040
|
case 'MYSQL2':
|
|
13862
|
-
query =
|
|
14041
|
+
query = queryStatisticInventaryMySQL2();
|
|
13863
14042
|
break;
|
|
13864
14043
|
}
|
|
13865
14044
|
}
|