alsmanager_lib 2.0.65 → 2.0.67
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 +1191 -1
- package/package.json +1 -1
package/lib/modules.js
CHANGED
|
@@ -15,6 +15,14 @@ function getConnectorsByIdDeviceMySQL(id_device) {
|
|
|
15
15
|
return query;
|
|
16
16
|
}
|
|
17
17
|
|
|
18
|
+
function getConnectorsByIdDeviceMySQL2(id_device) {
|
|
19
|
+
var query = "select dc.id, ct.conn_type as Tipo, cp.name as Protocollo, dc.conn_number as Numero, dc.conn_verse as Verso from device_connectors dc ";
|
|
20
|
+
query += "join connection_types ct on ct.id = dc.conn_type ";
|
|
21
|
+
query += "join connection_protocols cp on cp.id = dc.conn_protocol ";
|
|
22
|
+
query += "where id_device = " + id_device;
|
|
23
|
+
return query;
|
|
24
|
+
}
|
|
25
|
+
|
|
18
26
|
function getConnectorsByIdDevice(db_used, id_device) {
|
|
19
27
|
var query = "";
|
|
20
28
|
if (db_used) {
|
|
@@ -25,6 +33,9 @@ function getConnectorsByIdDevice(db_used, id_device) {
|
|
|
25
33
|
case 'MYSQL':
|
|
26
34
|
query = getConnectorsByIdDeviceMySQL(id_device);
|
|
27
35
|
break;
|
|
36
|
+
case 'MYSQL2':
|
|
37
|
+
query = getConnectorsByIdDeviceMySQL2(id_device);
|
|
38
|
+
break;
|
|
28
39
|
}
|
|
29
40
|
}
|
|
30
41
|
return query;
|
|
@@ -41,6 +52,7 @@ function getConnectorByIdMySQL() {
|
|
|
41
52
|
query += "where dc.id = :id_conn";
|
|
42
53
|
return query;
|
|
43
54
|
}
|
|
55
|
+
|
|
44
56
|
function getConnectorById(db_used, id_conn) {
|
|
45
57
|
var query = "";
|
|
46
58
|
if (db_used) {
|
|
@@ -51,6 +63,9 @@ function getConnectorById(db_used, id_conn) {
|
|
|
51
63
|
case 'MYSQL':
|
|
52
64
|
query = getConnectorByIdMySQL();
|
|
53
65
|
break;
|
|
66
|
+
case 'MYSQL2':
|
|
67
|
+
query = getConnectorByIdSQLite();
|
|
68
|
+
break;
|
|
54
69
|
}
|
|
55
70
|
}
|
|
56
71
|
return query;
|
|
@@ -89,6 +104,9 @@ function insertConnector(db_used, id_device, conn_obj) {
|
|
|
89
104
|
case 'MYSQL':
|
|
90
105
|
query = insertConnectorMySQL(id_device, conn_obj);
|
|
91
106
|
break;
|
|
107
|
+
case 'MYSQL2':
|
|
108
|
+
query = insertConnectorSQLite(id_device, conn_obj);
|
|
109
|
+
break;
|
|
92
110
|
}
|
|
93
111
|
}
|
|
94
112
|
return query;
|
|
@@ -123,6 +141,9 @@ function updateConnector(db_used, id_device, conn_obj) {
|
|
|
123
141
|
case 'MYSQL':
|
|
124
142
|
query = updateConnectorMySQL(id_device, conn_obj);
|
|
125
143
|
break;
|
|
144
|
+
case 'MYSQL2':
|
|
145
|
+
query = updateConnectorSQLite(id_device, conn_obj);
|
|
146
|
+
break;
|
|
126
147
|
}
|
|
127
148
|
}
|
|
128
149
|
return query;
|
|
@@ -149,6 +170,9 @@ function removeConnector(db_used, id_device, conn_obj) {
|
|
|
149
170
|
case 'MYSQL':
|
|
150
171
|
query = removeConnectorMySQL();
|
|
151
172
|
break;
|
|
173
|
+
case 'MYSQL2':
|
|
174
|
+
query = removeConnectorSQLite(id_device, conn_obj);
|
|
175
|
+
break;
|
|
152
176
|
}
|
|
153
177
|
}
|
|
154
178
|
return query;
|
|
@@ -184,6 +208,9 @@ function queryStorageModels(db_used, marca) {
|
|
|
184
208
|
case 'MYSQL':
|
|
185
209
|
query = queryStorageModelsMySQL(marca);
|
|
186
210
|
break;
|
|
211
|
+
case 'MYSQL2':
|
|
212
|
+
query = queryStorageModelsSQLite(marca);
|
|
213
|
+
break;
|
|
187
214
|
}
|
|
188
215
|
}
|
|
189
216
|
return query;
|
|
@@ -212,6 +239,9 @@ function getStorageByIdDevice(db_used, id_device) {
|
|
|
212
239
|
case 'MYSQL':
|
|
213
240
|
query = getStorageByIdDeviceMySQL(id_device);
|
|
214
241
|
break;
|
|
242
|
+
case 'MYSQL2':
|
|
243
|
+
query = getStorageByIdDeviceSQLite(id_device);
|
|
244
|
+
break;
|
|
215
245
|
}
|
|
216
246
|
}
|
|
217
247
|
return query;
|
|
@@ -247,6 +277,9 @@ function getStorageComboByIdDevice(db_used, id_device, id_exclude) {
|
|
|
247
277
|
case 'MYSQL':
|
|
248
278
|
query = getStorageComboByIdDeviceMySQL(id_device, id_exclude);
|
|
249
279
|
break;
|
|
280
|
+
case 'MYSQL2':
|
|
281
|
+
query = getStorageComboByIdDeviceSQLite(id_device, id_exclude);
|
|
282
|
+
break;
|
|
250
283
|
}
|
|
251
284
|
}
|
|
252
285
|
return query;
|
|
@@ -279,6 +312,9 @@ function getStorageByIdPartAndIdConf(db_used, id_storage, id_conf) {
|
|
|
279
312
|
case 'MYSQL':
|
|
280
313
|
query = getStorageByIdPartAndIdConfMySQL(id_storage, id_conf);
|
|
281
314
|
break;
|
|
315
|
+
case 'MYSQL2':
|
|
316
|
+
query = getStorageByIdPartAndIdConfSQLite(id_storage, id_conf);
|
|
317
|
+
break;
|
|
282
318
|
}
|
|
283
319
|
}
|
|
284
320
|
return query;
|
|
@@ -307,6 +343,9 @@ function getStorageById(db_used, id_storage) {
|
|
|
307
343
|
case 'MYSQL':
|
|
308
344
|
query = getStorageByIdMySQL();
|
|
309
345
|
break;
|
|
346
|
+
case 'MYSQL2':
|
|
347
|
+
query = getStorageByIdSQLite(id_storage);
|
|
348
|
+
break;
|
|
310
349
|
}
|
|
311
350
|
}
|
|
312
351
|
return query;
|
|
@@ -347,6 +386,9 @@ function insertStorage(db_used, id_device, storage_obj) {
|
|
|
347
386
|
case 'MYSQL':
|
|
348
387
|
query = insertStorageMySQL(id_device, storage_obj);
|
|
349
388
|
break;
|
|
389
|
+
case 'MYSQL2':
|
|
390
|
+
query = insertStorageSQLite(id_device, storage_obj);
|
|
391
|
+
break;
|
|
350
392
|
}
|
|
351
393
|
}
|
|
352
394
|
return query;
|
|
@@ -386,6 +428,9 @@ function updateStorage(db_used, id_device, storage_obj) {
|
|
|
386
428
|
case 'MYSQL':
|
|
387
429
|
query = updateStorageMySQL(id_device, storage_obj);
|
|
388
430
|
break;
|
|
431
|
+
case 'MYSQL2':
|
|
432
|
+
query = updateStorageSQLite(id_device, storage_obj);
|
|
433
|
+
break;
|
|
389
434
|
}
|
|
390
435
|
}
|
|
391
436
|
return query;
|
|
@@ -411,6 +456,9 @@ function removeStorage(db_used, id_device, storage_obj) {
|
|
|
411
456
|
case 'MYSQL':
|
|
412
457
|
query = removeStorageMySQL(id_device, storage_obj);
|
|
413
458
|
break;
|
|
459
|
+
case 'MYSQL2':
|
|
460
|
+
query = removeStorageSQLite(id_device, storage_obj);
|
|
461
|
+
break;
|
|
414
462
|
}
|
|
415
463
|
}
|
|
416
464
|
return query;
|
|
@@ -438,6 +486,9 @@ function getLastStorageInserted(db_used, id_device) {
|
|
|
438
486
|
case 'MYSQL':
|
|
439
487
|
query = getLastStorageInsertedMySQL(id_device);
|
|
440
488
|
break;
|
|
489
|
+
case 'MYSQL2':
|
|
490
|
+
query = getLastStorageInsertedSQLite(id_device);
|
|
491
|
+
break;
|
|
441
492
|
}
|
|
442
493
|
}
|
|
443
494
|
return query;
|
|
@@ -482,6 +533,9 @@ function getStoragesByConfig(db_used, id_device, id_conf) {
|
|
|
482
533
|
case 'MYSQL':
|
|
483
534
|
query = getStoragesByConfigMySQL(id_device, id_conf);
|
|
484
535
|
break;
|
|
536
|
+
case 'MYSQL2':
|
|
537
|
+
query = getStoragesByConfigSQLite(id_device, id_conf);
|
|
538
|
+
break;
|
|
485
539
|
}
|
|
486
540
|
}
|
|
487
541
|
return query;
|
|
@@ -509,6 +563,9 @@ function getNetworkByIdDevice(db_used, id_device) {
|
|
|
509
563
|
case 'MYSQL':
|
|
510
564
|
query = getNetworkByIdDeviceMySQL(id_device);
|
|
511
565
|
break;
|
|
566
|
+
case 'MYSQL2':
|
|
567
|
+
query = getNetworkByIdDeviceSQLite(id_device);
|
|
568
|
+
break;
|
|
512
569
|
}
|
|
513
570
|
}
|
|
514
571
|
return query;
|
|
@@ -540,6 +597,9 @@ function getNetworkComboByIdDevice(db_used, id_device, id_exclude) {
|
|
|
540
597
|
case 'MYSQL':
|
|
541
598
|
query = getNetworkComboByIdDeviceMySQL(id_device, id_exclude);
|
|
542
599
|
break;
|
|
600
|
+
case 'MYSQL2':
|
|
601
|
+
query = getNetworkComboByIdDeviceSQLite(id_device, id_exclude);
|
|
602
|
+
break;
|
|
543
603
|
}
|
|
544
604
|
}
|
|
545
605
|
return query;
|
|
@@ -571,6 +631,9 @@ function getNetworkByIdPartAndIdConf(db_used, id_network, id_conf) {
|
|
|
571
631
|
case 'MYSQL':
|
|
572
632
|
query = getNetworkByIdPartAndIdConfMySQL(id_network, id_conf);
|
|
573
633
|
break;
|
|
634
|
+
case 'MYSQL2':
|
|
635
|
+
query = getNetworkByIdPartAndIdConfSQLite(id_network, id_conf);
|
|
636
|
+
break;
|
|
574
637
|
}
|
|
575
638
|
}
|
|
576
639
|
return query;
|
|
@@ -597,6 +660,9 @@ function getNetworkById(db_used, id_network) {
|
|
|
597
660
|
case 'MYSQL':
|
|
598
661
|
query = getNetworkByIdMySQL();
|
|
599
662
|
break;
|
|
663
|
+
case 'MYSQL2':
|
|
664
|
+
query = getNetworkByIdSQLite(id_network);
|
|
665
|
+
break;
|
|
600
666
|
}
|
|
601
667
|
}
|
|
602
668
|
return query;
|
|
@@ -633,6 +699,9 @@ function insertNetwork(db_used, id_device, network_obj) {
|
|
|
633
699
|
case 'MYSQL':
|
|
634
700
|
query = insertNetworkMySQL(id_device, network_obj);
|
|
635
701
|
break;
|
|
702
|
+
case 'MYSQL2':
|
|
703
|
+
query = insertNetworkSQLite(id_device, network_obj);
|
|
704
|
+
break;
|
|
636
705
|
}
|
|
637
706
|
}
|
|
638
707
|
return query;
|
|
@@ -669,6 +738,9 @@ function updateNetwork(db_used, id_device, network_obj) {
|
|
|
669
738
|
case 'MYSQL':
|
|
670
739
|
query = updateNetworkMySQL(id_device, network_obj);
|
|
671
740
|
break;
|
|
741
|
+
case 'MYSQL2':
|
|
742
|
+
query = updateNetworkSQLite(id_device, network_obj);
|
|
743
|
+
break;
|
|
672
744
|
}
|
|
673
745
|
}
|
|
674
746
|
return query;
|
|
@@ -693,6 +765,9 @@ function removeNetwork(db_used, id_device, network_obj) {
|
|
|
693
765
|
case 'MYSQL':
|
|
694
766
|
query = removeNetworkMySQL(id_device, network_obj);
|
|
695
767
|
break;
|
|
768
|
+
case 'MYSQL2':
|
|
769
|
+
query = removeNetworkSQLite(id_device, network_obj);
|
|
770
|
+
break;
|
|
696
771
|
}
|
|
697
772
|
}
|
|
698
773
|
return query;
|
|
@@ -720,6 +795,9 @@ function getLastNetworkInserted(db_used, id_device) {
|
|
|
720
795
|
case 'MYSQL':
|
|
721
796
|
query = getLastNetworkInsertedMySQL(id_device);
|
|
722
797
|
break;
|
|
798
|
+
case 'MYSQL2':
|
|
799
|
+
query = getLastNetworkInsertedSQLite(id_device);
|
|
800
|
+
break;
|
|
723
801
|
}
|
|
724
802
|
}
|
|
725
803
|
return query;
|
|
@@ -757,6 +835,9 @@ function getNetworksByConfig(db_used, id_device, id_conf) {
|
|
|
757
835
|
case 'MYSQL':
|
|
758
836
|
query = getNetworksByConfigMySQL(id_device, id_conf);
|
|
759
837
|
break;
|
|
838
|
+
case 'MYSQL2':
|
|
839
|
+
query = getNetworksByConfigSQLite(id_device, id_conf);
|
|
840
|
+
break;
|
|
760
841
|
}
|
|
761
842
|
}
|
|
762
843
|
return query;
|
|
@@ -782,6 +863,9 @@ function getAddOnTypes(db_used) {
|
|
|
782
863
|
case 'MYSQL':
|
|
783
864
|
query = getAddOnTypesMySQL();
|
|
784
865
|
break;
|
|
866
|
+
case 'MYSQL2':
|
|
867
|
+
query = getAddOnTypesSQLite();
|
|
868
|
+
break;
|
|
785
869
|
}
|
|
786
870
|
}
|
|
787
871
|
return query;
|
|
@@ -811,6 +895,9 @@ function getAddOnByIdDevice(db_used, id_device) {
|
|
|
811
895
|
case 'MYSQL':
|
|
812
896
|
query = getAddOnByIdDeviceMySQL(id_device);
|
|
813
897
|
break;
|
|
898
|
+
case 'MYSQL2':
|
|
899
|
+
query = getAddOnByIdDeviceSQLite(id_device);
|
|
900
|
+
break;
|
|
814
901
|
}
|
|
815
902
|
}
|
|
816
903
|
return query;
|
|
@@ -844,6 +931,9 @@ function getAddOnComboByIdDevice(db_used, id_device, id_exclude) {
|
|
|
844
931
|
case 'MYSQL':
|
|
845
932
|
query = getAddOnComboByIdDeviceMySQL(id_device, id_exclude);
|
|
846
933
|
break;
|
|
934
|
+
case 'MYSQL2':
|
|
935
|
+
query = getAddOnComboByIdDeviceSQLite(id_device, id_exclude);
|
|
936
|
+
break;
|
|
847
937
|
}
|
|
848
938
|
}
|
|
849
939
|
return query;
|
|
@@ -875,6 +965,9 @@ function getAddOnByIdPartAndIdConf(db_used, id_addon, id_conf) {
|
|
|
875
965
|
case 'MYSQL':
|
|
876
966
|
query = getAddOnByIdPartAndIdConfMySQL(id_addon, id_conf);
|
|
877
967
|
break;
|
|
968
|
+
case 'MYSQL2':
|
|
969
|
+
query = getAddOnByIdPartAndIdConfSQLite(id_addon, id_conf);
|
|
970
|
+
break;
|
|
878
971
|
}
|
|
879
972
|
}
|
|
880
973
|
return query;
|
|
@@ -900,6 +993,9 @@ function getAddOnById(db_used, id_addon) {
|
|
|
900
993
|
case 'MYSQL':
|
|
901
994
|
query = getAddOnByIdMySQL();
|
|
902
995
|
break;
|
|
996
|
+
case 'MYSQL2':
|
|
997
|
+
query = getAddOnByIdSQLite(id_addon);
|
|
998
|
+
break;
|
|
903
999
|
}
|
|
904
1000
|
}
|
|
905
1001
|
return query;
|
|
@@ -937,6 +1033,9 @@ function insertAddOn(db_used, id_device, addon_obj) {
|
|
|
937
1033
|
case 'MYSQL':
|
|
938
1034
|
query = insertAddOnMySQL(id_device, addon_obj);
|
|
939
1035
|
break;
|
|
1036
|
+
case 'MYSQL2':
|
|
1037
|
+
query = insertAddOnSQLite(id_device, addon_obj);
|
|
1038
|
+
break;
|
|
940
1039
|
}
|
|
941
1040
|
}
|
|
942
1041
|
return query;
|
|
@@ -971,6 +1070,9 @@ function updateAddOn(db_used, id_device, addon_obj) {
|
|
|
971
1070
|
case 'MYSQL':
|
|
972
1071
|
query = updateAddOnMySQL(id_device, addon_obj);
|
|
973
1072
|
break;
|
|
1073
|
+
case 'MYSQL2':
|
|
1074
|
+
query = updateAddOnSQLite(id_device, addon_obj);
|
|
1075
|
+
break;
|
|
974
1076
|
}
|
|
975
1077
|
}
|
|
976
1078
|
return query;
|
|
@@ -994,6 +1096,9 @@ function removeAddOn(db_used, id_device, addon_obj) {
|
|
|
994
1096
|
case 'MYSQL':
|
|
995
1097
|
query = removeAddOnMySQL(id_device, addon_obj);
|
|
996
1098
|
break;
|
|
1099
|
+
case 'MYSQL2':
|
|
1100
|
+
query = removeAddOnSQLite(id_device, addon_obj);
|
|
1101
|
+
break;
|
|
997
1102
|
}
|
|
998
1103
|
}
|
|
999
1104
|
return query;
|
|
@@ -1021,6 +1126,9 @@ function getLastAddOnInserted(db_used, id_device) {
|
|
|
1021
1126
|
case 'MYSQL':
|
|
1022
1127
|
query = getLastAddOnInsertedMySQL(id_device);
|
|
1023
1128
|
break;
|
|
1129
|
+
case 'MYSQL2':
|
|
1130
|
+
query = getLastAddOnInsertedSQLite(id_device);
|
|
1131
|
+
break;
|
|
1024
1132
|
}
|
|
1025
1133
|
}
|
|
1026
1134
|
return query;
|
|
@@ -1060,6 +1168,9 @@ function getAddOnsByConfig(db_used, id_device, id_conf) {
|
|
|
1060
1168
|
case 'MYSQL':
|
|
1061
1169
|
query = getAddOnsByConfigMySQL(id_device, id_conf);
|
|
1062
1170
|
break;
|
|
1171
|
+
case 'MYSQL2':
|
|
1172
|
+
query = getAddOnsByConfigSQLite(id_device, id_conf);
|
|
1173
|
+
break;
|
|
1063
1174
|
}
|
|
1064
1175
|
}
|
|
1065
1176
|
return query;
|
|
@@ -1088,6 +1199,9 @@ function getDeviceConfigurations(db_used, id_device) {
|
|
|
1088
1199
|
case 'MYSQL':
|
|
1089
1200
|
query = getDeviceConfigurationsMySQL(id_device);
|
|
1090
1201
|
break;
|
|
1202
|
+
case 'MYSQL2':
|
|
1203
|
+
query = getDeviceConfigurationsSQLite(id_device);
|
|
1204
|
+
break;
|
|
1091
1205
|
}
|
|
1092
1206
|
}
|
|
1093
1207
|
return query;
|
|
@@ -1115,6 +1229,9 @@ function getLastDeviceConfiguration(db_used, id_device) {
|
|
|
1115
1229
|
case 'MYSQL':
|
|
1116
1230
|
query = getLastDeviceConfigurationMySQL(id_device);
|
|
1117
1231
|
break;
|
|
1232
|
+
case 'MYSQL2':
|
|
1233
|
+
query = getLastDeviceConfigurationSQLite(id_device);
|
|
1234
|
+
break;
|
|
1118
1235
|
}
|
|
1119
1236
|
}
|
|
1120
1237
|
return query;
|
|
@@ -1141,6 +1258,9 @@ function getDeviceConfigurationById(db_used, id_conf) {
|
|
|
1141
1258
|
case 'MYSQL':
|
|
1142
1259
|
query = getDeviceConfigurationByIdMySQL(id_conf);
|
|
1143
1260
|
break;
|
|
1261
|
+
case 'MYSQL2':
|
|
1262
|
+
query = getDeviceConfigurationByIdSQLite(id_conf);
|
|
1263
|
+
break;
|
|
1144
1264
|
}
|
|
1145
1265
|
}
|
|
1146
1266
|
return query;
|
|
@@ -1171,6 +1291,9 @@ function insertDeviceConfiguration(db_used, id_device, data, note) {
|
|
|
1171
1291
|
case 'MYSQL':
|
|
1172
1292
|
query = insertDeviceConfigurationMySQL(id_device, data, note);
|
|
1173
1293
|
break;
|
|
1294
|
+
case 'MYSQL2':
|
|
1295
|
+
query = insertDeviceConfigurationSQLite(id_device, data, note);
|
|
1296
|
+
break;
|
|
1174
1297
|
}
|
|
1175
1298
|
}
|
|
1176
1299
|
return query;
|
|
@@ -1205,6 +1328,9 @@ function updateDeviceConfiguration(db_used, id_conf, data, note) {
|
|
|
1205
1328
|
case 'MYSQL':
|
|
1206
1329
|
query = updateDeviceConfigurationMySQL(id_conf, data, note);
|
|
1207
1330
|
break;
|
|
1331
|
+
case 'MYSQL2':
|
|
1332
|
+
query = updateDeviceConfigurationSQLite(id_conf, data, note);
|
|
1333
|
+
break;
|
|
1208
1334
|
}
|
|
1209
1335
|
}
|
|
1210
1336
|
return query;
|
|
@@ -1230,6 +1356,9 @@ function removeDeviceConfiguration(db_used, id_conf) {
|
|
|
1230
1356
|
case 'MYSQL':
|
|
1231
1357
|
query = removeDeviceConfigurationMySQL(id_conf);
|
|
1232
1358
|
break;
|
|
1359
|
+
case 'MYSQL2':
|
|
1360
|
+
query = removeDeviceConfigurationSQLite(id_conf);
|
|
1361
|
+
break;
|
|
1233
1362
|
}
|
|
1234
1363
|
}
|
|
1235
1364
|
return query;
|
|
@@ -1263,6 +1392,9 @@ function getPartChanged(db_used, id_conf, id_device, id_part, part_type) {
|
|
|
1263
1392
|
case 'MYSQL':
|
|
1264
1393
|
query = getPartChangedMySQL(id_conf, id_device, id_part, part_type);
|
|
1265
1394
|
break;
|
|
1395
|
+
case 'MYSQL2':
|
|
1396
|
+
query = getPartChangedSQLite(id_conf, id_device, id_part, part_type);
|
|
1397
|
+
break;
|
|
1266
1398
|
}
|
|
1267
1399
|
}
|
|
1268
1400
|
return query;
|
|
@@ -1301,6 +1433,9 @@ function insertPartChanged(db_used, id_conf, id_device, id_part, part_type, oper
|
|
|
1301
1433
|
case 'MYSQL':
|
|
1302
1434
|
query = insertPartChangedMySQL(id_conf, id_device, id_part, part_type, operation, id_part_replaced);
|
|
1303
1435
|
break;
|
|
1436
|
+
case 'MYSQL2':
|
|
1437
|
+
query = insertPartChangedSQLite(id_conf, id_device, id_part, part_type, operation, id_part_replaced);
|
|
1438
|
+
break;
|
|
1304
1439
|
}
|
|
1305
1440
|
}
|
|
1306
1441
|
return query;
|
|
@@ -1332,6 +1467,9 @@ function updatePartChanged(db_used, id_change, operation, id_part_replaced) {
|
|
|
1332
1467
|
case 'MYSQL':
|
|
1333
1468
|
query = updatePartChangedMySQL(id_change, operation, id_part_replaced);
|
|
1334
1469
|
break;
|
|
1470
|
+
case 'MYSQL2':
|
|
1471
|
+
query = updatePartChangedSQLite(id_change, operation, id_part_replaced);
|
|
1472
|
+
break;
|
|
1335
1473
|
}
|
|
1336
1474
|
}
|
|
1337
1475
|
return query;
|
|
@@ -1363,6 +1501,9 @@ function removePartChanged(db_used, id_conf, id_part, part_type) {
|
|
|
1363
1501
|
case 'MYSQL':
|
|
1364
1502
|
query = removePartChangedMySQL(id_conf, id_part, part_type);
|
|
1365
1503
|
break;
|
|
1504
|
+
case 'MYSQL2':
|
|
1505
|
+
query = removePartChangedSQLite(id_conf, id_part, part_type);
|
|
1506
|
+
break;
|
|
1366
1507
|
}
|
|
1367
1508
|
}
|
|
1368
1509
|
return query;
|
|
@@ -1394,6 +1535,9 @@ function getLastPartInserted(db_used, id_device, id_conf, part_type) {
|
|
|
1394
1535
|
case 'MYSQL':
|
|
1395
1536
|
query = getLastPartInsertedMySQL(id_device, id_conf, part_type);
|
|
1396
1537
|
break;
|
|
1538
|
+
case 'MYSQL2':
|
|
1539
|
+
query = getLastPartInsertedSQLite(id_device, id_conf, part_type);
|
|
1540
|
+
break;
|
|
1397
1541
|
}
|
|
1398
1542
|
}
|
|
1399
1543
|
return query;
|
|
@@ -1427,6 +1571,9 @@ function existPartInConfig(db_used, id_device, id_conf, id_part, part_type) {
|
|
|
1427
1571
|
case 'MYSQL':
|
|
1428
1572
|
query = existPartInConfigMySQL(id_device, id_conf, id_part, part_type);
|
|
1429
1573
|
break;
|
|
1574
|
+
case 'MYSQL2':
|
|
1575
|
+
query = existPartInConfigSQLite(id_device, id_conf, id_part, part_type);
|
|
1576
|
+
break;
|
|
1430
1577
|
}
|
|
1431
1578
|
}
|
|
1432
1579
|
return query;
|
|
@@ -1455,6 +1602,9 @@ function getDiskUsagesByIdStorage(db_used, id_storage) {
|
|
|
1455
1602
|
case 'MYSQL':
|
|
1456
1603
|
query = getDiskUsagesByIdStorageMySQL(id_storage);
|
|
1457
1604
|
break;
|
|
1605
|
+
case 'MYSQL2':
|
|
1606
|
+
query = getDiskUsagesByIdStorageSQLite(id_storage);
|
|
1607
|
+
break;
|
|
1458
1608
|
}
|
|
1459
1609
|
}
|
|
1460
1610
|
return query;
|
|
@@ -1482,6 +1632,9 @@ function getLastDiskUsagesByIdStorage(db_used, id_storage) {
|
|
|
1482
1632
|
case 'MYSQL':
|
|
1483
1633
|
query = getLastDiskUsagesByIdStorageMySQL(id_storage);
|
|
1484
1634
|
break;
|
|
1635
|
+
case 'MYSQL2':
|
|
1636
|
+
query = getLastDiskUsagesByIdStorageSQLite(id_storage);
|
|
1637
|
+
break;
|
|
1485
1638
|
}
|
|
1486
1639
|
}
|
|
1487
1640
|
return query;
|
|
@@ -1511,6 +1664,9 @@ function getDiskUsageById(db_used, id_diskusage) {
|
|
|
1511
1664
|
case 'MYSQL':
|
|
1512
1665
|
query = getDiskUsageByIdMySQL(id_diskusage);
|
|
1513
1666
|
break;
|
|
1667
|
+
case 'MYSQL2':
|
|
1668
|
+
query = getDiskUsageByIdSQLite(id_diskusage);
|
|
1669
|
+
break;
|
|
1514
1670
|
}
|
|
1515
1671
|
}
|
|
1516
1672
|
return query;
|
|
@@ -1553,6 +1709,9 @@ function insertDiskUsage(db_used, id_device, id_storage, date_ref, size_unit, av
|
|
|
1553
1709
|
case 'MYSQL':
|
|
1554
1710
|
query = insertDiskUsageMySQL(id_device, id_storage, date_ref, size_unit, available_space);
|
|
1555
1711
|
break;
|
|
1712
|
+
case 'MYSQL2':
|
|
1713
|
+
query = insertDiskUsageSQLite(id_device, id_storage, date_ref, size_unit, available_space);
|
|
1714
|
+
break;
|
|
1556
1715
|
}
|
|
1557
1716
|
}
|
|
1558
1717
|
return query;
|
|
@@ -1590,6 +1749,9 @@ function updateDiskUsage(db_used, id_diskusage, date_ref, size_unit, available_s
|
|
|
1590
1749
|
case 'MYSQL':
|
|
1591
1750
|
query = updateDiskUsageMySQL(id_diskusage, date_ref, size_unit, available_space);
|
|
1592
1751
|
break;
|
|
1752
|
+
case 'MYSQL2':
|
|
1753
|
+
query = updateDiskUsageSQLite(id_diskusage, date_ref, size_unit, available_space);
|
|
1754
|
+
break;
|
|
1593
1755
|
}
|
|
1594
1756
|
}
|
|
1595
1757
|
return query;
|
|
@@ -1617,6 +1779,9 @@ function removeDiskUsage(db_used, id_diskusage) {
|
|
|
1617
1779
|
case 'MYSQL':
|
|
1618
1780
|
query = removeDiskUsageMySQL(id_diskusage);
|
|
1619
1781
|
break;
|
|
1782
|
+
case 'MYSQL2':
|
|
1783
|
+
query = removeDiskUsageSQLite(id_diskusage);
|
|
1784
|
+
break;
|
|
1620
1785
|
}
|
|
1621
1786
|
}
|
|
1622
1787
|
return query;
|
|
@@ -1645,6 +1810,9 @@ function existsPCProperties(db_used, id_device) {
|
|
|
1645
1810
|
case 'MYSQL':
|
|
1646
1811
|
query = existsPCPropertiesMySQL(id_device);
|
|
1647
1812
|
break;
|
|
1813
|
+
case 'MYSQL2':
|
|
1814
|
+
query = existsPCPropertiesSQLite(id_device);
|
|
1815
|
+
break;
|
|
1648
1816
|
}
|
|
1649
1817
|
}
|
|
1650
1818
|
return query;
|
|
@@ -1681,6 +1849,9 @@ function getPCProperties(db_used, id_device) {
|
|
|
1681
1849
|
case 'MYSQL':
|
|
1682
1850
|
query = getPCPropertiesMySQL(id_device);
|
|
1683
1851
|
break;
|
|
1852
|
+
case 'MYSQL2':
|
|
1853
|
+
query = getPCPropertiesSQLite(id_device);
|
|
1854
|
+
break;
|
|
1684
1855
|
}
|
|
1685
1856
|
}
|
|
1686
1857
|
return query;
|
|
@@ -1723,6 +1894,9 @@ function insertPCProperties(db_used, id_device, dev_prop) {
|
|
|
1723
1894
|
case 'MYSQL':
|
|
1724
1895
|
query = insertPCPropertiesMySQL();
|
|
1725
1896
|
break;
|
|
1897
|
+
case 'MYSQL2':
|
|
1898
|
+
query = insertPCPropertiesSQLite(id_device, dev_prop);
|
|
1899
|
+
break;
|
|
1726
1900
|
}
|
|
1727
1901
|
}
|
|
1728
1902
|
return query;
|
|
@@ -1775,6 +1949,9 @@ function updatePCProperties(db_used, id_device, dev_prop) {
|
|
|
1775
1949
|
case 'MYSQL':
|
|
1776
1950
|
query = updatePCPropertiesMySQL();
|
|
1777
1951
|
break;
|
|
1952
|
+
case 'MYSQL2':
|
|
1953
|
+
query = updatePCPropertiesSQLite(id_device, dev_prop);
|
|
1954
|
+
break;
|
|
1778
1955
|
}
|
|
1779
1956
|
}
|
|
1780
1957
|
return query;
|
|
@@ -1811,6 +1988,9 @@ function getLastPCPropertiesInserted(db_used, id_device) {
|
|
|
1811
1988
|
case 'MYSQL':
|
|
1812
1989
|
query = getLastPCPropertiesInsertedMySQL(id_device);
|
|
1813
1990
|
break;
|
|
1991
|
+
case 'MYSQL2':
|
|
1992
|
+
query = getLastPCPropertiesInsertedSQLite(id_device);
|
|
1993
|
+
break;
|
|
1814
1994
|
}
|
|
1815
1995
|
}
|
|
1816
1996
|
return query;
|
|
@@ -1859,6 +2039,9 @@ function getPCPropertiesByConfig(db_used, id_device, id_conf) {
|
|
|
1859
2039
|
case 'MYSQL':
|
|
1860
2040
|
query = getPCPropertiesByConfigMySQL(id_device, id_conf);
|
|
1861
2041
|
break;
|
|
2042
|
+
case 'MYSQL2':
|
|
2043
|
+
query = getPCPropertiesByConfigSQLite(id_device, id_conf);
|
|
2044
|
+
break;
|
|
1862
2045
|
}
|
|
1863
2046
|
}
|
|
1864
2047
|
return query;
|
|
@@ -1892,6 +2075,9 @@ function getDisplayPartProperties(db_used, id_device) {
|
|
|
1892
2075
|
case 'MYSQL':
|
|
1893
2076
|
query = getDisplayPartPropertiesMySQL(id_device);
|
|
1894
2077
|
break;
|
|
2078
|
+
case 'MYSQL2':
|
|
2079
|
+
query = getDisplayPartPropertiesSQLite(id_device);
|
|
2080
|
+
break;
|
|
1895
2081
|
}
|
|
1896
2082
|
}
|
|
1897
2083
|
return query;
|
|
@@ -1915,6 +2101,9 @@ function existsDisplayPartProperties(db_used, id_device) {
|
|
|
1915
2101
|
case 'MYSQL':
|
|
1916
2102
|
query = existsDisplayPartPropertiesMySQL(id_device);
|
|
1917
2103
|
break;
|
|
2104
|
+
case 'MYSQL2':
|
|
2105
|
+
query = existsDisplayPartPropertiesSQLite(id_device);
|
|
2106
|
+
break;
|
|
1918
2107
|
}
|
|
1919
2108
|
}
|
|
1920
2109
|
return query;
|
|
@@ -1939,6 +2128,9 @@ function insertDisplayPartProperties(db_used, id_device, dev_prop) {
|
|
|
1939
2128
|
case 'MYSQL':
|
|
1940
2129
|
query = insertDisplayPartPropertiesMySQL();
|
|
1941
2130
|
break;
|
|
2131
|
+
case 'MYSQL2':
|
|
2132
|
+
query = insertDisplayPartPropertiesSQLite(id_device, dev_prop);
|
|
2133
|
+
break;
|
|
1942
2134
|
}
|
|
1943
2135
|
}
|
|
1944
2136
|
return query;
|
|
@@ -1976,6 +2168,9 @@ function updateDisplayPartProperties(db_used, id_device, dev_prop) {
|
|
|
1976
2168
|
case 'MYSQL':
|
|
1977
2169
|
query = updateDisplayPartPropertiesMySQL();
|
|
1978
2170
|
break;
|
|
2171
|
+
case 'MYSQL2':
|
|
2172
|
+
query = updateDisplayPartPropertiesSQLite(id_device, dev_prop);
|
|
2173
|
+
break;
|
|
1979
2174
|
}
|
|
1980
2175
|
}
|
|
1981
2176
|
return query;
|
|
@@ -2003,6 +2198,9 @@ function existsDisplayProperties(db_used, id_device) {
|
|
|
2003
2198
|
case 'MYSQL':
|
|
2004
2199
|
query = existsDisplayPropertiesMySQL(id_device);
|
|
2005
2200
|
break;
|
|
2201
|
+
case 'MYSQL2':
|
|
2202
|
+
query = existsDisplayPropertiesSQLite(id_device);
|
|
2203
|
+
break;
|
|
2006
2204
|
}
|
|
2007
2205
|
}
|
|
2008
2206
|
return query;
|
|
@@ -2034,6 +2232,9 @@ function getDisplayProperties(db_used, id_device) {
|
|
|
2034
2232
|
case 'MYSQL':
|
|
2035
2233
|
query = getDisplayPropertiesMySQL(id_device);
|
|
2036
2234
|
break;
|
|
2235
|
+
case 'MYSQL2':
|
|
2236
|
+
query = getDisplayPropertiesSQLite(id_device);
|
|
2237
|
+
break;
|
|
2037
2238
|
}
|
|
2038
2239
|
}
|
|
2039
2240
|
return query;
|
|
@@ -2069,6 +2270,9 @@ function insertDisplayProperties(db_used, id_device, dev_prop) {
|
|
|
2069
2270
|
case 'MYSQL':
|
|
2070
2271
|
query = insertDisplayPropertiesMySQL();
|
|
2071
2272
|
break;
|
|
2273
|
+
case 'MYSQL2':
|
|
2274
|
+
query = insertDisplayPropertiesSQLite(id_device, dev_prop);
|
|
2275
|
+
break;
|
|
2072
2276
|
}
|
|
2073
2277
|
}
|
|
2074
2278
|
return query;
|
|
@@ -2105,6 +2309,9 @@ function updateDisplayProperties(db_used, id_device, dev_prop) {
|
|
|
2105
2309
|
case 'MYSQL':
|
|
2106
2310
|
query = updateDisplayPropertiesMySQL();
|
|
2107
2311
|
break;
|
|
2312
|
+
case 'MYSQL2':
|
|
2313
|
+
query = updateDisplayPropertiesSQLite(id_device, dev_prop);
|
|
2314
|
+
break;
|
|
2108
2315
|
}
|
|
2109
2316
|
}
|
|
2110
2317
|
return query;
|
|
@@ -2274,6 +2481,80 @@ function getDevicesSelectMySQL(search_type, inv_code, dev_type, marca, is_PNRR,
|
|
|
2274
2481
|
query += " order by id";
|
|
2275
2482
|
return query;
|
|
2276
2483
|
}
|
|
2484
|
+
|
|
2485
|
+
function getDevicesSelectMySQL2(search_type, inv_code, dev_type, marca, is_PNRR, dev_status, dev_gestione, id_dev_exclude) {
|
|
2486
|
+
var query = "SELECT DISTINCT d.id, d.type as Tipo, d.manifacturer as Marca, d.model as Modello, ";
|
|
2487
|
+
query += "case ";
|
|
2488
|
+
query += "when d.inv_ict3_number != '' and d.inv_ict3_number is not null then d.inv_ict3_number ";
|
|
2489
|
+
query += "when d.inv_pnrr_number != '' and d.inv_pnrr_number is not null then d.inv_pnrr_number ";
|
|
2490
|
+
query += "when d.inv_tn_number != '' and d.inv_tn_number is not null then concat(d.inv_tn_number,'(TN)') ";
|
|
2491
|
+
query += "when d.inv_tndigit_number != '' and d.inv_tndigit_number is not null then concat(d.inv_tndigit_number,'(TNDigit)') ";
|
|
2492
|
+
query += "when d.serial_no != '' and d.serial_no is not null then concat(d.serial_no,'(S/N)') ";
|
|
2493
|
+
query += "end as Codice ";
|
|
2494
|
+
query += "from devices d ";
|
|
2495
|
+
if (dev_status)
|
|
2496
|
+
query += "left join device_usage du on d.id = du.id_device"
|
|
2497
|
+
if (dev_gestione)
|
|
2498
|
+
query += "left join device_gestioni dg on d.id = dg.id_device"
|
|
2499
|
+
|
|
2500
|
+
var where_clause = " where (d.is_removed is null or d.is_removed = 0) ";
|
|
2501
|
+
if (inv_code || dev_type || marca || (is_PNRR && is_PNRR > 0) || dev_status || dev_gestione) {
|
|
2502
|
+
if (inv_code) {
|
|
2503
|
+
if (search_type == "ESATTA") {
|
|
2504
|
+
where_clause += " and (d.inv_ict3_number = '" + inv_code + "' or ";
|
|
2505
|
+
where_clause += "d.inv_tn_number = '" + inv_code + "' or ";
|
|
2506
|
+
where_clause += "d.serial_no = '" + inv_code + "' or ";
|
|
2507
|
+
where_clause += "d.inv_tndigit_number = '" + inv_code + "' or ";
|
|
2508
|
+
where_clause += "d.inv_pnrr_number = '" + inv_code + "')";
|
|
2509
|
+
}
|
|
2510
|
+
else {
|
|
2511
|
+
where_clause += " and (d.inv_ict3_number like '" + inv_code + "%' or ";
|
|
2512
|
+
where_clause += "d.inv_tn_number like '" + inv_code + "%' or ";
|
|
2513
|
+
where_clause += "d.serial_no like '%" + inv_code + "%' or ";
|
|
2514
|
+
where_clause += "d.inv_tndigit_number like '" + inv_code + "%' or ";
|
|
2515
|
+
where_clause += "d.inv_pnrr_number = '" + inv_code + "')";
|
|
2516
|
+
}
|
|
2517
|
+
}
|
|
2518
|
+
else {
|
|
2519
|
+
where_clause += " and ";
|
|
2520
|
+
if (dev_type) {
|
|
2521
|
+
where_clause += "d.type = '" + dev_type + "'";
|
|
2522
|
+
if (marca || (is_PNRR && is_PNRR > 0) || dev_status) {
|
|
2523
|
+
where_clause += " and ";
|
|
2524
|
+
}
|
|
2525
|
+
}
|
|
2526
|
+
if (marca) {
|
|
2527
|
+
where_clause += " d.manifacturer = '" + marca + "'";
|
|
2528
|
+
if ((is_PNRR && is_PNRR > 0) || dev_status) {
|
|
2529
|
+
where_clause += " and ";
|
|
2530
|
+
}
|
|
2531
|
+
}
|
|
2532
|
+
if (is_PNRR && is_PNRR > 0) {
|
|
2533
|
+
where_clause += " (d.inv_pnrr_number <> '' and inv_pnrr_number is not null) ";
|
|
2534
|
+
if (dev_status || dev_gestione) {
|
|
2535
|
+
where_clause += " and ";
|
|
2536
|
+
}
|
|
2537
|
+
}
|
|
2538
|
+
if (dev_status) {
|
|
2539
|
+
where_clause += " du.status = " + dev_status + " and CURDATE() >= du.date_status";
|
|
2540
|
+
if (dev_gestione) {
|
|
2541
|
+
where_clause += " and ";
|
|
2542
|
+
}
|
|
2543
|
+
}
|
|
2544
|
+
if (dev_gestione) {
|
|
2545
|
+
where_clause += " dg.id_gestione = " + dev_gestione + " and CURDATE() >= dg.date_start and CURDATE() <= dg.date_end";
|
|
2546
|
+
}
|
|
2547
|
+
}
|
|
2548
|
+
}
|
|
2549
|
+
else {
|
|
2550
|
+
if (id_dev_exclude > 0) {
|
|
2551
|
+
where_clause += " and d.id <> " + id_dev_exclude;
|
|
2552
|
+
}
|
|
2553
|
+
}
|
|
2554
|
+
query += where_clause;
|
|
2555
|
+
return query;
|
|
2556
|
+
}
|
|
2557
|
+
|
|
2277
2558
|
function getDevicesSelect(db_used, search_type, inv_code, dev_type, marca, is_PNRR, dev_status, dev_gestione, id_dev_exclude) {
|
|
2278
2559
|
var query = "";
|
|
2279
2560
|
if (db_used) {
|
|
@@ -2284,6 +2565,9 @@ function getDevicesSelect(db_used, search_type, inv_code, dev_type, marca, is_PN
|
|
|
2284
2565
|
case 'MYSQL':
|
|
2285
2566
|
query = getDevicesSelectMySQL(search_type, inv_code, dev_type, marca, is_PNRR, dev_status, dev_gestione, id_dev_exclude);
|
|
2286
2567
|
break;
|
|
2568
|
+
case 'MYSQL2':
|
|
2569
|
+
query = getDevicesSelectMySQL2(search_type, inv_code, dev_type, marca, is_PNRR, dev_status, dev_gestione, id_dev_exclude);
|
|
2570
|
+
break;
|
|
2287
2571
|
}
|
|
2288
2572
|
}
|
|
2289
2573
|
return query;
|
|
@@ -2344,6 +2628,34 @@ function getDevicesSelectBySiteMySQL(id_site, dev_type) {
|
|
|
2344
2628
|
|
|
2345
2629
|
return query;
|
|
2346
2630
|
}
|
|
2631
|
+
|
|
2632
|
+
function getDevicesSelectBySiteMySQL2(id_site, dev_type) {
|
|
2633
|
+
var query = "select distinct d.id, d.type as Tipo, d.manifacturer as Marca, d.model as modello, ";
|
|
2634
|
+
query += "case ";
|
|
2635
|
+
query += "when inv_ict3_number != '' and inv_ict3_number is not null then inv_ict3_number ";
|
|
2636
|
+
query += "when inv_pnrr_number != '' and inv_pnrr_number is not null then inv_pnrr_number ";
|
|
2637
|
+
query += "when inv_tn_number != '' and inv_tn_number is not null then concat(inv_tn_number,'(TN)') ";
|
|
2638
|
+
query += "when inv_tndigit_number != '' and inv_tndigit_number is not null then concat(inv_tndigit_number,'(TNDigit)') ";
|
|
2639
|
+
query += "when serial_no != '' and serial_no is not null then concat(serial_no,'(S/N)') ";
|
|
2640
|
+
query += "end as Codice, ";
|
|
2641
|
+
query += "case ";
|
|
2642
|
+
query += "when trim(inv_pnrr_number) is null then '' ";
|
|
2643
|
+
query += "when trim(inv_pnrr_number) = '' then '' ";
|
|
2644
|
+
query += "else 'SI' ";
|
|
2645
|
+
query += "end as PNRR ";
|
|
2646
|
+
query += " from devices d ";
|
|
2647
|
+
query += "inner join device_site ds on ds.id_device = d.id ";
|
|
2648
|
+
query += "inner join sites s on s.id = ds.id_site ";
|
|
2649
|
+
query += "where (CURDATE() >= ds.date_in and CURDATE() <= ds.date_out) ";
|
|
2650
|
+
query += "and (d.is_removed is null or d.is_removed = 0) ";
|
|
2651
|
+
query += "and s.id = " + id_site + " ";
|
|
2652
|
+
if (dev_type && dev_type != '') {
|
|
2653
|
+
query += "and d.type = '" + dev_type + "' ";
|
|
2654
|
+
}
|
|
2655
|
+
query += "order by d.type ";
|
|
2656
|
+
return query;
|
|
2657
|
+
}
|
|
2658
|
+
|
|
2347
2659
|
function getDevicesSelectBySite(db_used, id_site, dev_type) {
|
|
2348
2660
|
var query = "";
|
|
2349
2661
|
if (db_used) {
|
|
@@ -2354,6 +2666,9 @@ function getDevicesSelectBySite(db_used, id_site, dev_type) {
|
|
|
2354
2666
|
case 'MYSQL':
|
|
2355
2667
|
query = getDevicesSelectBySiteMySQL(id_site, dev_type);
|
|
2356
2668
|
break;
|
|
2669
|
+
case 'MYSQL2':
|
|
2670
|
+
query = getDevicesSelectBySiteMySQL2(id_site, dev_type);
|
|
2671
|
+
break;
|
|
2357
2672
|
}
|
|
2358
2673
|
}
|
|
2359
2674
|
return query;
|
|
@@ -2413,6 +2728,32 @@ function getDevicesSelectByPlaceMySQL(id_place, dev_type) {
|
|
|
2413
2728
|
query += "order by d.type ";
|
|
2414
2729
|
return query;
|
|
2415
2730
|
}
|
|
2731
|
+
function getDevicesSelectByPlaceMySQL2(id_place, dev_type) {
|
|
2732
|
+
var query = "select distinct d.id, d.type as Tipo, d.manifacturer as Marca, d.model as modello, ";
|
|
2733
|
+
query += "case ";
|
|
2734
|
+
query += "when inv_ict3_number != '' and inv_ict3_number is not null then inv_ict3_number ";
|
|
2735
|
+
query += "when inv_pnrr_number != '' and inv_pnrr_number is not null then inv_pnrr_number ";
|
|
2736
|
+
query += "when inv_tn_number != '' and inv_tn_number is not null then concat(inv_tn_number,'(TN)') ";
|
|
2737
|
+
query += "when inv_tndigit_number != '' and inv_tndigit_number is not null then concat(inv_tndigit_number,'(TNDigit)') ";
|
|
2738
|
+
query += "when serial_no != '' and serial_no is not null then concat(serial_no,'(S/N)') ";
|
|
2739
|
+
query += "end as Codice, ";
|
|
2740
|
+
query += "case ";
|
|
2741
|
+
query += "when trim(inv_pnrr_number) is null then '' ";
|
|
2742
|
+
query += "when trim(inv_pnrr_number) = '' then '' ";
|
|
2743
|
+
query += "else 'SI' ";
|
|
2744
|
+
query += "end as PNRR ";
|
|
2745
|
+
query += " from devices d ";
|
|
2746
|
+
query += "inner join device_site ds on ds.id_device = d.id ";
|
|
2747
|
+
query += "inner join sites s on s.id = ds.id_site ";
|
|
2748
|
+
query += "where (CURDATE() >= ds.date_in and CURDATE() <= ds.date_out) ";
|
|
2749
|
+
query += "and (d.is_removed is null or d.is_removed = 0) ";
|
|
2750
|
+
query += "and s.id_place = '" + id_place + "' ";
|
|
2751
|
+
if (dev_type && dev_type != '') {
|
|
2752
|
+
query += "and d.type = '" + dev_type + "' ";
|
|
2753
|
+
}
|
|
2754
|
+
query += "order by d.type ";
|
|
2755
|
+
return query;
|
|
2756
|
+
}
|
|
2416
2757
|
function getDevicesSelectByPlace(db_used, id_place, dev_type) {
|
|
2417
2758
|
var query = "";
|
|
2418
2759
|
if (db_used) {
|
|
@@ -2423,6 +2764,9 @@ function getDevicesSelectByPlace(db_used, id_place, dev_type) {
|
|
|
2423
2764
|
case 'MYSQL':
|
|
2424
2765
|
query = getDevicesSelectByPlaceMySQL(id_place, dev_type);
|
|
2425
2766
|
break;
|
|
2767
|
+
case 'MYSQL2':
|
|
2768
|
+
query = getDevicesSelectByPlaceMySQL2(id_place, dev_type);
|
|
2769
|
+
break;
|
|
2426
2770
|
}
|
|
2427
2771
|
}
|
|
2428
2772
|
return query;
|
|
@@ -2451,6 +2795,16 @@ function getDevicesCounterBySiteMySQL(id_site) {
|
|
|
2451
2795
|
return query;
|
|
2452
2796
|
}
|
|
2453
2797
|
|
|
2798
|
+
function getDevicesCounterBySiteMySQL2(id_site) {
|
|
2799
|
+
var query = "select d.type as Tipo, count(d.type) as Numero from devices d ";
|
|
2800
|
+
query += "inner join device_site ds on ds.id_device = d.id ";
|
|
2801
|
+
query += "where (CURDATE() >= ds.date_in and CURDATE() <= ds.date_out) ";
|
|
2802
|
+
query += "and (d.is_removed is null or d.is_removed = 0) ";
|
|
2803
|
+
query += "and ds.id_site = " + id_site + " ";
|
|
2804
|
+
query += "group by d.type";
|
|
2805
|
+
return query;
|
|
2806
|
+
}
|
|
2807
|
+
|
|
2454
2808
|
function getDevicesCounterBySite(db_used, id_site) {
|
|
2455
2809
|
var query = "";
|
|
2456
2810
|
if (db_used) {
|
|
@@ -2461,6 +2815,9 @@ function getDevicesCounterBySite(db_used, id_site) {
|
|
|
2461
2815
|
case 'MYSQL':
|
|
2462
2816
|
query = getDevicesCounterBySiteMySQL(id_site);
|
|
2463
2817
|
break;
|
|
2818
|
+
case 'MYSQL2':
|
|
2819
|
+
query = getDevicesCounterBySiteMySQL2(id_site);
|
|
2820
|
+
break;
|
|
2464
2821
|
}
|
|
2465
2822
|
}
|
|
2466
2823
|
return query;
|
|
@@ -2488,6 +2845,16 @@ function getDevicesCounterByPlaceMySQL(id_place) {
|
|
|
2488
2845
|
return query;
|
|
2489
2846
|
}
|
|
2490
2847
|
|
|
2848
|
+
function getDevicesCounterByPlaceMySQL2(id_place) {
|
|
2849
|
+
var query = "select d.type as Tipo, count(d.type) as Numero from devices d ";
|
|
2850
|
+
query += "inner join device_site ds on ds.id_device = d.id ";
|
|
2851
|
+
query += "inner join sites s on s.id = ds.id_site ";
|
|
2852
|
+
query += "where (CURDATE() >= ds.date_in and CURDATE() <= ds.date_out) ";
|
|
2853
|
+
query += "and ds.id_place = '" + id_place + "' ";
|
|
2854
|
+
query += "group by d.type";
|
|
2855
|
+
return query;
|
|
2856
|
+
}
|
|
2857
|
+
|
|
2491
2858
|
function getDevicesCounterByPlace(db_used, id_place) {
|
|
2492
2859
|
var query = "";
|
|
2493
2860
|
if (db_used) {
|
|
@@ -2498,6 +2865,9 @@ function getDevicesCounterByPlace(db_used, id_place) {
|
|
|
2498
2865
|
case 'MYSQL':
|
|
2499
2866
|
query = getDevicesCounterByPlaceMySQL(id_place);
|
|
2500
2867
|
break;
|
|
2868
|
+
case 'MYSQL2':
|
|
2869
|
+
query = getDevicesCounterByPlaceMySQL2(id_place);
|
|
2870
|
+
break;
|
|
2501
2871
|
}
|
|
2502
2872
|
}
|
|
2503
2873
|
return query;
|
|
@@ -2553,6 +2923,9 @@ function getDevicesSelectByRelated(db_used, id_device) {
|
|
|
2553
2923
|
case 'MYSQL':
|
|
2554
2924
|
query = getDevicesSelectByRelatedMySQL(id_device);
|
|
2555
2925
|
break;
|
|
2926
|
+
case 'MYSQL2':
|
|
2927
|
+
query = getDevicesSelectByRelatedSQLite(id_device);
|
|
2928
|
+
break;
|
|
2556
2929
|
}
|
|
2557
2930
|
}
|
|
2558
2931
|
return query;
|
|
@@ -2587,6 +2960,9 @@ function queryDeviceById(db_used, id_device) {
|
|
|
2587
2960
|
case 'MYSQL':
|
|
2588
2961
|
query = queryDeviceByIdMySQL(id_device);
|
|
2589
2962
|
break;
|
|
2963
|
+
case 'MYSQL2':
|
|
2964
|
+
query = queryDeviceByIdSQLite(id_device);
|
|
2965
|
+
break;
|
|
2590
2966
|
}
|
|
2591
2967
|
}
|
|
2592
2968
|
return query;
|
|
@@ -2628,6 +3004,9 @@ function queryDeviceByIdentificativo(db_used, identificativo) {
|
|
|
2628
3004
|
case 'MYSQL':
|
|
2629
3005
|
query = queryDeviceByIdentificativoMySQL(identificativo);
|
|
2630
3006
|
break;
|
|
3007
|
+
case 'MYSQL2':
|
|
3008
|
+
query = queryDeviceByIdentificativoSQLite(identificativo);
|
|
3009
|
+
break;
|
|
2631
3010
|
}
|
|
2632
3011
|
}
|
|
2633
3012
|
return query;
|
|
@@ -2671,6 +3050,23 @@ function queryDeviceStatusMySQL(id_device, date_ref) {
|
|
|
2671
3050
|
query += "order by id desc limit 1"
|
|
2672
3051
|
return query;
|
|
2673
3052
|
}
|
|
3053
|
+
function queryDeviceStatusMySQL2(id_device, date_ref) {
|
|
3054
|
+
var query = "select case when status is null then 0 else status end as stato, date_status from device_usage du ";
|
|
3055
|
+
query += "where du.id_device = " + id_device + " ";
|
|
3056
|
+
if (date_ref) {
|
|
3057
|
+
switch (date_ref) {
|
|
3058
|
+
case "current":
|
|
3059
|
+
query += "and CURDATE() >= du.date_status ";
|
|
3060
|
+
break;
|
|
3061
|
+
default:
|
|
3062
|
+
query += "and '" + date_ref + "' >= du.date_status ";
|
|
3063
|
+
break;
|
|
3064
|
+
|
|
3065
|
+
}
|
|
3066
|
+
}
|
|
3067
|
+
query += "order by id desc limit 1"
|
|
3068
|
+
return query;
|
|
3069
|
+
}
|
|
2674
3070
|
function queryDeviceStatus(db_used, id_device, date_ref) {
|
|
2675
3071
|
var query = "";
|
|
2676
3072
|
if (db_used) {
|
|
@@ -2681,6 +3077,9 @@ function queryDeviceStatus(db_used, id_device, date_ref) {
|
|
|
2681
3077
|
case 'MYSQL':
|
|
2682
3078
|
query = queryDeviceStatusMySQL(id_device, date_ref);
|
|
2683
3079
|
break;
|
|
3080
|
+
case 'MYSQL2':
|
|
3081
|
+
query = queryDeviceStatusMySQL2(id_device, date_ref);
|
|
3082
|
+
break;
|
|
2684
3083
|
}
|
|
2685
3084
|
}
|
|
2686
3085
|
return query;
|
|
@@ -2707,6 +3106,9 @@ function updateDeviceStatus(db_used, id_device) {
|
|
|
2707
3106
|
case 'MYSQL':
|
|
2708
3107
|
query = updateDeviceStatusMySQL(id_device);
|
|
2709
3108
|
break;
|
|
3109
|
+
case 'MYSQL2':
|
|
3110
|
+
query = updateDeviceStatusSQLite(id_device);
|
|
3111
|
+
break;
|
|
2710
3112
|
}
|
|
2711
3113
|
}
|
|
2712
3114
|
return query;
|
|
@@ -2742,6 +3144,20 @@ function insertDeviceStatusMySQL(id_device, dev_status, start_date) {
|
|
|
2742
3144
|
query += ")";
|
|
2743
3145
|
return query;
|
|
2744
3146
|
}
|
|
3147
|
+
function insertDeviceStatusMySQL2(id_device, dev_status, start_date) {
|
|
3148
|
+
var query = "insert into device_usage (date_status, id_device, status) ";
|
|
3149
|
+
query += "values (";
|
|
3150
|
+
if ((!start_date || start_date == '') || start_date == "TODAY") {
|
|
3151
|
+
query += "CURDATE(),";
|
|
3152
|
+
}
|
|
3153
|
+
else {
|
|
3154
|
+
query += "'" + start_date + "',";
|
|
3155
|
+
}
|
|
3156
|
+
query += id_device + ",";
|
|
3157
|
+
query += dev_status;
|
|
3158
|
+
query += ")";
|
|
3159
|
+
return query;
|
|
3160
|
+
}
|
|
2745
3161
|
function insertDeviceStatus(db_used, id_device, dev_status, start_date) {
|
|
2746
3162
|
var query = "";
|
|
2747
3163
|
if (db_used) {
|
|
@@ -2752,6 +3168,9 @@ function insertDeviceStatus(db_used, id_device, dev_status, start_date) {
|
|
|
2752
3168
|
case 'MYSQL':
|
|
2753
3169
|
query = insertDeviceStatusMySQL(id_device, dev_status, start_date);
|
|
2754
3170
|
break;
|
|
3171
|
+
case 'MYSQL2':
|
|
3172
|
+
query = insertDeviceStatusMySQL2(id_device, dev_status, start_date);
|
|
3173
|
+
break;
|
|
2755
3174
|
}
|
|
2756
3175
|
}
|
|
2757
3176
|
return query;
|
|
@@ -2834,6 +3253,9 @@ function insertDevice(db_used, deviceObj) {
|
|
|
2834
3253
|
case 'MYSQL':
|
|
2835
3254
|
query = insertDeviceMySQL();
|
|
2836
3255
|
break;
|
|
3256
|
+
case 'MYSQL2':
|
|
3257
|
+
query = insertDeviceSQLite(deviceObj);
|
|
3258
|
+
break;
|
|
2837
3259
|
}
|
|
2838
3260
|
}
|
|
2839
3261
|
return query;
|
|
@@ -2916,6 +3338,9 @@ function updateDevice(db_used, deviceObj) {
|
|
|
2916
3338
|
case 'MYSQL':
|
|
2917
3339
|
query = updateDeviceMySQL();
|
|
2918
3340
|
break;
|
|
3341
|
+
case 'MYSQL2':
|
|
3342
|
+
query = updateDeviceSQLite(deviceObj);
|
|
3343
|
+
break;
|
|
2919
3344
|
}
|
|
2920
3345
|
}
|
|
2921
3346
|
return query;
|
|
@@ -2997,6 +3422,9 @@ function removeDevice(db_used, id_device) {
|
|
|
2997
3422
|
case 'MYSQL':
|
|
2998
3423
|
query = removeDeviceMySQL();
|
|
2999
3424
|
break;
|
|
3425
|
+
case 'MYSQL2':
|
|
3426
|
+
query = removeDeviceSQLite(id_device);
|
|
3427
|
+
break;
|
|
3000
3428
|
}
|
|
3001
3429
|
}
|
|
3002
3430
|
return query;
|
|
@@ -3021,6 +3449,9 @@ function queryLastDeviceId(db_used) {
|
|
|
3021
3449
|
case 'MYSQL':
|
|
3022
3450
|
query = queryLastDeviceIdMySQL();
|
|
3023
3451
|
break;
|
|
3452
|
+
case 'MYSQL2':
|
|
3453
|
+
query = queryLastDeviceIdMySQL();
|
|
3454
|
+
break;
|
|
3024
3455
|
}
|
|
3025
3456
|
}
|
|
3026
3457
|
return query;
|
|
@@ -3098,6 +3529,9 @@ function getDevicesSelectCombo(db_used, categoria, id_dev_exclude, with_properti
|
|
|
3098
3529
|
case 'MYSQL':
|
|
3099
3530
|
query = getDevicesSelectComboMySQL(categoria, id_dev_exclude, with_properties);
|
|
3100
3531
|
break;
|
|
3532
|
+
case 'MYSQL2':
|
|
3533
|
+
query = getDevicesSelectComboSQLite(categoria, id_dev_exclude, with_properties);
|
|
3534
|
+
break;
|
|
3101
3535
|
}
|
|
3102
3536
|
}
|
|
3103
3537
|
return query;
|
|
@@ -3144,6 +3578,27 @@ function getDevicesSelectBySiteComboMySQL(id_site, dev_type) {
|
|
|
3144
3578
|
query += "order by d.inv_ict3_number";
|
|
3145
3579
|
return query;
|
|
3146
3580
|
}
|
|
3581
|
+
function getDevicesSelectBySiteComboMySQL2(id_site, dev_type) {
|
|
3582
|
+
var query = "SELECT d.id, d.type as Tipo, d.manifacturer as Marca, d.model as Modello, ";
|
|
3583
|
+
query += "case ";
|
|
3584
|
+
query += "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) ";
|
|
3585
|
+
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) ";
|
|
3586
|
+
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) ";
|
|
3587
|
+
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) ";
|
|
3588
|
+
query += "else '' "
|
|
3589
|
+
query += "end as Descrizione ";
|
|
3590
|
+
query += "from devices d ";
|
|
3591
|
+
query += "join device_site ds on ds.id_device = d.id ";
|
|
3592
|
+
query += "where (d.is_removed is null or d.is_removed = 0) ";
|
|
3593
|
+
query += "and ds.id_site = " + id_site + " ";
|
|
3594
|
+
query += "and CURDATE() >= ds.date_in and CURDATE() <= ds.date_out ";
|
|
3595
|
+
if (dev_type && dev_type != '') {
|
|
3596
|
+
query += "and d.type = '" + dev_type + "' ";
|
|
3597
|
+
}
|
|
3598
|
+
query += "order by d.inv_ict3_number";
|
|
3599
|
+
return query;
|
|
3600
|
+
}
|
|
3601
|
+
|
|
3147
3602
|
|
|
3148
3603
|
function getDevicesSelectBySiteCombo(db_used, id_site, dev_type) {
|
|
3149
3604
|
var query = "";
|
|
@@ -3155,6 +3610,9 @@ function getDevicesSelectBySiteCombo(db_used, id_site, dev_type) {
|
|
|
3155
3610
|
case 'MYSQL':
|
|
3156
3611
|
query = getDevicesSelectBySiteComboMySQL(id_site, dev_type);
|
|
3157
3612
|
break;
|
|
3613
|
+
case 'MYSQL2':
|
|
3614
|
+
query = getDevicesSelectBySiteComboMySQL2(id_site, dev_type);
|
|
3615
|
+
break;
|
|
3158
3616
|
}
|
|
3159
3617
|
}
|
|
3160
3618
|
return query;
|
|
@@ -3183,6 +3641,9 @@ function writeDeviceProperties(db_used, id_device, raw_data) {
|
|
|
3183
3641
|
case 'MYSQL':
|
|
3184
3642
|
query = writeDevicePropertiesMySQL();
|
|
3185
3643
|
break;
|
|
3644
|
+
case 'MYSQL2':
|
|
3645
|
+
query = writeDevicePropertiesSQLite(id_device, raw_data);
|
|
3646
|
+
break;
|
|
3186
3647
|
}
|
|
3187
3648
|
}
|
|
3188
3649
|
return query;
|
|
@@ -3210,6 +3671,9 @@ function readDeviceProperties(db_used, id_device) {
|
|
|
3210
3671
|
case 'MYSQL':
|
|
3211
3672
|
query = readDevicePropertiesMySQL();
|
|
3212
3673
|
break;
|
|
3674
|
+
case 'MYSQL2':
|
|
3675
|
+
query = readDevicePropertiesSQLite(id_device);
|
|
3676
|
+
break;
|
|
3213
3677
|
}
|
|
3214
3678
|
}
|
|
3215
3679
|
return query;
|
|
@@ -3263,6 +3727,9 @@ function getDevicesWithProperties(db_used, id_device) {
|
|
|
3263
3727
|
case 'MYSQL':
|
|
3264
3728
|
query = getDevicesWithPropertiesMySQL(id_device);
|
|
3265
3729
|
break;
|
|
3730
|
+
case 'MYSQL2':
|
|
3731
|
+
query = getDevicesWithPropertiesSQLite(id_device);
|
|
3732
|
+
break;
|
|
3266
3733
|
}
|
|
3267
3734
|
}
|
|
3268
3735
|
return query;
|
|
@@ -3433,6 +3900,9 @@ function getBeniDaInventari(db_used, table_name, inv_code, include_imp, is_pnrr,
|
|
|
3433
3900
|
case 'MYSQL':
|
|
3434
3901
|
query = getBeniDaInventariMySQL(table_name, inv_code, include_imp, is_pnrr, is_dismissione);
|
|
3435
3902
|
break;
|
|
3903
|
+
case 'MYSQL2':
|
|
3904
|
+
query = getBeniDaInventariSQLite(table_name, inv_code, include_imp, is_pnrr, is_dismissione);
|
|
3905
|
+
break;
|
|
3436
3906
|
}
|
|
3437
3907
|
}
|
|
3438
3908
|
return query;
|
|
@@ -3591,6 +4061,9 @@ function getBeniDaInventariNonAllocati(db_used, table_name, is_pnrr, is_dismissi
|
|
|
3591
4061
|
case 'MYSQL':
|
|
3592
4062
|
query = getBeniDaInventariNonAllocatiMySQL(table_name, table_name, is_pnrr, is_dismissione);
|
|
3593
4063
|
break;
|
|
4064
|
+
case 'MYSQL2':
|
|
4065
|
+
query = getBeniDaInventariNonAllocatiSQLite(table_name, table_name, is_pnrr, is_dismissione);
|
|
4066
|
+
break;
|
|
3594
4067
|
}
|
|
3595
4068
|
}
|
|
3596
4069
|
return query;
|
|
@@ -3761,6 +4234,9 @@ function getBeniDaInventariOnDescription(db_used, table_name, search_string, inc
|
|
|
3761
4234
|
case 'MYSQL':
|
|
3762
4235
|
query = getBeniDaInventariOnDescriptionMySQL(table_name, search_string, include_imp, is_pnrr, is_dismissione);
|
|
3763
4236
|
break;
|
|
4237
|
+
case 'MYSQL2':
|
|
4238
|
+
query = getBeniDaInventariOnDescriptionSQLite(table_name, search_string, include_imp, is_pnrr, is_dismissione);
|
|
4239
|
+
break;
|
|
3764
4240
|
}
|
|
3765
4241
|
}
|
|
3766
4242
|
return query;
|
|
@@ -3852,6 +4328,9 @@ function selectInventariPerIntervallo(db_used,table_name, is_pnrr, is_dismission
|
|
|
3852
4328
|
case 'MYSQL':
|
|
3853
4329
|
query = selectInventariPerIntervalloMySQL(table_name, is_pnrr, is_dismissione, code_da, code_a);
|
|
3854
4330
|
break;
|
|
4331
|
+
case 'MYSQL2':
|
|
4332
|
+
query = selectInventariPerIntervalloSQLite(table_name, is_pnrr, is_dismissione, code_da, code_a);
|
|
4333
|
+
break;
|
|
3855
4334
|
}
|
|
3856
4335
|
}
|
|
3857
4336
|
return query;
|
|
@@ -3992,6 +4471,9 @@ function getBeniAcquisiti(db_used, tab_name, is_pnrr, is_dismissione) {
|
|
|
3992
4471
|
case 'MYSQL':
|
|
3993
4472
|
query = getBeniAcquisitiMySQL(tab_name, is_pnrr, is_dismissione);
|
|
3994
4473
|
break;
|
|
4474
|
+
case 'MYSQL2':
|
|
4475
|
+
query = getBeniAcquisitiSQLite(tab_name, is_pnrr, is_dismissione);
|
|
4476
|
+
break;
|
|
3995
4477
|
}
|
|
3996
4478
|
}
|
|
3997
4479
|
return query;
|
|
@@ -4092,6 +4574,9 @@ function insertDeviceMassivo(db_used,table_name,lista_inv) {
|
|
|
4092
4574
|
case 'MYSQL':
|
|
4093
4575
|
query = insertDeviceMassivoMySQL(table_name,lista_inv);
|
|
4094
4576
|
break;
|
|
4577
|
+
case 'MYSQL2':
|
|
4578
|
+
query = insertDeviceMassivoSQLite(table_name,lista_inv);
|
|
4579
|
+
break;
|
|
4095
4580
|
}
|
|
4096
4581
|
}
|
|
4097
4582
|
return query;
|
|
@@ -4159,6 +4644,9 @@ function updateDeviceFromInventario(db_used, marca_sel, type_sel, lista_inv) {
|
|
|
4159
4644
|
case 'MYSQL':
|
|
4160
4645
|
query = updateDeviceFromInventarioMySQL(marca_sel, type_sel, lista_inv);
|
|
4161
4646
|
break;
|
|
4647
|
+
case 'MYSQL2':
|
|
4648
|
+
query = updateDeviceFromInventarioSQLite(marca_sel, type_sel, lista_inv);
|
|
4649
|
+
break;
|
|
4162
4650
|
}
|
|
4163
4651
|
}
|
|
4164
4652
|
return query;
|
|
@@ -4281,6 +4769,9 @@ function insertDeviceSiteFromInventario(db_used, table_name, data_in, id_place,
|
|
|
4281
4769
|
case 'MYSQL':
|
|
4282
4770
|
query = insertDeviceSiteFromInventarioMySQL(table_name, data_in, id_place, id_site, lista_inv);
|
|
4283
4771
|
break;
|
|
4772
|
+
case 'MYSQL2':
|
|
4773
|
+
query = insertDeviceSiteFromInventarioSQLite(table_name, data_in, id_place, id_site, lista_inv);
|
|
4774
|
+
break;
|
|
4284
4775
|
}
|
|
4285
4776
|
}
|
|
4286
4777
|
return query;
|
|
@@ -4309,6 +4800,9 @@ function getSetInfoByIdSet(db_used, id_set) {
|
|
|
4309
4800
|
case 'MYSQL':
|
|
4310
4801
|
query = getSetInfoByIdSetMySQL(id_set);
|
|
4311
4802
|
break;
|
|
4803
|
+
case 'MYSQL2':
|
|
4804
|
+
query = getSetInfoByIdSetSQLite(id_set);
|
|
4805
|
+
break;
|
|
4312
4806
|
}
|
|
4313
4807
|
}
|
|
4314
4808
|
return query;
|
|
@@ -4334,6 +4828,9 @@ function getSetInfoByIdDevice(db_used, id_device) {
|
|
|
4334
4828
|
case 'MYSQL':
|
|
4335
4829
|
query = getSetInfoByIdDeviceMySQL(id_device);
|
|
4336
4830
|
break;
|
|
4831
|
+
case 'MYSQL2':
|
|
4832
|
+
query = getSetInfoByIdDeviceSQLite(id_device);
|
|
4833
|
+
break;
|
|
4337
4834
|
}
|
|
4338
4835
|
}
|
|
4339
4836
|
return query;
|
|
@@ -4367,6 +4864,9 @@ function insertSetInfo(db_used, id_device, id_device_col) {
|
|
|
4367
4864
|
case 'MYSQL':
|
|
4368
4865
|
query = insertSetInfoMySQL(id_device, id_device_col);
|
|
4369
4866
|
break;
|
|
4867
|
+
case 'MYSQL2':
|
|
4868
|
+
query = insertSetInfoSQLite(id_device, id_device_col);
|
|
4869
|
+
break;
|
|
4370
4870
|
}
|
|
4371
4871
|
}
|
|
4372
4872
|
return query;
|
|
@@ -4382,6 +4882,9 @@ function insertSetInfoInverse(db_used, id_device, id_device_col) {
|
|
|
4382
4882
|
case 'MYSQL':
|
|
4383
4883
|
query = insertSetInfoMySQL(id_device_col, id_device);
|
|
4384
4884
|
break;
|
|
4885
|
+
case 'MYSQL2':
|
|
4886
|
+
query = insertSetInfoSQLite(id_device_col, id_device);
|
|
4887
|
+
break;
|
|
4385
4888
|
}
|
|
4386
4889
|
}
|
|
4387
4890
|
return query;
|
|
@@ -4415,6 +4918,9 @@ function removeSetInfo(db_used, id_device, id_device_col) {
|
|
|
4415
4918
|
case 'MYSQL':
|
|
4416
4919
|
query = removeSetInfoMySQL(id_device, id_device_col);
|
|
4417
4920
|
break;
|
|
4921
|
+
case 'MYSQL2':
|
|
4922
|
+
query = removeSetInfoSQLite(id_device, id_device_col);
|
|
4923
|
+
break;
|
|
4418
4924
|
}
|
|
4419
4925
|
}
|
|
4420
4926
|
return query;
|
|
@@ -4461,6 +4967,9 @@ function updateSetInfo(db_used, set_info) {
|
|
|
4461
4967
|
case 'MYSQL':
|
|
4462
4968
|
query = updateSetInfoMySQL();
|
|
4463
4969
|
break;
|
|
4970
|
+
case 'MYSQL2':
|
|
4971
|
+
query = updateSetInfoSQLite(set_info);
|
|
4972
|
+
break;
|
|
4464
4973
|
}
|
|
4465
4974
|
}
|
|
4466
4975
|
return query;
|
|
@@ -4489,6 +4998,9 @@ function selectSetsByIdDevice(db_used, id_device) {
|
|
|
4489
4998
|
case 'MYSQL':
|
|
4490
4999
|
query = selectSetsByIdDeviceMySQL(id_device);
|
|
4491
5000
|
break;
|
|
5001
|
+
case 'MYSQL2':
|
|
5002
|
+
query = selectSetsByIdDeviceSQLite(id_device);
|
|
5003
|
+
break;
|
|
4492
5004
|
}
|
|
4493
5005
|
}
|
|
4494
5006
|
return query;
|
|
@@ -4530,6 +5042,9 @@ function getNetworksOnDevice(db_used, id_device) {
|
|
|
4530
5042
|
case 'MYSQL':
|
|
4531
5043
|
query = getNetworksOnDeviceMySQL(id_device);
|
|
4532
5044
|
break;
|
|
5045
|
+
case 'MYSQL2':
|
|
5046
|
+
query = getNetworksOnDeviceSQLite(id_device);
|
|
5047
|
+
break;
|
|
4533
5048
|
}
|
|
4534
5049
|
}
|
|
4535
5050
|
return query;
|
|
@@ -4556,6 +5071,9 @@ function getImportedPropertiesByIdDevice(db_used, id_device) {
|
|
|
4556
5071
|
case 'MYSQL':
|
|
4557
5072
|
query = getImportedPropertiesByIdDeviceMySQL(id_device);
|
|
4558
5073
|
break;
|
|
5074
|
+
case 'MYSQL2':
|
|
5075
|
+
query = getImportedPropertiesByIdDeviceSQLite(id_device);
|
|
5076
|
+
break;
|
|
4559
5077
|
}
|
|
4560
5078
|
}
|
|
4561
5079
|
return query;
|
|
@@ -4648,6 +5166,47 @@ function getDevicesNotAllocatedComboMySQL(id_site, id_place, sel_type, sel_maker
|
|
|
4648
5166
|
}
|
|
4649
5167
|
return query;
|
|
4650
5168
|
}
|
|
5169
|
+
|
|
5170
|
+
function getDevicesNotAllocatedComboMySQL2(id_site, id_place, sel_type, sel_maker, ordered_by) {
|
|
5171
|
+
var sel_type_str = "";
|
|
5172
|
+
if (sel_type) {
|
|
5173
|
+
sel_type_str = sel_type;
|
|
5174
|
+
}
|
|
5175
|
+
var sel_maker_str = "";
|
|
5176
|
+
if (sel_maker) {
|
|
5177
|
+
sel_maker_str = sel_maker;
|
|
5178
|
+
}
|
|
5179
|
+
var query = "SELECT d.id, d.type as Tipo, d.manifacturer as Marca, d.model as Modello, ";
|
|
5180
|
+
query += "case ";
|
|
5181
|
+
query += "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) ";
|
|
5182
|
+
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) ";
|
|
5183
|
+
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) ";
|
|
5184
|
+
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) ";
|
|
5185
|
+
query += "else '' "
|
|
5186
|
+
query += "end as Descrizione ";
|
|
5187
|
+
query += "from devices d ";
|
|
5188
|
+
query += "left join device_site ds on d.id = ds.id_device ";
|
|
5189
|
+
query += "left join site_destinations sd on ds.id_site = sd.id_site ";
|
|
5190
|
+
query += "left join device_consegne dc on d.id = dc.id_device ";
|
|
5191
|
+
query += "where (d.is_removed is null or d.is_removed = 0) "
|
|
5192
|
+
query += "and (dc.id_consegna is null) ";
|
|
5193
|
+
query += "and (ds.id_place is null ";
|
|
5194
|
+
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 + ")) ";
|
|
5195
|
+
if (sel_type_str.trim() != '') {
|
|
5196
|
+
query += "and d.type = '" + sel_type_str.trim() + "' ";
|
|
5197
|
+
}
|
|
5198
|
+
if (sel_maker_str.trim() != '') {
|
|
5199
|
+
query += "and d.manifacturer = '" + sel_maker_str.trim() + "' ";
|
|
5200
|
+
}
|
|
5201
|
+
if (ordered_by && ordered_by == "ID") {
|
|
5202
|
+
query += "order by d.id desc";
|
|
5203
|
+
}
|
|
5204
|
+
else {
|
|
5205
|
+
query += "order by d.inv_ict3_number";
|
|
5206
|
+
}
|
|
5207
|
+
return query;
|
|
5208
|
+
}
|
|
5209
|
+
|
|
4651
5210
|
function getDevicesNotAllocatedCombo(db_used, id_site, id_place, sel_type, sel_maker, ordered_by) {
|
|
4652
5211
|
var query = "";
|
|
4653
5212
|
if (db_used) {
|
|
@@ -4658,6 +5217,9 @@ function getDevicesNotAllocatedCombo(db_used, id_site, id_place, sel_type, sel_m
|
|
|
4658
5217
|
case 'MYSQL':
|
|
4659
5218
|
query = getDevicesNotAllocatedComboMySQL(id_site, id_place, sel_type, sel_maker, ordered_by);
|
|
4660
5219
|
break;
|
|
5220
|
+
case 'MYSQL2':
|
|
5221
|
+
query = getDevicesNotAllocatedComboMySQL2(id_site, id_place, sel_type, sel_maker, ordered_by);
|
|
5222
|
+
break;
|
|
4661
5223
|
}
|
|
4662
5224
|
}
|
|
4663
5225
|
return query;
|
|
@@ -4739,6 +5301,44 @@ function getDevicesAllocatedComboMySQL(id_site, id_place, sel_type, sel_maker, o
|
|
|
4739
5301
|
}
|
|
4740
5302
|
return query;
|
|
4741
5303
|
}
|
|
5304
|
+
function getDevicesAllocatedComboMySQL2(id_site, id_place, sel_type, sel_maker, ordered_by) {
|
|
5305
|
+
var sel_type_str = "";
|
|
5306
|
+
if (sel_type) {
|
|
5307
|
+
sel_type_str = sel_type;
|
|
5308
|
+
}
|
|
5309
|
+
var sel_maker_str = "";
|
|
5310
|
+
if (sel_maker) {
|
|
5311
|
+
sel_maker_str = sel_maker;
|
|
5312
|
+
}
|
|
5313
|
+
|
|
5314
|
+
var query = "SELECT d.id, d.type as Tipo, d.manifacturer as Marca, d.model as Modello, ";
|
|
5315
|
+
query += "case ";
|
|
5316
|
+
query += "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) ";
|
|
5317
|
+
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) ";
|
|
5318
|
+
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) ";
|
|
5319
|
+
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) ";
|
|
5320
|
+
query += "else '' "
|
|
5321
|
+
query += "end as Descrizione ";
|
|
5322
|
+
query += "from devices d ";
|
|
5323
|
+
query += "left join device_site ds on d.id = ds.id_device ";
|
|
5324
|
+
query += "left join site_destinations sd on ds.id_site = sd.id_site ";
|
|
5325
|
+
query += "where (d.is_removed is null or d.is_removed = 0) "
|
|
5326
|
+
query += "and (ds.id_place is not null ";
|
|
5327
|
+
query += "or (ds.date_in <= CURDATE() and ds.date_out >= CURDATE() and ds.id_site <> " + id_site + " and ds.id_place <> '" + id_place + "')) ";
|
|
5328
|
+
if (sel_type_str.trim() != '') {
|
|
5329
|
+
query += "and d.type = '" + sel_type_str.trim() + "' ";
|
|
5330
|
+
}
|
|
5331
|
+
if (sel_maker_str.trim() != '') {
|
|
5332
|
+
query += "and d.manifacturer = '" + sel_maker_str.trim() + "' ";
|
|
5333
|
+
}
|
|
5334
|
+
if (ordered_by && ordered_by == "ID") {
|
|
5335
|
+
query += "order by d.id desc";
|
|
5336
|
+
}
|
|
5337
|
+
else {
|
|
5338
|
+
query += "order by d.inv_ict3_number";
|
|
5339
|
+
}
|
|
5340
|
+
return query;
|
|
5341
|
+
}
|
|
4742
5342
|
function getDevicesAllocatedCombo(db_used, id_site, id_place, sel_type, sel_maker, ordered_by) {
|
|
4743
5343
|
var query = "";
|
|
4744
5344
|
if (db_used) {
|
|
@@ -4749,6 +5349,9 @@ function getDevicesAllocatedCombo(db_used, id_site, id_place, sel_type, sel_make
|
|
|
4749
5349
|
case 'MYSQL':
|
|
4750
5350
|
query = getDevicesAllocatedComboMySQL(id_site, id_place, sel_type, sel_maker, ordered_by);
|
|
4751
5351
|
break;
|
|
5352
|
+
case 'MYSQL2':
|
|
5353
|
+
query = getDevicesAllocatedComboMySQL2(id_site, id_place, sel_type, sel_maker, ordered_by);
|
|
5354
|
+
break;
|
|
4752
5355
|
}
|
|
4753
5356
|
}
|
|
4754
5357
|
return query;
|
|
@@ -4803,6 +5406,9 @@ function getDevicesSelectForInventarioRaw(db_used, inv_code) {
|
|
|
4803
5406
|
case 'MYSQL':
|
|
4804
5407
|
query = getDevicesSelectForInventarioRawMySQL(inv_code);
|
|
4805
5408
|
break;
|
|
5409
|
+
case 'MYSQL2':
|
|
5410
|
+
query = getDevicesSelectForInventarioRawSQLite(inv_code);
|
|
5411
|
+
break;
|
|
4806
5412
|
}
|
|
4807
5413
|
}
|
|
4808
5414
|
return query;
|
|
@@ -4838,6 +5444,21 @@ function getDevicesSelectForInventarioRawByIdMySQL(id_device) {
|
|
|
4838
5444
|
return query;
|
|
4839
5445
|
}
|
|
4840
5446
|
|
|
5447
|
+
function getDevicesSelectForInventarioRawByIdMySQL2(id_device) {
|
|
5448
|
+
var query = "SELECT id, type as Tipo, manifacturer as Marca, model as Modello, ";
|
|
5449
|
+
query += "type as Tipo, ";
|
|
5450
|
+
query += "inv_ict3_number as Inventario, ";
|
|
5451
|
+
query += "inv_tn_number as Precedente, ";
|
|
5452
|
+
query += "serial_no as Matricola, ";
|
|
5453
|
+
query += "ds.id_place as Plesso, "
|
|
5454
|
+
query += "ds.id_site as Collocazione "
|
|
5455
|
+
query += "from devices d ";
|
|
5456
|
+
query += "join device_site ds on ds.id_device = d.id "
|
|
5457
|
+
query += "where (CURDATE() >= ds.date_in and CURDATE() <= ds.date_out)";
|
|
5458
|
+
query += " and id = " + id_device;
|
|
5459
|
+
return query;
|
|
5460
|
+
}
|
|
5461
|
+
|
|
4841
5462
|
function getDevicesSelectForInventarioRawById(db_used, id_device) {
|
|
4842
5463
|
var query = "";
|
|
4843
5464
|
if (db_used) {
|
|
@@ -4848,6 +5469,9 @@ function getDevicesSelectForInventarioRawById(db_used, id_device) {
|
|
|
4848
5469
|
case 'MYSQL':
|
|
4849
5470
|
query = getDevicesSelectForInventarioRawByIdMySQL(id_device);
|
|
4850
5471
|
break;
|
|
5472
|
+
case 'MYSQL2':
|
|
5473
|
+
query = getDevicesSelectForInventarioRawByIdMySQL2(id_device);
|
|
5474
|
+
break;
|
|
4851
5475
|
}
|
|
4852
5476
|
}
|
|
4853
5477
|
return query;
|
|
@@ -5001,6 +5625,9 @@ function selectBeneDaInventario(db_used, table_name, inv_code, is_pnrr, is_dismi
|
|
|
5001
5625
|
case 'MYSQL':
|
|
5002
5626
|
query = selectBeneDaInventarioMySQL(table_name, inv_code, is_pnrr, is_dismissione);
|
|
5003
5627
|
break;
|
|
5628
|
+
case 'MYSQL2':
|
|
5629
|
+
query = selectBeneDaInventarioSQLite(table_name, inv_code, is_pnrr, is_dismissione);
|
|
5630
|
+
break;
|
|
5004
5631
|
}
|
|
5005
5632
|
}
|
|
5006
5633
|
return query;
|
|
@@ -5030,6 +5657,9 @@ function checkEsistenzaInInventario(db_used,codice) {
|
|
|
5030
5657
|
case 'MYSQL':
|
|
5031
5658
|
query = checkEsistenzaInInventarioMySQL(codice);
|
|
5032
5659
|
break;
|
|
5660
|
+
case 'MYSQL2':
|
|
5661
|
+
query = checkEsistenzaInInventarioSQLite(codice);
|
|
5662
|
+
break;
|
|
5033
5663
|
}
|
|
5034
5664
|
}
|
|
5035
5665
|
return query;
|
|
@@ -5077,6 +5707,9 @@ function selectTabelleInventariCombo(db_used, only_dismiss, only_pnrr) {
|
|
|
5077
5707
|
case 'MYSQL':
|
|
5078
5708
|
query = selectTabelleInventariComboMySQL(only_dismiss, only_pnrr);
|
|
5079
5709
|
break;
|
|
5710
|
+
case 'MYSQL2':
|
|
5711
|
+
query = selectTabelleInventariComboSQLite(only_dismiss, only_pnrr);
|
|
5712
|
+
break;
|
|
5080
5713
|
}
|
|
5081
5714
|
}
|
|
5082
5715
|
return query;
|
|
@@ -5100,6 +5733,9 @@ function selectTabellaInventarioByName(db_used, tab_name) {
|
|
|
5100
5733
|
case 'MYSQL':
|
|
5101
5734
|
query = selectTabellaInventarioByNameMySQL(tab_name);
|
|
5102
5735
|
break;
|
|
5736
|
+
case 'MYSQL2':
|
|
5737
|
+
query = selectTabellaInventarioByNameSQLite(tab_name);
|
|
5738
|
+
break;
|
|
5103
5739
|
}
|
|
5104
5740
|
}
|
|
5105
5741
|
return query;
|
|
@@ -5121,6 +5757,15 @@ function queryCloseGestioneDeviceMySQL(id_gestione, id_device, id_gestore) {
|
|
|
5121
5757
|
query += "and date_start < CURDATE()";
|
|
5122
5758
|
return query;
|
|
5123
5759
|
}
|
|
5760
|
+
|
|
5761
|
+
function queryCloseGestioneDeviceMySQL2(id_gestione) {
|
|
5762
|
+
var query = "update device_gestioni ";
|
|
5763
|
+
query += "set date_end = DATE_SUB(CURDATE(), INTERVAL 1 DAY) ";
|
|
5764
|
+
query += "where id = " + id_gestione + " ";
|
|
5765
|
+
query += "and date_start < CURDATE()";
|
|
5766
|
+
return query;
|
|
5767
|
+
}
|
|
5768
|
+
|
|
5124
5769
|
function queryCloseGestioneDevice(db_used,id_gestione) {
|
|
5125
5770
|
var query = "";
|
|
5126
5771
|
if (db_used) {
|
|
@@ -5131,6 +5776,9 @@ function queryCloseGestioneDevice(db_used,id_gestione) {
|
|
|
5131
5776
|
case 'MYSQL':
|
|
5132
5777
|
query = queryCloseGestioneDeviceMySQL(id_gestione);
|
|
5133
5778
|
break;
|
|
5779
|
+
case 'MYSQL2':
|
|
5780
|
+
query = queryCloseGestioneDeviceMySQL2(id_gestione);
|
|
5781
|
+
break;
|
|
5134
5782
|
}
|
|
5135
5783
|
}
|
|
5136
5784
|
return query;
|
|
@@ -5167,6 +5815,9 @@ function selectGestoreById(db_used,id_gestore) {
|
|
|
5167
5815
|
case 'MYSQL':
|
|
5168
5816
|
query = selectGestoreByIdMySQL(id_gestore);
|
|
5169
5817
|
break;
|
|
5818
|
+
case 'MYSQL2':
|
|
5819
|
+
query = selectGestoreByIdSQLite(id_gestore);
|
|
5820
|
+
break;
|
|
5170
5821
|
}
|
|
5171
5822
|
}
|
|
5172
5823
|
return query;
|
|
@@ -5188,6 +5839,14 @@ function queryInsertGestioneDeviceMySQL(id_device, id_gestore) {
|
|
|
5188
5839
|
return query;
|
|
5189
5840
|
}
|
|
5190
5841
|
|
|
5842
|
+
function queryInsertGestioneDeviceMySQL2(id_device, id_gestore) {
|
|
5843
|
+
var query = "insert into device_gestioni (id_device, id_gestione, date_start, date_end) ";
|
|
5844
|
+
query += "values (" + id_device + ", ";
|
|
5845
|
+
query += id_gestore + ", ";
|
|
5846
|
+
query += "CURDATE(), '2999-12-31')";
|
|
5847
|
+
return query;
|
|
5848
|
+
}
|
|
5849
|
+
|
|
5191
5850
|
function queryInsertGestioneDevice(db_used, id_device, id_gestore) {
|
|
5192
5851
|
var query = "";
|
|
5193
5852
|
if (db_used) {
|
|
@@ -5198,6 +5857,9 @@ function queryInsertGestioneDevice(db_used, id_device, id_gestore) {
|
|
|
5198
5857
|
case 'MYSQL':
|
|
5199
5858
|
query = queryInsertGestioneDeviceMySQL(id_device, id_gestore);
|
|
5200
5859
|
break;
|
|
5860
|
+
case 'MYSQL2':
|
|
5861
|
+
query = queryInsertGestioneDeviceMySQL2(id_device, id_gestore);
|
|
5862
|
+
break;
|
|
5201
5863
|
}
|
|
5202
5864
|
}
|
|
5203
5865
|
return query;
|
|
@@ -5229,6 +5891,9 @@ function querySelectExistsGestioneDeviceByIds(db_used,id_device, id_gestione) {
|
|
|
5229
5891
|
case 'MYSQL':
|
|
5230
5892
|
query = querySelectExistsGestioneDeviceByIdsMySQL(id_device, id_gestione);
|
|
5231
5893
|
break;
|
|
5894
|
+
case 'MYSQL2':
|
|
5895
|
+
query = querySelectExistsGestioneDeviceByIdsSQLite(id_device, id_gestione);
|
|
5896
|
+
break;
|
|
5232
5897
|
}
|
|
5233
5898
|
}
|
|
5234
5899
|
return query;
|
|
@@ -5275,6 +5940,28 @@ function querySelectGestioniDeviceByIdDeviceMySQL(id_device, date_ref) {
|
|
|
5275
5940
|
query += " order by date_start desc"
|
|
5276
5941
|
return query;
|
|
5277
5942
|
}
|
|
5943
|
+
|
|
5944
|
+
function querySelectGestioniDeviceByIdDeviceMySQL2(id_device, date_ref) {
|
|
5945
|
+
var query = "select gf.name as Denominazione, contact_phone as Telefono, contact_email as Email from device_gestioni dg ";
|
|
5946
|
+
query += "inner join gestori_fornitori gf on gf.id = dg.id_gestione ";
|
|
5947
|
+
query += "where dg.id_device = " + id_device;
|
|
5948
|
+
if (date_ref) {
|
|
5949
|
+
switch (date_ref) {
|
|
5950
|
+
case "current":
|
|
5951
|
+
query += " and ";
|
|
5952
|
+
query += " (CURDATE() >= date_start and CURDATE() <= date_end)";
|
|
5953
|
+
break;
|
|
5954
|
+
default:
|
|
5955
|
+
query += " and ";
|
|
5956
|
+
query += " ('" + date_ref + "' >= date_start and '" + date_ref + "' <= date_end)";
|
|
5957
|
+
break;
|
|
5958
|
+
|
|
5959
|
+
}
|
|
5960
|
+
}
|
|
5961
|
+
query += " order by date_start desc"
|
|
5962
|
+
return query;
|
|
5963
|
+
}
|
|
5964
|
+
|
|
5278
5965
|
function querySelectGestioniDeviceByIdDevice(db_used,id_device, date_ref) {
|
|
5279
5966
|
var query = "";
|
|
5280
5967
|
if (db_used) {
|
|
@@ -5285,6 +5972,9 @@ function querySelectGestioniDeviceByIdDevice(db_used,id_device, date_ref) {
|
|
|
5285
5972
|
case 'MYSQL':
|
|
5286
5973
|
query = querySelectGestioniDeviceByIdDeviceMySQL(id_device, date_ref);
|
|
5287
5974
|
break;
|
|
5975
|
+
case 'MYSQL2':
|
|
5976
|
+
query = querySelectGestioniDeviceByIdDeviceMySQL2(id_device, date_ref);
|
|
5977
|
+
break;
|
|
5288
5978
|
}
|
|
5289
5979
|
}
|
|
5290
5980
|
return query;
|
|
@@ -5330,6 +6020,25 @@ function getLastGestioneDeviceByIdDeviceMySQL(id_device, date_ref) {
|
|
|
5330
6020
|
return query;
|
|
5331
6021
|
}
|
|
5332
6022
|
|
|
6023
|
+
function getLastGestioneDeviceByIdDeviceMySQL2(id_device, date_ref) {
|
|
6024
|
+
var query = "select dg.id, dg.id_gestione, dg.date_start, dg.date_end from device_gestioni dg ";
|
|
6025
|
+
query += "where dg.id_device = " + id_device;
|
|
6026
|
+
if (date_ref) {
|
|
6027
|
+
switch (date_ref) {
|
|
6028
|
+
case "current":
|
|
6029
|
+
query += " and ";
|
|
6030
|
+
query += " (CURDATE() >= dg.date_start and CURDATE() <= dg.date_end)";
|
|
6031
|
+
break;
|
|
6032
|
+
default:
|
|
6033
|
+
query += " and ";
|
|
6034
|
+
query += " ('" + date_ref + "' >= dg.date_start and '" + date_ref + "' <= dg.date_end)";
|
|
6035
|
+
break;
|
|
6036
|
+
|
|
6037
|
+
}
|
|
6038
|
+
}
|
|
6039
|
+
query += " order by date_start desc LIMIT 1"
|
|
6040
|
+
return query;
|
|
6041
|
+
}
|
|
5333
6042
|
function getLastGestioneDeviceByIdDevice(db_used,id_device, date_ref) {
|
|
5334
6043
|
var query = "";
|
|
5335
6044
|
if (db_used) {
|
|
@@ -5340,6 +6049,9 @@ function getLastGestioneDeviceByIdDevice(db_used,id_device, date_ref) {
|
|
|
5340
6049
|
case 'MYSQL':
|
|
5341
6050
|
query = getLastGestioneDeviceByIdDeviceMySQL(id_device, date_ref);
|
|
5342
6051
|
break;
|
|
6052
|
+
case 'MYSQL2':
|
|
6053
|
+
query = getLastGestioneDeviceByIdDeviceMySQL2(id_device, date_ref);
|
|
6054
|
+
break;
|
|
5343
6055
|
}
|
|
5344
6056
|
}
|
|
5345
6057
|
return query;
|
|
@@ -5415,6 +6127,9 @@ function queryConsegne(db_used,data_da, data_a, data_filter) {
|
|
|
5415
6127
|
case 'MYSQL':
|
|
5416
6128
|
query = queryConsegneMySQL(data_da, data_a, data_filter);
|
|
5417
6129
|
break;
|
|
6130
|
+
case 'MYSQL2':
|
|
6131
|
+
query = queryConsegneMySQL2(data_da, data_a, data_filter);
|
|
6132
|
+
break;
|
|
5418
6133
|
}
|
|
5419
6134
|
}
|
|
5420
6135
|
return query;
|
|
@@ -5447,6 +6162,9 @@ function queryConsegnaById(db_used,id_consegna) {
|
|
|
5447
6162
|
case 'MYSQL':
|
|
5448
6163
|
query = queryConsegnaByIdMySQL(id_consegna);
|
|
5449
6164
|
break;
|
|
6165
|
+
case 'MYSQL2':
|
|
6166
|
+
query = queryConsegnaByIdSQLite(id_consegna);
|
|
6167
|
+
break;
|
|
5450
6168
|
}
|
|
5451
6169
|
}
|
|
5452
6170
|
return query;
|
|
@@ -5494,6 +6212,9 @@ function queryConsegneByIdDevice(db_used, id_device) {
|
|
|
5494
6212
|
case 'MYSQL':
|
|
5495
6213
|
query = queryConsegneByIdDeviceMySQL(id_device);
|
|
5496
6214
|
break;
|
|
6215
|
+
case 'MYSQL2':
|
|
6216
|
+
query = queryConsegneByIdDeviceSQLite(id_device);
|
|
6217
|
+
break;
|
|
5497
6218
|
}
|
|
5498
6219
|
}
|
|
5499
6220
|
return query;
|
|
@@ -5578,6 +6299,9 @@ function selectInterventi(db_used, data_da, data_a) {
|
|
|
5578
6299
|
case 'MYSQL':
|
|
5579
6300
|
query = selectInterventiMySQL(data_da, data_a);
|
|
5580
6301
|
break;
|
|
6302
|
+
case 'MYSQL2':
|
|
6303
|
+
query = selectInterventiSQLite(data_da, data_a);
|
|
6304
|
+
break;
|
|
5581
6305
|
}
|
|
5582
6306
|
}
|
|
5583
6307
|
return query;
|
|
@@ -5605,6 +6329,9 @@ function queryInterventoById(db_used,id_interv) {
|
|
|
5605
6329
|
case 'MYSQL':
|
|
5606
6330
|
query = queryInterventoByIdMySQL(id_interv);
|
|
5607
6331
|
break;
|
|
6332
|
+
case 'MYSQL2':
|
|
6333
|
+
query = queryInterventoByIdSQLite(id_interv);
|
|
6334
|
+
break;
|
|
5608
6335
|
}
|
|
5609
6336
|
}
|
|
5610
6337
|
return query;
|
|
@@ -5651,6 +6378,9 @@ function insertIntervento(db_used, id_place, id_site, data_inizio, data_fine, ri
|
|
|
5651
6378
|
case 'MYSQL':
|
|
5652
6379
|
query = insertInterventoMySQL(id_place, id_site, data_inizio, data_fine, richiedente, esecutore, id_esecutore, tipo_esecutore, tipo_risoluzione, descrizione);
|
|
5653
6380
|
break;
|
|
6381
|
+
case 'MYSQL2':
|
|
6382
|
+
query = insertInterventoSQLite(id_place, id_site, data_inizio, data_fine, richiedente, esecutore, id_esecutore, tipo_esecutore, tipo_risoluzione, descrizione);
|
|
6383
|
+
break;
|
|
5654
6384
|
}
|
|
5655
6385
|
}
|
|
5656
6386
|
return query;
|
|
@@ -5693,6 +6423,9 @@ function updateIntervento(db_used, id_intervento, data_inizio, data_fine, richie
|
|
|
5693
6423
|
case 'MYSQL':
|
|
5694
6424
|
query = updateInterventoMySQL(id_intervento, data_inizio, data_fine, richiedente, esecutore, id_esecutore, tipo_esecutore, tipo_risoluzione, descrizione);
|
|
5695
6425
|
break;
|
|
6426
|
+
case 'MYSQL2':
|
|
6427
|
+
query = updateInterventoSQLite(id_intervento, data_inizio, data_fine, richiedente, esecutore, id_esecutore, tipo_esecutore, tipo_risoluzione, descrizione);
|
|
6428
|
+
break;
|
|
5696
6429
|
}
|
|
5697
6430
|
}
|
|
5698
6431
|
return query;
|
|
@@ -5720,6 +6453,9 @@ function removeIntervento(db_used,id_intervento) {
|
|
|
5720
6453
|
case 'MYSQL':
|
|
5721
6454
|
query = removeInterventoMySQL(id_intervento);
|
|
5722
6455
|
break;
|
|
6456
|
+
case 'MYSQL2':
|
|
6457
|
+
query = removeInterventoSQLite(id_intervento);
|
|
6458
|
+
break;
|
|
5723
6459
|
}
|
|
5724
6460
|
}
|
|
5725
6461
|
return query;
|
|
@@ -5748,6 +6484,9 @@ function insertDeviceIntervento(db_used,id_intervento, id_device, note) {
|
|
|
5748
6484
|
case 'MYSQL':
|
|
5749
6485
|
query = insertDeviceInterventoMySQL(id_intervento, id_device, note);
|
|
5750
6486
|
break;
|
|
6487
|
+
case 'MYSQL2':
|
|
6488
|
+
query = insertDeviceInterventoSQLite(id_intervento, id_device, note);
|
|
6489
|
+
break;
|
|
5751
6490
|
}
|
|
5752
6491
|
}
|
|
5753
6492
|
return query;
|
|
@@ -5777,6 +6516,9 @@ function updateDeviceIntervento(db_used, id_dev_interv, id_device, note) {
|
|
|
5777
6516
|
case 'MYSQL':
|
|
5778
6517
|
query = updateDeviceInterventoMySQL(id_dev_interv, id_device, note);
|
|
5779
6518
|
break;
|
|
6519
|
+
case 'MYSQL2':
|
|
6520
|
+
query = updateDeviceInterventoSQLite(id_dev_interv, id_device, note);
|
|
6521
|
+
break;
|
|
5780
6522
|
}
|
|
5781
6523
|
}
|
|
5782
6524
|
return query;
|
|
@@ -5802,6 +6544,9 @@ function removeDeviceIntervento(db_used, id_dev_interv) {
|
|
|
5802
6544
|
case 'MYSQL':
|
|
5803
6545
|
query = removeDeviceInterventoMySQL(id_dev_interv);
|
|
5804
6546
|
break;
|
|
6547
|
+
case 'MYSQL2':
|
|
6548
|
+
query = removeDeviceInterventoSQLite(id_dev_interv);
|
|
6549
|
+
break;
|
|
5805
6550
|
}
|
|
5806
6551
|
}
|
|
5807
6552
|
return query;
|
|
@@ -5947,6 +6692,9 @@ function insertConsegna(db_used, consegna){
|
|
|
5947
6692
|
case 'MYSQL':
|
|
5948
6693
|
query = insertConsegnaMySQL(consegna);
|
|
5949
6694
|
break;
|
|
6695
|
+
case 'MYSQL2':
|
|
6696
|
+
query = insertConsegnaSQLite(consegna);
|
|
6697
|
+
break;
|
|
5950
6698
|
}
|
|
5951
6699
|
}
|
|
5952
6700
|
return query;
|
|
@@ -6018,6 +6766,9 @@ function updateConsegna(db_used, consegna) {
|
|
|
6018
6766
|
case 'MYSQL':
|
|
6019
6767
|
query = updateConsegnaMySQL(consegna);
|
|
6020
6768
|
break;
|
|
6769
|
+
case 'MYSQL2':
|
|
6770
|
+
query = updateConsegnaSQLite(consegna);
|
|
6771
|
+
break;
|
|
6021
6772
|
}
|
|
6022
6773
|
}
|
|
6023
6774
|
return query;
|
|
@@ -6047,6 +6798,9 @@ function removeConsegna(db_used,id_consegna) {
|
|
|
6047
6798
|
case 'MYSQL':
|
|
6048
6799
|
query = removeConsegnaMySQL(id_consegna);
|
|
6049
6800
|
break;
|
|
6801
|
+
case 'MYSQL2':
|
|
6802
|
+
query = removeConsegnaSQLite(id_consegna);
|
|
6803
|
+
break;
|
|
6050
6804
|
}
|
|
6051
6805
|
}
|
|
6052
6806
|
return query;
|
|
@@ -6068,6 +6822,9 @@ function queryLastConsegnaId(db_used) {
|
|
|
6068
6822
|
case 'MYSQL':
|
|
6069
6823
|
query = queryLastConsegnaIdMySQL();
|
|
6070
6824
|
break;
|
|
6825
|
+
case 'MYSQL2':
|
|
6826
|
+
query = queryLastConsegnaIdMySQL();
|
|
6827
|
+
break;
|
|
6071
6828
|
}
|
|
6072
6829
|
}
|
|
6073
6830
|
return query;
|
|
@@ -6101,6 +6858,9 @@ function insertConsegnaDevice(db_used, id_consegna, id_device, note) {
|
|
|
6101
6858
|
case 'MYSQL':
|
|
6102
6859
|
query = insertConsegnaDeviceMySQL(id_consegna, id_device, note);
|
|
6103
6860
|
break;
|
|
6861
|
+
case 'MYSQL2':
|
|
6862
|
+
query = insertConsegnaDeviceSQLite(id_consegna, id_device, note);
|
|
6863
|
+
break;
|
|
6104
6864
|
}
|
|
6105
6865
|
}
|
|
6106
6866
|
return query;
|
|
@@ -6134,6 +6894,9 @@ function updateConsegnaDevice(db_used, id_devcons, id_consegna, id_device, note)
|
|
|
6134
6894
|
case 'MYSQL':
|
|
6135
6895
|
query = updateConsegnaDeviceMySQL(id_devcons, id_consegna, id_device, note);
|
|
6136
6896
|
break;
|
|
6897
|
+
case 'MYSQL2':
|
|
6898
|
+
query = updateConsegnaDeviceSQLite(id_devcons, id_consegna, id_device, note);
|
|
6899
|
+
break;
|
|
6137
6900
|
}
|
|
6138
6901
|
}
|
|
6139
6902
|
return query;
|
|
@@ -6161,6 +6924,9 @@ function removeConsegnaDevice(db_used, id_consegna, id_device) {
|
|
|
6161
6924
|
case 'MYSQL':
|
|
6162
6925
|
query = removeConsegnaDeviceMySQL(id_consegna, id_device);
|
|
6163
6926
|
break;
|
|
6927
|
+
case 'MYSQL2':
|
|
6928
|
+
query = removeConsegnaDeviceSQLite(id_consegna, id_device);
|
|
6929
|
+
break;
|
|
6164
6930
|
}
|
|
6165
6931
|
}
|
|
6166
6932
|
return query;
|
|
@@ -6215,6 +6981,9 @@ function selectDevicePerConsegna(db_used, id_consegna) {
|
|
|
6215
6981
|
case 'MYSQL':
|
|
6216
6982
|
query = selectDevicePerConsegnaMySQL(id_consegna);
|
|
6217
6983
|
break;
|
|
6984
|
+
case 'MYSQL2':
|
|
6985
|
+
query = selectDevicePerConsegnaSQLite(id_consegna);
|
|
6986
|
+
break;
|
|
6218
6987
|
}
|
|
6219
6988
|
}
|
|
6220
6989
|
return query;
|
|
@@ -6263,6 +7032,9 @@ function selectDeviceConsegna(db_used, id_consegna, id_device) {
|
|
|
6263
7032
|
case 'MYSQL':
|
|
6264
7033
|
query = selectDeviceConsegnaMySQL(id_consegna, id_device);
|
|
6265
7034
|
break;
|
|
7035
|
+
case 'MYSQL2':
|
|
7036
|
+
query = selectDeviceConsegnaSQLite(id_consegna, id_device);
|
|
7037
|
+
break;
|
|
6266
7038
|
}
|
|
6267
7039
|
}
|
|
6268
7040
|
return query;
|
|
@@ -6318,6 +7090,9 @@ function selectDeviceInDeposito(db_used, inv_code) {
|
|
|
6318
7090
|
case 'MYSQL':
|
|
6319
7091
|
query = selectDeviceInDepositoMySQL(inv_code);
|
|
6320
7092
|
break;
|
|
7093
|
+
case 'MYSQL2':
|
|
7094
|
+
query = selectDeviceInDepositoSQLite(inv_code);
|
|
7095
|
+
break;
|
|
6321
7096
|
}
|
|
6322
7097
|
}
|
|
6323
7098
|
return query;
|
|
@@ -6341,6 +7116,9 @@ function getConnectionTypes(db_used) {
|
|
|
6341
7116
|
case 'MYSQL':
|
|
6342
7117
|
query = getConnectionTypesMySQL();
|
|
6343
7118
|
break;
|
|
7119
|
+
case 'MYSQL2':
|
|
7120
|
+
query = getConnectionTypesSQLite();
|
|
7121
|
+
break;
|
|
6344
7122
|
}
|
|
6345
7123
|
}
|
|
6346
7124
|
return query;
|
|
@@ -6365,6 +7143,9 @@ function getConnectionProtocols(db_used) {
|
|
|
6365
7143
|
case 'MYSQL':
|
|
6366
7144
|
query = getConnectionProtocolsMySQL();
|
|
6367
7145
|
break;
|
|
7146
|
+
case 'MYSQL2':
|
|
7147
|
+
query = getConnectionProtocolsSQLite();
|
|
7148
|
+
break;
|
|
6368
7149
|
}
|
|
6369
7150
|
}
|
|
6370
7151
|
return query;
|
|
@@ -6389,6 +7170,9 @@ function getStorageTypes(db_used) {
|
|
|
6389
7170
|
case 'MYSQL':
|
|
6390
7171
|
query = getStorageTypesMySQL();
|
|
6391
7172
|
break;
|
|
7173
|
+
case 'MYSQL2':
|
|
7174
|
+
query = getStorageTypesSQLite();
|
|
7175
|
+
break;
|
|
6392
7176
|
}
|
|
6393
7177
|
}
|
|
6394
7178
|
return query;
|
|
@@ -6421,6 +7205,9 @@ function getAdapterTypes(db_used) {
|
|
|
6421
7205
|
case 'MYSQL':
|
|
6422
7206
|
query = getAdapterTypesMySQL();
|
|
6423
7207
|
break;
|
|
7208
|
+
case 'MYSQL2':
|
|
7209
|
+
query = getAdapterTypesSQLite();
|
|
7210
|
+
break;
|
|
6424
7211
|
}
|
|
6425
7212
|
}
|
|
6426
7213
|
return query;
|
|
@@ -6491,6 +7278,9 @@ function getLaboratorioByIdSite(db_used,id_site, id_place) {
|
|
|
6491
7278
|
case 'MYSQL':
|
|
6492
7279
|
query = getLaboratorioByIdSiteMySQL(id_site, id_place);
|
|
6493
7280
|
break;
|
|
7281
|
+
case 'MYSQL2':
|
|
7282
|
+
query = getLaboratorioByIdSiteSQLite(id_site, id_place);
|
|
7283
|
+
break;
|
|
6494
7284
|
}
|
|
6495
7285
|
}
|
|
6496
7286
|
return query;
|
|
@@ -6522,6 +7312,9 @@ function assignCategoryFromDB(db_used,dev_type) {
|
|
|
6522
7312
|
case 'MYSQL':
|
|
6523
7313
|
query = assignCategoryFromDBMySQL(dev_type);
|
|
6524
7314
|
break;
|
|
7315
|
+
case 'MYSQL2':
|
|
7316
|
+
query = assignCategoryFromDBSQLite(dev_type);
|
|
7317
|
+
break;
|
|
6525
7318
|
}
|
|
6526
7319
|
}
|
|
6527
7320
|
return query;
|
|
@@ -6554,6 +7347,9 @@ function getBeniConsumoByIdDevice(db_used,id_device) {
|
|
|
6554
7347
|
case 'MYSQL':
|
|
6555
7348
|
query = getBeniConsumoByIdDeviceMySQL(id_device);
|
|
6556
7349
|
break;
|
|
7350
|
+
case 'MYSQL2':
|
|
7351
|
+
query = getBeniConsumoByIdDeviceSQLite(id_device);
|
|
7352
|
+
break;
|
|
6557
7353
|
}
|
|
6558
7354
|
}
|
|
6559
7355
|
return query;
|
|
@@ -6586,6 +7382,9 @@ function selectDismissioniByYear(db_used, sel_year) {
|
|
|
6586
7382
|
case 'MYSQL':
|
|
6587
7383
|
query = selectDismissioniByYearMySQL(sel_year);
|
|
6588
7384
|
break;
|
|
7385
|
+
case 'MYSQL2':
|
|
7386
|
+
query = selectDismissioniByYearSQLite(sel_year);
|
|
7387
|
+
break;
|
|
6589
7388
|
}
|
|
6590
7389
|
}
|
|
6591
7390
|
return query;
|
|
@@ -6613,6 +7412,9 @@ function selectDismissioneById(db_used, id_dismiss) {
|
|
|
6613
7412
|
case 'MYSQL':
|
|
6614
7413
|
query = selectDismissioneByIdMySQL(id_dismiss);
|
|
6615
7414
|
break;
|
|
7415
|
+
case 'MYSQL2':
|
|
7416
|
+
query = selectDismissioneByIdSQLite(id_dismiss);
|
|
7417
|
+
break;
|
|
6616
7418
|
}
|
|
6617
7419
|
}
|
|
6618
7420
|
return query;
|
|
@@ -6646,6 +7448,9 @@ function insertDismissione(db_used, data, descrizione, is_closed) {
|
|
|
6646
7448
|
case 'MYSQL':
|
|
6647
7449
|
query = insertDismissioneMySQL(data, descrizione, is_closed);
|
|
6648
7450
|
break;
|
|
7451
|
+
case 'MYSQL2':
|
|
7452
|
+
query = insertDismissioneSQLite(data, descrizione, is_closed);
|
|
7453
|
+
break;
|
|
6649
7454
|
}
|
|
6650
7455
|
}
|
|
6651
7456
|
return query;
|
|
@@ -6681,6 +7486,9 @@ function updateDismissione(db_used, id_dismiss, data, descrizione, is_closed) {
|
|
|
6681
7486
|
case 'MYSQL':
|
|
6682
7487
|
query = updateDismissioneMySQL(id_dismiss, data, descrizione, is_closed);
|
|
6683
7488
|
break;
|
|
7489
|
+
case 'MYSQL2':
|
|
7490
|
+
query = updateDismissioneSQLite(id_dismiss, data, descrizione, is_closed);
|
|
7491
|
+
break;
|
|
6684
7492
|
}
|
|
6685
7493
|
}
|
|
6686
7494
|
return query;
|
|
@@ -6707,6 +7515,9 @@ function removeDismissioneById(db_used, id_dismiss) {
|
|
|
6707
7515
|
case 'MYSQL':
|
|
6708
7516
|
query = removeDismissioneByIdMySQL(id_dismiss);
|
|
6709
7517
|
break;
|
|
7518
|
+
case 'MYSQL2':
|
|
7519
|
+
query = removeDismissioneByIdSQLite(id_dismiss);
|
|
7520
|
+
break;
|
|
6710
7521
|
}
|
|
6711
7522
|
}
|
|
6712
7523
|
return query;
|
|
@@ -6763,6 +7574,9 @@ function selectDismissioneDevicesByIdDismiss(db_used, id_dismiss) {
|
|
|
6763
7574
|
case 'MYSQL':
|
|
6764
7575
|
query = selectDismissioneDevicesByIdDismissMySQL(id_dismiss);
|
|
6765
7576
|
break;
|
|
7577
|
+
case 'MYSQL2':
|
|
7578
|
+
query = selectDismissioneDevicesByIdDismissSQLite(id_dismiss);
|
|
7579
|
+
break;
|
|
6766
7580
|
}
|
|
6767
7581
|
}
|
|
6768
7582
|
return query;
|
|
@@ -6791,6 +7605,9 @@ function selectDismissioneDevicesById(db_used, id_devdismiss) {
|
|
|
6791
7605
|
case 'MYSQL':
|
|
6792
7606
|
query = selectDismissioneDevicesByIdMySQL(id_devdismiss);
|
|
6793
7607
|
break;
|
|
7608
|
+
case 'MYSQL2':
|
|
7609
|
+
query = selectDismissioneDevicesByIdSQLite(id_devdismiss);
|
|
7610
|
+
break;
|
|
6794
7611
|
}
|
|
6795
7612
|
}
|
|
6796
7613
|
return query;
|
|
@@ -6819,6 +7636,9 @@ function removeDismissioneDeviceByIdDismissione(db_used, id_devdismiss) {
|
|
|
6819
7636
|
case 'MYSQL':
|
|
6820
7637
|
query = removeDismissioneDeviceByIdDismissioneMySQL(id_devdismiss);
|
|
6821
7638
|
break;
|
|
7639
|
+
case 'MYSQL2':
|
|
7640
|
+
query = removeDismissioneDeviceByIdDismissioneSQLite(id_devdismiss);
|
|
7641
|
+
break;
|
|
6822
7642
|
}
|
|
6823
7643
|
}
|
|
6824
7644
|
return query;
|
|
@@ -6846,6 +7666,9 @@ function insertDismissioneDevice(db_used, id_dismiss, id_device, motivo, note, d
|
|
|
6846
7666
|
case 'MYSQL':
|
|
6847
7667
|
query = insertDismissioneDeviceMySQL(id_dismiss, id_device, motivo, note, data);
|
|
6848
7668
|
break;
|
|
7669
|
+
case 'MYSQL2':
|
|
7670
|
+
query = insertDismissioneDeviceSQLite(id_dismiss, id_device, motivo, note, data);
|
|
7671
|
+
break;
|
|
6849
7672
|
}
|
|
6850
7673
|
}
|
|
6851
7674
|
return query;
|
|
@@ -6882,6 +7705,9 @@ function updateDismissioneDevice(db_used, id_devdismiss, id_dismiss, id_device,
|
|
|
6882
7705
|
case 'MYSQL':
|
|
6883
7706
|
query = updateDismissioneDeviceMySQL(id_devdismiss, id_dismiss, id_device, motivo, note, data);
|
|
6884
7707
|
break;
|
|
7708
|
+
case 'MYSQL2':
|
|
7709
|
+
query = updateDismissioneDeviceSQLite(id_devdismiss, id_dismiss, id_device, motivo, note, data);
|
|
7710
|
+
break;
|
|
6885
7711
|
}
|
|
6886
7712
|
}
|
|
6887
7713
|
return query;
|
|
@@ -6908,6 +7734,9 @@ function removeDismissioneDevice(db_used, id_devdismiss) {
|
|
|
6908
7734
|
case 'MYSQL':
|
|
6909
7735
|
query = removeDismissioneDeviceMySQL(id_devdismiss);
|
|
6910
7736
|
break;
|
|
7737
|
+
case 'MYSQL2':
|
|
7738
|
+
query = removeDismissioneDeviceSQLite(id_devdismiss);
|
|
7739
|
+
break;
|
|
6911
7740
|
}
|
|
6912
7741
|
}
|
|
6913
7742
|
return query;
|
|
@@ -6983,6 +7812,9 @@ function assignDevicesToDismissione(db_used, id_dismiss, list_id_devdismiss) {
|
|
|
6983
7812
|
case 'MYSQL':
|
|
6984
7813
|
query = assignDevicesToDismissioneMySQL(id_dismiss, list_id_devdismiss);
|
|
6985
7814
|
break;
|
|
7815
|
+
case 'MYSQL2':
|
|
7816
|
+
query = assignDevicesToDismissioneSQLite(id_dismiss, list_id_devdismiss);
|
|
7817
|
+
break;
|
|
6986
7818
|
}
|
|
6987
7819
|
}
|
|
6988
7820
|
return query;
|
|
@@ -7011,6 +7843,9 @@ function removeDevicesFromDismissione(db_used, id_dismiss) {
|
|
|
7011
7843
|
case 'MYSQL':
|
|
7012
7844
|
query = removeDevicesFromDismissioneMySQL(id_dismiss);
|
|
7013
7845
|
break;
|
|
7846
|
+
case 'MYSQL2':
|
|
7847
|
+
query = removeDevicesFromDismissioneSQLite(id_dismiss);
|
|
7848
|
+
break;
|
|
7014
7849
|
}
|
|
7015
7850
|
}
|
|
7016
7851
|
return query;
|
|
@@ -7042,6 +7877,9 @@ function removeDismissioneDeviceFromDismissione(db_used, id_devdismiss, id_dismi
|
|
|
7042
7877
|
case 'MYSQL':
|
|
7043
7878
|
query = removeDismissioneDeviceFromDismissioneMySQL(id_devdismiss, id_dismiss);
|
|
7044
7879
|
break;
|
|
7880
|
+
case 'MYSQL2':
|
|
7881
|
+
query = removeDismissioneDeviceFromDismissioneSQLite(id_devdismiss, id_dismiss);
|
|
7882
|
+
break;
|
|
7045
7883
|
}
|
|
7046
7884
|
}
|
|
7047
7885
|
return query;
|
|
@@ -7064,6 +7902,9 @@ function queryLastDismissioneId(db_used) {
|
|
|
7064
7902
|
case 'MYSQL':
|
|
7065
7903
|
query = queryLastDismissioneIdMySQL();
|
|
7066
7904
|
break;
|
|
7905
|
+
case 'MYSQL2':
|
|
7906
|
+
query = queryLastDismissioneIdMySQL();
|
|
7907
|
+
break;
|
|
7067
7908
|
}
|
|
7068
7909
|
}
|
|
7069
7910
|
return query;
|
|
@@ -7097,6 +7938,9 @@ function selectDocumentiByIdDismissione(db_used,id_dismiss) {
|
|
|
7097
7938
|
case 'MYSQL':
|
|
7098
7939
|
query = selectDocumentiByIdDismissioneMySQL(id_dismiss);
|
|
7099
7940
|
break;
|
|
7941
|
+
case 'MYSQL2':
|
|
7942
|
+
query = selectDocumentiByIdDismissioneSQLite(id_dismiss);
|
|
7943
|
+
break;
|
|
7100
7944
|
}
|
|
7101
7945
|
}
|
|
7102
7946
|
return query;
|
|
@@ -7125,6 +7969,9 @@ function insertDocumentoDismissione(db_used, id_dismiss, id_doc) {
|
|
|
7125
7969
|
case 'MYSQL':
|
|
7126
7970
|
query = insertDocumentoDismissioneMySQL(id_dismiss, id_doc);
|
|
7127
7971
|
break;
|
|
7972
|
+
case 'MYSQL2':
|
|
7973
|
+
query = insertDocumentoDismissioneSQLite(id_dismiss, id_doc);
|
|
7974
|
+
break;
|
|
7128
7975
|
}
|
|
7129
7976
|
}
|
|
7130
7977
|
return query;
|
|
@@ -7150,6 +7997,9 @@ function updateDocumentoDismissione(db_used, id_docdismiss, id_doc) {
|
|
|
7150
7997
|
case 'MYSQL':
|
|
7151
7998
|
query = updateDocumentoDismissioneMySQL(id_docdismiss, id_doc);
|
|
7152
7999
|
break;
|
|
8000
|
+
case 'MYSQL2':
|
|
8001
|
+
query = updateDocumentoDismissioneSQLite(id_docdismiss, id_doc);
|
|
8002
|
+
break;
|
|
7153
8003
|
}
|
|
7154
8004
|
}
|
|
7155
8005
|
return query;
|
|
@@ -7175,6 +8025,9 @@ function removeDocumentoDismissione(db_used, id_docdismiss) {
|
|
|
7175
8025
|
case 'MYSQL':
|
|
7176
8026
|
query = removeDocumentoDismissioneMySQL(id_docdismiss);
|
|
7177
8027
|
break;
|
|
8028
|
+
case 'MYSQL2':
|
|
8029
|
+
query = removeDocumentoDismissioneSQLite(id_docdismiss);
|
|
8030
|
+
break;
|
|
7178
8031
|
}
|
|
7179
8032
|
}
|
|
7180
8033
|
return query;
|
|
@@ -7200,6 +8053,9 @@ function checkDocumentoInDismissione(db_used, id_dismiss, id_doc) {
|
|
|
7200
8053
|
case 'MYSQL':
|
|
7201
8054
|
query = checkDocumentoInDismissioneMySQL(id_dismiss, id_doc);
|
|
7202
8055
|
break;
|
|
8056
|
+
case 'MYSQL2':
|
|
8057
|
+
query = checkDocumentoInDismissioneSQLite(id_dismiss, id_doc);
|
|
8058
|
+
break;
|
|
7203
8059
|
}
|
|
7204
8060
|
}
|
|
7205
8061
|
return query;
|
|
@@ -7232,6 +8088,9 @@ function queryDocumentsDismissioneIdDevice(db_used, id_device) {
|
|
|
7232
8088
|
case 'MYSQL':
|
|
7233
8089
|
query = queryDocumentsDismissioneIdDeviceMySQL(id_device);
|
|
7234
8090
|
break;
|
|
8091
|
+
case 'MYSQL2':
|
|
8092
|
+
query = queryDocumentsDismissioneIdDeviceSQLite(id_device);
|
|
8093
|
+
break;
|
|
7235
8094
|
}
|
|
7236
8095
|
}
|
|
7237
8096
|
return query;
|
|
@@ -7277,6 +8136,9 @@ function queryDocumentsIdDevice(db_used, id_device) {
|
|
|
7277
8136
|
case 'MYSQL':
|
|
7278
8137
|
query = queryDocumentsIdDeviceMySQL(id_device);
|
|
7279
8138
|
break;
|
|
8139
|
+
case 'MYSQL2':
|
|
8140
|
+
query = queryDocumentsIdDeviceSQLite(id_device);
|
|
8141
|
+
break;
|
|
7280
8142
|
}
|
|
7281
8143
|
}
|
|
7282
8144
|
return query;
|
|
@@ -7342,6 +8204,9 @@ function insertDocumentoDevice(db_used, id_device, id_doc, scopo) {
|
|
|
7342
8204
|
case 'MYSQL':
|
|
7343
8205
|
query = insertDocumentoDeviceMySQL(id_device, id_doc, scopo);
|
|
7344
8206
|
break;
|
|
8207
|
+
case 'MYSQL2':
|
|
8208
|
+
query = insertDocumentoDeviceSQLite(id_device, id_doc, scopo);
|
|
8209
|
+
break;
|
|
7345
8210
|
}
|
|
7346
8211
|
}
|
|
7347
8212
|
return query;
|
|
@@ -7370,6 +8235,9 @@ function removeDocumentoDevice(db_used, id_device, id_doc) {
|
|
|
7370
8235
|
case 'MYSQL':
|
|
7371
8236
|
query = removeDocumentoDeviceMySQL(id_device, id_doc);
|
|
7372
8237
|
break;
|
|
8238
|
+
case 'MYSQL2':
|
|
8239
|
+
query = removeDocumentoDeviceSQLite(id_device, id_doc);
|
|
8240
|
+
break;
|
|
7373
8241
|
}
|
|
7374
8242
|
}
|
|
7375
8243
|
return query;
|
|
@@ -7396,6 +8264,9 @@ function selectDocumentoDeviceById(db_used, id_docdev) {
|
|
|
7396
8264
|
case 'MYSQL':
|
|
7397
8265
|
query = selectDocumentoDeviceByIdMySQL(id_docdev);
|
|
7398
8266
|
break;
|
|
8267
|
+
case 'MYSQL2':
|
|
8268
|
+
query = selectDocumentoDeviceByIdSQLite(id_docdev);
|
|
8269
|
+
break;
|
|
7399
8270
|
}
|
|
7400
8271
|
}
|
|
7401
8272
|
return query;
|
|
@@ -7422,6 +8293,9 @@ function checkDocumentoDevice(db_used, id_device, id_doc) {
|
|
|
7422
8293
|
case 'MYSQL':
|
|
7423
8294
|
query = checkDocumentoDeviceMySQL(id_device, id_doc);
|
|
7424
8295
|
break;
|
|
8296
|
+
case 'MYSQL2':
|
|
8297
|
+
query = checkDocumentoDeviceSQLite(id_device, id_doc);
|
|
8298
|
+
break;
|
|
7425
8299
|
}
|
|
7426
8300
|
}
|
|
7427
8301
|
return query;
|
|
@@ -7447,6 +8321,9 @@ function getDocumentByIdDoc(db_used, id_doc) {
|
|
|
7447
8321
|
case 'MYSQL':
|
|
7448
8322
|
query = getDocumentByIdDocMySQL(id_doc);
|
|
7449
8323
|
break;
|
|
8324
|
+
case 'MYSQL2':
|
|
8325
|
+
query = getDocumentByIdDocSQLite(id_doc);
|
|
8326
|
+
break;
|
|
7450
8327
|
}
|
|
7451
8328
|
}
|
|
7452
8329
|
return query;
|
|
@@ -7469,6 +8346,9 @@ function selectDocumentoById(db_used, id_doc) {
|
|
|
7469
8346
|
case 'MYSQL':
|
|
7470
8347
|
query = selectDocumentoByIdMySQL(id_doc);
|
|
7471
8348
|
break;
|
|
8349
|
+
case 'MYSQL2':
|
|
8350
|
+
query = selectDocumentoByIdSQLite(id_doc);
|
|
8351
|
+
break;
|
|
7472
8352
|
}
|
|
7473
8353
|
}
|
|
7474
8354
|
return query;
|
|
@@ -7532,6 +8412,9 @@ function selectDocumentiCombo(db_used, tipo, anno_emissione) {
|
|
|
7532
8412
|
case 'MYSQL':
|
|
7533
8413
|
query = selectDocumentiComboMySQL(tipo, anno_emissione);
|
|
7534
8414
|
break;
|
|
8415
|
+
case 'MYSQL2':
|
|
8416
|
+
query = selectDocumentiComboSQLite(tipo, anno_emissione);
|
|
8417
|
+
break;
|
|
7535
8418
|
}
|
|
7536
8419
|
}
|
|
7537
8420
|
return query;
|
|
@@ -7559,6 +8442,9 @@ function insertDocumento(db_used, descrizione, tipo, data_emissione, riferimento
|
|
|
7559
8442
|
case 'MYSQL':
|
|
7560
8443
|
query = insertDocumentoMySQL(descrizione, tipo, data_emissione, riferimento, file_name);
|
|
7561
8444
|
break;
|
|
8445
|
+
case 'MYSQL2':
|
|
8446
|
+
query = insertDocumentoSQLite(descrizione, tipo, data_emissione, riferimento, file_name);
|
|
8447
|
+
break;
|
|
7562
8448
|
}
|
|
7563
8449
|
}
|
|
7564
8450
|
return query;
|
|
@@ -7596,6 +8482,9 @@ function updateDocumento(db_used, id_doc, descrizione, tipo, data_emissione, rif
|
|
|
7596
8482
|
case 'MYSQL':
|
|
7597
8483
|
query = updateDocumentoMySQL(id_doc, descrizione, tipo, data_emissione, riferimento, file_name);
|
|
7598
8484
|
break;
|
|
8485
|
+
case 'MYSQL2':
|
|
8486
|
+
query = updateDocumentoSQLite(id_doc, descrizione, tipo, data_emissione, riferimento, file_name);
|
|
8487
|
+
break;
|
|
7599
8488
|
}
|
|
7600
8489
|
}
|
|
7601
8490
|
return query;
|
|
@@ -7624,6 +8513,9 @@ function removeDocumento(db_used, id_doc) {
|
|
|
7624
8513
|
case 'MYSQL':
|
|
7625
8514
|
query = removeDocumentoMySQL(id_doc);
|
|
7626
8515
|
break;
|
|
8516
|
+
case 'MYSQL2':
|
|
8517
|
+
query = removeDocumentoSQLite(id_doc);
|
|
8518
|
+
break;
|
|
7627
8519
|
}
|
|
7628
8520
|
}
|
|
7629
8521
|
return query;
|
|
@@ -7653,6 +8545,9 @@ function getCategoriesByIdDevice(db_used,id_device) {
|
|
|
7653
8545
|
case 'MYSQL':
|
|
7654
8546
|
query = getCategoriesByIdDeviceMySQL(id_device);
|
|
7655
8547
|
break;
|
|
8548
|
+
case 'MYSQL2':
|
|
8549
|
+
query = getCategoriesByIdDeviceSQLite(id_device);
|
|
8550
|
+
break;
|
|
7656
8551
|
}
|
|
7657
8552
|
}
|
|
7658
8553
|
return query;
|
|
@@ -7681,6 +8576,9 @@ function queryDetailsByIdDevice(db_used,id_device) {
|
|
|
7681
8576
|
case 'MYSQL':
|
|
7682
8577
|
query = queryDetailsByIdDeviceMySQL(id_device);
|
|
7683
8578
|
break;
|
|
8579
|
+
case 'MYSQL2':
|
|
8580
|
+
query = queryDetailsByIdDeviceSQLite(id_device);
|
|
8581
|
+
break;
|
|
7684
8582
|
}
|
|
7685
8583
|
}
|
|
7686
8584
|
return query;
|
|
@@ -7707,6 +8605,9 @@ function getConnectionSetById(db_used, id_conn_set) {
|
|
|
7707
8605
|
case 'MYSQL':
|
|
7708
8606
|
query = getConnectionSetByIdMySQL(id_conn_set);
|
|
7709
8607
|
break;
|
|
8608
|
+
case 'MYSQL2':
|
|
8609
|
+
query = getConnectionSetByIdSQLite(id_conn_set);
|
|
8610
|
+
break;
|
|
7710
8611
|
}
|
|
7711
8612
|
}
|
|
7712
8613
|
return query;
|
|
@@ -7751,6 +8652,9 @@ function getConnectionByIdSet(db_used, id_set) {
|
|
|
7751
8652
|
case 'MYSQL':
|
|
7752
8653
|
query = getConnectionByIdSetMySQL(id_set);
|
|
7753
8654
|
break;
|
|
8655
|
+
case 'MYSQL2':
|
|
8656
|
+
query = getConnectionByIdSetSQLite(id_set);
|
|
8657
|
+
break;
|
|
7754
8658
|
}
|
|
7755
8659
|
}
|
|
7756
8660
|
return query;
|
|
@@ -7801,6 +8705,9 @@ function updateConnectionSet(db_used, id_set, id_conn_set, id_conn, verse, id_ad
|
|
|
7801
8705
|
case 'MYSQL':
|
|
7802
8706
|
query = updateConnectionSetMySQL(id_set, id_conn_set, id_conn, verse, id_adapter);
|
|
7803
8707
|
break;
|
|
8708
|
+
case 'MYSQL2':
|
|
8709
|
+
query = updateConnectionSetSQLite(id_set, id_conn_set, id_conn, verse, id_adapter);
|
|
8710
|
+
break;
|
|
7804
8711
|
}
|
|
7805
8712
|
}
|
|
7806
8713
|
return query;
|
|
@@ -7833,6 +8740,9 @@ function insertConnectionSet(db_used, id_set, id_conn, verse, id_adapter) {
|
|
|
7833
8740
|
case 'MYSQL':
|
|
7834
8741
|
query = insertConnectionSetMySQL(id_set, id_conn, verse, id_adapter);
|
|
7835
8742
|
break;
|
|
8743
|
+
case 'MYSQL2':
|
|
8744
|
+
query = insertConnectionSetSQLite(id_set, id_conn, verse, id_adapter);
|
|
8745
|
+
break;
|
|
7836
8746
|
}
|
|
7837
8747
|
}
|
|
7838
8748
|
return query;
|
|
@@ -7861,6 +8771,9 @@ function removeConnectionSet(db_used, id_set, id_conn_set) {
|
|
|
7861
8771
|
case 'MYSQL':
|
|
7862
8772
|
query = removeConnectionSetMySQL(id_set, id_conn_set);
|
|
7863
8773
|
break;
|
|
8774
|
+
case 'MYSQL2':
|
|
8775
|
+
query = removeConnectionSetSQLite(id_set, id_conn_set);
|
|
8776
|
+
break;
|
|
7864
8777
|
}
|
|
7865
8778
|
}
|
|
7866
8779
|
return query;
|
|
@@ -7907,6 +8820,9 @@ function getBeniConsumoNotNull(db_used) {
|
|
|
7907
8820
|
case 'MYSQL':
|
|
7908
8821
|
query = getBeniConsumoNotNullMySQL();
|
|
7909
8822
|
break;
|
|
8823
|
+
case 'MYSQL2':
|
|
8824
|
+
query = getBeniConsumoNotNullSQLite();
|
|
8825
|
+
break;
|
|
7910
8826
|
}
|
|
7911
8827
|
}
|
|
7912
8828
|
return query;
|
|
@@ -7934,6 +8850,9 @@ function getBeneConsumoUsato(db_used, id_device, id_bene) {
|
|
|
7934
8850
|
case 'MYSQL':
|
|
7935
8851
|
query = getBeneConsumoUsatoMySQL(id_device, id_bene);
|
|
7936
8852
|
break;
|
|
8853
|
+
case 'MYSQL2':
|
|
8854
|
+
query = getBeneConsumoUsatoSQLite(id_device, id_bene);
|
|
8855
|
+
break;
|
|
7937
8856
|
}
|
|
7938
8857
|
}
|
|
7939
8858
|
return query;
|
|
@@ -7959,6 +8878,9 @@ function getBeneConsumoById(db_used, id_bene) {
|
|
|
7959
8878
|
case 'MYSQL':
|
|
7960
8879
|
query = getBeneConsumoByIdMySQL(id_bene);
|
|
7961
8880
|
break;
|
|
8881
|
+
case 'MYSQL2':
|
|
8882
|
+
query = getBeneConsumoByIdSQLite(id_bene);
|
|
8883
|
+
break;
|
|
7962
8884
|
}
|
|
7963
8885
|
}
|
|
7964
8886
|
return query;
|
|
@@ -7984,6 +8906,9 @@ function insertBeneConsumoAbbinato(db_used,id_device, id_bene, numero) {
|
|
|
7984
8906
|
case 'MYSQL':
|
|
7985
8907
|
query = insertBeneConsumoAbbinatoMySQL(id_device, id_bene, numero);
|
|
7986
8908
|
break;
|
|
8909
|
+
case 'MYSQL2':
|
|
8910
|
+
query = insertBeneConsumoAbbinatoSQLite(id_device, id_bene, numero);
|
|
8911
|
+
break;
|
|
7987
8912
|
}
|
|
7988
8913
|
}
|
|
7989
8914
|
return query;
|
|
@@ -8011,6 +8936,9 @@ function updateBeneConsumoAbbinato(db_used,id_device, id_bene, numero) {
|
|
|
8011
8936
|
case 'MYSQL':
|
|
8012
8937
|
query = updateBeneConsumoAbbinatoMySQL(id_device, id_bene, numero);
|
|
8013
8938
|
break;
|
|
8939
|
+
case 'MYSQL2':
|
|
8940
|
+
query = updateBeneConsumoAbbinatoSQLite(id_device, id_bene, numero);
|
|
8941
|
+
break;
|
|
8014
8942
|
}
|
|
8015
8943
|
}
|
|
8016
8944
|
return query;
|
|
@@ -8036,6 +8964,9 @@ function existBeneAbbinato(db_used, id_device, id_bene) {
|
|
|
8036
8964
|
case 'MYSQL':
|
|
8037
8965
|
query = existBeneAbbinatoMySQL(id_device, id_bene);
|
|
8038
8966
|
break;
|
|
8967
|
+
case 'MYSQL2':
|
|
8968
|
+
query = existBeneAbbinatoSQLite(id_device, id_bene);
|
|
8969
|
+
break;
|
|
8039
8970
|
}
|
|
8040
8971
|
}
|
|
8041
8972
|
return query;
|
|
@@ -8075,6 +9006,9 @@ function queryFloorsByPlace(db_used, id_place) {
|
|
|
8075
9006
|
case 'MYSQL':
|
|
8076
9007
|
query = queryFloorsByPlaceMySQL(id_place);
|
|
8077
9008
|
break;
|
|
9009
|
+
case 'MYSQL2':
|
|
9010
|
+
query = queryFloorsByPlaceSQLite(id_place);
|
|
9011
|
+
break;
|
|
8078
9012
|
}
|
|
8079
9013
|
}
|
|
8080
9014
|
return query;
|
|
@@ -8112,6 +9046,22 @@ function queryFunzioneByPlaceAndFloorMySQL(id_place, piano) {
|
|
|
8112
9046
|
|
|
8113
9047
|
}
|
|
8114
9048
|
|
|
9049
|
+
function queryFunzioneByPlaceAndFloorMySQL2(id_place, piano) {
|
|
9050
|
+
var query = "";
|
|
9051
|
+
query = "SELECT DISTINCT sd.type as funzione from site_destinations sd";
|
|
9052
|
+
query += " JOIN sites s ON s.id = sd.id_site"
|
|
9053
|
+
if (id_place) {
|
|
9054
|
+
query += " where CURDATE() >= sd.date_start and CURDATE() <= sd.date_end";
|
|
9055
|
+
query += " and sd.id_place = '" + id_place + "'";
|
|
9056
|
+
if (piano) {
|
|
9057
|
+
query += " and s.floor = '" + piano + "'";
|
|
9058
|
+
}
|
|
9059
|
+
}
|
|
9060
|
+
query += " order by funzione";
|
|
9061
|
+
return query;
|
|
9062
|
+
|
|
9063
|
+
}
|
|
9064
|
+
|
|
8115
9065
|
function queryFunzioneByPlaceAndFloor(db_used, id_place, piano) {
|
|
8116
9066
|
var query = "";
|
|
8117
9067
|
if (db_used) {
|
|
@@ -8122,6 +9072,9 @@ function queryFunzioneByPlaceAndFloor(db_used, id_place, piano) {
|
|
|
8122
9072
|
case 'MYSQL':
|
|
8123
9073
|
query = queryFunzioneByPlaceAndFloorMySQL(id_place, piano);
|
|
8124
9074
|
break;
|
|
9075
|
+
case 'MYSQL2':
|
|
9076
|
+
query = queryFunzioneByPlaceAndFloorMySQL2(id_place, piano);
|
|
9077
|
+
break;
|
|
8125
9078
|
}
|
|
8126
9079
|
}
|
|
8127
9080
|
return query;
|
|
@@ -8167,6 +9120,25 @@ function querySitesMySQL(place, piano, funzione) {
|
|
|
8167
9120
|
return query;
|
|
8168
9121
|
}
|
|
8169
9122
|
|
|
9123
|
+
function querySitesMySQL2(place, piano, funzione) {
|
|
9124
|
+
var query = "SELECT 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";
|
|
9125
|
+
query += " LEFT JOIN sites s ON s.id = sd.id_site"
|
|
9126
|
+
query += " where CURDATE() >= sd.date_start and CURDATE() <= sd.date_end";
|
|
9127
|
+
|
|
9128
|
+
if (place) {
|
|
9129
|
+
query += " and s.id_place = '" + place + "'";
|
|
9130
|
+
}
|
|
9131
|
+
if (funzione) {
|
|
9132
|
+
query += " and sd.type = '" + funzione + "'";
|
|
9133
|
+
}
|
|
9134
|
+
|
|
9135
|
+
if (piano) {
|
|
9136
|
+
query += " and s.floor = '" + piano + "'";
|
|
9137
|
+
}
|
|
9138
|
+
query += " order by s.id_place, s.floor";
|
|
9139
|
+
return query;
|
|
9140
|
+
}
|
|
9141
|
+
|
|
8170
9142
|
function querySites(db_used, place, piano, funzione) {
|
|
8171
9143
|
var query = "";
|
|
8172
9144
|
if (db_used) {
|
|
@@ -8177,6 +9149,9 @@ function querySites(db_used, place, piano, funzione) {
|
|
|
8177
9149
|
case 'MYSQL':
|
|
8178
9150
|
query = querySitesMySQL(place, piano, funzione);
|
|
8179
9151
|
break;
|
|
9152
|
+
case 'MYSQL2':
|
|
9153
|
+
query = querySitesMySQL2(place, piano, funzione);
|
|
9154
|
+
break;
|
|
8180
9155
|
}
|
|
8181
9156
|
}
|
|
8182
9157
|
return query;
|
|
@@ -8214,6 +9189,21 @@ function getSitesFromDeviceMySQL(id_device, prec_pos) {
|
|
|
8214
9189
|
query += " order by sd.name, s.floor";
|
|
8215
9190
|
return query;
|
|
8216
9191
|
}
|
|
9192
|
+
function getSitesFromDeviceMySQL2(id_device, prec_pos) {
|
|
9193
|
+
var query = "SELECT p.mark as Sigla, p.name as Plesso, sd.name as Aula, sd.type as Funzione, s.floor as Piano from device_site ds ";
|
|
9194
|
+
query += " JOIN sites s ON s.id = ds.id_site";
|
|
9195
|
+
query += " JOIN site_destinations sd ON sd.id_site = ds.id_site";
|
|
9196
|
+
query += " JOIN places p ON p.mark = sd.id_place";
|
|
9197
|
+
if (prec_pos == 1) {
|
|
9198
|
+
query += " where ds.id_device = " + id_device;
|
|
9199
|
+
}
|
|
9200
|
+
else {
|
|
9201
|
+
query += " where (CURDATE() >= ds.date_in and CURDATE() <= ds.date_out) and";
|
|
9202
|
+
query += " ds.id_device = " + id_device;
|
|
9203
|
+
}
|
|
9204
|
+
query += " order by sd.name, s.floor";
|
|
9205
|
+
return query;
|
|
9206
|
+
}
|
|
8217
9207
|
function getSitesFromDevice(db_used, id_device, prec_pos) {
|
|
8218
9208
|
var query = "";
|
|
8219
9209
|
if (db_used) {
|
|
@@ -8224,6 +9214,9 @@ function getSitesFromDevice(db_used, id_device, prec_pos) {
|
|
|
8224
9214
|
case 'MYSQL':
|
|
8225
9215
|
query = getSitesFromDeviceMySQL(id_device, prec_pos);
|
|
8226
9216
|
break;
|
|
9217
|
+
case 'MYSQL2':
|
|
9218
|
+
query = getSitesFromDeviceMySQL2(id_device, prec_pos);
|
|
9219
|
+
break;
|
|
8227
9220
|
}
|
|
8228
9221
|
}
|
|
8229
9222
|
return query;
|
|
@@ -8258,6 +9251,9 @@ function getSitesWithDatesFromDevice(db_used, id_device) {
|
|
|
8258
9251
|
case 'MYSQL':
|
|
8259
9252
|
query = getSitesWithDatesFromDeviceMySQL(id_device);
|
|
8260
9253
|
break;
|
|
9254
|
+
case 'MYSQL2':
|
|
9255
|
+
query = getSitesWithDatesFromDeviceSQLite(id_device);
|
|
9256
|
+
break;
|
|
8261
9257
|
}
|
|
8262
9258
|
}
|
|
8263
9259
|
return query;
|
|
@@ -8324,6 +9320,36 @@ function querySitesWithDefaultsMySQL(def_values) {
|
|
|
8324
9320
|
return query;
|
|
8325
9321
|
}
|
|
8326
9322
|
|
|
9323
|
+
function querySitesWithDefaultsMySQL2(def_values) {
|
|
9324
|
+
var where_clause = "";
|
|
9325
|
+
if (def_values && (def_values.site_place || def_values.site_floor || def_values.site_type)) {
|
|
9326
|
+
where_clause = " and ";
|
|
9327
|
+
if (def_values.site_place) {
|
|
9328
|
+
where_clause += "s.id_place = '" + def_values.site_place + "'";
|
|
9329
|
+
if (def_values.site_floor || def_values.site_type) {
|
|
9330
|
+
where_clause += " and ";
|
|
9331
|
+
}
|
|
9332
|
+
}
|
|
9333
|
+
if (def_values.site_floor) {
|
|
9334
|
+
where_clause += "s.floor = '" + def_values.site_floor + "'";
|
|
9335
|
+
if (def_values.site_type) {
|
|
9336
|
+
where_clause += " and ";
|
|
9337
|
+
}
|
|
9338
|
+
}
|
|
9339
|
+
if (def_values.type) {
|
|
9340
|
+
where_clause += "s.type = '" + def_values.site_type + "'";
|
|
9341
|
+
}
|
|
9342
|
+
}
|
|
9343
|
+
|
|
9344
|
+
var query = "select s.id, s.id_place as Plesso, p.name as Denominazione, sd.name as Destinazione, s.mark as Codice, sd.type as Tipo from sites s ";
|
|
9345
|
+
query += "join site_destinations sd on sd.id_site = s.id ";
|
|
9346
|
+
query += "join places p on p.mark = s.id_place ";
|
|
9347
|
+
query += "where CURDATE() >= sd.date_start and CURDATE() <= sd.date_end ";
|
|
9348
|
+
query += where_clause;
|
|
9349
|
+
query += " order by sd.id_place, s.mark";
|
|
9350
|
+
return query;
|
|
9351
|
+
}
|
|
9352
|
+
|
|
8327
9353
|
function querySitesWithDefaults(db_used, def_values) {
|
|
8328
9354
|
var query = "";
|
|
8329
9355
|
if (db_used) {
|
|
@@ -8334,6 +9360,9 @@ function querySitesWithDefaults(db_used, def_values) {
|
|
|
8334
9360
|
case 'MYSQL':
|
|
8335
9361
|
query = querySitesWithDefaultsMySQL(def_values);
|
|
8336
9362
|
break;
|
|
9363
|
+
case 'MYSQL2':
|
|
9364
|
+
query = querySitesWithDefaultsMySQL2(def_values);
|
|
9365
|
+
break;
|
|
8337
9366
|
}
|
|
8338
9367
|
}
|
|
8339
9368
|
return query;
|
|
@@ -8361,6 +9390,9 @@ function getPorteByIdSite(db_used, id_site) {
|
|
|
8361
9390
|
case 'MYSQL':
|
|
8362
9391
|
query = getPorteByIdSiteMySQL(id_site);
|
|
8363
9392
|
break;
|
|
9393
|
+
case 'MYSQL2':
|
|
9394
|
+
query = getPorteByIdSiteSQLite(id_site);
|
|
9395
|
+
break;
|
|
8364
9396
|
}
|
|
8365
9397
|
}
|
|
8366
9398
|
return query;
|
|
@@ -8388,6 +9420,9 @@ function verifyPrevDeviceSite(db_used, id_device) {
|
|
|
8388
9420
|
case 'MYSQL':
|
|
8389
9421
|
query = verifyPrevDeviceSiteMySQL(id_device);
|
|
8390
9422
|
break;
|
|
9423
|
+
case 'MYSQL2':
|
|
9424
|
+
query = verifyPrevDeviceSiteSQLite(id_device);
|
|
9425
|
+
break;
|
|
8391
9426
|
}
|
|
8392
9427
|
}
|
|
8393
9428
|
return query;
|
|
@@ -8413,6 +9448,9 @@ function removeDeviceSite(db_used,id_site, id_place, id_device) {
|
|
|
8413
9448
|
case 'MYSQL':
|
|
8414
9449
|
query = removeDeviceSiteMySQL(id_site, id_place, id_device);
|
|
8415
9450
|
break;
|
|
9451
|
+
case 'MYSQL2':
|
|
9452
|
+
query = removeDeviceSiteSQLite(id_site, id_place, id_device);
|
|
9453
|
+
break;
|
|
8416
9454
|
}
|
|
8417
9455
|
}
|
|
8418
9456
|
return query;
|
|
@@ -8438,6 +9476,9 @@ function updateDeviceSiteAfterRemove(db_used,id_device) {
|
|
|
8438
9476
|
case 'MYSQL':
|
|
8439
9477
|
query = updateDeviceSiteAfterRemoveMySQL(id_device);
|
|
8440
9478
|
break;
|
|
9479
|
+
case 'MYSQL2':
|
|
9480
|
+
query = updateDeviceSiteAfterRemoveSQLite(id_device);
|
|
9481
|
+
break;
|
|
8441
9482
|
}
|
|
8442
9483
|
}
|
|
8443
9484
|
return query;
|
|
@@ -8464,6 +9505,9 @@ function updateDeviceSite(db_used,id_device) {
|
|
|
8464
9505
|
case 'MYSQL':
|
|
8465
9506
|
query = updateDeviceSiteMySQL(id_device);
|
|
8466
9507
|
break;
|
|
9508
|
+
case 'MYSQL2':
|
|
9509
|
+
query = updateDeviceSiteSQLite(id_device);
|
|
9510
|
+
break;
|
|
8467
9511
|
}
|
|
8468
9512
|
}
|
|
8469
9513
|
return query;
|
|
@@ -8512,6 +9556,9 @@ function insertDeviceSite(db_used,id_device, id_place, id_site, start_date) {
|
|
|
8512
9556
|
case 'MYSQL':
|
|
8513
9557
|
query = insertDeviceSiteMySQL(id_device, id_place, id_site, start_date);
|
|
8514
9558
|
break;
|
|
9559
|
+
case 'MYSQL2':
|
|
9560
|
+
query = insertDeviceSiteSQLite(id_device, id_place, id_site, start_date);
|
|
9561
|
+
break;
|
|
8515
9562
|
}
|
|
8516
9563
|
}
|
|
8517
9564
|
return query;
|
|
@@ -8538,6 +9585,9 @@ function removeDeviceFromAllSites(db_used, id_device) {
|
|
|
8538
9585
|
case 'MYSQL':
|
|
8539
9586
|
query = removeDeviceFromAllSitesMySQL(id_device);
|
|
8540
9587
|
break;
|
|
9588
|
+
case 'MYSQL2':
|
|
9589
|
+
query = removeDeviceFromAllSitesSQLite(id_device);
|
|
9590
|
+
break;
|
|
8541
9591
|
}
|
|
8542
9592
|
}
|
|
8543
9593
|
return query;
|
|
@@ -8587,6 +9637,28 @@ function getSitesSelectComboMySQL(id_place, tipo_aula) {
|
|
|
8587
9637
|
query += "order by p.name, s.floor, sd.name ";
|
|
8588
9638
|
return query;
|
|
8589
9639
|
}
|
|
9640
|
+
|
|
9641
|
+
function getSitesSelectComboMySQL2(id_place, tipo_aula) {
|
|
9642
|
+
var query = "select s.id, concat(p.name, ' - ', sd.name, ' - ', s.mark) as Descrizione from sites s ";
|
|
9643
|
+
query += "join site_destinations sd on sd.id_site = s.id ";
|
|
9644
|
+
query += "join places p on p.mark = s.id_place ";
|
|
9645
|
+
query += "where CURDATE() >= sd.date_start and CURDATE() <= sd.date_end ";
|
|
9646
|
+
if (id_place || tipo_aula) {
|
|
9647
|
+
if (id_place && id_place != "") {
|
|
9648
|
+
query += "and s.id_place = '" + id_place +"' ";
|
|
9649
|
+
}
|
|
9650
|
+
if (tipo_aula && tipo_aula != "ALL") {
|
|
9651
|
+
query += "and sd.type = '" + tipo_aula + "' ";
|
|
9652
|
+
}
|
|
9653
|
+
}
|
|
9654
|
+
else {
|
|
9655
|
+
if (!tipo_aula || tipo_aula == "ALL")
|
|
9656
|
+
query += "and sd.type in ('DIDATTICA', 'LABORATORIO', 'UFFICIO', 'SERVIZIO') ";
|
|
9657
|
+
}
|
|
9658
|
+
query += "order by p.name, s.floor, sd.name ";
|
|
9659
|
+
return query;
|
|
9660
|
+
}
|
|
9661
|
+
|
|
8590
9662
|
function getSitesSelectCombo(db_used,id_place, tipo_aula) {
|
|
8591
9663
|
var query = "";
|
|
8592
9664
|
if (db_used) {
|
|
@@ -8597,6 +9669,9 @@ function getSitesSelectCombo(db_used,id_place, tipo_aula) {
|
|
|
8597
9669
|
case 'MYSQL':
|
|
8598
9670
|
query = getSitesSelectComboMySQL(id_place, tipo_aula);
|
|
8599
9671
|
break;
|
|
9672
|
+
case 'MYSQL2':
|
|
9673
|
+
query = getSitesSelectComboMySQL2(id_place, tipo_aula);
|
|
9674
|
+
break;
|
|
8600
9675
|
}
|
|
8601
9676
|
}
|
|
8602
9677
|
return query;
|
|
@@ -8620,6 +9695,17 @@ function getSiteByIdMySQL(id_site) {
|
|
|
8620
9695
|
query += "and s.id = :id_site";
|
|
8621
9696
|
return query;
|
|
8622
9697
|
}
|
|
9698
|
+
|
|
9699
|
+
function getSiteByIdMySQL2(id_site) {
|
|
9700
|
+
var query = "select s.id, s.id_place as Plesso, p.name as Denominazione, sd.name as Destinazione, s.mark as Codice, sd.type as Tipo from sites s ";
|
|
9701
|
+
query += "join site_destinations sd on sd.id_site = s.id ";
|
|
9702
|
+
query += "join places p on p.mark = s.id_place ";
|
|
9703
|
+
query += "where CURDATE() >= sd.date_start and CURDATE() <= sd.date_end ";
|
|
9704
|
+
query += "and s.id = " + id_site;
|
|
9705
|
+
return query;
|
|
9706
|
+
}
|
|
9707
|
+
|
|
9708
|
+
|
|
8623
9709
|
function getSiteById(db_used,id_site) {
|
|
8624
9710
|
var query = "";
|
|
8625
9711
|
if (db_used) {
|
|
@@ -8630,6 +9716,9 @@ function getSiteById(db_used,id_site) {
|
|
|
8630
9716
|
case 'MYSQL':
|
|
8631
9717
|
query = getSiteByIdMySQL(id_site);
|
|
8632
9718
|
break;
|
|
9719
|
+
case 'MYSQL2':
|
|
9720
|
+
query = getSiteByIdMySQL2(id_site);
|
|
9721
|
+
break;
|
|
8633
9722
|
}
|
|
8634
9723
|
}
|
|
8635
9724
|
return query;
|
|
@@ -8659,6 +9748,9 @@ function querySitesLab(db_used,id_place) {
|
|
|
8659
9748
|
case 'MYSQL':
|
|
8660
9749
|
query = querySitesLabMySQL(id_place);
|
|
8661
9750
|
break;
|
|
9751
|
+
case 'MYSQL2':
|
|
9752
|
+
query = querySitesLabSQLite(id_place);
|
|
9753
|
+
break;
|
|
8662
9754
|
}
|
|
8663
9755
|
}
|
|
8664
9756
|
return query;
|
|
@@ -8683,6 +9775,15 @@ function removeSiteBySetMySQL(id_device) {
|
|
|
8683
9775
|
query += ")";
|
|
8684
9776
|
return query;
|
|
8685
9777
|
}
|
|
9778
|
+
function removeSiteBySetMySQL2(id_device) {
|
|
9779
|
+
var query = "delete from device_site where id_device in ";
|
|
9780
|
+
query += "(select dt.id_relateddevice from device_set dt ";
|
|
9781
|
+
query += "left join device_site ds on dt.id_maindevice = ds.id_device ";
|
|
9782
|
+
query += "where dt.id_maindevice = " + id_device + " ";
|
|
9783
|
+
query += "and (CURDATE() >= ds.date_in and CURDATE() <= ds.date_out)";
|
|
9784
|
+
query += ")";
|
|
9785
|
+
return query;
|
|
9786
|
+
}
|
|
8686
9787
|
function removeSiteBySet(db_used, id_device) {
|
|
8687
9788
|
var query = "";
|
|
8688
9789
|
if (db_used) {
|
|
@@ -8693,6 +9794,9 @@ function removeSiteBySet(db_used, id_device) {
|
|
|
8693
9794
|
case 'MYSQL':
|
|
8694
9795
|
query = removeSiteBySetMySQL(id_device);
|
|
8695
9796
|
break;
|
|
9797
|
+
case 'MYSQL2':
|
|
9798
|
+
query = removeSiteBySetMySQL2(id_device);
|
|
9799
|
+
break;
|
|
8696
9800
|
}
|
|
8697
9801
|
}
|
|
8698
9802
|
return query;
|
|
@@ -8714,6 +9818,13 @@ function updateSiteBySetMySQL(id_device) {
|
|
|
8714
9818
|
query += "and CURDATE() >= date_in and CURDATE() <= date_out"
|
|
8715
9819
|
return query;
|
|
8716
9820
|
}
|
|
9821
|
+
function updateSiteBySetMySQL2(id_device) {
|
|
9822
|
+
var query = "update device_site set date_out = date('now','-1 day'), date_in = date('now','-1 day') where id_device in "
|
|
9823
|
+
query += "(select dt.id_relateddevice from device_set dt ";
|
|
9824
|
+
query += "where dt.id_maindevice = " + id_device + ") ";
|
|
9825
|
+
query += "and CURDATE() >= date_in and CURDATE() <= date_out"
|
|
9826
|
+
return query;
|
|
9827
|
+
}
|
|
8717
9828
|
function updateSiteBySet(db_used,id_device) {
|
|
8718
9829
|
var query = "";
|
|
8719
9830
|
if (db_used) {
|
|
@@ -8724,6 +9835,9 @@ function updateSiteBySet(db_used,id_device) {
|
|
|
8724
9835
|
case 'MYSQL':
|
|
8725
9836
|
query = updateSiteBySetMySQL(id_device);
|
|
8726
9837
|
break;
|
|
9838
|
+
case 'MYSQL2':
|
|
9839
|
+
query = updateSiteBySetMySQL2(id_device);
|
|
9840
|
+
break;
|
|
8727
9841
|
}
|
|
8728
9842
|
}
|
|
8729
9843
|
return query;
|
|
@@ -8746,6 +9860,14 @@ function insertSiteBySetMySQL(id_device) {
|
|
|
8746
9860
|
query += "where ds.id_maindevice = :id_device";
|
|
8747
9861
|
return query;
|
|
8748
9862
|
}
|
|
9863
|
+
function insertSiteBySetMySQL2(id_device) {
|
|
9864
|
+
var query = "insert into device_site (id_site, id_place, date_in, date_out, id_device) ";
|
|
9865
|
+
query += "select das.id_site, das.id_place, CURDATE(), '2999-12-31', d.id from devices d ";
|
|
9866
|
+
query += "join device_set ds on ds.id_relateddevice = d.id ";
|
|
9867
|
+
query += "join device_as_site das on das.id_device = ds.id_maindevice ";
|
|
9868
|
+
query += "where ds.id_maindevice = " + id_device;
|
|
9869
|
+
return query;
|
|
9870
|
+
}
|
|
8749
9871
|
function insertSiteBySet(db_used,id_device) {
|
|
8750
9872
|
var query = "";
|
|
8751
9873
|
if (db_used) {
|
|
@@ -8756,6 +9878,9 @@ function insertSiteBySet(db_used,id_device) {
|
|
|
8756
9878
|
case 'MYSQL':
|
|
8757
9879
|
query = insertSiteBySetMySQL(id_device);
|
|
8758
9880
|
break;
|
|
9881
|
+
case 'MYSQL2':
|
|
9882
|
+
query = insertSiteBySetMySQL2(id_device);
|
|
9883
|
+
break;
|
|
8759
9884
|
}
|
|
8760
9885
|
}
|
|
8761
9886
|
return query;
|
|
@@ -8786,6 +9911,9 @@ function insertSiteBySetParam(db_used,id_device) {
|
|
|
8786
9911
|
case 'MYSQL':
|
|
8787
9912
|
query = insertSiteBySetParamMySQL(id_device);
|
|
8788
9913
|
break;
|
|
9914
|
+
case 'MYSQL2':
|
|
9915
|
+
query = insertSiteBySetParamSQLite(id_device);
|
|
9916
|
+
break;
|
|
8789
9917
|
}
|
|
8790
9918
|
}
|
|
8791
9919
|
return query;
|
|
@@ -8812,6 +9940,9 @@ function getDeviceAsSite(db_used,id_device) {
|
|
|
8812
9940
|
case 'MYSQL':
|
|
8813
9941
|
query = getDeviceAsSiteMySQL(id_device);
|
|
8814
9942
|
break;
|
|
9943
|
+
case 'MYSQL2':
|
|
9944
|
+
query = getDeviceAsSiteSQLite(id_device);
|
|
9945
|
+
break;
|
|
8815
9946
|
}
|
|
8816
9947
|
}
|
|
8817
9948
|
return query;
|
|
@@ -8824,12 +9955,20 @@ function getLastSiteForDeviceSQLite(id_device) {
|
|
|
8824
9955
|
query += "and date('now') >= ds.date_in and date('now') <= ds.date_out";
|
|
8825
9956
|
return query;
|
|
8826
9957
|
}
|
|
9958
|
+
|
|
8827
9959
|
function getLastSiteForDeviceMySQL(id_device) {
|
|
8828
9960
|
var query = "select distinct id_site, id_place, id_device from device_site ds ";
|
|
8829
9961
|
query += "where id_device = :id_device ";
|
|
8830
9962
|
query += "and CURDATE() >= ds.date_in and CURDATE() <= ds.date_out";
|
|
8831
9963
|
return query;
|
|
8832
9964
|
}
|
|
9965
|
+
|
|
9966
|
+
function getLastSiteForDeviceMySQL2(id_device) {
|
|
9967
|
+
var query = "select distinct id_site, id_place, id_device from device_site ds ";
|
|
9968
|
+
query += "where id_device = " + id_device + " ";
|
|
9969
|
+
query += "and CURDATE() >= ds.date_in and CURDATE() <= ds.date_out";
|
|
9970
|
+
return query;
|
|
9971
|
+
}
|
|
8833
9972
|
function getLastSiteForDevice(db_used,id_device) {
|
|
8834
9973
|
var query = "";
|
|
8835
9974
|
if (db_used) {
|
|
@@ -8840,6 +9979,9 @@ function getLastSiteForDevice(db_used,id_device) {
|
|
|
8840
9979
|
case 'MYSQL':
|
|
8841
9980
|
query = getLastSiteForDeviceMySQL(id_device);
|
|
8842
9981
|
break;
|
|
9982
|
+
case 'MYSQL2':
|
|
9983
|
+
query = getLastSiteForDeviceMySQL2(id_device);
|
|
9984
|
+
break;
|
|
8843
9985
|
}
|
|
8844
9986
|
}
|
|
8845
9987
|
return query;
|
|
@@ -8884,6 +10026,9 @@ function queryStatistic(db_used,list_types) {
|
|
|
8884
10026
|
case 'MYSQL':
|
|
8885
10027
|
query = queryStatisticMySQL(list_types);
|
|
8886
10028
|
break;
|
|
10029
|
+
case 'MYSQL2':
|
|
10030
|
+
query = queryStatisticSQLite(list_types);
|
|
10031
|
+
break;
|
|
8887
10032
|
}
|
|
8888
10033
|
}
|
|
8889
10034
|
return query;
|
|
@@ -8910,6 +10055,9 @@ function queryStatisticInventary(db_used) {
|
|
|
8910
10055
|
case 'MYSQL':
|
|
8911
10056
|
query = queryStatisticInventaryMySQL();
|
|
8912
10057
|
break;
|
|
10058
|
+
case 'MYSQL2':
|
|
10059
|
+
query = queryStatisticInventarySQLite();
|
|
10060
|
+
break;
|
|
8913
10061
|
}
|
|
8914
10062
|
}
|
|
8915
10063
|
return query;
|
|
@@ -8938,6 +10086,9 @@ function getBenchmarkById(db_used, id_device) {
|
|
|
8938
10086
|
case 'MYSQL':
|
|
8939
10087
|
query = getBenchmarkByIdMySQL(id_device);
|
|
8940
10088
|
break;
|
|
10089
|
+
case 'MYSQL2':
|
|
10090
|
+
query = getBenchmarkByIdSQLite(id_device);
|
|
10091
|
+
break;
|
|
8941
10092
|
}
|
|
8942
10093
|
}
|
|
8943
10094
|
return query;
|
|
@@ -8973,6 +10124,9 @@ function getBenchmarkPercentageById(db_used, id_device) {
|
|
|
8973
10124
|
case 'MYSQL':
|
|
8974
10125
|
query = getBenchmarkPercentageByIdMySQL(id_device);
|
|
8975
10126
|
break;
|
|
10127
|
+
case 'MYSQL2':
|
|
10128
|
+
query = getBenchmarkPercentageByIdSQLite(id_device);
|
|
10129
|
+
break;
|
|
8976
10130
|
}
|
|
8977
10131
|
}
|
|
8978
10132
|
return query;
|
|
@@ -9001,6 +10155,9 @@ function insertBenchmark(db_used, id_device, total_ref, eval_perfs) {
|
|
|
9001
10155
|
case 'MYSQL':
|
|
9002
10156
|
query = insertBenchmarkMySQL(id_device, total_ref, eval_perfs);
|
|
9003
10157
|
break;
|
|
10158
|
+
case 'MYSQL2':
|
|
10159
|
+
query = insertBenchmarkSQLite(id_device, total_ref, eval_perfs);
|
|
10160
|
+
break;
|
|
9004
10161
|
}
|
|
9005
10162
|
}
|
|
9006
10163
|
return query;
|
|
@@ -9033,6 +10190,9 @@ function updateBenchmark(db_used, id_device, total_ref, eval_perfs) {
|
|
|
9033
10190
|
case 'MYSQL':
|
|
9034
10191
|
query = updateBenchmarkMySQL(id_device, total_ref, eval_perfs);
|
|
9035
10192
|
break;
|
|
10193
|
+
case 'MYSQL2':
|
|
10194
|
+
query = updateBenchmarkSQLite(id_device, total_ref, eval_perfs);
|
|
10195
|
+
break;
|
|
9036
10196
|
}
|
|
9037
10197
|
}
|
|
9038
10198
|
return query;
|
|
@@ -9060,6 +10220,9 @@ function removeBenchmarkById(db_used, id_device) {
|
|
|
9060
10220
|
case 'MYSQL':
|
|
9061
10221
|
query = removeBenchmarkByIdMySQL(id_device);
|
|
9062
10222
|
break;
|
|
10223
|
+
case 'MYSQL2':
|
|
10224
|
+
query = removeBenchmarkByIdSQLite(id_device);
|
|
10225
|
+
break;
|
|
9063
10226
|
}
|
|
9064
10227
|
}
|
|
9065
10228
|
return query;
|
|
@@ -9086,6 +10249,15 @@ function queryStatisticsDeviceStatusMySQL() {
|
|
|
9086
10249
|
query += "group by Stato";
|
|
9087
10250
|
return query;
|
|
9088
10251
|
}
|
|
10252
|
+
function queryStatisticsDeviceStatusMySQL2() {
|
|
10253
|
+
var query = "select case when ds.status is null then 0 else ds.status end as Stato, sd.name as Descrizione, count(*) as Numero from devices d ";
|
|
10254
|
+
query += "left join device_usage ds on d.id = ds.id_device ";
|
|
10255
|
+
query += "join status_description sd on sd.id = Stato "
|
|
10256
|
+
query += "where CURDATE() >= ds.date_status or Stato = 0 ";
|
|
10257
|
+
query += "and (is_removed is null or is_removed = 0) ";
|
|
10258
|
+
query += "group by Stato";
|
|
10259
|
+
return query;
|
|
10260
|
+
}
|
|
9089
10261
|
function queryStatisticsDeviceStatus(db_used) {
|
|
9090
10262
|
var query = "";
|
|
9091
10263
|
if (db_used) {
|
|
@@ -9096,6 +10268,9 @@ function queryStatisticsDeviceStatus(db_used) {
|
|
|
9096
10268
|
case 'MYSQL':
|
|
9097
10269
|
query = queryStatisticsDeviceStatusMySQL();
|
|
9098
10270
|
break;
|
|
10271
|
+
case 'MYSQL2':
|
|
10272
|
+
query = queryStatisticsDeviceStatusMySQL2();
|
|
10273
|
+
break;
|
|
9099
10274
|
}
|
|
9100
10275
|
}
|
|
9101
10276
|
return query;
|
|
@@ -9303,8 +10478,11 @@ function getDevicesInUse(db_used) {
|
|
|
9303
10478
|
case 'MYSQL':
|
|
9304
10479
|
query = getDevicesInUseMySQL();
|
|
9305
10480
|
break;
|
|
10481
|
+
case 'MYSQL2':
|
|
10482
|
+
query = getDevicesInUseSQLite();
|
|
10483
|
+
break;
|
|
9306
10484
|
}
|
|
9307
|
-
|
|
10485
|
+
}
|
|
9308
10486
|
return query;
|
|
9309
10487
|
}
|
|
9310
10488
|
|
|
@@ -9340,6 +10518,9 @@ function getDevicesInUseByPlaces(db_used) {
|
|
|
9340
10518
|
case 'MYSQL':
|
|
9341
10519
|
query = getDevicesInUseByPlacesMySQL();
|
|
9342
10520
|
break;
|
|
10521
|
+
case 'MYSQL2':
|
|
10522
|
+
query = getDevicesInUseByPlacesMySQL();
|
|
10523
|
+
break;
|
|
9343
10524
|
}
|
|
9344
10525
|
}
|
|
9345
10526
|
return query;
|
|
@@ -9367,6 +10548,9 @@ function getDatiAcquistoDevice(db_used,id_device) {
|
|
|
9367
10548
|
case 'MYSQL':
|
|
9368
10549
|
query = getDatiAcquistoDeviceMySQL(id_device);
|
|
9369
10550
|
break;
|
|
10551
|
+
case 'MYSQL2':
|
|
10552
|
+
query = getDatiAcquistoDeviceSQLite(id_device);
|
|
10553
|
+
break;
|
|
9370
10554
|
}
|
|
9371
10555
|
}
|
|
9372
10556
|
return query;
|
|
@@ -9750,6 +10934,9 @@ function exportDBSQLSQLite(db_path, dump_path, dump_filename) {
|
|
|
9750
10934
|
}
|
|
9751
10935
|
function exportDBSQLMySQL(db_path, dump_path, dump_filename) {
|
|
9752
10936
|
|
|
10937
|
+
}
|
|
10938
|
+
function exportDBSQLMySQL2(db_path, dump_path, dump_filename) {
|
|
10939
|
+
|
|
9753
10940
|
}
|
|
9754
10941
|
function exportDBSQL(db_used, db_path, dump_path, dump_filename) {
|
|
9755
10942
|
var query = "";
|
|
@@ -9761,6 +10948,9 @@ function exportDBSQL(db_used, db_path, dump_path, dump_filename) {
|
|
|
9761
10948
|
case 'MYSQL':
|
|
9762
10949
|
query = exportDBSQLMySQL(db_path, dump_path, dump_filename);
|
|
9763
10950
|
break;
|
|
10951
|
+
case 'MYSQL2':
|
|
10952
|
+
query = exportDBSQLMySQL2(db_path, dump_path, dump_filename);
|
|
10953
|
+
break;
|
|
9764
10954
|
}
|
|
9765
10955
|
}
|
|
9766
10956
|
return query;
|