alsmanager_lib 2.0.76 → 2.0.78
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 +48 -24
- package/package.json +1 -1
package/lib/modules.js
CHANGED
|
@@ -2378,32 +2378,38 @@ function queryDeviceModels() {
|
|
|
2378
2378
|
return query;
|
|
2379
2379
|
}
|
|
2380
2380
|
//
|
|
2381
|
-
function
|
|
2381
|
+
function queryDeviceModelsByFilterSQLite(manifacturer, dev_type) {
|
|
2382
2382
|
var query = "SELECT DISTINCT model from devices ";
|
|
2383
2383
|
query += "where manifacturer = '" + manifacturer + "' ";
|
|
2384
|
+
if (dev_type && dev_type != '') {
|
|
2385
|
+
query += "and type = '" + dev_type + "' ";
|
|
2386
|
+
}
|
|
2384
2387
|
query += "order by model";
|
|
2385
2388
|
return query;
|
|
2386
2389
|
}
|
|
2387
2390
|
|
|
2388
|
-
function
|
|
2391
|
+
function queryDeviceModelsByFilterMySQL(manifacturer, dev_type) {
|
|
2389
2392
|
var query = "SELECT DISTINCT model from devices ";
|
|
2390
2393
|
query += "where manifacturer = :manifacturer ";
|
|
2394
|
+
if (dev_type && dev_type != '') {
|
|
2395
|
+
query += "and type = :dev_type ";
|
|
2396
|
+
}
|
|
2391
2397
|
query += "order by model";
|
|
2392
2398
|
return query;
|
|
2393
2399
|
}
|
|
2394
2400
|
|
|
2395
|
-
function
|
|
2401
|
+
function queryDeviceModelsByFilter(db_used, manifacturer, dev_type) {
|
|
2396
2402
|
var query = "";
|
|
2397
2403
|
if (db_used) {
|
|
2398
2404
|
switch (db_used) {
|
|
2399
2405
|
case 'SQLITE':
|
|
2400
|
-
query =
|
|
2406
|
+
query = queryDeviceModelsByFilterSQLite(manifacturer, dev_type);
|
|
2401
2407
|
break;
|
|
2402
2408
|
case 'MYSQL':
|
|
2403
|
-
query =
|
|
2409
|
+
query = queryDeviceModelsByFilterMySQL(manifacturer, dev_type);
|
|
2404
2410
|
break;
|
|
2405
2411
|
case 'MYSQL2':
|
|
2406
|
-
query =
|
|
2412
|
+
query = queryDeviceModelsByFilterSQLite(manifacturer, dev_type);
|
|
2407
2413
|
break;
|
|
2408
2414
|
}
|
|
2409
2415
|
}
|
|
@@ -2430,7 +2436,7 @@ function getDevicesSelectSQLite(search_type, inv_code, dev_type, marca, is_PNRR,
|
|
|
2430
2436
|
query += "left join device_gestioni dg on d.id = dg.id_device"
|
|
2431
2437
|
|
|
2432
2438
|
var where_clause = " where (d.is_removed is null or d.is_removed = 0) ";
|
|
2433
|
-
if (inv_code || dev_type || marca || (is_PNRR && is_PNRR > 0) || dev_status || dev_gestione) {
|
|
2439
|
+
if (inv_code || dev_type || marca || dev_model || (is_PNRR && is_PNRR > 0) || dev_status || dev_gestione) {
|
|
2434
2440
|
if (inv_code) {
|
|
2435
2441
|
if (search_type == "ESATTA") {
|
|
2436
2442
|
where_clause += " and (d.inv_ict3_number = '" + inv_code + "' or ";
|
|
@@ -2451,22 +2457,28 @@ function getDevicesSelectSQLite(search_type, inv_code, dev_type, marca, is_PNRR,
|
|
|
2451
2457
|
where_clause += " and ";
|
|
2452
2458
|
if (dev_type) {
|
|
2453
2459
|
where_clause += "d.type = '" + dev_type + "'";
|
|
2454
|
-
if (marca || (is_PNRR && is_PNRR > 0) || dev_status) {
|
|
2460
|
+
if (marca || (is_PNRR && is_PNRR > 0) || dev_status || dev_model || dev_gestione) {
|
|
2455
2461
|
where_clause += " and ";
|
|
2456
2462
|
}
|
|
2457
2463
|
}
|
|
2458
2464
|
if (marca) {
|
|
2459
2465
|
where_clause += " d.manifacturer = '" + marca + "'";
|
|
2460
|
-
if ((is_PNRR && is_PNRR > 0) || dev_status) {
|
|
2466
|
+
if ((is_PNRR && is_PNRR > 0) || dev_status || dev_model || dev_gestione) {
|
|
2461
2467
|
where_clause += " and ";
|
|
2462
2468
|
}
|
|
2463
2469
|
}
|
|
2464
2470
|
if (is_PNRR && is_PNRR > 0) {
|
|
2465
2471
|
where_clause += " (d.inv_pnrr_number <> '' and inv_pnrr_number is not null) ";
|
|
2466
|
-
if (dev_status || dev_gestione) {
|
|
2472
|
+
if (dev_status || dev_gestione || dev_model) {
|
|
2467
2473
|
where_clause += " and ";
|
|
2468
2474
|
}
|
|
2469
2475
|
}
|
|
2476
|
+
if (dev_model) {
|
|
2477
|
+
where_clause += " d.model = '" + dev_model + "'";
|
|
2478
|
+
if (dev_status || dev_gestione) {
|
|
2479
|
+
where_clause += " and ";
|
|
2480
|
+
}
|
|
2481
|
+
}
|
|
2470
2482
|
if (dev_status) {
|
|
2471
2483
|
where_clause += " du.status = " + dev_status + " and date('now') >= du.date_status";
|
|
2472
2484
|
if (dev_gestione) {
|
|
@@ -2487,7 +2499,7 @@ function getDevicesSelectSQLite(search_type, inv_code, dev_type, marca, is_PNRR,
|
|
|
2487
2499
|
return query;
|
|
2488
2500
|
}
|
|
2489
2501
|
|
|
2490
|
-
function getDevicesSelectMySQL(search_type, inv_code, dev_type, marca, is_PNRR, dev_status, dev_gestione, id_dev_exclude) {
|
|
2502
|
+
function getDevicesSelectMySQL(search_type, inv_code, dev_type, marca, dev_model, is_PNRR, dev_status, dev_gestione, id_dev_exclude) {
|
|
2491
2503
|
var query = "SELECT DISTINCT d.id, d.type as Tipo, d.manifacturer as Marca, d.model as Modello, ";
|
|
2492
2504
|
query += "case ";
|
|
2493
2505
|
query += "when d.inv_ict3_number != '' and d.inv_ict3_number is not null then d.inv_ict3_number ";
|
|
@@ -2504,7 +2516,7 @@ function getDevicesSelectMySQL(search_type, inv_code, dev_type, marca, is_PNRR,
|
|
|
2504
2516
|
|
|
2505
2517
|
|
|
2506
2518
|
var where_clause = " where (d.is_removed is null or d.is_removed = 0) ";
|
|
2507
|
-
if (inv_code || dev_type || marca || (is_PNRR && is_PNRR > 0) || dev_gestione) {
|
|
2519
|
+
if (inv_code || dev_type || marca || dev_model || (is_PNRR && is_PNRR > 0) || dev_status || dev_gestione) {
|
|
2508
2520
|
if (inv_code) {
|
|
2509
2521
|
if (search_type == "ESATTA") {
|
|
2510
2522
|
where_clause += " and (d.inv_ict3_number = :inv_code or ";
|
|
@@ -2525,18 +2537,24 @@ function getDevicesSelectMySQL(search_type, inv_code, dev_type, marca, is_PNRR,
|
|
|
2525
2537
|
where_clause += " and ";
|
|
2526
2538
|
if (dev_type) {
|
|
2527
2539
|
where_clause += " d.type = :dev_type";
|
|
2528
|
-
if (marca || (is_PNRR && is_PNRR > 0)) {
|
|
2540
|
+
if (marca || dev_model || (is_PNRR && is_PNRR > 0 || dev_status || dev_gestione)) {
|
|
2529
2541
|
where_clause += " and ";
|
|
2530
2542
|
}
|
|
2531
2543
|
}
|
|
2532
2544
|
if (marca) {
|
|
2533
2545
|
where_clause += " d.manifacturer = :marca";
|
|
2534
|
-
if (is_PNRR && is_PNRR > 0) {
|
|
2546
|
+
if (dev_model || is_PNRR && is_PNRR > 0 || dev_status || dev_gestione) {
|
|
2535
2547
|
where_clause += " and ";
|
|
2536
2548
|
}
|
|
2537
2549
|
}
|
|
2538
2550
|
if (is_PNRR && is_PNRR > 0) {
|
|
2539
2551
|
where_clause += " (d.inv_pnrr_number <> '' and inv_pnrr_number is not null) ";
|
|
2552
|
+
if (dev_model || dev_status || dev_gestione ) {
|
|
2553
|
+
where_clause += " and ";
|
|
2554
|
+
}
|
|
2555
|
+
}
|
|
2556
|
+
if (dev_model) {
|
|
2557
|
+
where_clause += " d.model = :dev_model ";
|
|
2540
2558
|
if (dev_status || dev_gestione) {
|
|
2541
2559
|
where_clause += " and ";
|
|
2542
2560
|
}
|
|
@@ -2563,7 +2581,7 @@ function getDevicesSelectMySQL(search_type, inv_code, dev_type, marca, is_PNRR,
|
|
|
2563
2581
|
return query;
|
|
2564
2582
|
}
|
|
2565
2583
|
|
|
2566
|
-
function getDevicesSelectMySQL2(search_type, inv_code, dev_type, marca, is_PNRR, dev_status, dev_gestione, id_dev_exclude) {
|
|
2584
|
+
function getDevicesSelectMySQL2(search_type, inv_code, dev_type, marca, dev_model, is_PNRR, dev_status, dev_gestione, id_dev_exclude) {
|
|
2567
2585
|
var query = "SELECT DISTINCT d.id, d.type as Tipo, d.manifacturer as Marca, d.model as Modello, ";
|
|
2568
2586
|
query += "case ";
|
|
2569
2587
|
query += "when d.inv_ict3_number != '' and d.inv_ict3_number is not null then d.inv_ict3_number ";
|
|
@@ -2579,7 +2597,7 @@ function getDevicesSelectMySQL2(search_type, inv_code, dev_type, marca, is_PNRR,
|
|
|
2579
2597
|
query += "left join device_gestioni dg on d.id = dg.id_device"
|
|
2580
2598
|
|
|
2581
2599
|
var where_clause = " where (d.is_removed is null or d.is_removed = 0) ";
|
|
2582
|
-
if (inv_code || dev_type || marca || (is_PNRR && is_PNRR > 0) || dev_status || dev_gestione) {
|
|
2600
|
+
if (inv_code || dev_type || marca || dev_model || (is_PNRR && is_PNRR > 0) || dev_status || dev_gestione) {
|
|
2583
2601
|
if (inv_code) {
|
|
2584
2602
|
if (search_type == "ESATTA") {
|
|
2585
2603
|
where_clause += " and (d.inv_ict3_number = '" + inv_code + "' or ";
|
|
@@ -2600,22 +2618,28 @@ function getDevicesSelectMySQL2(search_type, inv_code, dev_type, marca, is_PNRR,
|
|
|
2600
2618
|
where_clause += " and ";
|
|
2601
2619
|
if (dev_type) {
|
|
2602
2620
|
where_clause += "d.type = '" + dev_type + "'";
|
|
2603
|
-
if (marca || (is_PNRR && is_PNRR > 0) || dev_status) {
|
|
2621
|
+
if (marca || (is_PNRR && is_PNRR > 0) || dev_status || dev_model || dev_gestione) {
|
|
2604
2622
|
where_clause += " and ";
|
|
2605
2623
|
}
|
|
2606
2624
|
}
|
|
2607
2625
|
if (marca) {
|
|
2608
2626
|
where_clause += " d.manifacturer = '" + marca + "'";
|
|
2609
|
-
if ((is_PNRR && is_PNRR > 0) || dev_status) {
|
|
2627
|
+
if ((is_PNRR && is_PNRR > 0) || dev_status || dev_model || dev_gestione) {
|
|
2610
2628
|
where_clause += " and ";
|
|
2611
2629
|
}
|
|
2612
2630
|
}
|
|
2613
2631
|
if (is_PNRR && is_PNRR > 0) {
|
|
2614
2632
|
where_clause += " (d.inv_pnrr_number <> '' and inv_pnrr_number is not null) ";
|
|
2615
|
-
if (dev_status || dev_gestione) {
|
|
2633
|
+
if (dev_status || dev_model || dev_gestione) {
|
|
2616
2634
|
where_clause += " and ";
|
|
2617
2635
|
}
|
|
2618
2636
|
}
|
|
2637
|
+
if (dev_model) {
|
|
2638
|
+
where_clause += " d.model = '" + dev_model + "'";
|
|
2639
|
+
if (dev_status || dev_gestione) {
|
|
2640
|
+
where_clause += " and ";
|
|
2641
|
+
}
|
|
2642
|
+
}
|
|
2619
2643
|
if (dev_status) {
|
|
2620
2644
|
where_clause += " du.status = " + dev_status + " and CURDATE() >= du.date_status";
|
|
2621
2645
|
if (dev_gestione) {
|
|
@@ -2636,18 +2660,18 @@ function getDevicesSelectMySQL2(search_type, inv_code, dev_type, marca, is_PNRR,
|
|
|
2636
2660
|
return query;
|
|
2637
2661
|
}
|
|
2638
2662
|
|
|
2639
|
-
function getDevicesSelect(db_used, search_type, inv_code, dev_type, marca, is_PNRR, dev_status, dev_gestione, id_dev_exclude) {
|
|
2663
|
+
function getDevicesSelect(db_used, search_type, inv_code, dev_type, marca, dev_model, is_PNRR, dev_status, dev_gestione, id_dev_exclude) {
|
|
2640
2664
|
var query = "";
|
|
2641
2665
|
if (db_used) {
|
|
2642
2666
|
switch (db_used) {
|
|
2643
2667
|
case 'SQLITE':
|
|
2644
|
-
query = getDevicesSelectSQLite(search_type, inv_code, dev_type, marca, is_PNRR, dev_status, dev_gestione, id_dev_exclude);
|
|
2668
|
+
query = getDevicesSelectSQLite(search_type, inv_code, dev_type, marca, dev_model, is_PNRR, dev_status, dev_gestione, id_dev_exclude);
|
|
2645
2669
|
break;
|
|
2646
2670
|
case 'MYSQL':
|
|
2647
|
-
query = getDevicesSelectMySQL(search_type, inv_code, dev_type, marca, is_PNRR, dev_status, dev_gestione, id_dev_exclude);
|
|
2671
|
+
query = getDevicesSelectMySQL(search_type, inv_code, dev_type, marca, dev_model, is_PNRR, dev_status, dev_gestione, id_dev_exclude);
|
|
2648
2672
|
break;
|
|
2649
2673
|
case 'MYSQL2':
|
|
2650
|
-
query = getDevicesSelectMySQL2(search_type, inv_code, dev_type, marca, is_PNRR, dev_status, dev_gestione, id_dev_exclude);
|
|
2674
|
+
query = getDevicesSelectMySQL2(search_type, inv_code, dev_type, marca, dev_model, is_PNRR, dev_status, dev_gestione, id_dev_exclude);
|
|
2651
2675
|
break;
|
|
2652
2676
|
}
|
|
2653
2677
|
}
|
|
@@ -11047,7 +11071,7 @@ module.exports = {
|
|
|
11047
11071
|
queryDeviceTypes,
|
|
11048
11072
|
queryDeviceManifactures,
|
|
11049
11073
|
queryDeviceModels,
|
|
11050
|
-
|
|
11074
|
+
queryDeviceModelsByFilter,
|
|
11051
11075
|
getDevicesSelectByRelated,
|
|
11052
11076
|
getDevicesSelect,
|
|
11053
11077
|
getDevicesSelectBySite,
|