alsmanager_lib 3.0.4 → 3.0.6
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 +290 -46
- package/package.json +1 -1
package/lib/modules.js
CHANGED
|
@@ -2458,9 +2458,10 @@ function queryDeviceModelsByFilter(db_used, manifacturer, dev_type) {
|
|
|
2458
2458
|
//end of Manage models
|
|
2459
2459
|
|
|
2460
2460
|
// Device select
|
|
2461
|
-
function getDevicesSelectSQLite(search_type, inv_code, dev_type, marca, dev_model, is_PNRR, dev_status, dev_gestione, id_dev_exclude) {
|
|
2461
|
+
function getDevicesSelectSQLite(search_type, inv_code, dev_type, marca, dev_model, is_PNRR, dev_status, dev_gestione, no_inv, id_dev_exclude) {
|
|
2462
2462
|
var query = "SELECT DISTINCT d.id, d.type as Tipo, d.manifacturer as Marca, d.model as Modello, ";
|
|
2463
2463
|
query += "case ";
|
|
2464
|
+
query += "when d.no_inventario is not null and d.no_inventario > 0 then concat(d.id,'(ID)') ";
|
|
2464
2465
|
query += "when d.inv_ict3_number != '' and d.inv_ict3_number is not null then d.inv_ict3_number ";
|
|
2465
2466
|
query += "when d.inv_pnrr_number != '' and d.inv_pnrr_number is not null then d.inv_pnrr_number ";
|
|
2466
2467
|
query += "when d.inv_tn_number != '' and d.inv_tn_number is not null then concat(d.inv_tn_number,'(TN)') ";
|
|
@@ -2474,7 +2475,7 @@ function getDevicesSelectSQLite(search_type, inv_code, dev_type, marca, dev_mode
|
|
|
2474
2475
|
query += "left join device_gestioni dg on d.id = dg.id_device"
|
|
2475
2476
|
|
|
2476
2477
|
var where_clause = " where (d.is_removed is null or d.is_removed = 0) ";
|
|
2477
|
-
if (inv_code || dev_type || marca || dev_model || (is_PNRR && is_PNRR > 0) || dev_status || dev_gestione) {
|
|
2478
|
+
if (inv_code || dev_type || marca || dev_model || (is_PNRR && is_PNRR > 0) || dev_status || dev_gestione || no_inv) {
|
|
2478
2479
|
if (inv_code) {
|
|
2479
2480
|
if (search_type == "ESATTA") {
|
|
2480
2481
|
where_clause += " and (d.inv_ict3_number = '" + inv_code + "' or ";
|
|
@@ -2495,49 +2496,53 @@ function getDevicesSelectSQLite(search_type, inv_code, dev_type, marca, dev_mode
|
|
|
2495
2496
|
where_clause += " and ";
|
|
2496
2497
|
if (dev_type) {
|
|
2497
2498
|
where_clause += "d.type = '" + dev_type + "'";
|
|
2498
|
-
if (marca || (is_PNRR && is_PNRR > 0) || dev_status || dev_model || dev_gestione) {
|
|
2499
|
+
if (marca || (is_PNRR && is_PNRR > 0) || dev_status || dev_model || dev_gestione || no_inv) {
|
|
2499
2500
|
where_clause += " and ";
|
|
2500
2501
|
}
|
|
2501
2502
|
}
|
|
2502
2503
|
if (marca) {
|
|
2503
2504
|
where_clause += " d.manifacturer = '" + marca + "'";
|
|
2504
|
-
if ((is_PNRR && is_PNRR > 0) || dev_status || dev_model || dev_gestione) {
|
|
2505
|
+
if ((is_PNRR && is_PNRR > 0) || dev_status || dev_model || dev_gestione || no_inv) {
|
|
2505
2506
|
where_clause += " and ";
|
|
2506
2507
|
}
|
|
2507
2508
|
}
|
|
2508
2509
|
if (is_PNRR && is_PNRR > 0) {
|
|
2509
2510
|
where_clause += " (d.inv_pnrr_number <> '' and inv_pnrr_number is not null) ";
|
|
2510
|
-
if (dev_status || dev_gestione || dev_model) {
|
|
2511
|
+
if (dev_status || dev_gestione || dev_model || no_inv) {
|
|
2511
2512
|
where_clause += " and ";
|
|
2512
2513
|
}
|
|
2513
2514
|
}
|
|
2514
2515
|
if (dev_model) {
|
|
2515
2516
|
where_clause += " d.model = '" + dev_model + "'";
|
|
2516
|
-
if (dev_status || dev_gestione) {
|
|
2517
|
+
if (dev_status || dev_gestione || no_inv) {
|
|
2517
2518
|
where_clause += " and ";
|
|
2518
2519
|
}
|
|
2519
2520
|
}
|
|
2520
2521
|
if (dev_status) {
|
|
2521
2522
|
where_clause += " du.status = " + dev_status + " and date('now') >= du.date_status";
|
|
2522
|
-
if (dev_gestione) {
|
|
2523
|
+
if (dev_gestione || no_inv) {
|
|
2523
2524
|
where_clause += " and ";
|
|
2524
2525
|
}
|
|
2525
2526
|
}
|
|
2526
2527
|
if (dev_gestione) {
|
|
2527
2528
|
where_clause += " dg.id_gestione = " + dev_gestione + " and date('now') >= dg.date_start and date('now') <= dg.date_end";
|
|
2529
|
+
if (no_inv) {
|
|
2530
|
+
where_clause += " and ";
|
|
2531
|
+
}
|
|
2532
|
+
}
|
|
2533
|
+
if (no_inv) {
|
|
2534
|
+
where_clause += " d.no_inventario = 1";
|
|
2528
2535
|
}
|
|
2529
2536
|
}
|
|
2530
2537
|
}
|
|
2531
|
-
|
|
2532
|
-
|
|
2533
|
-
where_clause += " and d.id <> " + id_dev_exclude;
|
|
2534
|
-
}
|
|
2538
|
+
if (id_dev_exclude > 0) {
|
|
2539
|
+
where_clause += " and d.id <> " + id_dev_exclude;
|
|
2535
2540
|
}
|
|
2536
2541
|
query += where_clause;
|
|
2537
2542
|
return query;
|
|
2538
2543
|
}
|
|
2539
2544
|
|
|
2540
|
-
function getDevicesSelectMySQL(search_type, inv_code, dev_type, marca, dev_model, is_PNRR, dev_status, dev_gestione, id_dev_exclude) {
|
|
2545
|
+
function getDevicesSelectMySQL(search_type, inv_code, dev_type, marca, dev_model, is_PNRR, dev_status, dev_gestione, no_inv, id_dev_exclude) {
|
|
2541
2546
|
var query = "SELECT DISTINCT d.id, d.type as Tipo, d.manifacturer as Marca, d.model as Modello, ";
|
|
2542
2547
|
query += "case ";
|
|
2543
2548
|
query += "when d.inv_ict3_number != '' and d.inv_ict3_number is not null then d.inv_ict3_number ";
|
|
@@ -2554,7 +2559,7 @@ function getDevicesSelectMySQL(search_type, inv_code, dev_type, marca, dev_model
|
|
|
2554
2559
|
|
|
2555
2560
|
|
|
2556
2561
|
var where_clause = " where (d.is_removed is null or d.is_removed = 0) ";
|
|
2557
|
-
if (inv_code || dev_type || marca || dev_model || (is_PNRR && is_PNRR > 0) || dev_status || dev_gestione) {
|
|
2562
|
+
if (inv_code || dev_type || marca || dev_model || (is_PNRR && is_PNRR > 0) || dev_status || dev_gestione || no_inv) {
|
|
2558
2563
|
if (inv_code) {
|
|
2559
2564
|
if (search_type == "ESATTA") {
|
|
2560
2565
|
where_clause += " and (d.inv_ict3_number = :inv_code or ";
|
|
@@ -2575,43 +2580,47 @@ function getDevicesSelectMySQL(search_type, inv_code, dev_type, marca, dev_model
|
|
|
2575
2580
|
where_clause += " and ";
|
|
2576
2581
|
if (dev_type) {
|
|
2577
2582
|
where_clause += " d.type = :dev_type";
|
|
2578
|
-
if (marca || dev_model || (is_PNRR && is_PNRR > 0 || dev_status || dev_gestione)) {
|
|
2583
|
+
if (marca || dev_model || (is_PNRR && is_PNRR > 0 || dev_status || dev_gestione || no_inv)) {
|
|
2579
2584
|
where_clause += " and ";
|
|
2580
2585
|
}
|
|
2581
2586
|
}
|
|
2582
2587
|
if (marca) {
|
|
2583
2588
|
where_clause += " d.manifacturer = :marca";
|
|
2584
|
-
if (dev_model || is_PNRR && is_PNRR > 0 || dev_status || dev_gestione) {
|
|
2589
|
+
if (dev_model || is_PNRR && is_PNRR > 0 || dev_status || dev_gestione|| no_inv) {
|
|
2585
2590
|
where_clause += " and ";
|
|
2586
2591
|
}
|
|
2587
2592
|
}
|
|
2588
2593
|
if (is_PNRR && is_PNRR > 0) {
|
|
2589
2594
|
where_clause += " (d.inv_pnrr_number <> '' and inv_pnrr_number is not null) ";
|
|
2590
|
-
if (dev_model || dev_status || dev_gestione ) {
|
|
2595
|
+
if (dev_model || dev_status || dev_gestione || no_inv ) {
|
|
2591
2596
|
where_clause += " and ";
|
|
2592
2597
|
}
|
|
2593
2598
|
}
|
|
2594
2599
|
if (dev_model) {
|
|
2595
2600
|
where_clause += " d.model = :dev_model ";
|
|
2596
|
-
if (dev_status || dev_gestione) {
|
|
2601
|
+
if (dev_status || dev_gestione || no_inv) {
|
|
2597
2602
|
where_clause += " and ";
|
|
2598
2603
|
}
|
|
2599
2604
|
}
|
|
2600
2605
|
if (dev_status) {
|
|
2601
2606
|
where_clause += " du.status = :dev_status and CURDATE() >= du.date_status";
|
|
2602
|
-
if (dev_gestione) {
|
|
2607
|
+
if (dev_gestione || no_inv) {
|
|
2603
2608
|
where_clause += " and ";
|
|
2604
2609
|
}
|
|
2605
2610
|
}
|
|
2606
2611
|
if (dev_gestione) {
|
|
2607
2612
|
where_clause += " dg.id_gestione = :dev_gestione and CURDATE() >= dg.date_start and CURDATE() <= dg.date_end";
|
|
2613
|
+
if (no_inv) {
|
|
2614
|
+
where_clause += " and ";
|
|
2615
|
+
}
|
|
2616
|
+
}
|
|
2617
|
+
if (no_inv) {
|
|
2618
|
+
where_clause += " d.no_inventario = 1";
|
|
2608
2619
|
}
|
|
2609
2620
|
}
|
|
2610
2621
|
}
|
|
2611
|
-
|
|
2612
|
-
|
|
2613
|
-
where_clause += " and d.id <> :id_dev_exclude";
|
|
2614
|
-
}
|
|
2622
|
+
if (id_dev_exclude > 0) {
|
|
2623
|
+
where_clause += " and d.id <> :id_dev_exclude";
|
|
2615
2624
|
}
|
|
2616
2625
|
|
|
2617
2626
|
query += where_clause;
|
|
@@ -2619,7 +2628,7 @@ function getDevicesSelectMySQL(search_type, inv_code, dev_type, marca, dev_model
|
|
|
2619
2628
|
return query;
|
|
2620
2629
|
}
|
|
2621
2630
|
|
|
2622
|
-
function getDevicesSelectMySQL2(search_type, inv_code, dev_type, marca, dev_model, is_PNRR, dev_status, dev_gestione, id_dev_exclude) {
|
|
2631
|
+
function getDevicesSelectMySQL2(search_type, inv_code, dev_type, marca, dev_model, is_PNRR, dev_status, dev_gestione, no_inv, id_dev_exclude) {
|
|
2623
2632
|
var query = "SELECT DISTINCT d.id, d.type as Tipo, d.manifacturer as Marca, d.model as Modello, ";
|
|
2624
2633
|
query += "case ";
|
|
2625
2634
|
query += "when d.inv_ict3_number != '' and d.inv_ict3_number is not null then d.inv_ict3_number ";
|
|
@@ -2635,7 +2644,7 @@ function getDevicesSelectMySQL2(search_type, inv_code, dev_type, marca, dev_mode
|
|
|
2635
2644
|
query += "left join device_gestioni dg on d.id = dg.id_device"
|
|
2636
2645
|
|
|
2637
2646
|
var where_clause = " where (d.is_removed is null or d.is_removed = 0) ";
|
|
2638
|
-
if (inv_code || dev_type || marca || dev_model || (is_PNRR && is_PNRR > 0) || dev_status || dev_gestione) {
|
|
2647
|
+
if (inv_code || dev_type || marca || dev_model || (is_PNRR && is_PNRR > 0) || dev_status || dev_gestione || no_inv) {
|
|
2639
2648
|
if (inv_code) {
|
|
2640
2649
|
if (search_type == "ESATTA") {
|
|
2641
2650
|
where_clause += " and (d.inv_ict3_number = '" + inv_code + "' or ";
|
|
@@ -2656,60 +2665,64 @@ function getDevicesSelectMySQL2(search_type, inv_code, dev_type, marca, dev_mode
|
|
|
2656
2665
|
where_clause += " and ";
|
|
2657
2666
|
if (dev_type) {
|
|
2658
2667
|
where_clause += "d.type = '" + dev_type + "'";
|
|
2659
|
-
if (marca || (is_PNRR && is_PNRR > 0) || dev_status || dev_model || dev_gestione) {
|
|
2668
|
+
if (marca || (is_PNRR && is_PNRR > 0) || dev_status || dev_model || dev_gestione || no_inv) {
|
|
2660
2669
|
where_clause += " and ";
|
|
2661
2670
|
}
|
|
2662
2671
|
}
|
|
2663
2672
|
if (marca) {
|
|
2664
2673
|
where_clause += " d.manifacturer = '" + marca + "'";
|
|
2665
|
-
if ((is_PNRR && is_PNRR > 0) || dev_status || dev_model || dev_gestione) {
|
|
2674
|
+
if ((is_PNRR && is_PNRR > 0) || dev_status || dev_model || dev_gestione || no_inv) {
|
|
2666
2675
|
where_clause += " and ";
|
|
2667
2676
|
}
|
|
2668
2677
|
}
|
|
2669
2678
|
if (is_PNRR && is_PNRR > 0) {
|
|
2670
2679
|
where_clause += " (d.inv_pnrr_number <> '' and inv_pnrr_number is not null) ";
|
|
2671
|
-
if (dev_status || dev_model || dev_gestione) {
|
|
2680
|
+
if (dev_status || dev_model || dev_gestione || no_inv) {
|
|
2672
2681
|
where_clause += " and ";
|
|
2673
2682
|
}
|
|
2674
2683
|
}
|
|
2675
2684
|
if (dev_model) {
|
|
2676
2685
|
where_clause += " d.model = '" + dev_model + "'";
|
|
2677
|
-
if (dev_status || dev_gestione) {
|
|
2686
|
+
if (dev_status || dev_gestione || no_inv) {
|
|
2678
2687
|
where_clause += " and ";
|
|
2679
2688
|
}
|
|
2680
2689
|
}
|
|
2681
2690
|
if (dev_status) {
|
|
2682
2691
|
where_clause += " du.status = " + dev_status + " and CURDATE() >= du.date_status";
|
|
2683
|
-
if (dev_gestione) {
|
|
2692
|
+
if (dev_gestione || no_inv) {
|
|
2684
2693
|
where_clause += " and ";
|
|
2685
2694
|
}
|
|
2686
2695
|
}
|
|
2687
2696
|
if (dev_gestione) {
|
|
2688
2697
|
where_clause += " dg.id_gestione = " + dev_gestione + " and CURDATE() >= dg.date_start and CURDATE() <= dg.date_end";
|
|
2698
|
+
if (no_inv) {
|
|
2699
|
+
where_clause += " and ";
|
|
2700
|
+
}
|
|
2701
|
+
}
|
|
2702
|
+
if (no_inv) {
|
|
2703
|
+
where_clause += " d.no_inventario = 1";
|
|
2689
2704
|
}
|
|
2690
2705
|
}
|
|
2691
2706
|
}
|
|
2692
|
-
|
|
2693
|
-
|
|
2694
|
-
where_clause += " and d.id <> " + id_dev_exclude;
|
|
2695
|
-
}
|
|
2707
|
+
if (id_dev_exclude > 0) {
|
|
2708
|
+
where_clause += " and d.id <> " + id_dev_exclude;
|
|
2696
2709
|
}
|
|
2697
2710
|
query += where_clause;
|
|
2698
2711
|
return query;
|
|
2699
2712
|
}
|
|
2700
2713
|
|
|
2701
|
-
function getDevicesSelect(db_used, search_type, inv_code, dev_type, marca, dev_model, is_PNRR, dev_status, dev_gestione, id_dev_exclude) {
|
|
2714
|
+
function getDevicesSelect(db_used, search_type, inv_code, dev_type, marca, dev_model, is_PNRR, dev_status, dev_gestione, no_inv,id_dev_exclude) {
|
|
2702
2715
|
var query = "";
|
|
2703
2716
|
if (db_used) {
|
|
2704
2717
|
switch (db_used) {
|
|
2705
2718
|
case 'SQLITE':
|
|
2706
|
-
query = getDevicesSelectSQLite(search_type, inv_code, dev_type, marca, dev_model, is_PNRR, dev_status, dev_gestione, id_dev_exclude);
|
|
2719
|
+
query = getDevicesSelectSQLite(search_type, inv_code, dev_type, marca, dev_model, is_PNRR, dev_status, dev_gestione, no_inv, id_dev_exclude);
|
|
2707
2720
|
break;
|
|
2708
2721
|
case 'MYSQL':
|
|
2709
|
-
query = getDevicesSelectMySQL(search_type, inv_code, dev_type, marca, dev_model, is_PNRR, dev_status, dev_gestione, id_dev_exclude);
|
|
2722
|
+
query = getDevicesSelectMySQL(search_type, inv_code, dev_type, marca, dev_model, is_PNRR, dev_status, dev_gestione, no_inv, id_dev_exclude);
|
|
2710
2723
|
break;
|
|
2711
2724
|
case 'MYSQL2':
|
|
2712
|
-
query = getDevicesSelectMySQL2(search_type, inv_code, dev_type, marca, dev_model, is_PNRR, dev_status, dev_gestione, id_dev_exclude);
|
|
2725
|
+
query = getDevicesSelectMySQL2(search_type, inv_code, dev_type, marca, dev_model, is_PNRR, dev_status, dev_gestione, no_inv, id_dev_exclude);
|
|
2713
2726
|
break;
|
|
2714
2727
|
}
|
|
2715
2728
|
}
|
|
@@ -2720,6 +2733,7 @@ function getDevicesSelect(db_used, search_type, inv_code, dev_type, marca, dev_m
|
|
|
2720
2733
|
function getDevicesByIdDocSQLite(id_doc) {
|
|
2721
2734
|
var query = "SELECT DISTINCT d.id, d.type as Tipo, d.manifacturer as Marca, d.model as Modello, ";
|
|
2722
2735
|
query += "case ";
|
|
2736
|
+
query += "when d.no_inventario is not null and d.no_inventario > 0 then concat(d.id,'(ID)') ";
|
|
2723
2737
|
query += "when d.inv_ict3_number != '' and d.inv_ict3_number is not null then d.inv_ict3_number ";
|
|
2724
2738
|
query += "when d.inv_pnrr_number != '' and d.inv_pnrr_number is not null then d.inv_pnrr_number ";
|
|
2725
2739
|
query += "when d.inv_tn_number != '' and d.inv_tn_number is not null then concat(d.inv_tn_number,'(TN)') ";
|
|
@@ -2736,6 +2750,7 @@ function getDevicesByIdDocSQLite(id_doc) {
|
|
|
2736
2750
|
function getDevicesByIdDocMySQL(id_doc) {
|
|
2737
2751
|
var query = "SELECT DISTINCT d.id, d.type as Tipo, d.manifacturer as Marca, d.model as Modello, ";
|
|
2738
2752
|
query += "case ";
|
|
2753
|
+
query += "when d.no_inventario is not null and d.no_inventario > 0 then concat(d.id,'(ID)') ";
|
|
2739
2754
|
query += "when d.inv_ict3_number != '' and d.inv_ict3_number is not null then d.inv_ict3_number ";
|
|
2740
2755
|
query += "when d.inv_pnrr_number != '' and d.inv_pnrr_number is not null then d.inv_pnrr_number ";
|
|
2741
2756
|
query += "when d.inv_tn_number != '' and d.inv_tn_number is not null then concat(d.inv_tn_number,'(TN)') ";
|
|
@@ -2770,6 +2785,7 @@ function getDevicesByIdDoc(db_used, id_doc) {
|
|
|
2770
2785
|
function getDevicesSelectBySiteSQLite(id_site, dev_type) {
|
|
2771
2786
|
var query = "select distinct d.id, d.type as Tipo, d.manifacturer as Marca, d.model as modello, ";
|
|
2772
2787
|
query += "case ";
|
|
2788
|
+
query += "when d.no_inventario is not null and d.no_inventario > 0 then concat(d.id,'(ID)') ";
|
|
2773
2789
|
query += "when inv_ict3_number != '' and inv_ict3_number is not null then inv_ict3_number ";
|
|
2774
2790
|
query += "when inv_pnrr_number != '' and inv_pnrr_number is not null then inv_pnrr_number ";
|
|
2775
2791
|
query += "when inv_tn_number != '' and inv_tn_number is not null then concat(inv_tn_number,'(TN)') ";
|
|
@@ -2797,6 +2813,7 @@ function getDevicesSelectBySiteSQLite(id_site, dev_type) {
|
|
|
2797
2813
|
function getDevicesSelectBySiteMySQL(id_site, dev_type) {
|
|
2798
2814
|
var query = "select DISTINCT d.id, d.type as Tipo, d.manifacturer as Marca, d.model as modello, ";
|
|
2799
2815
|
query += "case ";
|
|
2816
|
+
query += "when d.no_inventario is not null and d.no_inventario > 0 then concat(d.id,'(ID)') ";
|
|
2800
2817
|
query += "when inv_ict3_number != '' and inv_ict3_number is not null then inv_ict3_number ";
|
|
2801
2818
|
query += "when inv_pnrr_number != '' and inv_pnrr_number is not null then inv_pnrr_number ";
|
|
2802
2819
|
query += "when inv_tn_number != '' and inv_tn_number is not null then concat(inv_tn_number,'(TN)') ";
|
|
@@ -2825,6 +2842,7 @@ function getDevicesSelectBySiteMySQL(id_site, dev_type) {
|
|
|
2825
2842
|
function getDevicesSelectBySiteMySQL2(id_site, dev_type) {
|
|
2826
2843
|
var query = "select distinct d.id, d.type as Tipo, d.manifacturer as Marca, d.model as modello, ";
|
|
2827
2844
|
query += "case ";
|
|
2845
|
+
query += "when d.no_inventario is not null and d.no_inventario > 0 then concat(d.id,'(ID)') ";
|
|
2828
2846
|
query += "when inv_ict3_number != '' and inv_ict3_number is not null then inv_ict3_number ";
|
|
2829
2847
|
query += "when inv_pnrr_number != '' and inv_pnrr_number is not null then inv_pnrr_number ";
|
|
2830
2848
|
query += "when inv_tn_number != '' and inv_tn_number is not null then concat(inv_tn_number,'(TN)') ";
|
|
@@ -2871,6 +2889,7 @@ function getDevicesSelectBySite(db_used, id_site, dev_type) {
|
|
|
2871
2889
|
function getDevicesSelectByPlaceSQLite(id_place, dev_type) {
|
|
2872
2890
|
var query = "select distinct d.id, d.type as Tipo, d.manifacturer as Marca, d.model as modello, ";
|
|
2873
2891
|
query += "case ";
|
|
2892
|
+
query += "when d.no_inventario is not null and d.no_inventario > 0 then concat(d.id,'(ID)') ";
|
|
2874
2893
|
query += "when inv_ict3_number != '' and inv_ict3_number is not null then inv_ict3_number ";
|
|
2875
2894
|
query += "when inv_pnrr_number != '' and inv_pnrr_number is not null then inv_pnrr_number ";
|
|
2876
2895
|
query += "when inv_tn_number != '' and inv_tn_number is not null then concat(inv_tn_number,'(TN)') ";
|
|
@@ -2898,6 +2917,7 @@ function getDevicesSelectByPlaceSQLite(id_place, dev_type) {
|
|
|
2898
2917
|
function getDevicesSelectByPlaceMySQL(id_place, dev_type) {
|
|
2899
2918
|
var query = "select DISTINCT d.id, d.type as Tipo, d.manifacturer as Marca, d.model as modello, ";
|
|
2900
2919
|
query += "case ";
|
|
2920
|
+
query += "when d.no_inventario is not null and d.no_inventario > 0 then concat(d.id,'(ID)') ";
|
|
2901
2921
|
query += "when d.inv_ict3_number != '' and d.inv_ict3_number is not null then d.inv_ict3_number ";
|
|
2902
2922
|
query += "when d.inv_pnrr_number != '' and d.inv_pnrr_number is not null then d.inv_pnrr_number ";
|
|
2903
2923
|
query += "when d.inv_tn_number != '' and d.inv_tn_number is not null then concat(d.inv_tn_number,'(TN)') ";
|
|
@@ -2924,6 +2944,7 @@ function getDevicesSelectByPlaceMySQL(id_place, dev_type) {
|
|
|
2924
2944
|
function getDevicesSelectByPlaceMySQL2(id_place, dev_type) {
|
|
2925
2945
|
var query = "select distinct d.id, d.type as Tipo, d.manifacturer as Marca, d.model as modello, ";
|
|
2926
2946
|
query += "case ";
|
|
2947
|
+
query += "when d.no_inventario is not null and d.no_inventario > 0 then concat(d.id,'(ID)') ";
|
|
2927
2948
|
query += "when inv_ict3_number != '' and inv_ict3_number is not null then inv_ict3_number ";
|
|
2928
2949
|
query += "when inv_pnrr_number != '' and inv_pnrr_number is not null then inv_pnrr_number ";
|
|
2929
2950
|
query += "when inv_tn_number != '' and inv_tn_number is not null then concat(inv_tn_number,'(TN)') ";
|
|
@@ -3070,6 +3091,7 @@ function getDevicesCounterByPlace(db_used, id_place) {
|
|
|
3070
3091
|
function getDevicesSelectByRelatedSQLite(id_device) {
|
|
3071
3092
|
var query = "select type as Tipo, manifacturer as Marca, model as modello, ";
|
|
3072
3093
|
query += "case ";
|
|
3094
|
+
query += "when d.no_inventario is not null and d.no_inventario > 0 then concat(d.id,'(ID)') ";
|
|
3073
3095
|
query += "when inv_ict3_number != '' and inv_ict3_number is not null then inv_ict3_number ";
|
|
3074
3096
|
query += "when inv_pnrr_number != '' and inv_pnrr_number is not null then inv_pnrr_number ";
|
|
3075
3097
|
query += "when inv_tn_number != '' and inv_tn_number is not null then concat(inv_tn_number,'(TN)') ";
|
|
@@ -3090,6 +3112,7 @@ function getDevicesSelectByRelatedSQLite(id_device) {
|
|
|
3090
3112
|
function getDevicesSelectByRelatedMySQL(id_device) {
|
|
3091
3113
|
var query = "select type as Tipo, manifacturer as Marca, model as modello, ";
|
|
3092
3114
|
query += "case ";
|
|
3115
|
+
query += "when d.no_inventario is not null and d.no_inventario > 0 then concat(d.id,'(ID)') ";
|
|
3093
3116
|
query += "when inv_ict3_number != '' and inv_ict3_number is not null then inv_ict3_number ";
|
|
3094
3117
|
query += "when inv_pnrr_number != '' and inv_pnrr_number is not null then inv_pnrr_number ";
|
|
3095
3118
|
query += "when inv_tn_number != '' and inv_tn_number is not null then concat(inv_tn_number,'(TN)') ";
|
|
@@ -3130,7 +3153,7 @@ function queryDeviceByIdSQLite(id_device) {
|
|
|
3130
3153
|
query += "d.manifacturer as Marca, d.model as Modello, ";
|
|
3131
3154
|
query += "d.inv_ict3_number as Inventario, d.serial_no, ";
|
|
3132
3155
|
query += "d.inv_tn_number, d.inv_pnrr_number, d.inv_tndigit_number, ";
|
|
3133
|
-
query += "d.note, d.num_objects from devices d ";
|
|
3156
|
+
query += "d.note, d.num_objects, d.no_inventario from devices d ";
|
|
3134
3157
|
query += "where d.id = " + id_device;
|
|
3135
3158
|
return query;
|
|
3136
3159
|
}
|
|
@@ -3139,7 +3162,7 @@ function queryDeviceByIdMySQL(id_device) {
|
|
|
3139
3162
|
query += "d.manifacturer as Marca, d.model as Modello, ";
|
|
3140
3163
|
query += "d.inv_ict3_number as Inventario, d.serial_no, ";
|
|
3141
3164
|
query += "d.inv_tn_number, d.inv_pnrr_number, d.inv_tndigit_number, ";
|
|
3142
|
-
query += "d.note, d.num_objects from devices d ";
|
|
3165
|
+
query += "d.note, d.num_objects, d.no_inventario from devices d ";
|
|
3143
3166
|
query += "where d.id = :id_device";
|
|
3144
3167
|
return query;
|
|
3145
3168
|
}
|
|
@@ -3167,7 +3190,7 @@ function queryDeviceByIdentificativoSQLite(identificativo) {
|
|
|
3167
3190
|
query += "d.manifacturer as Marca, d.model as Modello, ";
|
|
3168
3191
|
query += "d.inv_ict3_number as Inventario, d.serial_no, ";
|
|
3169
3192
|
query += "d.inv_tn_number, d.inv_pnrr_number, d.inv_tndigit_number, ";
|
|
3170
|
-
query += "d.note, d.num_objects from devices d ";
|
|
3193
|
+
query += "d.note, d.num_objects, d.no_inventario from devices d ";
|
|
3171
3194
|
query += "where (d.inv_ict3_number = '" + identificativo + "' or ";
|
|
3172
3195
|
query += "d.serial_no = '" + identificativo + "' or ";
|
|
3173
3196
|
query += "d.inv_tndigit_number = '" + identificativo + "' or ";
|
|
@@ -3180,7 +3203,7 @@ function queryDeviceByIdentificativoMySQL(identificativo) {
|
|
|
3180
3203
|
query += "d.manifacturer as Marca, d.model as Modello, ";
|
|
3181
3204
|
query += "d.inv_ict3_number as Inventario, d.serial_no, ";
|
|
3182
3205
|
query += "d.inv_tn_number, d.inv_pnrr_number, d.inv_tndigit_number, ";
|
|
3183
|
-
query += "d.note, d.num_objects from devices d ";
|
|
3206
|
+
query += "d.note, d.num_objects, d.no_inventario from devices d ";
|
|
3184
3207
|
query += "where (d.inv_ict3_number = :identificativo or ";
|
|
3185
3208
|
query += "d.serial_no = :identificativo or ";
|
|
3186
3209
|
query += "d.inv_tndigit_number = :identificativo or ";
|
|
@@ -3407,7 +3430,7 @@ function insertDeviceSQLite(dev) {
|
|
|
3407
3430
|
if (dev.note)
|
|
3408
3431
|
note = dev.note;
|
|
3409
3432
|
|
|
3410
|
-
query = "insert into devices (inv_ict3_number, inv_tn_number, inv_pnrr_number, inv_tndigit_number, type, manifacturer, model, serial_no, note, num_objects) ";
|
|
3433
|
+
query = "insert into devices (inv_ict3_number, inv_tn_number, inv_pnrr_number, inv_tndigit_number, type, manifacturer, model, serial_no, note, num_objects, no_inventario) ";
|
|
3411
3434
|
query += "values (";
|
|
3412
3435
|
query += "'" + String(inventario).trim() + "',";
|
|
3413
3436
|
query += "'" + String(inv_comune).trim() + "',";
|
|
@@ -3419,12 +3442,13 @@ function insertDeviceSQLite(dev) {
|
|
|
3419
3442
|
query += "'" + String(serial_no).trim() + "',";
|
|
3420
3443
|
query += "'" + String(note).trim() + "',";
|
|
3421
3444
|
query += dev.num_objects;
|
|
3445
|
+
query += dev.no_inv;
|
|
3422
3446
|
query += ")";
|
|
3423
3447
|
}
|
|
3424
3448
|
return query;
|
|
3425
3449
|
}
|
|
3426
3450
|
function insertDeviceMySQL() {
|
|
3427
|
-
var query = "insert into devices (inv_ict3_number, inv_tn_number, inv_pnrr_number, inv_tndigit_number, type, manifacturer, model, serial_no, note, num_objects) ";
|
|
3451
|
+
var query = "insert into devices (inv_ict3_number, inv_tn_number, inv_pnrr_number, inv_tndigit_number, type, manifacturer, model, serial_no, note, num_objects, no_inventario) ";
|
|
3428
3452
|
query += "values (";
|
|
3429
3453
|
query += ":inventario, ";
|
|
3430
3454
|
query += ":inv_comune, ";
|
|
@@ -3435,7 +3459,8 @@ function insertDeviceMySQL() {
|
|
|
3435
3459
|
query += ":modello, ";
|
|
3436
3460
|
query += ":serial_no, ";
|
|
3437
3461
|
query += ":note, ";
|
|
3438
|
-
query += ":num_objects"
|
|
3462
|
+
query += ":num_objects";
|
|
3463
|
+
query += ":no_inv";
|
|
3439
3464
|
query += ")";
|
|
3440
3465
|
return query;
|
|
3441
3466
|
}
|
|
@@ -3502,7 +3527,8 @@ function updateDeviceSQLite(deviceObj) {
|
|
|
3502
3527
|
query += "model = '" + modello.trim() + "',";
|
|
3503
3528
|
query += "serial_no = '" + serial_no.trim() + "',";
|
|
3504
3529
|
query += "note = '" + note.trim() + "',";
|
|
3505
|
-
query += "num_objects = " + dev.num_objects + " ";
|
|
3530
|
+
query += "num_objects = " + dev.num_objects + ", ";
|
|
3531
|
+
query += "no_inventario = " + dev.no_inv + " ";
|
|
3506
3532
|
query += " where id = " + dev.id;
|
|
3507
3533
|
}
|
|
3508
3534
|
return query;
|
|
@@ -3519,7 +3545,8 @@ function updateDeviceMySQL() {
|
|
|
3519
3545
|
query += "model = :modello, ";
|
|
3520
3546
|
query += "serial_no = :serial_no, ";
|
|
3521
3547
|
query += "note = :note, ";
|
|
3522
|
-
query += "num_objects = :num_objects ";
|
|
3548
|
+
query += "num_objects = :num_objects, ";
|
|
3549
|
+
query += "no_inventario = :no_inv ";
|
|
3523
3550
|
query += " where id = :id_device";
|
|
3524
3551
|
return query;
|
|
3525
3552
|
}
|
|
@@ -3578,6 +3605,7 @@ function getDeviceMySQLPayload(dev) {
|
|
|
3578
3605
|
retValue.note = dev.note;
|
|
3579
3606
|
}
|
|
3580
3607
|
retValue.num_objects = dev.num_objects;
|
|
3608
|
+
retValue.no_inv = dev.no_inv;
|
|
3581
3609
|
payloadObj = {
|
|
3582
3610
|
"inventario": retValue.inventario.trim(),
|
|
3583
3611
|
"inv_comune": retValue.inv_comune.trim(),
|
|
@@ -3589,6 +3617,7 @@ function getDeviceMySQLPayload(dev) {
|
|
|
3589
3617
|
"serial_no": retValue.serial_no.trim(),
|
|
3590
3618
|
"note": retValue.note.trim(),
|
|
3591
3619
|
"num_objects": retValue.num_objects,
|
|
3620
|
+
"no_inv": retValue.no_inv,
|
|
3592
3621
|
"id_device": dev.id
|
|
3593
3622
|
};
|
|
3594
3623
|
}
|
|
@@ -3665,6 +3694,7 @@ function getDevicesSelectComboSQLite(categoria, id_dev_exclude, with_properties)
|
|
|
3665
3694
|
end) as Descrizione
|
|
3666
3695
|
*/
|
|
3667
3696
|
query += "case ";
|
|
3697
|
+
query += "when d.no_inventario is not null and d.no_inventario > 0 then concat(d.id, '(ID)', ' - ', d.type, ' - ', d.manifacturer, ' - ', d.model) ";
|
|
3668
3698
|
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) ";
|
|
3669
3699
|
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) ";
|
|
3670
3700
|
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) ";
|
|
@@ -3692,6 +3722,7 @@ function getDevicesSelectComboSQLite(categoria, id_dev_exclude, with_properties)
|
|
|
3692
3722
|
function getDevicesSelectComboMySQL(categoria, id_dev_exclude, with_properties) {
|
|
3693
3723
|
var query = "SELECT d.id, d.type as Tipo, d.manifacturer as Marca, d.model as Modello, ";
|
|
3694
3724
|
query += "case ";
|
|
3725
|
+
query += "when d.no_inventario is not null and d.no_inventario > 0 then concat(d.id, '(ID)', ' - ', d.type, ' - ', d.manifacturer, ' - ', d.model) ";
|
|
3695
3726
|
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) ";
|
|
3696
3727
|
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) ";
|
|
3697
3728
|
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) ";
|
|
@@ -3737,6 +3768,7 @@ function getDevicesSelectCombo(db_used, categoria, id_dev_exclude, with_properti
|
|
|
3737
3768
|
function getDevicesSelectBySiteComboSQLite(id_site, dev_type) {
|
|
3738
3769
|
var query = "SELECT d.id, d.type as Tipo, d.manifacturer as Marca, d.model as Modello, ";
|
|
3739
3770
|
query += "case ";
|
|
3771
|
+
query += "when d.no_inventario is not null and d.no_inventario > 0 then concat(d.id, '(ID)', ' - ', d.type, ' - ', d.manifacturer, ' - ', d.model) ";
|
|
3740
3772
|
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) ";
|
|
3741
3773
|
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) ";
|
|
3742
3774
|
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) ";
|
|
@@ -3757,6 +3789,7 @@ function getDevicesSelectBySiteComboSQLite(id_site, dev_type) {
|
|
|
3757
3789
|
function getDevicesSelectBySiteComboMySQL(id_site, dev_type) {
|
|
3758
3790
|
var query = "SELECT d.id, d.type as Tipo, d.manifacturer as Marca, d.model as Modello, ";
|
|
3759
3791
|
query += "case ";
|
|
3792
|
+
query += "when d.no_inventario is not null and d.no_inventario > 0 then concat(d.id, '(ID)', ' - ', d.type, ' - ', d.manifacturer, ' - ', d.model) ";
|
|
3760
3793
|
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) ";
|
|
3761
3794
|
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) ";
|
|
3762
3795
|
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) ";
|
|
@@ -3777,6 +3810,7 @@ function getDevicesSelectBySiteComboMySQL(id_site, dev_type) {
|
|
|
3777
3810
|
function getDevicesSelectBySiteComboMySQL2(id_site, dev_type) {
|
|
3778
3811
|
var query = "SELECT d.id, d.type as Tipo, d.manifacturer as Marca, d.model as Modello, ";
|
|
3779
3812
|
query += "case ";
|
|
3813
|
+
query += "when d.no_inventario is not null and d.no_inventario > 0 then concat(d.id, '(ID)', ' - ', d.type, ' - ', d.manifacturer, ' - ', d.model) ";
|
|
3780
3814
|
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) ";
|
|
3781
3815
|
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) ";
|
|
3782
3816
|
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) ";
|
|
@@ -3880,6 +3914,7 @@ function readDeviceProperties(db_used, id_device) {
|
|
|
3880
3914
|
function getDevicesWithPropertiesSQLite(id_device) {
|
|
3881
3915
|
var query = "select ";
|
|
3882
3916
|
query += "case ";
|
|
3917
|
+
query += "when d.no_inventario is not null and d.no_inventario > 0 then concat(d.id, '(ID)') ";
|
|
3883
3918
|
query += "when d.inv_ict3_number != '' and d.inv_ict3_number is not null then d.inv_ict3_number ";
|
|
3884
3919
|
query += "when d.inv_pnrr_number != '' and d.inv_pnrr_number is not null then d.inv_pnrr_number ";
|
|
3885
3920
|
query += "when d.inv_tn_number != '' and d.inv_tn_number is not null then concat(d.inv_tn_number,'(TN)') ";
|
|
@@ -3898,6 +3933,7 @@ function getDevicesWithPropertiesSQLite(id_device) {
|
|
|
3898
3933
|
function getDevicesWithPropertiesMySQL(id_device) {
|
|
3899
3934
|
var query = "select ";
|
|
3900
3935
|
query += "case ";
|
|
3936
|
+
query += "when d.no_inventario is not null and d.no_inventario > 0 then concat(d.id, '(ID)') ";
|
|
3901
3937
|
query += "when d.inv_ict3_number != '' and d.inv_ict3_number is not null then d.inv_ict3_number ";
|
|
3902
3938
|
query += "when d.inv_pnrr_number != '' and d.inv_pnrr_number is not null then d.inv_pnrr_number ";
|
|
3903
3939
|
query += "when d.inv_tn_number != '' and d.inv_tn_number is not null then concat(d.inv_tn_number,'(TN)') ";
|
|
@@ -8499,6 +8535,209 @@ function checkDocumentoDevice(db_used, id_device, id_doc) {
|
|
|
8499
8535
|
return query;
|
|
8500
8536
|
}
|
|
8501
8537
|
|
|
8538
|
+
// Altri beni
|
|
8539
|
+
function queryDocumentsIdAltroBeneSQLite(id_bene) {
|
|
8540
|
+
var query = "select distinct c.id, c.tipo, c.data_emissione, c.descrizione, ";
|
|
8541
|
+
query += "case ";
|
|
8542
|
+
query += "when is_collaudo = 1 then 'Collaudo' ";
|
|
8543
|
+
query += "when is_acquisto = 1 then 'Acquisto' ";
|
|
8544
|
+
query += "when is_dismissione = 1 then 'Dismissione' ";
|
|
8545
|
+
query += "end as motivo ";
|
|
8546
|
+
query += "from documenti c ";
|
|
8547
|
+
query += "join altri_beni_doc ac on ac.id_doc = c.id ";
|
|
8548
|
+
query += "where ac.id_bene = " + id_bene;
|
|
8549
|
+
return query;
|
|
8550
|
+
}
|
|
8551
|
+
function queryDocumentsIdAltroBeneMySQL(id_bene) {
|
|
8552
|
+
var query = "select distinct c.id, c.tipo, c.data_emissione, c.descrizione, ";
|
|
8553
|
+
query += "case ";
|
|
8554
|
+
query += "when is_collaudo = 1 then 'Collaudo' ";
|
|
8555
|
+
query += "when is_acquisto = 1 then 'Acquisto' ";
|
|
8556
|
+
query += "when is_dismissione = 1 then 'Dismissione' ";
|
|
8557
|
+
query += "end as motivo ";
|
|
8558
|
+
query += "from documenti c ";
|
|
8559
|
+
query += "join altri_beni_doc ac on ac.id_doc = c.id ";
|
|
8560
|
+
query += "where ac.id_device = :id_device";
|
|
8561
|
+
return query;
|
|
8562
|
+
}
|
|
8563
|
+
|
|
8564
|
+
function queryDocumentsIdAltroBene(db_used, id_bene) {
|
|
8565
|
+
var query = "";
|
|
8566
|
+
if (db_used) {
|
|
8567
|
+
switch (db_used) {
|
|
8568
|
+
case 'SQLITE':
|
|
8569
|
+
query = queryDocumentsIdAltroBeneSQLite(id_bene);
|
|
8570
|
+
break;
|
|
8571
|
+
case 'MYSQL':
|
|
8572
|
+
query = queryDocumentsIdAltroBeneMySQL(id_bene);
|
|
8573
|
+
break;
|
|
8574
|
+
case 'MYSQL2':
|
|
8575
|
+
query = queryDocumentsIdAltroBeneSQLite(id_bene);
|
|
8576
|
+
break;
|
|
8577
|
+
}
|
|
8578
|
+
}
|
|
8579
|
+
return query;
|
|
8580
|
+
}
|
|
8581
|
+
|
|
8582
|
+
function insertDocumentoAltroBeneSQLite(id_bene, id_doc, scopo) {
|
|
8583
|
+
let collaudoFlag = 0;
|
|
8584
|
+
let acquistoFlag = 0;
|
|
8585
|
+
let dismissioneFlag = 0;
|
|
8586
|
+
switch (scopo) {
|
|
8587
|
+
case 'ACQUISTO':
|
|
8588
|
+
acquistoFlag = 1;
|
|
8589
|
+
break;
|
|
8590
|
+
case 'COLLAUDO':
|
|
8591
|
+
collaudoFlag = 1;
|
|
8592
|
+
break;
|
|
8593
|
+
case 'DISMISSIONE':
|
|
8594
|
+
dismissioneFlag = 1;
|
|
8595
|
+
break;
|
|
8596
|
+
default:
|
|
8597
|
+
break;
|
|
8598
|
+
}
|
|
8599
|
+
var query = "insert into altri_beni_doc (id_bene, id_doc, is_acquisto, is_collaudo, is_dismissione) values ";
|
|
8600
|
+
query += "(" + id_bene + ", " + id_doc + ", ";
|
|
8601
|
+
query += acquistoFlag + ", ";
|
|
8602
|
+
query += collaudoFlag + ", ";
|
|
8603
|
+
query += dismissioneFlag;
|
|
8604
|
+
query += ")";
|
|
8605
|
+
return query;
|
|
8606
|
+
}
|
|
8607
|
+
function insertDocumentoAltroBeneMySQL(id_bene, id_doc, scopo) {
|
|
8608
|
+
let collaudoFlag = 0;
|
|
8609
|
+
let acquistoFlag = 0;
|
|
8610
|
+
let dismissioneFlag = 0;
|
|
8611
|
+
switch (scopo) {
|
|
8612
|
+
case 'ACQUISTO':
|
|
8613
|
+
acquistoFlag = 1;
|
|
8614
|
+
break;
|
|
8615
|
+
case 'COLLAUDO':
|
|
8616
|
+
collaudoFlag = 1;
|
|
8617
|
+
break;
|
|
8618
|
+
case 'DISMISSIONE':
|
|
8619
|
+
dismissioneFlag = 1;
|
|
8620
|
+
break;
|
|
8621
|
+
default:
|
|
8622
|
+
break;
|
|
8623
|
+
}
|
|
8624
|
+
var query = "insert into altri_beni_doc (id_bene, id_doc, is_acquisto, is_collaudo, is_dismissione) values ";
|
|
8625
|
+
query += "(:id_bene, :id_doc, ";
|
|
8626
|
+
query += acquistoFlag + ", ";
|
|
8627
|
+
query += collaudoFlag + ", ";
|
|
8628
|
+
query += dismissioneFlag;
|
|
8629
|
+
query += ")";
|
|
8630
|
+
return query;
|
|
8631
|
+
}
|
|
8632
|
+
function insertDocumentoAltroBene(db_used, id_bene, id_doc, scopo) {
|
|
8633
|
+
var query = "";
|
|
8634
|
+
if (db_used) {
|
|
8635
|
+
switch (db_used) {
|
|
8636
|
+
case 'SQLITE':
|
|
8637
|
+
query = insertDocumentoAltroBeneSQLite(id_bene, id_doc, scopo);
|
|
8638
|
+
break;
|
|
8639
|
+
case 'MYSQL':
|
|
8640
|
+
query = insertDocumentoAltroBeneMySQL(id_bene, id_doc, scopo);
|
|
8641
|
+
break;
|
|
8642
|
+
case 'MYSQL2':
|
|
8643
|
+
query = insertDocumentoAltroBeneSQLite(id_bene, id_doc, scopo);
|
|
8644
|
+
break;
|
|
8645
|
+
}
|
|
8646
|
+
}
|
|
8647
|
+
return query;
|
|
8648
|
+
}
|
|
8649
|
+
|
|
8650
|
+
|
|
8651
|
+
function removeDocumentoAltroBeneSQLite(id_bene, id_doc) {
|
|
8652
|
+
var query = "delete from altri_beni_doc ";
|
|
8653
|
+
query += "where id_bene = " + id_bene + " and ";
|
|
8654
|
+
query += "id_doc = " + id_doc;
|
|
8655
|
+
return query;
|
|
8656
|
+
}
|
|
8657
|
+
function removeDocumentoAltroBeneMySQL(id_bene, id_doc) {
|
|
8658
|
+
var query = "delete from altri_beni_doc ";
|
|
8659
|
+
query += "where id_bene = :id_bene and ";
|
|
8660
|
+
query += "id_doc = :id_doc";
|
|
8661
|
+
return query;
|
|
8662
|
+
}
|
|
8663
|
+
function removeDocumentoAltroBene(db_used, id_bene, id_doc) {
|
|
8664
|
+
var query = "";
|
|
8665
|
+
if (db_used) {
|
|
8666
|
+
switch (db_used) {
|
|
8667
|
+
case 'SQLITE':
|
|
8668
|
+
query = removeDocumentoAltroBeneSQLite(id_bene, id_doc);
|
|
8669
|
+
break;
|
|
8670
|
+
case 'MYSQL':
|
|
8671
|
+
query = removeDocumentoAltroBeneMySQL(id_bene, id_doc);
|
|
8672
|
+
break;
|
|
8673
|
+
case 'MYSQL2':
|
|
8674
|
+
query = removeDocumentoAltroBeneSQLite(id_bene, id_doc);
|
|
8675
|
+
break;
|
|
8676
|
+
}
|
|
8677
|
+
}
|
|
8678
|
+
return query;
|
|
8679
|
+
}
|
|
8680
|
+
|
|
8681
|
+
function selectDocumentoAltroBeneByIdSQLite(id_docdev) {
|
|
8682
|
+
var query = "select id, id_device, id_doc, is_acquisto, is_collaudo, is_dismissione from device_doc ";
|
|
8683
|
+
query += "where id = " + id_docdev;
|
|
8684
|
+
return query;
|
|
8685
|
+
}
|
|
8686
|
+
|
|
8687
|
+
function selectDocumentoAltroBeneByIdMySQL(id_docdev) {
|
|
8688
|
+
var query = "select id, id_device, id_doc, is_acquisto, is_collaudo, is_dismissione from device_doc ";
|
|
8689
|
+
query += "where id = :id_docdev";
|
|
8690
|
+
return query;
|
|
8691
|
+
}
|
|
8692
|
+
function selectDocumentoAltroBeneById(db_used, id_docdev) {
|
|
8693
|
+
var query = "";
|
|
8694
|
+
if (db_used) {
|
|
8695
|
+
switch (db_used) {
|
|
8696
|
+
case 'SQLITE':
|
|
8697
|
+
query = selectDocumentoAltroBeneByIdSQLite(id_docdev);
|
|
8698
|
+
break;
|
|
8699
|
+
case 'MYSQL':
|
|
8700
|
+
query = selectDocumentoAltroBeneByIdMySQL(id_docdev);
|
|
8701
|
+
break;
|
|
8702
|
+
case 'MYSQL2':
|
|
8703
|
+
query = selectDocumentoAltroBeneByIdSQLite(id_docdev);
|
|
8704
|
+
break;
|
|
8705
|
+
}
|
|
8706
|
+
}
|
|
8707
|
+
return query;
|
|
8708
|
+
}
|
|
8709
|
+
|
|
8710
|
+
|
|
8711
|
+
function checkDocumentoAltroBeneSQLite(id_bene, id_doc) {
|
|
8712
|
+
var query = "select count(*) as num from device_doc ";
|
|
8713
|
+
query += "where id_bene = " + id_bene + " and id_doc = " + id_doc;
|
|
8714
|
+
return query;
|
|
8715
|
+
}
|
|
8716
|
+
function checkDocumentoAltroBeneMySQL(id_bene, id_doc) {
|
|
8717
|
+
var query = "select count(*) as num from device_doc ";
|
|
8718
|
+
query += "where id_bene = :id_bene and id_doc = :id_doc";
|
|
8719
|
+
return query;
|
|
8720
|
+
}
|
|
8721
|
+
function checkDocumentoAltroBene(db_used, id_bene, id_doc) {
|
|
8722
|
+
var query = "";
|
|
8723
|
+
if (db_used) {
|
|
8724
|
+
switch (db_used) {
|
|
8725
|
+
case 'SQLITE':
|
|
8726
|
+
query = checkDocumentoAltroBeneSQLite(id_bene, id_doc);
|
|
8727
|
+
break;
|
|
8728
|
+
case 'MYSQL':
|
|
8729
|
+
query = checkDocumentoAltroBeneMySQL(id_bene, id_doc);
|
|
8730
|
+
break;
|
|
8731
|
+
case 'MYSQL2':
|
|
8732
|
+
query = checkDocumentoAltroBeneSQLite(id_bene, id_doc);
|
|
8733
|
+
break;
|
|
8734
|
+
}
|
|
8735
|
+
}
|
|
8736
|
+
return query;
|
|
8737
|
+
}
|
|
8738
|
+
|
|
8739
|
+
// End altri beni
|
|
8740
|
+
|
|
8502
8741
|
function getDocumentByIdDocSQLite(id_doc) {
|
|
8503
8742
|
var query = "select c.id, c.tipo, c.anno, c.data_emissione, c.descrizione, c.riferimento, c.nome_originale, c.nome_uuid from documenti c ";
|
|
8504
8743
|
query += "where c.id = " + id_doc;
|
|
@@ -12840,6 +13079,9 @@ module.exports = {
|
|
|
12840
13079
|
queryDocumentsIdDevice,
|
|
12841
13080
|
insertDocumentoDevice,
|
|
12842
13081
|
removeDocumentoDevice,
|
|
13082
|
+
queryDocumentsIdAltroBene,
|
|
13083
|
+
insertDocumentoAltroBene,
|
|
13084
|
+
removeDocumentoAltroBene,
|
|
12843
13085
|
selectDocumentoById,
|
|
12844
13086
|
selectDocuments,
|
|
12845
13087
|
selectDocumentiCombo,
|
|
@@ -12851,6 +13093,8 @@ module.exports = {
|
|
|
12851
13093
|
queryDocumentoMotivo,
|
|
12852
13094
|
checkDocumentoDevice,
|
|
12853
13095
|
selectDocumentoDeviceById,
|
|
13096
|
+
checkDocumentoAltroBene,
|
|
13097
|
+
selectDocumentoAltroBeneById,
|
|
12854
13098
|
//
|
|
12855
13099
|
selectDismissioniByYear,
|
|
12856
13100
|
selectDismissioneById,
|