alsmanager_lib 1.0.29 → 1.0.31
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 +768 -121
- package/package.json +1 -1
package/lib/modules.js
CHANGED
|
@@ -276,7 +276,6 @@ function removeStorageMySQL(id_device, storage_obj) {
|
|
|
276
276
|
}
|
|
277
277
|
function removeStorage(db_used, id_device, storage_obj) {
|
|
278
278
|
var query = "";
|
|
279
|
-
var db_used = global.get("db_used");
|
|
280
279
|
if (db_used) {
|
|
281
280
|
switch (db_used) {
|
|
282
281
|
case 'SQLITE':
|
|
@@ -1367,7 +1366,6 @@ function queryDeviceByIdMySQL(id_device) {
|
|
|
1367
1366
|
}
|
|
1368
1367
|
function queryDeviceById(db_used, id_device) {
|
|
1369
1368
|
var query = "";
|
|
1370
|
-
var db_used = global.get("db_used");
|
|
1371
1369
|
if (db_used) {
|
|
1372
1370
|
switch (db_used) {
|
|
1373
1371
|
case 'SQLITE':
|
|
@@ -2836,6 +2834,21 @@ function queryCloseGestioneDeviceMySQL(id_gestione, id_device, id_gestore) {
|
|
|
2836
2834
|
query += "and date_start < CURDATE()";
|
|
2837
2835
|
return query;
|
|
2838
2836
|
}
|
|
2837
|
+
function queryCloseGestioneDevice(db_used,id_gestione) {
|
|
2838
|
+
var query = "";
|
|
2839
|
+
if (db_used) {
|
|
2840
|
+
switch (db_used) {
|
|
2841
|
+
case 'SQLITE':
|
|
2842
|
+
query = queryCloseGestioneDeviceSQLite(id_gestione);
|
|
2843
|
+
break;
|
|
2844
|
+
case 'MYSQL':
|
|
2845
|
+
query = queryCloseGestioneDeviceMySQL(id_gestione);
|
|
2846
|
+
break;
|
|
2847
|
+
}
|
|
2848
|
+
}
|
|
2849
|
+
return query;
|
|
2850
|
+
}
|
|
2851
|
+
|
|
2839
2852
|
|
|
2840
2853
|
|
|
2841
2854
|
function queryFornitoriGestoriCombo()
|
|
@@ -2861,6 +2874,21 @@ function queryInsertGestioneDeviceMySQL(id_device, id_gestore) {
|
|
|
2861
2874
|
return query;
|
|
2862
2875
|
}
|
|
2863
2876
|
|
|
2877
|
+
function queryInsertGestioneDevice(db_used, id_device, id_gestore) {
|
|
2878
|
+
var query = "";
|
|
2879
|
+
if (db_used) {
|
|
2880
|
+
switch (db_used) {
|
|
2881
|
+
case 'SQLITE':
|
|
2882
|
+
query = queryInsertGestioneDeviceSQLite(id_device, id_gestore);
|
|
2883
|
+
break;
|
|
2884
|
+
case 'MYSQL':
|
|
2885
|
+
query = queryInsertGestioneDeviceMySQL(id_device, id_gestore);
|
|
2886
|
+
break;
|
|
2887
|
+
}
|
|
2888
|
+
}
|
|
2889
|
+
return query;
|
|
2890
|
+
}
|
|
2891
|
+
|
|
2864
2892
|
function querySelectExistsGestioneDeviceByIdsMySQL(id_device, id_gestione, date_ref) {
|
|
2865
2893
|
|
|
2866
2894
|
}
|
|
@@ -2872,6 +2900,22 @@ function querySelectExistsGestioneDeviceByIdsSQLite(id_device, id_gestione, date
|
|
|
2872
2900
|
return query;
|
|
2873
2901
|
}
|
|
2874
2902
|
|
|
2903
|
+
|
|
2904
|
+
function querySelectExistsGestioneDeviceByIds(db_used,id_device, id_gestione) {
|
|
2905
|
+
var query = "";
|
|
2906
|
+
if (db_used) {
|
|
2907
|
+
switch (db_used) {
|
|
2908
|
+
case 'SQLITE':
|
|
2909
|
+
query = querySelectExistsGestioneDeviceByIdsSQLite(id_device, id_gestione);
|
|
2910
|
+
break;
|
|
2911
|
+
case 'MYSQL':
|
|
2912
|
+
query = querySelectExistsGestioneDeviceByIdsMySQL(id_device, id_gestione);
|
|
2913
|
+
break;
|
|
2914
|
+
}
|
|
2915
|
+
}
|
|
2916
|
+
return query;
|
|
2917
|
+
}
|
|
2918
|
+
|
|
2875
2919
|
function querySelectGestioniDeviceByIdDeviceSQLite(id_device, date_ref) {
|
|
2876
2920
|
var query = "select gf.name as Denominazione, contact_phone as Telefono, contact_email as Email from device_gestioni dg ";
|
|
2877
2921
|
query += "inner join gestori_fornitori gf on gf.id = dg.id_gestione ";
|
|
@@ -2913,7 +2957,20 @@ function querySelectGestioniDeviceByIdDeviceMySQL(id_device, date_ref) {
|
|
|
2913
2957
|
query += " order by date_start desc"
|
|
2914
2958
|
return query;
|
|
2915
2959
|
}
|
|
2916
|
-
|
|
2960
|
+
function querySelectGestioniDeviceByIdDevice(db_used,id_device, date_ref) {
|
|
2961
|
+
var query = "";
|
|
2962
|
+
if (db_used) {
|
|
2963
|
+
switch (db_used) {
|
|
2964
|
+
case 'SQLITE':
|
|
2965
|
+
query = querySelectGestioniDeviceByIdDeviceSQLite(id_device, date_ref);
|
|
2966
|
+
break;
|
|
2967
|
+
case 'MYSQL':
|
|
2968
|
+
query = querySelectGestioniDeviceByIdDeviceMySQL(id_device, date_ref);
|
|
2969
|
+
break;
|
|
2970
|
+
}
|
|
2971
|
+
}
|
|
2972
|
+
return query;
|
|
2973
|
+
}
|
|
2917
2974
|
|
|
2918
2975
|
function queryConsegneSQLite(data_da, data_a, data_filter) {
|
|
2919
2976
|
var query = "SELECT id, data_richiesta as Richiesta, data_consegna as Consegna, richiedente_adulto as Adulto, richiedente_alunno as Alunno, richiedente_genitore as Genitore, is_home as Casa, note as Note from consegne";
|
|
@@ -2975,7 +3032,20 @@ function queryConsegneMySQL(data_da, data_a, data_filter) {
|
|
|
2975
3032
|
|
|
2976
3033
|
return query;
|
|
2977
3034
|
}
|
|
2978
|
-
|
|
3035
|
+
function queryConsegne(db_used,data_da, data_a, data_filter) {
|
|
3036
|
+
var query = "";
|
|
3037
|
+
if (db_used) {
|
|
3038
|
+
switch (db_used) {
|
|
3039
|
+
case 'SQLITE':
|
|
3040
|
+
query = queryConsegneSQLite(data_da, data_a, data_filter);
|
|
3041
|
+
break;
|
|
3042
|
+
case 'MYSQL':
|
|
3043
|
+
query = queryConsegneMySQL(data_da, data_a, data_filter);
|
|
3044
|
+
break;
|
|
3045
|
+
}
|
|
3046
|
+
}
|
|
3047
|
+
return query;
|
|
3048
|
+
}
|
|
2979
3049
|
|
|
2980
3050
|
function queryConsegnaByIdSQLite(id_consegna) {
|
|
2981
3051
|
var query = "SELECT id, id_place, id_site, data_richiesta, data_consegna, data_rientro, ";
|
|
@@ -2994,7 +3064,20 @@ function queryConsegnaByIdMySQL(id_consegna) {
|
|
|
2994
3064
|
query += " where id = :id_consegna";
|
|
2995
3065
|
return query;
|
|
2996
3066
|
}
|
|
2997
|
-
|
|
3067
|
+
function queryConsegnaById(db_used,id_consegna) {
|
|
3068
|
+
var query = "";
|
|
3069
|
+
if (db_used) {
|
|
3070
|
+
switch (db_used) {
|
|
3071
|
+
case 'SQLITE':
|
|
3072
|
+
query = queryConsegnaByIdSQLite(id_consegna);
|
|
3073
|
+
break;
|
|
3074
|
+
case 'MYSQL':
|
|
3075
|
+
query = queryConsegnaByIdMySQL(id_consegna);
|
|
3076
|
+
break;
|
|
3077
|
+
}
|
|
3078
|
+
}
|
|
3079
|
+
return query;
|
|
3080
|
+
}
|
|
2998
3081
|
|
|
2999
3082
|
function queryConsegneByIdDeviceSQLite(id_device) {
|
|
3000
3083
|
var query = "select c.data_consegna as Consegna, ";
|
|
@@ -3028,6 +3111,21 @@ function queryConsegneByIdDeviceMySQL(id_device) {
|
|
|
3028
3111
|
return query;
|
|
3029
3112
|
}
|
|
3030
3113
|
|
|
3114
|
+
function queryConsegneByIdDevice(db_used, id_device) {
|
|
3115
|
+
var query = "";
|
|
3116
|
+
if (db_used) {
|
|
3117
|
+
switch (db_used) {
|
|
3118
|
+
case 'SQLITE':
|
|
3119
|
+
query = queryConsegneByIdDeviceSQLite(id_device);
|
|
3120
|
+
break;
|
|
3121
|
+
case 'MYSQL':
|
|
3122
|
+
query = queryConsegneByIdDeviceMySQL(id_device);
|
|
3123
|
+
break;
|
|
3124
|
+
}
|
|
3125
|
+
}
|
|
3126
|
+
return query;
|
|
3127
|
+
}
|
|
3128
|
+
|
|
3031
3129
|
|
|
3032
3130
|
function queryDeviceStatusCombo() {
|
|
3033
3131
|
var query = "SELECT id, name from status_description order by id";
|
|
@@ -3065,6 +3163,22 @@ function queryInterventoByIdMySQL(id_interv) {
|
|
|
3065
3163
|
return query;
|
|
3066
3164
|
}
|
|
3067
3165
|
|
|
3166
|
+
function queryInterventoById(db_used,id_interv) {
|
|
3167
|
+
var query = "";
|
|
3168
|
+
if (db_used) {
|
|
3169
|
+
switch (db_used) {
|
|
3170
|
+
case 'SQLITE':
|
|
3171
|
+
query = queryInterventoByIdSQLite(id_interv);
|
|
3172
|
+
break;
|
|
3173
|
+
case 'MYSQL':
|
|
3174
|
+
query = queryInterventoByIdSQLite(id_interv);
|
|
3175
|
+
break;
|
|
3176
|
+
}
|
|
3177
|
+
}
|
|
3178
|
+
return query;
|
|
3179
|
+
}
|
|
3180
|
+
|
|
3181
|
+
|
|
3068
3182
|
|
|
3069
3183
|
// Device intervento
|
|
3070
3184
|
function insertDeviceInterventoSQLite(id_intervento, id_device, note) {
|
|
@@ -3077,6 +3191,20 @@ function insertDeviceInterventoMySQL(id_intervento, id_device, note) {
|
|
|
3077
3191
|
query += "values (:id_intervento, :id_device, :note)";
|
|
3078
3192
|
return query;
|
|
3079
3193
|
}
|
|
3194
|
+
function insertDeviceIntervento(db_used,id_intervento, id_device, note) {
|
|
3195
|
+
var query = "";
|
|
3196
|
+
if (db_used) {
|
|
3197
|
+
switch (db_used) {
|
|
3198
|
+
case 'SQLITE':
|
|
3199
|
+
query = insertDeviceInterventoSQLite(id_intervento, id_device, note);
|
|
3200
|
+
break;
|
|
3201
|
+
case 'MYSQL':
|
|
3202
|
+
query = insertDeviceInterventoMySQL(id_intervento, id_device, note);
|
|
3203
|
+
break;
|
|
3204
|
+
}
|
|
3205
|
+
}
|
|
3206
|
+
return query;
|
|
3207
|
+
}
|
|
3080
3208
|
// Update
|
|
3081
3209
|
function updateDeviceInterventoSQLite(id_dev_interv, id_device, note) {
|
|
3082
3210
|
var query = "update device_interventi set ";
|
|
@@ -3092,6 +3220,20 @@ function updateDeviceInterventoMySQL(id_dev_interv, id_device, note) {
|
|
|
3092
3220
|
query += "where id = :id_dev_interv";
|
|
3093
3221
|
return query;
|
|
3094
3222
|
}
|
|
3223
|
+
function updateDeviceIntervento(db_used, id_dev_interv, id_device, note) {
|
|
3224
|
+
var query = "";
|
|
3225
|
+
if (db_used) {
|
|
3226
|
+
switch (db_used) {
|
|
3227
|
+
case 'SQLITE':
|
|
3228
|
+
query = updateDeviceInterventoSQLite(id_dev_interv, id_device, note);
|
|
3229
|
+
break;
|
|
3230
|
+
case 'MYSQL':
|
|
3231
|
+
query = updateDeviceInterventoMySQL(id_dev_interv, id_device, note);
|
|
3232
|
+
break;
|
|
3233
|
+
}
|
|
3234
|
+
}
|
|
3235
|
+
return query;
|
|
3236
|
+
}
|
|
3095
3237
|
// Remove
|
|
3096
3238
|
function removeDeviceInterventoSQLite(id_dev_interv) {
|
|
3097
3239
|
var query = "delete from device_interventi ";
|
|
@@ -3103,6 +3245,20 @@ function removeDeviceInterventoMySQL(id_intervento, id_device, note) {
|
|
|
3103
3245
|
query += "values (:id_intervento, :id_device, :note)";
|
|
3104
3246
|
return query;
|
|
3105
3247
|
}
|
|
3248
|
+
function removeDeviceIntervento(db_used, id_intervento, id_device, note) {
|
|
3249
|
+
var query = "";
|
|
3250
|
+
if (db_used) {
|
|
3251
|
+
switch (db_used) {
|
|
3252
|
+
case 'SQLITE':
|
|
3253
|
+
query = insertDeviceInterventoSQLite(id_intervento, id_device, note);
|
|
3254
|
+
break;
|
|
3255
|
+
case 'MYSQL':
|
|
3256
|
+
query = insertDeviceInterventoMySQL(id_intervento, id_device, note);
|
|
3257
|
+
break;
|
|
3258
|
+
}
|
|
3259
|
+
}
|
|
3260
|
+
return query;
|
|
3261
|
+
}
|
|
3106
3262
|
//End device intervento
|
|
3107
3263
|
|
|
3108
3264
|
|
|
@@ -3234,7 +3390,20 @@ function insertConsegnaMySQL(consegnaObj) {
|
|
|
3234
3390
|
return query;
|
|
3235
3391
|
}
|
|
3236
3392
|
|
|
3237
|
-
|
|
3393
|
+
function insertConsegna(db_used, consegna){
|
|
3394
|
+
var query = "";
|
|
3395
|
+
if (db_used) {
|
|
3396
|
+
switch (db_used) {
|
|
3397
|
+
case 'SQLITE':
|
|
3398
|
+
query = insertConsegnaSQLite(consegna);
|
|
3399
|
+
break;
|
|
3400
|
+
case 'MYSQL':
|
|
3401
|
+
query = insertConsegnaMySQL(consegna);
|
|
3402
|
+
break;
|
|
3403
|
+
}
|
|
3404
|
+
}
|
|
3405
|
+
return query;
|
|
3406
|
+
}
|
|
3238
3407
|
|
|
3239
3408
|
function updateConsegnaSQLite(consegna) {
|
|
3240
3409
|
var query = "";
|
|
@@ -3292,6 +3461,20 @@ function updateConsegnaMySQL(consegna) {
|
|
|
3292
3461
|
return query;
|
|
3293
3462
|
}
|
|
3294
3463
|
|
|
3464
|
+
function updateConsegna(db_used, consegna) {
|
|
3465
|
+
var query = "";
|
|
3466
|
+
if (db_used) {
|
|
3467
|
+
switch (db_used) {
|
|
3468
|
+
case 'SQLITE':
|
|
3469
|
+
query = updateConsegnaSQLite(consegna);
|
|
3470
|
+
break;
|
|
3471
|
+
case 'MYSQL':
|
|
3472
|
+
query = updateConsegnaMySQL(consegna);
|
|
3473
|
+
break;
|
|
3474
|
+
}
|
|
3475
|
+
}
|
|
3476
|
+
return query;
|
|
3477
|
+
}
|
|
3295
3478
|
|
|
3296
3479
|
function removeConsegnaSQLite(id_consegna) {
|
|
3297
3480
|
var query = "update consegne";
|
|
@@ -3307,6 +3490,20 @@ function removeConsegnaMySQL(id_consegna) {
|
|
|
3307
3490
|
return query;
|
|
3308
3491
|
}
|
|
3309
3492
|
|
|
3493
|
+
function removeConsegna(db_used,id_consegna) {
|
|
3494
|
+
var query = "";
|
|
3495
|
+
if (db_used) {
|
|
3496
|
+
switch (db_used) {
|
|
3497
|
+
case 'SQLITE':
|
|
3498
|
+
query = removeConsegnaSQLite(id_consegna);
|
|
3499
|
+
break;
|
|
3500
|
+
case 'MYSQL':
|
|
3501
|
+
query = removeConsegnaMySQL(id_consegna);
|
|
3502
|
+
break;
|
|
3503
|
+
}
|
|
3504
|
+
}
|
|
3505
|
+
return query;
|
|
3506
|
+
}
|
|
3310
3507
|
|
|
3311
3508
|
function queryLastConsegnaIdSQLite() {
|
|
3312
3509
|
return "select seq as id from sqlite_sequence where name = 'consegne'";
|
|
@@ -3314,7 +3511,20 @@ function queryLastConsegnaIdSQLite() {
|
|
|
3314
3511
|
function queryLastConsegnaIdMySQL() {
|
|
3315
3512
|
return "SELECT AUTO_INCREMENT - 1 as CurrentId FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA = 'ALS' AND TABLE_NAME = 'consegne'";
|
|
3316
3513
|
}
|
|
3317
|
-
|
|
3514
|
+
function queryLastConsegnaId(db_used) {
|
|
3515
|
+
var query = "";
|
|
3516
|
+
if (db_used) {
|
|
3517
|
+
switch (db_used) {
|
|
3518
|
+
case 'SQLITE':
|
|
3519
|
+
query = queryLastConsegnaIdSQLite();
|
|
3520
|
+
break;
|
|
3521
|
+
case 'MYSQL':
|
|
3522
|
+
query = queryLastConsegnaIdMySQL();
|
|
3523
|
+
break;
|
|
3524
|
+
}
|
|
3525
|
+
}
|
|
3526
|
+
return query;
|
|
3527
|
+
}
|
|
3318
3528
|
|
|
3319
3529
|
//get connection types
|
|
3320
3530
|
function getConnectionTypesSQLite() {
|
|
@@ -3325,6 +3535,20 @@ function getConnectionTypesMySQL() {
|
|
|
3325
3535
|
var query = "select id, conn_type from connection_types";
|
|
3326
3536
|
return query;
|
|
3327
3537
|
}
|
|
3538
|
+
function getConnectionTypes(db_used) {
|
|
3539
|
+
var query = "";
|
|
3540
|
+
if (db_used) {
|
|
3541
|
+
switch (db_used) {
|
|
3542
|
+
case 'SQLITE':
|
|
3543
|
+
query = getConnectionTypesSQLite();
|
|
3544
|
+
break;
|
|
3545
|
+
case 'MYSQL':
|
|
3546
|
+
query = getConnectionTypesMySQL();
|
|
3547
|
+
break;
|
|
3548
|
+
}
|
|
3549
|
+
}
|
|
3550
|
+
return query;
|
|
3551
|
+
}
|
|
3328
3552
|
//end get connection types
|
|
3329
3553
|
//get connection protocols
|
|
3330
3554
|
function getConnectionProtocolsSQLite() {
|
|
@@ -3335,6 +3559,20 @@ function getConnectionProtocolsMySQL() {
|
|
|
3335
3559
|
var query = "select id, name from connection_protocols";
|
|
3336
3560
|
return query;
|
|
3337
3561
|
}
|
|
3562
|
+
function getConnectionProtocols(db_used) {
|
|
3563
|
+
var query = "";
|
|
3564
|
+
if (db_used) {
|
|
3565
|
+
switch (db_used) {
|
|
3566
|
+
case 'SQLITE':
|
|
3567
|
+
query = getConnectionProtocolsSQLite();
|
|
3568
|
+
break;
|
|
3569
|
+
case 'MYSQL':
|
|
3570
|
+
query = getConnectionProtocolsMySQL();
|
|
3571
|
+
break;
|
|
3572
|
+
}
|
|
3573
|
+
}
|
|
3574
|
+
return query;
|
|
3575
|
+
}
|
|
3338
3576
|
//end get connection protocols
|
|
3339
3577
|
//Get Storage types
|
|
3340
3578
|
function getStorageTypesSQLite() {
|
|
@@ -3345,6 +3583,20 @@ function getStorageTypesMySQL() {
|
|
|
3345
3583
|
var query = "select id, name from storage_types order by exp_order";
|
|
3346
3584
|
return query;
|
|
3347
3585
|
}
|
|
3586
|
+
function getStorageTypes(db_used) {
|
|
3587
|
+
var query = "";
|
|
3588
|
+
if (db_used) {
|
|
3589
|
+
switch (db_used) {
|
|
3590
|
+
case 'SQLITE':
|
|
3591
|
+
query = getStorageTypesSQLite();
|
|
3592
|
+
break;
|
|
3593
|
+
case 'MYSQL':
|
|
3594
|
+
query = getStorageTypesMySQL();
|
|
3595
|
+
break;
|
|
3596
|
+
}
|
|
3597
|
+
}
|
|
3598
|
+
return query;
|
|
3599
|
+
}
|
|
3348
3600
|
//end get storage types
|
|
3349
3601
|
|
|
3350
3602
|
|
|
@@ -3363,6 +3615,20 @@ function getAdapterTypesMySQL() {
|
|
|
3363
3615
|
|
|
3364
3616
|
return query;
|
|
3365
3617
|
}
|
|
3618
|
+
function getAdapterTypes(db_used) {
|
|
3619
|
+
var query = "";
|
|
3620
|
+
if (db_used) {
|
|
3621
|
+
switch (db_used) {
|
|
3622
|
+
case 'SQLITE':
|
|
3623
|
+
query = getAdapterTypesSQLite();
|
|
3624
|
+
break;
|
|
3625
|
+
case 'MYSQL':
|
|
3626
|
+
query = getAdapterTypesMySQL();
|
|
3627
|
+
break;
|
|
3628
|
+
}
|
|
3629
|
+
}
|
|
3630
|
+
return query;
|
|
3631
|
+
}
|
|
3366
3632
|
//end get adapter types
|
|
3367
3633
|
|
|
3368
3634
|
function getLaboratorioByIdSiteSQLite(id_site, id_place) {
|
|
@@ -3419,6 +3685,20 @@ function getLaboratorioByIdSiteMySQL(id_site, id_place) {
|
|
|
3419
3685
|
query += "order by pl.Bancata asc, pl.num_pos desc ";
|
|
3420
3686
|
return query;
|
|
3421
3687
|
}
|
|
3688
|
+
function getLaboratorioByIdSite(db_used,id_site, id_place) {
|
|
3689
|
+
var query = "";
|
|
3690
|
+
if (db_used) {
|
|
3691
|
+
switch (db_used) {
|
|
3692
|
+
case 'SQLITE':
|
|
3693
|
+
query = getLaboratorioByIdSiteSQLite(id_site, id_place);
|
|
3694
|
+
break;
|
|
3695
|
+
case 'MYSQL':
|
|
3696
|
+
query = getLaboratorioByIdSiteMySQL(id_site, id_place);
|
|
3697
|
+
break;
|
|
3698
|
+
}
|
|
3699
|
+
}
|
|
3700
|
+
return query;
|
|
3701
|
+
}
|
|
3422
3702
|
// Manage categories
|
|
3423
3703
|
function getCategories() {
|
|
3424
3704
|
var query = "select DISTINCT categoria from categorie_device ";
|
|
@@ -3435,6 +3715,22 @@ function assignCategoryFromDBMySQL(dev_type) {
|
|
|
3435
3715
|
query += "where tipo = :dev_type";
|
|
3436
3716
|
return query;
|
|
3437
3717
|
}
|
|
3718
|
+
|
|
3719
|
+
function assignCategoryFromDB(db_used,dev_type) {
|
|
3720
|
+
var query = "";
|
|
3721
|
+
if (db_used) {
|
|
3722
|
+
switch (db_used) {
|
|
3723
|
+
case 'SQLITE':
|
|
3724
|
+
query = assignCategoryFromDBSQLite(dev_type);
|
|
3725
|
+
break;
|
|
3726
|
+
case 'MYSQL':
|
|
3727
|
+
query = assignCategoryFromDBMySQL(dev_type);
|
|
3728
|
+
break;
|
|
3729
|
+
}
|
|
3730
|
+
}
|
|
3731
|
+
return query;
|
|
3732
|
+
}
|
|
3733
|
+
|
|
3438
3734
|
// end manage categories
|
|
3439
3735
|
function getBeniConsumoByIdDeviceSQLite(id_device) {
|
|
3440
3736
|
var query = "select Tipo, Marca, Modello from beniconsumo bc ";
|
|
@@ -3452,6 +3748,21 @@ function getBeniConsumoByIdDeviceMySQL(id_device) {
|
|
|
3452
3748
|
return query;
|
|
3453
3749
|
}
|
|
3454
3750
|
|
|
3751
|
+
function getBeniConsumoByIdDevice(db_used,id_device) {
|
|
3752
|
+
var query = "";
|
|
3753
|
+
if (db_used) {
|
|
3754
|
+
switch (db_used) {
|
|
3755
|
+
case 'SQLITE':
|
|
3756
|
+
query = getBeniConsumoByIdDeviceSQLite(id_device);
|
|
3757
|
+
break;
|
|
3758
|
+
case 'MYSQL':
|
|
3759
|
+
query = getBeniConsumoByIdDeviceMySQL(id_device);
|
|
3760
|
+
break;
|
|
3761
|
+
}
|
|
3762
|
+
}
|
|
3763
|
+
return query;
|
|
3764
|
+
}
|
|
3765
|
+
|
|
3455
3766
|
//Manage dismissioni
|
|
3456
3767
|
function selectDismissioniByYearSQLite(sel_year) {
|
|
3457
3768
|
var query = "select id, data, descrizione from dismissioni ";
|
|
@@ -3528,6 +3839,7 @@ function insertDismissioneMySQL(data, descrizione, is_closed) {
|
|
|
3528
3839
|
return query;
|
|
3529
3840
|
}
|
|
3530
3841
|
|
|
3842
|
+
|
|
3531
3843
|
function insertDismissione(db_used, data, descrizione, is_closed) {
|
|
3532
3844
|
var query = "";
|
|
3533
3845
|
if (db_used) {
|
|
@@ -4209,6 +4521,20 @@ function getCategoriesByIdDeviceMySQL(id_device) {
|
|
|
4209
4521
|
query += "where d.id = :id_device";
|
|
4210
4522
|
return query;
|
|
4211
4523
|
}
|
|
4524
|
+
function getCategoriesByIdDevice(db_used,id_device) {
|
|
4525
|
+
var query = "";
|
|
4526
|
+
if (db_used) {
|
|
4527
|
+
switch (db_used) {
|
|
4528
|
+
case 'SQLITE':
|
|
4529
|
+
query = getCategoriesByIdDeviceSQLite(id_device);
|
|
4530
|
+
break;
|
|
4531
|
+
case 'MYSQL':
|
|
4532
|
+
query = getCategoriesByIdDeviceMySQL(id_device);
|
|
4533
|
+
break;
|
|
4534
|
+
}
|
|
4535
|
+
}
|
|
4536
|
+
return query;
|
|
4537
|
+
}
|
|
4212
4538
|
//End Get Categories by IdDevice
|
|
4213
4539
|
//Get details by type
|
|
4214
4540
|
function queryDetailsByIdDeviceSQLite(id_device) {
|
|
@@ -4223,7 +4549,20 @@ function queryDetailsByIdDeviceMySQL(id_device) {
|
|
|
4223
4549
|
query += "where d.id = :id_device";
|
|
4224
4550
|
return query;
|
|
4225
4551
|
}
|
|
4226
|
-
|
|
4552
|
+
function queryDetailsByIdDevice(db_used,id_device) {
|
|
4553
|
+
var query = "";
|
|
4554
|
+
if (db_used) {
|
|
4555
|
+
switch (db_used) {
|
|
4556
|
+
case 'SQLITE':
|
|
4557
|
+
query = queryDetailsByIdDeviceSQLite(id_device);
|
|
4558
|
+
break;
|
|
4559
|
+
case 'MYSQL':
|
|
4560
|
+
query = queryDetailsByIdDeviceMySQL(id_device);
|
|
4561
|
+
break;
|
|
4562
|
+
}
|
|
4563
|
+
}
|
|
4564
|
+
return query;
|
|
4565
|
+
}
|
|
4227
4566
|
//End Get details by type
|
|
4228
4567
|
// Define getConnectionSetById
|
|
4229
4568
|
function getConnectionSetByIdSQLite(id_conn_set) {
|
|
@@ -4233,6 +4572,21 @@ function getConnectionSetByIdSQLite(id_conn_set) {
|
|
|
4233
4572
|
}
|
|
4234
4573
|
function getConnectionSetByIdMySQL(id_conn_set) {
|
|
4235
4574
|
|
|
4575
|
+
}
|
|
4576
|
+
function getConnectionSetById(db_used, id_conn_set) {
|
|
4577
|
+
var query = "";
|
|
4578
|
+
if (db_used) {
|
|
4579
|
+
switch (db_used) {
|
|
4580
|
+
case 'SQLITE':
|
|
4581
|
+
query = getConnectionSetByIdSQLite(id_conn_set);
|
|
4582
|
+
break;
|
|
4583
|
+
case 'MYSQL':
|
|
4584
|
+
query = getConnectionSetByIdMySQL(id_conn_set);
|
|
4585
|
+
break;
|
|
4586
|
+
}
|
|
4587
|
+
}
|
|
4588
|
+
return query;
|
|
4589
|
+
|
|
4236
4590
|
}
|
|
4237
4591
|
// End define getConnectionSetById
|
|
4238
4592
|
// Define getConnectionByIdSet
|
|
@@ -4263,6 +4617,20 @@ function getConnectionByIdSetMySQL(id_set) {
|
|
|
4263
4617
|
query += "left join connection_types ac2 on at.adapt_type_out = ac2.id ";
|
|
4264
4618
|
query += "where id_set = :id_set";
|
|
4265
4619
|
}
|
|
4620
|
+
function getConnectionByIdSet(db_used, id_set) {
|
|
4621
|
+
var query = "";
|
|
4622
|
+
if (db_used) {
|
|
4623
|
+
switch (db_used) {
|
|
4624
|
+
case 'SQLITE':
|
|
4625
|
+
query = getConnectionByIdSetSQLite(id_set);
|
|
4626
|
+
break;
|
|
4627
|
+
case 'MYSQL':
|
|
4628
|
+
query = getConnectionByIdSetMySQL(id_set);
|
|
4629
|
+
break;
|
|
4630
|
+
}
|
|
4631
|
+
}
|
|
4632
|
+
return query;
|
|
4633
|
+
}
|
|
4266
4634
|
//End Define getConnectionByIdSet
|
|
4267
4635
|
// Define updateConnectionSet
|
|
4268
4636
|
function updateConnectionSetSQLite(id_set, id_conn_set, id_conn, verse, id_adapter) {
|
|
@@ -4284,6 +4652,20 @@ function updateConnectionSetSQLite(id_set, id_conn_set, id_conn, verse, id_adapt
|
|
|
4284
4652
|
}
|
|
4285
4653
|
function updateConnectionSetMySQL(id_set, id_conn_set, id_conn, verse, id_adapter) {
|
|
4286
4654
|
|
|
4655
|
+
}
|
|
4656
|
+
function updateConnectionSet(db_used, id_set, id_conn_set, id_conn, verse, id_adapter) {
|
|
4657
|
+
var query = "";
|
|
4658
|
+
if (db_used) {
|
|
4659
|
+
switch (db_used) {
|
|
4660
|
+
case 'SQLITE':
|
|
4661
|
+
query = updateConnectionSetSQLite(id_set, id_conn_set, id_conn, verse, id_adapter);
|
|
4662
|
+
break;
|
|
4663
|
+
case 'MYSQL':
|
|
4664
|
+
query = updateConnectionSetMySQL(id_set, id_conn_set, id_conn, verse, id_adapter);
|
|
4665
|
+
break;
|
|
4666
|
+
}
|
|
4667
|
+
}
|
|
4668
|
+
return query;
|
|
4287
4669
|
}
|
|
4288
4670
|
// end define updateConnectionSet
|
|
4289
4671
|
// Define insertConnectionSet
|
|
@@ -4294,9 +4676,23 @@ function insertConnectionSetSQLite(id_set, id_conn, verse, id_adapter) {
|
|
|
4294
4676
|
query += id_adapter + ", ";
|
|
4295
4677
|
query += "'" + verse + "')";
|
|
4296
4678
|
return query;
|
|
4297
|
-
}
|
|
4298
|
-
function insertConnectionSetMySQL(id_set, id_conn, verse, id_adapter) {
|
|
4299
|
-
|
|
4679
|
+
}
|
|
4680
|
+
function insertConnectionSetMySQL(id_set, id_conn, verse, id_adapter) {
|
|
4681
|
+
|
|
4682
|
+
}
|
|
4683
|
+
function insertConnectionSet(db_used, id_set, id_conn, verse, id_adapter) {
|
|
4684
|
+
var query = "";
|
|
4685
|
+
if (db_used) {
|
|
4686
|
+
switch (db_used) {
|
|
4687
|
+
case 'SQLITE':
|
|
4688
|
+
query = insertConnectionSetSQLite(id_set, id_conn, verse, id_adapter);
|
|
4689
|
+
break;
|
|
4690
|
+
case 'MYSQL':
|
|
4691
|
+
query = insertConnectionSetMySQL(id_set, id_conn, verse, id_adapter);
|
|
4692
|
+
break;
|
|
4693
|
+
}
|
|
4694
|
+
}
|
|
4695
|
+
return query;
|
|
4300
4696
|
}
|
|
4301
4697
|
// end define insertConnectionSet
|
|
4302
4698
|
// Define removeConnectionSet
|
|
@@ -4309,6 +4705,21 @@ function removeConnectionSetSQLite(id_set, id_conn_set) {
|
|
|
4309
4705
|
function removeConnectionSetMySQL(id_set, id_conn_set, id_conn, id_adapter, verse) {
|
|
4310
4706
|
|
|
4311
4707
|
}
|
|
4708
|
+
function removeConnectionSet(db_used, id_set, id_conn_set) {
|
|
4709
|
+
var query = "";
|
|
4710
|
+
if (db_used) {
|
|
4711
|
+
switch (db_used) {
|
|
4712
|
+
case 'SQLITE':
|
|
4713
|
+
query = removeConnectionSetSQLite(id_set, id_conn_set);
|
|
4714
|
+
break;
|
|
4715
|
+
case 'MYSQL':
|
|
4716
|
+
query = removeConnectionSetMySQL(id_set, id_conn_set);
|
|
4717
|
+
break;
|
|
4718
|
+
}
|
|
4719
|
+
}
|
|
4720
|
+
return query;
|
|
4721
|
+
}
|
|
4722
|
+
|
|
4312
4723
|
// end define removeConnectionSet
|
|
4313
4724
|
// Code added here will be run once
|
|
4314
4725
|
// whenever the node is started.
|
|
@@ -4340,6 +4751,20 @@ function getBeneConsumoUsatoMySQL(id_device, id_bene) {
|
|
|
4340
4751
|
query += "where db.id_bene = :id_bene and db.id_device = :id_device";
|
|
4341
4752
|
return query;
|
|
4342
4753
|
}
|
|
4754
|
+
function getBeneConsumoUsato(db_used, id_device, id_bene) {
|
|
4755
|
+
var query = "";
|
|
4756
|
+
if (db_used) {
|
|
4757
|
+
switch (db_used) {
|
|
4758
|
+
case 'SQLITE':
|
|
4759
|
+
query = removeConnectionSetSQLite(id_device, id_bene);
|
|
4760
|
+
break;
|
|
4761
|
+
case 'MYSQL':
|
|
4762
|
+
query = removeConnectionSetMySQL(id_device, id_bene);
|
|
4763
|
+
break;
|
|
4764
|
+
}
|
|
4765
|
+
}
|
|
4766
|
+
return query;
|
|
4767
|
+
}
|
|
4343
4768
|
//
|
|
4344
4769
|
function getBeneConsumoByIdSQLite(id_bene) {
|
|
4345
4770
|
var query = "select id, tipo, marca, modello, quantitativo from beniconsumo ";
|
|
@@ -4351,6 +4776,20 @@ function getBeneConsumoByIdMySQL(id_bene) {
|
|
|
4351
4776
|
query += "where id :id_bene";
|
|
4352
4777
|
return query;
|
|
4353
4778
|
}
|
|
4779
|
+
function getBeneConsumoById(db_used, id_bene) {
|
|
4780
|
+
var query = "";
|
|
4781
|
+
if (db_used) {
|
|
4782
|
+
switch (db_used) {
|
|
4783
|
+
case 'SQLITE':
|
|
4784
|
+
query = getBeneConsumoByIdSQLite(id_bene);
|
|
4785
|
+
break;
|
|
4786
|
+
case 'MYSQL':
|
|
4787
|
+
query = getBeneConsumoByIdMySQL(id_bene);
|
|
4788
|
+
break;
|
|
4789
|
+
}
|
|
4790
|
+
}
|
|
4791
|
+
return query;
|
|
4792
|
+
}
|
|
4354
4793
|
//
|
|
4355
4794
|
function insertBeneConsumoAbbinatoSQLite(id_device, id_bene, numero) {
|
|
4356
4795
|
var query = "insert into device_beniconsumo (id_device, id_bene, numero) values ";
|
|
@@ -4362,6 +4801,20 @@ function insertBeneConsumoAbbinatoMySQL(id_device, id_bene, numero) {
|
|
|
4362
4801
|
query += "(:id_device, :id_bene, :numero)";
|
|
4363
4802
|
return query;
|
|
4364
4803
|
}
|
|
4804
|
+
function insertBeneConsumoAbbinato(db_used,id_device, id_bene, numero) {
|
|
4805
|
+
var query = "";
|
|
4806
|
+
if (db_used) {
|
|
4807
|
+
switch (db_used) {
|
|
4808
|
+
case 'SQLITE':
|
|
4809
|
+
query = insertBeneConsumoAbbinatoSQLite(id_device, id_bene, numero);
|
|
4810
|
+
break;
|
|
4811
|
+
case 'MYSQL':
|
|
4812
|
+
query = insertBeneConsumoAbbinatoMySQL(id_device, id_bene, numero);
|
|
4813
|
+
break;
|
|
4814
|
+
}
|
|
4815
|
+
}
|
|
4816
|
+
return query;
|
|
4817
|
+
}
|
|
4365
4818
|
//
|
|
4366
4819
|
function updateBeneConsumoAbbinatoSQLite(id_device, id_bene, numero) {
|
|
4367
4820
|
var query = "update device_beniconsumo ";
|
|
@@ -4375,6 +4828,20 @@ function updateBeneConsumoAbbinatoMySQL(id_device, id_bene, numero) {
|
|
|
4375
4828
|
query += "where id_device = :id_device and id_bene = :id_bene";
|
|
4376
4829
|
return query;
|
|
4377
4830
|
}
|
|
4831
|
+
function updateBeneConsumoAbbinato(db_used,id_device, id_bene, numero) {
|
|
4832
|
+
var query = "";
|
|
4833
|
+
if (db_used) {
|
|
4834
|
+
switch (db_used) {
|
|
4835
|
+
case 'SQLITE':
|
|
4836
|
+
query = updateBeneConsumoAbbinatoSQLite(id_device, id_bene, numero);
|
|
4837
|
+
break;
|
|
4838
|
+
case 'MYSQL':
|
|
4839
|
+
query = updateBeneConsumoAbbinatoMySQL(id_device, id_bene, numero);
|
|
4840
|
+
break;
|
|
4841
|
+
}
|
|
4842
|
+
}
|
|
4843
|
+
return query;
|
|
4844
|
+
}
|
|
4378
4845
|
//
|
|
4379
4846
|
function existBeneAbbinatoSQLite(id_device, id_bene) {
|
|
4380
4847
|
var query = "select count(id_device) as numero from device_beniconsumo ";
|
|
@@ -4386,6 +4853,20 @@ function existBeneAbbinatoMySQL(id_device, id_bene) {
|
|
|
4386
4853
|
query += "where id_device :id_device and id_bene = :id_bene";
|
|
4387
4854
|
return query;
|
|
4388
4855
|
}
|
|
4856
|
+
function existBeneAbbinato(db_used, id_device, id_bene) {
|
|
4857
|
+
var query = "";
|
|
4858
|
+
if (db_used) {
|
|
4859
|
+
switch (db_used) {
|
|
4860
|
+
case 'SQLITE':
|
|
4861
|
+
query = existBeneAbbinatoSQLite(id_device, id_bene);
|
|
4862
|
+
break;
|
|
4863
|
+
case 'MYSQL':
|
|
4864
|
+
query = existBeneAbbinatoMySQL(id_device, id_bene);
|
|
4865
|
+
break;
|
|
4866
|
+
}
|
|
4867
|
+
}
|
|
4868
|
+
return query;
|
|
4869
|
+
}
|
|
4389
4870
|
// end of source
|
|
4390
4871
|
|
|
4391
4872
|
|
|
@@ -4745,7 +5226,20 @@ function removeDeviceSiteSQLite(id_site, id_place, id_device) {
|
|
|
4745
5226
|
function removeDeviceSiteMySQL(id_site, id_place, id_device) {
|
|
4746
5227
|
|
|
4747
5228
|
}
|
|
4748
|
-
|
|
5229
|
+
function removeDeviceSite(db_used,id_site, id_place, id_device) {
|
|
5230
|
+
var query = "";
|
|
5231
|
+
if (db_used) {
|
|
5232
|
+
switch (db_used) {
|
|
5233
|
+
case 'SQLITE':
|
|
5234
|
+
query = removeDeviceSiteSQLite(id_site, id_place, id_device);
|
|
5235
|
+
break;
|
|
5236
|
+
case 'MYSQL':
|
|
5237
|
+
query = removeDeviceSiteMySQL(id_site, id_place, id_device);
|
|
5238
|
+
break;
|
|
5239
|
+
}
|
|
5240
|
+
}
|
|
5241
|
+
return query;
|
|
5242
|
+
}
|
|
4749
5243
|
|
|
4750
5244
|
function updateDeviceSiteSQLite(id_device) {
|
|
4751
5245
|
var query = "update device_site set date_out = date('now','-1 day') ";
|
|
@@ -4757,6 +5251,20 @@ function updateDeviceSiteMySQL(id_device) {
|
|
|
4757
5251
|
query += "where id_device = :id_device and date_in = (select max(date_in) from device_site where id_device = :id_device)";
|
|
4758
5252
|
return query;
|
|
4759
5253
|
}
|
|
5254
|
+
function updateDeviceSite(db_used,id_device) {
|
|
5255
|
+
var query = "";
|
|
5256
|
+
if (db_used) {
|
|
5257
|
+
switch (db_used) {
|
|
5258
|
+
case 'SQLITE':
|
|
5259
|
+
query = updateDeviceSiteSQLite(id_device);
|
|
5260
|
+
break;
|
|
5261
|
+
case 'MYSQL':
|
|
5262
|
+
query = updateDeviceSiteMySQL(id_device);
|
|
5263
|
+
break;
|
|
5264
|
+
}
|
|
5265
|
+
}
|
|
5266
|
+
return query;
|
|
5267
|
+
}
|
|
4760
5268
|
// end manage updateDevicesSite
|
|
4761
5269
|
// Manage insertDeviceSite
|
|
4762
5270
|
function insertDeviceSiteSQLite(id_device, id_place, id_site, start_date) {
|
|
@@ -4791,6 +5299,20 @@ function insertDeviceSiteMySQL(id_device, id_place, id_site, start_date) {
|
|
|
4791
5299
|
query += ")";
|
|
4792
5300
|
return query;
|
|
4793
5301
|
}
|
|
5302
|
+
function insertDeviceSite(db_used,id_device, id_place, id_site, start_date) {
|
|
5303
|
+
var query = "";
|
|
5304
|
+
if (db_used) {
|
|
5305
|
+
switch (db_used) {
|
|
5306
|
+
case 'SQLITE':
|
|
5307
|
+
query = insertDeviceSiteSQLite(id_device, id_place, id_site, start_date);
|
|
5308
|
+
break;
|
|
5309
|
+
case 'MYSQL':
|
|
5310
|
+
query = insertDeviceSiteMySQL(id_device, id_place, id_site, start_date);
|
|
5311
|
+
break;
|
|
5312
|
+
}
|
|
5313
|
+
}
|
|
5314
|
+
return query;
|
|
5315
|
+
}
|
|
4794
5316
|
// end manage updateDevicesSite
|
|
4795
5317
|
//Get Sites for Combo
|
|
4796
5318
|
function getSitesSelectComboSQLite(id_place, tipo_aula) {
|
|
@@ -4834,7 +5356,20 @@ function getSitesSelectComboMySQL(id_place, tipo_aula) {
|
|
|
4834
5356
|
query += "order by p.name, s.floor, sd.name ";
|
|
4835
5357
|
return query;
|
|
4836
5358
|
}
|
|
4837
|
-
|
|
5359
|
+
function getSitesSelectCombo(db_used,id_place, tipo_aula) {
|
|
5360
|
+
var query = "";
|
|
5361
|
+
if (db_used) {
|
|
5362
|
+
switch (db_used) {
|
|
5363
|
+
case 'SQLITE':
|
|
5364
|
+
query = getSitesSelectComboSQLite(id_place, tipo_aula);
|
|
5365
|
+
break;
|
|
5366
|
+
case 'MYSQL':
|
|
5367
|
+
query = getSitesSelectComboMySQL(id_place, tipo_aula);
|
|
5368
|
+
break;
|
|
5369
|
+
}
|
|
5370
|
+
}
|
|
5371
|
+
return query;
|
|
5372
|
+
}
|
|
4838
5373
|
//End get sites for combo
|
|
4839
5374
|
//Get Sites by Id
|
|
4840
5375
|
function getSiteByIdSQLite(id_site) {
|
|
@@ -4854,7 +5389,20 @@ function getSiteByIdMySQL(id_site) {
|
|
|
4854
5389
|
query += "and s.id = :id_site";
|
|
4855
5390
|
return query;
|
|
4856
5391
|
}
|
|
4857
|
-
|
|
5392
|
+
function getSiteById(db_used,id_site) {
|
|
5393
|
+
var query = "";
|
|
5394
|
+
if (db_used) {
|
|
5395
|
+
switch (db_used) {
|
|
5396
|
+
case 'SQLITE':
|
|
5397
|
+
query = getSiteByIdSQLite(id_site);
|
|
5398
|
+
break;
|
|
5399
|
+
case 'MYSQL':
|
|
5400
|
+
query = getSiteByIdMySQL(id_site);
|
|
5401
|
+
break;
|
|
5402
|
+
}
|
|
5403
|
+
}
|
|
5404
|
+
return query;
|
|
5405
|
+
}
|
|
4858
5406
|
//End get site by id
|
|
4859
5407
|
// Get Labs from Place
|
|
4860
5408
|
function querySitesLabSQLite(id_place) {
|
|
@@ -4870,7 +5418,20 @@ function querySitesLabMySQL(id_place) {
|
|
|
4870
5418
|
query += "where s.id_place = :id_place ";
|
|
4871
5419
|
query += "and s.id in (select id_site from postazione_lab where id_place = :id_place) ";
|
|
4872
5420
|
}
|
|
4873
|
-
|
|
5421
|
+
function querySitesLab(db_used,id_place) {
|
|
5422
|
+
var query = "";
|
|
5423
|
+
if (db_used) {
|
|
5424
|
+
switch (db_used) {
|
|
5425
|
+
case 'SQLITE':
|
|
5426
|
+
query = querySitesLabSQLite(id_place);
|
|
5427
|
+
break;
|
|
5428
|
+
case 'MYSQL':
|
|
5429
|
+
query = querySitesLabMySQL(id_place);
|
|
5430
|
+
break;
|
|
5431
|
+
}
|
|
5432
|
+
}
|
|
5433
|
+
return query;
|
|
5434
|
+
}
|
|
4874
5435
|
//end get labs from place
|
|
4875
5436
|
//Define removeSiteBySet
|
|
4876
5437
|
function removeSiteBySetSQLite(id_device) {
|
|
@@ -4891,6 +5452,20 @@ function removeSiteBySetMySQL(id_device) {
|
|
|
4891
5452
|
query += ")";
|
|
4892
5453
|
return query;
|
|
4893
5454
|
}
|
|
5455
|
+
function removeSiteBySet(db_used, id_device) {
|
|
5456
|
+
var query = "";
|
|
5457
|
+
if (db_used) {
|
|
5458
|
+
switch (db_used) {
|
|
5459
|
+
case 'SQLITE':
|
|
5460
|
+
query = removeSiteBySetSQLite(id_device);
|
|
5461
|
+
break;
|
|
5462
|
+
case 'MYSQL':
|
|
5463
|
+
query = emoveSiteBySetMySQL(id_device);
|
|
5464
|
+
break;
|
|
5465
|
+
}
|
|
5466
|
+
}
|
|
5467
|
+
return query;
|
|
5468
|
+
}
|
|
4894
5469
|
//End define removeSiteBySet
|
|
4895
5470
|
|
|
4896
5471
|
// Define updateSiteBySet
|
|
@@ -4907,6 +5482,20 @@ function updateSiteBySetMySQL(id_device) {
|
|
|
4907
5482
|
query += "where dt.id_maindevice = :id_device)";
|
|
4908
5483
|
return query;
|
|
4909
5484
|
}
|
|
5485
|
+
function updateSiteBySet(db_used,id_device) {
|
|
5486
|
+
var query = "";
|
|
5487
|
+
if (db_used) {
|
|
5488
|
+
switch (db_used) {
|
|
5489
|
+
case 'SQLITE':
|
|
5490
|
+
query = updateSiteBySetSQLite(id_device);
|
|
5491
|
+
break;
|
|
5492
|
+
case 'MYSQL':
|
|
5493
|
+
query = updateSiteBySetMySQL(id_device);
|
|
5494
|
+
break;
|
|
5495
|
+
}
|
|
5496
|
+
}
|
|
5497
|
+
return query;
|
|
5498
|
+
}
|
|
4910
5499
|
// End define updateSiteBySet
|
|
4911
5500
|
// Define insertSiteBySet
|
|
4912
5501
|
function insertSiteBySetSQLite(id_device) {
|
|
@@ -4925,6 +5514,20 @@ function insertSiteBySetMySQL(id_device) {
|
|
|
4925
5514
|
query += "where ds.id_maindevice = :id_device";
|
|
4926
5515
|
return query;
|
|
4927
5516
|
}
|
|
5517
|
+
function insertSiteBySet(db_used,id_device) {
|
|
5518
|
+
var query = "";
|
|
5519
|
+
if (db_used) {
|
|
5520
|
+
switch (db_used) {
|
|
5521
|
+
case 'SQLITE':
|
|
5522
|
+
query = insertSiteBySetSQLite(id_device);
|
|
5523
|
+
break;
|
|
5524
|
+
case 'MYSQL':
|
|
5525
|
+
query = insertSiteBySetMySQL(id_device);
|
|
5526
|
+
break;
|
|
5527
|
+
}
|
|
5528
|
+
}
|
|
5529
|
+
return query;
|
|
5530
|
+
}
|
|
4928
5531
|
//End define insertSiteBySet
|
|
4929
5532
|
// Define insertSiteBySet
|
|
4930
5533
|
function insertSiteBySetParamSQLite(id_device, id_site, id_place, start_date) {
|
|
@@ -4941,6 +5544,20 @@ function insertSiteBySetParamMySQL(id_device) {
|
|
|
4941
5544
|
query += "where ds.id_maindevice = :id_device";
|
|
4942
5545
|
return query;
|
|
4943
5546
|
}
|
|
5547
|
+
function insertSiteBySetParam(db_used,id_device) {
|
|
5548
|
+
var query = "";
|
|
5549
|
+
if (db_used) {
|
|
5550
|
+
switch (db_used) {
|
|
5551
|
+
case 'SQLITE':
|
|
5552
|
+
query = insertSiteBySetParamSQLite(id_device);
|
|
5553
|
+
break;
|
|
5554
|
+
case 'MYSQL':
|
|
5555
|
+
query = insertSiteBySetParamMySQL(id_device);
|
|
5556
|
+
break;
|
|
5557
|
+
}
|
|
5558
|
+
}
|
|
5559
|
+
return query;
|
|
5560
|
+
}
|
|
4944
5561
|
//End define insertSiteBySetParam
|
|
4945
5562
|
//Define getDeviceAsSite
|
|
4946
5563
|
function getDeviceAsSiteSQLite(id_device) {
|
|
@@ -4953,6 +5570,20 @@ function getDeviceAsSiteMySQL(id_device) {
|
|
|
4953
5570
|
query += "where das.id_device = :id_device";
|
|
4954
5571
|
return query;
|
|
4955
5572
|
}
|
|
5573
|
+
function getDeviceAsSite(db_used,id_device) {
|
|
5574
|
+
var query = "";
|
|
5575
|
+
if (db_used) {
|
|
5576
|
+
switch (db_used) {
|
|
5577
|
+
case 'SQLITE':
|
|
5578
|
+
query = getDeviceAsSiteSQLite(id_device);
|
|
5579
|
+
break;
|
|
5580
|
+
case 'MYSQL':
|
|
5581
|
+
query = getDeviceAsSiteMySQL(id_device);
|
|
5582
|
+
break;
|
|
5583
|
+
}
|
|
5584
|
+
}
|
|
5585
|
+
return query;
|
|
5586
|
+
}
|
|
4956
5587
|
//End define getDeviceAsSite
|
|
4957
5588
|
// Define getLastSiteForDevice
|
|
4958
5589
|
function getLastSiteForDeviceSQLite(id_device) {
|
|
@@ -4967,6 +5598,20 @@ function getLastSiteForDeviceMySQL(id_device) {
|
|
|
4967
5598
|
query += "and CURDATE() >= ds.date_in and CURDATE() <= ds.date_out";
|
|
4968
5599
|
return query;
|
|
4969
5600
|
}
|
|
5601
|
+
function getLastSiteForDevice(db_used,id_device) {
|
|
5602
|
+
var query = "";
|
|
5603
|
+
if (db_used) {
|
|
5604
|
+
switch (db_used) {
|
|
5605
|
+
case 'SQLITE':
|
|
5606
|
+
query = getLastSiteForDeviceSQLite(id_device);
|
|
5607
|
+
break;
|
|
5608
|
+
case 'MYSQL':
|
|
5609
|
+
query = getLastSiteForDeviceMySQL(id_device);
|
|
5610
|
+
break;
|
|
5611
|
+
}
|
|
5612
|
+
}
|
|
5613
|
+
return query;
|
|
5614
|
+
}
|
|
4970
5615
|
// End define getLastSiteForDevice
|
|
4971
5616
|
|
|
4972
5617
|
|
|
@@ -4997,6 +5642,20 @@ function queryStatisticMySQL(list_types) {
|
|
|
4997
5642
|
query += "group by Tipo";
|
|
4998
5643
|
return query;
|
|
4999
5644
|
}
|
|
5645
|
+
function queryStatistic(db_used,list_types) {
|
|
5646
|
+
var query = "";
|
|
5647
|
+
if (db_used) {
|
|
5648
|
+
switch (db_used) {
|
|
5649
|
+
case 'SQLITE':
|
|
5650
|
+
query = queryStatisticSQLite(list_types);
|
|
5651
|
+
break;
|
|
5652
|
+
case 'MYSQL':
|
|
5653
|
+
query = queryStatisticMySQL(list_types);
|
|
5654
|
+
break;
|
|
5655
|
+
}
|
|
5656
|
+
}
|
|
5657
|
+
return query;
|
|
5658
|
+
}
|
|
5000
5659
|
//End Get Devices for Statistics
|
|
5001
5660
|
//Get Inventary for Statistics
|
|
5002
5661
|
function queryStatisticInventarySQLite() {
|
|
@@ -5009,6 +5668,20 @@ function queryStatisticInventaryMySQL() {
|
|
|
5009
5668
|
query += "where (is_removed is null or is_removed = 0) ";
|
|
5010
5669
|
return query;
|
|
5011
5670
|
}
|
|
5671
|
+
function queryStatisticInventary(db_used) {
|
|
5672
|
+
var query = "";
|
|
5673
|
+
if (db_used) {
|
|
5674
|
+
switch (db_used) {
|
|
5675
|
+
case 'SQLITE':
|
|
5676
|
+
query = queryStatisticInventarySQLite();
|
|
5677
|
+
break;
|
|
5678
|
+
case 'MYSQL':
|
|
5679
|
+
query = queryStatisticInventaryMySQL();
|
|
5680
|
+
break;
|
|
5681
|
+
}
|
|
5682
|
+
}
|
|
5683
|
+
return query;
|
|
5684
|
+
}
|
|
5012
5685
|
//End Get Inventary for Statistics
|
|
5013
5686
|
//Get Devices Statistics bt Status
|
|
5014
5687
|
function queryStatisticsDeviceStatusSQLite() {
|
|
@@ -5022,6 +5695,20 @@ function queryStatisticsDeviceStatusSQLite() {
|
|
|
5022
5695
|
}
|
|
5023
5696
|
function queryStatisticsDeviceStatusMySQL() {
|
|
5024
5697
|
}
|
|
5698
|
+
function queryStatisticsDeviceStatus(db_used) {
|
|
5699
|
+
var query = "";
|
|
5700
|
+
if (db_used) {
|
|
5701
|
+
switch (db_used) {
|
|
5702
|
+
case 'SQLITE':
|
|
5703
|
+
query = queryStatisticsDeviceStatusSQLite();
|
|
5704
|
+
break;
|
|
5705
|
+
case 'MYSQL':
|
|
5706
|
+
query = queryStatisticsDeviceStatusMySQL();
|
|
5707
|
+
break;
|
|
5708
|
+
}
|
|
5709
|
+
}
|
|
5710
|
+
return query;
|
|
5711
|
+
}
|
|
5025
5712
|
|
|
5026
5713
|
function tokenizer(marker, input, marker2) {
|
|
5027
5714
|
var retValue = "";
|
|
@@ -5227,9 +5914,6 @@ function getDevicesInUse(db_used) {
|
|
|
5227
5914
|
break;
|
|
5228
5915
|
}
|
|
5229
5916
|
}
|
|
5230
|
-
else {
|
|
5231
|
-
query = getDevicesInUseSQLite();
|
|
5232
|
-
}
|
|
5233
5917
|
return query;
|
|
5234
5918
|
}
|
|
5235
5919
|
|
|
@@ -5267,9 +5951,6 @@ function getDevicesInUseByPlaces(db_used) {
|
|
|
5267
5951
|
break;
|
|
5268
5952
|
}
|
|
5269
5953
|
}
|
|
5270
|
-
else {
|
|
5271
|
-
query = getDevicesInUseByPlacesSQLite();
|
|
5272
|
-
}
|
|
5273
5954
|
return query;
|
|
5274
5955
|
}
|
|
5275
5956
|
|
|
@@ -5285,6 +5966,22 @@ function getDatiAcquistoDeviceMySQL(id_device) {
|
|
|
5285
5966
|
return query;
|
|
5286
5967
|
}
|
|
5287
5968
|
|
|
5969
|
+
function getDatiAcquistoDevice(db_used,id_device) {
|
|
5970
|
+
var query = "";
|
|
5971
|
+
if (db_used) {
|
|
5972
|
+
switch (db_used) {
|
|
5973
|
+
case 'SQLITE':
|
|
5974
|
+
query = getDatiAcquistoDeviceSQLite(id_device);
|
|
5975
|
+
break;
|
|
5976
|
+
case 'MYSQL':
|
|
5977
|
+
query = getDatiAcquistoDeviceMySQL(id_device);
|
|
5978
|
+
break;
|
|
5979
|
+
}
|
|
5980
|
+
}
|
|
5981
|
+
return query;
|
|
5982
|
+
}
|
|
5983
|
+
|
|
5984
|
+
|
|
5288
5985
|
//End reports
|
|
5289
5986
|
function getPackageJsVersion() {
|
|
5290
5987
|
var pjson = require('../package.json');
|
|
@@ -5368,28 +6065,17 @@ module.exports = {
|
|
|
5368
6065
|
getDevicesSelectForInventarioRawById,
|
|
5369
6066
|
getBeniConsumo,
|
|
5370
6067
|
getBeniConsumoNotNull,
|
|
5371
|
-
|
|
5372
|
-
|
|
5373
|
-
|
|
5374
|
-
|
|
5375
|
-
|
|
5376
|
-
|
|
5377
|
-
|
|
5378
|
-
|
|
5379
|
-
|
|
5380
|
-
|
|
5381
|
-
|
|
5382
|
-
insertConnectionSetMySQL,
|
|
5383
|
-
updateConnectionSetSQLite,
|
|
5384
|
-
updateConnectionSetMySQL,
|
|
5385
|
-
removeConnectionSetSQLite,
|
|
5386
|
-
removeConnectionSetMySQL,
|
|
5387
|
-
getConnectionByIdSetSQLite,
|
|
5388
|
-
getConnectionByIdSetMySQL,
|
|
5389
|
-
getConnectionSetByIdSQLite,
|
|
5390
|
-
getConnectionSetByIdMySQL,
|
|
5391
|
-
queryDetailsByIdDeviceSQLite,
|
|
5392
|
-
queryDetailsByIdDeviceMySQL,
|
|
6068
|
+
getBeneConsumoUsato,
|
|
6069
|
+
getBeneConsumoById,
|
|
6070
|
+
existBeneAbbinato,
|
|
6071
|
+
insertBeneConsumoAbbinato,
|
|
6072
|
+
updateBeneConsumoAbbinato,
|
|
6073
|
+
insertConnectionSet,
|
|
6074
|
+
updateConnectionSet,
|
|
6075
|
+
removeConnectionSet,
|
|
6076
|
+
getConnectionByIdSet,
|
|
6077
|
+
getConnectionSetById,
|
|
6078
|
+
queryDetailsByIdDevice,
|
|
5393
6079
|
//
|
|
5394
6080
|
queryDocumentsIdDevice,
|
|
5395
6081
|
selectDocumentoById,
|
|
@@ -5418,86 +6104,51 @@ module.exports = {
|
|
|
5418
6104
|
removeDismissioneDeviceFromDismissione,
|
|
5419
6105
|
queryLastDismissioneId,
|
|
5420
6106
|
//
|
|
5421
|
-
|
|
5422
|
-
|
|
5423
|
-
|
|
5424
|
-
getBeniConsumoByIdDeviceMySQL,
|
|
5425
|
-
queryConsegneByIdDeviceSQLite,
|
|
5426
|
-
queryConsegneByIdDeviceMySQL,
|
|
6107
|
+
assignCategoryFromDB,
|
|
6108
|
+
getBeniConsumoByIdDevice,
|
|
6109
|
+
queryConsegneByIdDevice,
|
|
5427
6110
|
queryFornitoriGestoriCombo,
|
|
5428
|
-
|
|
5429
|
-
|
|
5430
|
-
|
|
5431
|
-
|
|
5432
|
-
|
|
5433
|
-
|
|
5434
|
-
querySelectGestioniDeviceByIdDeviceSQLite,
|
|
5435
|
-
querySelectGestioniDeviceByIdDeviceMySQL,
|
|
5436
|
-
queryConsegneSQLite,
|
|
5437
|
-
queryConsegneMySQL,
|
|
5438
|
-
queryConsegnaByIdSQLite,
|
|
5439
|
-
queryConsegnaByIdMySQL,
|
|
6111
|
+
queryCloseGestioneDevice,
|
|
6112
|
+
queryInsertGestioneDevice,
|
|
6113
|
+
querySelectExistsGestioneDeviceByIds,
|
|
6114
|
+
querySelectGestioniDeviceByIdDevice,
|
|
6115
|
+
queryConsegne,
|
|
6116
|
+
queryConsegnaById,
|
|
5440
6117
|
queryDeviceStatusCombo,
|
|
5441
6118
|
queryUsers,
|
|
5442
6119
|
queryFunctions,
|
|
5443
6120
|
queryAllFunctions,
|
|
5444
|
-
|
|
5445
|
-
|
|
5446
|
-
|
|
5447
|
-
|
|
5448
|
-
updateDeviceInterventoSQLite,
|
|
5449
|
-
updateDeviceInterventoMySQL,
|
|
5450
|
-
removeDeviceInterventoSQLite,
|
|
5451
|
-
removeDeviceInterventoMySQL,
|
|
6121
|
+
queryInterventoById,
|
|
6122
|
+
insertDeviceIntervento,
|
|
6123
|
+
updateDeviceIntervento,
|
|
6124
|
+
removeDeviceIntervento,
|
|
5452
6125
|
//
|
|
5453
|
-
|
|
5454
|
-
|
|
5455
|
-
|
|
5456
|
-
|
|
5457
|
-
|
|
5458
|
-
getAdapterTypesMySQL,
|
|
5459
|
-
getStorageTypesSQLite,
|
|
5460
|
-
getStorageTypesMySQL,
|
|
5461
|
-
getLaboratorioByIdSiteSQLite,
|
|
5462
|
-
getLaboratorioByIdSiteMySQL,
|
|
6126
|
+
getConnectionTypes,
|
|
6127
|
+
getConnectionProtocols,
|
|
6128
|
+
getAdapterTypes,
|
|
6129
|
+
getStorageTypes,
|
|
6130
|
+
getLaboratorioByIdSite,
|
|
5463
6131
|
getCategories,
|
|
5464
|
-
|
|
5465
|
-
getCategoriesByIdDeviceMySQL,
|
|
6132
|
+
getCategoriesByIdDevice,
|
|
5466
6133
|
createConsegnaMySQLObj,
|
|
5467
|
-
|
|
5468
|
-
|
|
5469
|
-
|
|
5470
|
-
|
|
5471
|
-
removeConsegnaSQLite,
|
|
5472
|
-
removeConsegnaMySQL,
|
|
5473
|
-
queryLastConsegnaIdSQLite,
|
|
5474
|
-
queryLastConsegnaIdMySQL,
|
|
6134
|
+
insertConsegna,
|
|
6135
|
+
updateConsegna,
|
|
6136
|
+
removeConsegna,
|
|
6137
|
+
queryLastConsegnaId,
|
|
5475
6138
|
//
|
|
5476
|
-
|
|
5477
|
-
|
|
5478
|
-
|
|
5479
|
-
|
|
5480
|
-
|
|
5481
|
-
|
|
5482
|
-
|
|
5483
|
-
|
|
5484
|
-
|
|
5485
|
-
getDeviceAsSiteMySQL,
|
|
5486
|
-
getLastSiteForDeviceSQLite,
|
|
5487
|
-
getLastSiteForDeviceMySQL,
|
|
5488
|
-
querySitesLabSQLite,
|
|
5489
|
-
querySitesLabMySQL,
|
|
5490
|
-
getSiteByIdSQLite,
|
|
5491
|
-
getSiteByIdMySQL,
|
|
5492
|
-
getSitesSelectComboSQLite,
|
|
5493
|
-
getSitesSelectComboMySQL,
|
|
6139
|
+
removeSiteBySet,
|
|
6140
|
+
updateSiteBySet,
|
|
6141
|
+
insertSiteBySet,
|
|
6142
|
+
insertSiteBySetParam,
|
|
6143
|
+
getDeviceAsSite,
|
|
6144
|
+
getLastSiteForDevice,
|
|
6145
|
+
querySitesLab,
|
|
6146
|
+
getSiteById,
|
|
6147
|
+
getSitesSelectCombo,
|
|
5494
6148
|
verifyPrevDeviceSite,
|
|
5495
|
-
|
|
5496
|
-
|
|
5497
|
-
|
|
5498
|
-
updateDeviceSiteMySQL,
|
|
5499
|
-
removeDeviceSiteSQLite,
|
|
5500
|
-
removeDeviceSiteMySQL,
|
|
6149
|
+
insertDeviceSite,
|
|
6150
|
+
updateDeviceSite,
|
|
6151
|
+
removeDeviceSite,
|
|
5501
6152
|
queryPlaces,
|
|
5502
6153
|
queryFloorsByPlace,
|
|
5503
6154
|
queryFunzioneByPlaceAndFloor,
|
|
@@ -5507,17 +6158,13 @@ module.exports = {
|
|
|
5507
6158
|
querySitesWithDefaults,
|
|
5508
6159
|
getPorteByIdSite,
|
|
5509
6160
|
//
|
|
5510
|
-
|
|
5511
|
-
|
|
5512
|
-
|
|
5513
|
-
queryStatisticInventaryMySQL,
|
|
5514
|
-
queryStatisticsDeviceStatusSQLite,
|
|
5515
|
-
queryStatisticsDeviceStatusMySQL,
|
|
6161
|
+
queryStatistic,
|
|
6162
|
+
queryStatisticInventary,
|
|
6163
|
+
queryStatisticsDeviceStatus,
|
|
5516
6164
|
getPropertiesFromBLOB,
|
|
5517
6165
|
getOpSystemFromBLOB,
|
|
5518
6166
|
getAllPropertiesFromBLOB,
|
|
5519
|
-
|
|
5520
|
-
getDatiAcquistoDeviceMySQL,
|
|
6167
|
+
getDatiAcquistoDevice,
|
|
5521
6168
|
getPackageJsVersion
|
|
5522
6169
|
};
|
|
5523
6170
|
// end of source
|