alsmanager_lib 2.0.65 → 2.0.66
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 +856 -11
- 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;
|
|
@@ -4568,8 +5086,48 @@ function queryDeviceTypes() {
|
|
|
4568
5086
|
query += "order by search_type";
|
|
4569
5087
|
return query;
|
|
4570
5088
|
}
|
|
4571
|
-
// Define getDevicesNotAllocatedCombo
|
|
4572
|
-
function getDevicesNotAllocatedComboSQLite(id_site, id_place, sel_type, sel_maker, ordered_by) {
|
|
5089
|
+
// Define getDevicesNotAllocatedCombo
|
|
5090
|
+
function getDevicesNotAllocatedComboSQLite(id_site, id_place, sel_type, sel_maker, ordered_by) {
|
|
5091
|
+
var sel_type_str = "";
|
|
5092
|
+
if (sel_type) {
|
|
5093
|
+
sel_type_str = sel_type;
|
|
5094
|
+
}
|
|
5095
|
+
var sel_maker_str = "";
|
|
5096
|
+
if (sel_maker) {
|
|
5097
|
+
sel_maker_str = sel_maker;
|
|
5098
|
+
}
|
|
5099
|
+
var query = "SELECT d.id, d.type as Tipo, d.manifacturer as Marca, d.model as Modello, ";
|
|
5100
|
+
query += "case ";
|
|
5101
|
+
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) ";
|
|
5102
|
+
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) ";
|
|
5103
|
+
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) ";
|
|
5104
|
+
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) ";
|
|
5105
|
+
query += "else '' "
|
|
5106
|
+
query += "end as Descrizione ";
|
|
5107
|
+
query += "from devices d ";
|
|
5108
|
+
query += "left join device_site ds on d.id = ds.id_device ";
|
|
5109
|
+
query += "left join site_destinations sd on ds.id_site = sd.id_site ";
|
|
5110
|
+
query += "left join device_consegne dc on d.id = dc.id_device ";
|
|
5111
|
+
query += "where (d.is_removed is null or d.is_removed = 0) "
|
|
5112
|
+
query += "and (dc.id_consegna is null) ";
|
|
5113
|
+
query += "and (ds.id_place is null ";
|
|
5114
|
+
query += "or ((ds.date_in <= date('now') and ds.date_out >= date('now') and sd.type = 'MAGAZZINO')) and (ds.id_place <> '" + id_place + "' and ds.id_site <> " + id_site + ")) ";
|
|
5115
|
+
if (sel_type_str.trim() != '') {
|
|
5116
|
+
query += "and d.type = '" + sel_type_str.trim() + "' ";
|
|
5117
|
+
}
|
|
5118
|
+
if (sel_maker_str.trim() != '') {
|
|
5119
|
+
query += "and d.manifacturer = '" + sel_maker_str.trim() + "' ";
|
|
5120
|
+
}
|
|
5121
|
+
if (ordered_by && ordered_by == "ID") {
|
|
5122
|
+
query += "order by d.id desc";
|
|
5123
|
+
}
|
|
5124
|
+
else {
|
|
5125
|
+
query += "order by d.inv_ict3_number";
|
|
5126
|
+
}
|
|
5127
|
+
return query;
|
|
5128
|
+
}
|
|
5129
|
+
|
|
5130
|
+
function getDevicesNotAllocatedComboMySQL(id_site, id_place, sel_type, sel_maker,ordered_by) {
|
|
4573
5131
|
var sel_type_str = "";
|
|
4574
5132
|
if (sel_type) {
|
|
4575
5133
|
sel_type_str = sel_type;
|
|
@@ -4578,7 +5136,7 @@ function getDevicesNotAllocatedComboSQLite(id_site, id_place, sel_type, sel_make
|
|
|
4578
5136
|
if (sel_maker) {
|
|
4579
5137
|
sel_maker_str = sel_maker;
|
|
4580
5138
|
}
|
|
4581
|
-
var query = "SELECT d.id, d.type as Tipo, d.manifacturer as Marca, d.model as Modello, ";
|
|
5139
|
+
var query = "SELECT d.id, d.type as Tipo, d.manifacturer as Marca, d.model as Modello, ";
|
|
4582
5140
|
query += "case ";
|
|
4583
5141
|
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) ";
|
|
4584
5142
|
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) ";
|
|
@@ -4593,12 +5151,12 @@ function getDevicesNotAllocatedComboSQLite(id_site, id_place, sel_type, sel_make
|
|
|
4593
5151
|
query += "where (d.is_removed is null or d.is_removed = 0) "
|
|
4594
5152
|
query += "and (dc.id_consegna is null) ";
|
|
4595
5153
|
query += "and (ds.id_place is null ";
|
|
4596
|
-
query += "or ((ds.date_in <=
|
|
5154
|
+
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)) ";
|
|
4597
5155
|
if (sel_type_str.trim() != '') {
|
|
4598
|
-
query += "and d.type =
|
|
5156
|
+
query += "and d.type = :dev_type ";
|
|
4599
5157
|
}
|
|
4600
5158
|
if (sel_maker_str.trim() != '') {
|
|
4601
|
-
query += "and d.manifacturer =
|
|
5159
|
+
query += "and d.manifacturer = :dev_manifacturer ";
|
|
4602
5160
|
}
|
|
4603
5161
|
if (ordered_by && ordered_by == "ID") {
|
|
4604
5162
|
query += "order by d.id desc";
|
|
@@ -4609,7 +5167,7 @@ function getDevicesNotAllocatedComboSQLite(id_site, id_place, sel_type, sel_make
|
|
|
4609
5167
|
return query;
|
|
4610
5168
|
}
|
|
4611
5169
|
|
|
4612
|
-
function
|
|
5170
|
+
function getDevicesNotAllocatedComboMySQL2(id_site, id_place, sel_type, sel_maker, ordered_by) {
|
|
4613
5171
|
var sel_type_str = "";
|
|
4614
5172
|
if (sel_type) {
|
|
4615
5173
|
sel_type_str = sel_type;
|
|
@@ -4618,7 +5176,7 @@ function getDevicesNotAllocatedComboMySQL(id_site, id_place, sel_type, sel_maker
|
|
|
4618
5176
|
if (sel_maker) {
|
|
4619
5177
|
sel_maker_str = sel_maker;
|
|
4620
5178
|
}
|
|
4621
|
-
var query = "SELECT d.id, d.type as Tipo, d.manifacturer as Marca, d.model as Modello, ";
|
|
5179
|
+
var query = "SELECT d.id, d.type as Tipo, d.manifacturer as Marca, d.model as Modello, ";
|
|
4622
5180
|
query += "case ";
|
|
4623
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) ";
|
|
4624
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) ";
|
|
@@ -4633,12 +5191,12 @@ function getDevicesNotAllocatedComboMySQL(id_site, id_place, sel_type, sel_maker
|
|
|
4633
5191
|
query += "where (d.is_removed is null or d.is_removed = 0) "
|
|
4634
5192
|
query += "and (dc.id_consegna is null) ";
|
|
4635
5193
|
query += "and (ds.id_place is null ";
|
|
4636
|
-
query += "or ((ds.date_in <= CURDATE() and ds.date_out >= CURDATE() and sd.type = 'MAGAZZINO')) and (ds.id_place <>
|
|
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 + ")) ";
|
|
4637
5195
|
if (sel_type_str.trim() != '') {
|
|
4638
|
-
query += "and d.type =
|
|
5196
|
+
query += "and d.type = '" + sel_type_str.trim() + "' ";
|
|
4639
5197
|
}
|
|
4640
5198
|
if (sel_maker_str.trim() != '') {
|
|
4641
|
-
query += "and d.manifacturer =
|
|
5199
|
+
query += "and d.manifacturer = '" + sel_maker_str.trim() + "' ";
|
|
4642
5200
|
}
|
|
4643
5201
|
if (ordered_by && ordered_by == "ID") {
|
|
4644
5202
|
query += "order by d.id desc";
|
|
@@ -4648,6 +5206,7 @@ function getDevicesNotAllocatedComboMySQL(id_site, id_place, sel_type, sel_maker
|
|
|
4648
5206
|
}
|
|
4649
5207
|
return query;
|
|
4650
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;
|
|
@@ -8075,6 +8726,9 @@ function queryFloorsByPlace(db_used, id_place) {
|
|
|
8075
8726
|
case 'MYSQL':
|
|
8076
8727
|
query = queryFloorsByPlaceMySQL(id_place);
|
|
8077
8728
|
break;
|
|
8729
|
+
case 'MYSQL2':
|
|
8730
|
+
query = queryFloorsByPlaceSQLite(id_place);
|
|
8731
|
+
break;
|
|
8078
8732
|
}
|
|
8079
8733
|
}
|
|
8080
8734
|
return query;
|
|
@@ -8112,6 +8766,22 @@ function queryFunzioneByPlaceAndFloorMySQL(id_place, piano) {
|
|
|
8112
8766
|
|
|
8113
8767
|
}
|
|
8114
8768
|
|
|
8769
|
+
function queryFunzioneByPlaceAndFloorMySQL2(id_place, piano) {
|
|
8770
|
+
var query = "";
|
|
8771
|
+
query = "SELECT DISTINCT sd.type as funzione from site_destinations sd";
|
|
8772
|
+
query += " JOIN sites s ON s.id = sd.id_site"
|
|
8773
|
+
if (id_place) {
|
|
8774
|
+
query += " where CURDATE() >= sd.date_start and CURDATE() <= sd.date_end";
|
|
8775
|
+
query += " and sd.id_place = '" + id_place + "'";
|
|
8776
|
+
if (piano) {
|
|
8777
|
+
query += " and s.floor = '" + piano + "'";
|
|
8778
|
+
}
|
|
8779
|
+
}
|
|
8780
|
+
query += " order by funzione";
|
|
8781
|
+
return query;
|
|
8782
|
+
|
|
8783
|
+
}
|
|
8784
|
+
|
|
8115
8785
|
function queryFunzioneByPlaceAndFloor(db_used, id_place, piano) {
|
|
8116
8786
|
var query = "";
|
|
8117
8787
|
if (db_used) {
|
|
@@ -8122,6 +8792,9 @@ function queryFunzioneByPlaceAndFloor(db_used, id_place, piano) {
|
|
|
8122
8792
|
case 'MYSQL':
|
|
8123
8793
|
query = queryFunzioneByPlaceAndFloorMySQL(id_place, piano);
|
|
8124
8794
|
break;
|
|
8795
|
+
case 'MYSQL2':
|
|
8796
|
+
query = queryFunzioneByPlaceAndFloorMySQL2(id_place, piano);
|
|
8797
|
+
break;
|
|
8125
8798
|
}
|
|
8126
8799
|
}
|
|
8127
8800
|
return query;
|
|
@@ -8167,6 +8840,25 @@ function querySitesMySQL(place, piano, funzione) {
|
|
|
8167
8840
|
return query;
|
|
8168
8841
|
}
|
|
8169
8842
|
|
|
8843
|
+
function querySitesMySQL2(place, piano, funzione) {
|
|
8844
|
+
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";
|
|
8845
|
+
query += " LEFT JOIN sites s ON s.id = sd.id_site"
|
|
8846
|
+
query += " where CURDATE() >= sd.date_start and CURDATE() <= sd.date_end";
|
|
8847
|
+
|
|
8848
|
+
if (place) {
|
|
8849
|
+
query += " and s.id_place = '" + place + "'";
|
|
8850
|
+
}
|
|
8851
|
+
if (funzione) {
|
|
8852
|
+
query += " and sd.type = '" + funzione + "'";
|
|
8853
|
+
}
|
|
8854
|
+
|
|
8855
|
+
if (piano) {
|
|
8856
|
+
query += " and s.floor = '" + piano + "'";
|
|
8857
|
+
}
|
|
8858
|
+
query += " order by s.id_place, s.floor";
|
|
8859
|
+
return query;
|
|
8860
|
+
}
|
|
8861
|
+
|
|
8170
8862
|
function querySites(db_used, place, piano, funzione) {
|
|
8171
8863
|
var query = "";
|
|
8172
8864
|
if (db_used) {
|
|
@@ -8177,6 +8869,9 @@ function querySites(db_used, place, piano, funzione) {
|
|
|
8177
8869
|
case 'MYSQL':
|
|
8178
8870
|
query = querySitesMySQL(place, piano, funzione);
|
|
8179
8871
|
break;
|
|
8872
|
+
case 'MYSQL2':
|
|
8873
|
+
query = querySitesMySQL2(place, piano, funzione);
|
|
8874
|
+
break;
|
|
8180
8875
|
}
|
|
8181
8876
|
}
|
|
8182
8877
|
return query;
|
|
@@ -8214,6 +8909,21 @@ function getSitesFromDeviceMySQL(id_device, prec_pos) {
|
|
|
8214
8909
|
query += " order by sd.name, s.floor";
|
|
8215
8910
|
return query;
|
|
8216
8911
|
}
|
|
8912
|
+
function getSitesFromDeviceMySQL2(id_device, prec_pos) {
|
|
8913
|
+
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 ";
|
|
8914
|
+
query += " JOIN sites s ON s.id = ds.id_site";
|
|
8915
|
+
query += " JOIN site_destinations sd ON sd.id_site = ds.id_site";
|
|
8916
|
+
query += " JOIN places p ON p.mark = sd.id_place";
|
|
8917
|
+
if (prec_pos == 1) {
|
|
8918
|
+
query += " where ds.id_device = " + id_device;
|
|
8919
|
+
}
|
|
8920
|
+
else {
|
|
8921
|
+
query += " where (CURDATE() >= ds.date_in and CURDATE() <= ds.date_out) and";
|
|
8922
|
+
query += " ds.id_device = " + id_device;
|
|
8923
|
+
}
|
|
8924
|
+
query += " order by sd.name, s.floor";
|
|
8925
|
+
return query;
|
|
8926
|
+
}
|
|
8217
8927
|
function getSitesFromDevice(db_used, id_device, prec_pos) {
|
|
8218
8928
|
var query = "";
|
|
8219
8929
|
if (db_used) {
|
|
@@ -8224,6 +8934,9 @@ function getSitesFromDevice(db_used, id_device, prec_pos) {
|
|
|
8224
8934
|
case 'MYSQL':
|
|
8225
8935
|
query = getSitesFromDeviceMySQL(id_device, prec_pos);
|
|
8226
8936
|
break;
|
|
8937
|
+
case 'MYSQL2':
|
|
8938
|
+
query = getSitesFromDeviceMySQL2(id_device, prec_pos);
|
|
8939
|
+
break;
|
|
8227
8940
|
}
|
|
8228
8941
|
}
|
|
8229
8942
|
return query;
|
|
@@ -8258,6 +8971,9 @@ function getSitesWithDatesFromDevice(db_used, id_device) {
|
|
|
8258
8971
|
case 'MYSQL':
|
|
8259
8972
|
query = getSitesWithDatesFromDeviceMySQL(id_device);
|
|
8260
8973
|
break;
|
|
8974
|
+
case 'MYSQL2':
|
|
8975
|
+
query = getSitesWithDatesFromDeviceSQLite(id_device);
|
|
8976
|
+
break;
|
|
8261
8977
|
}
|
|
8262
8978
|
}
|
|
8263
8979
|
return query;
|
|
@@ -8324,6 +9040,36 @@ function querySitesWithDefaultsMySQL(def_values) {
|
|
|
8324
9040
|
return query;
|
|
8325
9041
|
}
|
|
8326
9042
|
|
|
9043
|
+
function querySitesWithDefaultsMySQL2(def_values) {
|
|
9044
|
+
var where_clause = "";
|
|
9045
|
+
if (def_values && (def_values.site_place || def_values.site_floor || def_values.site_type)) {
|
|
9046
|
+
where_clause = " and ";
|
|
9047
|
+
if (def_values.site_place) {
|
|
9048
|
+
where_clause += "s.id_place = '" + def_values.site_place + "'";
|
|
9049
|
+
if (def_values.site_floor || def_values.site_type) {
|
|
9050
|
+
where_clause += " and ";
|
|
9051
|
+
}
|
|
9052
|
+
}
|
|
9053
|
+
if (def_values.site_floor) {
|
|
9054
|
+
where_clause += "s.floor = '" + def_values.site_floor + "'";
|
|
9055
|
+
if (def_values.site_type) {
|
|
9056
|
+
where_clause += " and ";
|
|
9057
|
+
}
|
|
9058
|
+
}
|
|
9059
|
+
if (def_values.type) {
|
|
9060
|
+
where_clause += "s.type = '" + def_values.site_type + "'";
|
|
9061
|
+
}
|
|
9062
|
+
}
|
|
9063
|
+
|
|
9064
|
+
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 ";
|
|
9065
|
+
query += "join site_destinations sd on sd.id_site = s.id ";
|
|
9066
|
+
query += "join places p on p.mark = s.id_place ";
|
|
9067
|
+
query += "where CURDATE() >= sd.date_start and CURDATE() <= sd.date_end ";
|
|
9068
|
+
query += where_clause;
|
|
9069
|
+
query += " order by sd.id_place, s.mark";
|
|
9070
|
+
return query;
|
|
9071
|
+
}
|
|
9072
|
+
|
|
8327
9073
|
function querySitesWithDefaults(db_used, def_values) {
|
|
8328
9074
|
var query = "";
|
|
8329
9075
|
if (db_used) {
|
|
@@ -8334,6 +9080,9 @@ function querySitesWithDefaults(db_used, def_values) {
|
|
|
8334
9080
|
case 'MYSQL':
|
|
8335
9081
|
query = querySitesWithDefaultsMySQL(def_values);
|
|
8336
9082
|
break;
|
|
9083
|
+
case 'MYSQL2':
|
|
9084
|
+
query = querySitesWithDefaultsMySQL2(def_values);
|
|
9085
|
+
break;
|
|
8337
9086
|
}
|
|
8338
9087
|
}
|
|
8339
9088
|
return query;
|
|
@@ -8361,6 +9110,9 @@ function getPorteByIdSite(db_used, id_site) {
|
|
|
8361
9110
|
case 'MYSQL':
|
|
8362
9111
|
query = getPorteByIdSiteMySQL(id_site);
|
|
8363
9112
|
break;
|
|
9113
|
+
case 'MYSQL2':
|
|
9114
|
+
query = getPorteByIdSiteSQLite(id_site);
|
|
9115
|
+
break;
|
|
8364
9116
|
}
|
|
8365
9117
|
}
|
|
8366
9118
|
return query;
|
|
@@ -8388,6 +9140,9 @@ function verifyPrevDeviceSite(db_used, id_device) {
|
|
|
8388
9140
|
case 'MYSQL':
|
|
8389
9141
|
query = verifyPrevDeviceSiteMySQL(id_device);
|
|
8390
9142
|
break;
|
|
9143
|
+
case 'MYSQL2':
|
|
9144
|
+
query = verifyPrevDeviceSiteSQLite(id_device);
|
|
9145
|
+
break;
|
|
8391
9146
|
}
|
|
8392
9147
|
}
|
|
8393
9148
|
return query;
|
|
@@ -8413,6 +9168,9 @@ function removeDeviceSite(db_used,id_site, id_place, id_device) {
|
|
|
8413
9168
|
case 'MYSQL':
|
|
8414
9169
|
query = removeDeviceSiteMySQL(id_site, id_place, id_device);
|
|
8415
9170
|
break;
|
|
9171
|
+
case 'MYSQL2':
|
|
9172
|
+
query = removeDeviceSiteSQLite(id_site, id_place, id_device);
|
|
9173
|
+
break;
|
|
8416
9174
|
}
|
|
8417
9175
|
}
|
|
8418
9176
|
return query;
|
|
@@ -8438,6 +9196,9 @@ function updateDeviceSiteAfterRemove(db_used,id_device) {
|
|
|
8438
9196
|
case 'MYSQL':
|
|
8439
9197
|
query = updateDeviceSiteAfterRemoveMySQL(id_device);
|
|
8440
9198
|
break;
|
|
9199
|
+
case 'MYSQL2':
|
|
9200
|
+
query = updateDeviceSiteAfterRemoveSQLite(id_device);
|
|
9201
|
+
break;
|
|
8441
9202
|
}
|
|
8442
9203
|
}
|
|
8443
9204
|
return query;
|
|
@@ -8464,6 +9225,9 @@ function updateDeviceSite(db_used,id_device) {
|
|
|
8464
9225
|
case 'MYSQL':
|
|
8465
9226
|
query = updateDeviceSiteMySQL(id_device);
|
|
8466
9227
|
break;
|
|
9228
|
+
case 'MYSQL2':
|
|
9229
|
+
query = updateDeviceSiteSQLite(id_device);
|
|
9230
|
+
break;
|
|
8467
9231
|
}
|
|
8468
9232
|
}
|
|
8469
9233
|
return query;
|
|
@@ -8512,6 +9276,9 @@ function insertDeviceSite(db_used,id_device, id_place, id_site, start_date) {
|
|
|
8512
9276
|
case 'MYSQL':
|
|
8513
9277
|
query = insertDeviceSiteMySQL(id_device, id_place, id_site, start_date);
|
|
8514
9278
|
break;
|
|
9279
|
+
case 'MYSQL2':
|
|
9280
|
+
query = insertDeviceSiteSQLite(id_device, id_place, id_site, start_date);
|
|
9281
|
+
break;
|
|
8515
9282
|
}
|
|
8516
9283
|
}
|
|
8517
9284
|
return query;
|
|
@@ -8538,6 +9305,9 @@ function removeDeviceFromAllSites(db_used, id_device) {
|
|
|
8538
9305
|
case 'MYSQL':
|
|
8539
9306
|
query = removeDeviceFromAllSitesMySQL(id_device);
|
|
8540
9307
|
break;
|
|
9308
|
+
case 'MYSQL2':
|
|
9309
|
+
query = removeDeviceFromAllSitesSQLite(id_device);
|
|
9310
|
+
break;
|
|
8541
9311
|
}
|
|
8542
9312
|
}
|
|
8543
9313
|
return query;
|
|
@@ -8587,6 +9357,28 @@ function getSitesSelectComboMySQL(id_place, tipo_aula) {
|
|
|
8587
9357
|
query += "order by p.name, s.floor, sd.name ";
|
|
8588
9358
|
return query;
|
|
8589
9359
|
}
|
|
9360
|
+
|
|
9361
|
+
function getSitesSelectComboMySQL2(id_place, tipo_aula) {
|
|
9362
|
+
var query = "select s.id, concat(p.name, ' - ', sd.name, ' - ', s.mark) as Descrizione from sites s ";
|
|
9363
|
+
query += "join site_destinations sd on sd.id_site = s.id ";
|
|
9364
|
+
query += "join places p on p.mark = s.id_place ";
|
|
9365
|
+
query += "where CURDATE() >= sd.date_start and CURDATE() <= sd.date_end ";
|
|
9366
|
+
if (id_place || tipo_aula) {
|
|
9367
|
+
if (id_place && id_place != "") {
|
|
9368
|
+
query += "and s.id_place = '" + id_place +"' ";
|
|
9369
|
+
}
|
|
9370
|
+
if (tipo_aula && tipo_aula != "ALL") {
|
|
9371
|
+
query += "and sd.type = '" + tipo_aula + "' ";
|
|
9372
|
+
}
|
|
9373
|
+
}
|
|
9374
|
+
else {
|
|
9375
|
+
if (!tipo_aula || tipo_aula == "ALL")
|
|
9376
|
+
query += "and sd.type in ('DIDATTICA', 'LABORATORIO', 'UFFICIO', 'SERVIZIO') ";
|
|
9377
|
+
}
|
|
9378
|
+
query += "order by p.name, s.floor, sd.name ";
|
|
9379
|
+
return query;
|
|
9380
|
+
}
|
|
9381
|
+
|
|
8590
9382
|
function getSitesSelectCombo(db_used,id_place, tipo_aula) {
|
|
8591
9383
|
var query = "";
|
|
8592
9384
|
if (db_used) {
|
|
@@ -8597,6 +9389,9 @@ function getSitesSelectCombo(db_used,id_place, tipo_aula) {
|
|
|
8597
9389
|
case 'MYSQL':
|
|
8598
9390
|
query = getSitesSelectComboMySQL(id_place, tipo_aula);
|
|
8599
9391
|
break;
|
|
9392
|
+
case 'MYSQL2':
|
|
9393
|
+
query = getSitesSelectComboMySQL2(id_place, tipo_aula);
|
|
9394
|
+
break;
|
|
8600
9395
|
}
|
|
8601
9396
|
}
|
|
8602
9397
|
return query;
|
|
@@ -8620,6 +9415,17 @@ function getSiteByIdMySQL(id_site) {
|
|
|
8620
9415
|
query += "and s.id = :id_site";
|
|
8621
9416
|
return query;
|
|
8622
9417
|
}
|
|
9418
|
+
|
|
9419
|
+
function getSiteByIdMySQL2(id_site) {
|
|
9420
|
+
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 ";
|
|
9421
|
+
query += "join site_destinations sd on sd.id_site = s.id ";
|
|
9422
|
+
query += "join places p on p.mark = s.id_place ";
|
|
9423
|
+
query += "where CURDATE() >= sd.date_start and CURDATE() <= sd.date_end ";
|
|
9424
|
+
query += "and s.id = " + id_site;
|
|
9425
|
+
return query;
|
|
9426
|
+
}
|
|
9427
|
+
|
|
9428
|
+
|
|
8623
9429
|
function getSiteById(db_used,id_site) {
|
|
8624
9430
|
var query = "";
|
|
8625
9431
|
if (db_used) {
|
|
@@ -8630,6 +9436,9 @@ function getSiteById(db_used,id_site) {
|
|
|
8630
9436
|
case 'MYSQL':
|
|
8631
9437
|
query = getSiteByIdMySQL(id_site);
|
|
8632
9438
|
break;
|
|
9439
|
+
case 'MYSQL2':
|
|
9440
|
+
query = getSiteByIdMySQL2(id_site);
|
|
9441
|
+
break;
|
|
8633
9442
|
}
|
|
8634
9443
|
}
|
|
8635
9444
|
return query;
|
|
@@ -8659,6 +9468,9 @@ function querySitesLab(db_used,id_place) {
|
|
|
8659
9468
|
case 'MYSQL':
|
|
8660
9469
|
query = querySitesLabMySQL(id_place);
|
|
8661
9470
|
break;
|
|
9471
|
+
case 'MYSQL2':
|
|
9472
|
+
query = querySitesLabSQLite(id_place);
|
|
9473
|
+
break;
|
|
8662
9474
|
}
|
|
8663
9475
|
}
|
|
8664
9476
|
return query;
|
|
@@ -8683,6 +9495,15 @@ function removeSiteBySetMySQL(id_device) {
|
|
|
8683
9495
|
query += ")";
|
|
8684
9496
|
return query;
|
|
8685
9497
|
}
|
|
9498
|
+
function removeSiteBySetMySQL2(id_device) {
|
|
9499
|
+
var query = "delete from device_site where id_device in ";
|
|
9500
|
+
query += "(select dt.id_relateddevice from device_set dt ";
|
|
9501
|
+
query += "left join device_site ds on dt.id_maindevice = ds.id_device ";
|
|
9502
|
+
query += "where dt.id_maindevice = " + id_device + " ";
|
|
9503
|
+
query += "and (CURDATE() >= ds.date_in and CURDATE() <= ds.date_out)";
|
|
9504
|
+
query += ")";
|
|
9505
|
+
return query;
|
|
9506
|
+
}
|
|
8686
9507
|
function removeSiteBySet(db_used, id_device) {
|
|
8687
9508
|
var query = "";
|
|
8688
9509
|
if (db_used) {
|
|
@@ -8693,6 +9514,9 @@ function removeSiteBySet(db_used, id_device) {
|
|
|
8693
9514
|
case 'MYSQL':
|
|
8694
9515
|
query = removeSiteBySetMySQL(id_device);
|
|
8695
9516
|
break;
|
|
9517
|
+
case 'MYSQL2':
|
|
9518
|
+
query = removeSiteBySetMySQL2(id_device);
|
|
9519
|
+
break;
|
|
8696
9520
|
}
|
|
8697
9521
|
}
|
|
8698
9522
|
return query;
|
|
@@ -8714,6 +9538,13 @@ function updateSiteBySetMySQL(id_device) {
|
|
|
8714
9538
|
query += "and CURDATE() >= date_in and CURDATE() <= date_out"
|
|
8715
9539
|
return query;
|
|
8716
9540
|
}
|
|
9541
|
+
function updateSiteBySetMySQL2(id_device) {
|
|
9542
|
+
var query = "update device_site set date_out = date('now','-1 day'), date_in = date('now','-1 day') where id_device in "
|
|
9543
|
+
query += "(select dt.id_relateddevice from device_set dt ";
|
|
9544
|
+
query += "where dt.id_maindevice = " + id_device + ") ";
|
|
9545
|
+
query += "and CURDATE() >= date_in and CURDATE() <= date_out"
|
|
9546
|
+
return query;
|
|
9547
|
+
}
|
|
8717
9548
|
function updateSiteBySet(db_used,id_device) {
|
|
8718
9549
|
var query = "";
|
|
8719
9550
|
if (db_used) {
|
|
@@ -8724,6 +9555,9 @@ function updateSiteBySet(db_used,id_device) {
|
|
|
8724
9555
|
case 'MYSQL':
|
|
8725
9556
|
query = updateSiteBySetMySQL(id_device);
|
|
8726
9557
|
break;
|
|
9558
|
+
case 'MYSQL2':
|
|
9559
|
+
query = updateSiteBySetMySQL2(id_device);
|
|
9560
|
+
break;
|
|
8727
9561
|
}
|
|
8728
9562
|
}
|
|
8729
9563
|
return query;
|
|
@@ -8746,6 +9580,14 @@ function insertSiteBySetMySQL(id_device) {
|
|
|
8746
9580
|
query += "where ds.id_maindevice = :id_device";
|
|
8747
9581
|
return query;
|
|
8748
9582
|
}
|
|
9583
|
+
function insertSiteBySetMySQL2(id_device) {
|
|
9584
|
+
var query = "insert into device_site (id_site, id_place, date_in, date_out, id_device) ";
|
|
9585
|
+
query += "select das.id_site, das.id_place, CURDATE(), '2999-12-31', d.id from devices d ";
|
|
9586
|
+
query += "join device_set ds on ds.id_relateddevice = d.id ";
|
|
9587
|
+
query += "join device_as_site das on das.id_device = ds.id_maindevice ";
|
|
9588
|
+
query += "where ds.id_maindevice = " + id_device;
|
|
9589
|
+
return query;
|
|
9590
|
+
}
|
|
8749
9591
|
function insertSiteBySet(db_used,id_device) {
|
|
8750
9592
|
var query = "";
|
|
8751
9593
|
if (db_used) {
|
|
@@ -8756,6 +9598,9 @@ function insertSiteBySet(db_used,id_device) {
|
|
|
8756
9598
|
case 'MYSQL':
|
|
8757
9599
|
query = insertSiteBySetMySQL(id_device);
|
|
8758
9600
|
break;
|
|
9601
|
+
case 'MYSQL2':
|
|
9602
|
+
query = insertSiteBySetMySQL2(id_device);
|
|
9603
|
+
break;
|
|
8759
9604
|
}
|
|
8760
9605
|
}
|
|
8761
9606
|
return query;
|