alsmanager_lib 2.0.77 → 2.0.79

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.
Files changed (2) hide show
  1. package/lib/modules.js +36 -18
  2. package/package.json +1 -1
package/lib/modules.js CHANGED
@@ -2420,7 +2420,7 @@ function queryDeviceModelsByFilter(db_used, manifacturer, dev_type) {
2420
2420
  //end of Manage models
2421
2421
 
2422
2422
  // Device select
2423
- function getDevicesSelectSQLite(search_type, inv_code, dev_type, marca, is_PNRR, dev_status, dev_gestione, id_dev_exclude) {
2423
+ function getDevicesSelectSQLite(search_type, inv_code, dev_type, marca, dev_model, is_PNRR, dev_status, dev_gestione, id_dev_exclude) {
2424
2424
  var query = "SELECT DISTINCT d.id, d.type as Tipo, d.manifacturer as Marca, d.model as Modello, ";
2425
2425
  query += "case ";
2426
2426
  query += "when d.inv_ict3_number != '' and d.inv_ict3_number is not null then d.inv_ict3_number ";
@@ -2436,7 +2436,7 @@ function getDevicesSelectSQLite(search_type, inv_code, dev_type, marca, is_PNRR,
2436
2436
  query += "left join device_gestioni dg on d.id = dg.id_device"
2437
2437
 
2438
2438
  var where_clause = " where (d.is_removed is null or d.is_removed = 0) ";
2439
- 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) {
2440
2440
  if (inv_code) {
2441
2441
  if (search_type == "ESATTA") {
2442
2442
  where_clause += " and (d.inv_ict3_number = '" + inv_code + "' or ";
@@ -2457,22 +2457,28 @@ function getDevicesSelectSQLite(search_type, inv_code, dev_type, marca, is_PNRR,
2457
2457
  where_clause += " and ";
2458
2458
  if (dev_type) {
2459
2459
  where_clause += "d.type = '" + dev_type + "'";
2460
- if (marca || (is_PNRR && is_PNRR > 0) || dev_status) {
2460
+ if (marca || (is_PNRR && is_PNRR > 0) || dev_status || dev_model || dev_gestione) {
2461
2461
  where_clause += " and ";
2462
2462
  }
2463
2463
  }
2464
2464
  if (marca) {
2465
2465
  where_clause += " d.manifacturer = '" + marca + "'";
2466
- if ((is_PNRR && is_PNRR > 0) || dev_status) {
2466
+ if ((is_PNRR && is_PNRR > 0) || dev_status || dev_model || dev_gestione) {
2467
2467
  where_clause += " and ";
2468
2468
  }
2469
2469
  }
2470
2470
  if (is_PNRR && is_PNRR > 0) {
2471
2471
  where_clause += " (d.inv_pnrr_number <> '' and inv_pnrr_number is not null) ";
2472
- if (dev_status || dev_gestione) {
2472
+ if (dev_status || dev_gestione || dev_model) {
2473
2473
  where_clause += " and ";
2474
2474
  }
2475
2475
  }
2476
+ if (dev_model) {
2477
+ where_clause += " d.model = '" + dev_model + "'";
2478
+ if (dev_status || dev_gestione) {
2479
+ where_clause += " and ";
2480
+ }
2481
+ }
2476
2482
  if (dev_status) {
2477
2483
  where_clause += " du.status = " + dev_status + " and date('now') >= du.date_status";
2478
2484
  if (dev_gestione) {
@@ -2493,7 +2499,7 @@ function getDevicesSelectSQLite(search_type, inv_code, dev_type, marca, is_PNRR,
2493
2499
  return query;
2494
2500
  }
2495
2501
 
2496
- 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) {
2497
2503
  var query = "SELECT DISTINCT d.id, d.type as Tipo, d.manifacturer as Marca, d.model as Modello, ";
2498
2504
  query += "case ";
2499
2505
  query += "when d.inv_ict3_number != '' and d.inv_ict3_number is not null then d.inv_ict3_number ";
@@ -2510,7 +2516,7 @@ function getDevicesSelectMySQL(search_type, inv_code, dev_type, marca, is_PNRR,
2510
2516
 
2511
2517
 
2512
2518
  var where_clause = " where (d.is_removed is null or d.is_removed = 0) ";
2513
- 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) {
2514
2520
  if (inv_code) {
2515
2521
  if (search_type == "ESATTA") {
2516
2522
  where_clause += " and (d.inv_ict3_number = :inv_code or ";
@@ -2531,18 +2537,24 @@ function getDevicesSelectMySQL(search_type, inv_code, dev_type, marca, is_PNRR,
2531
2537
  where_clause += " and ";
2532
2538
  if (dev_type) {
2533
2539
  where_clause += " d.type = :dev_type";
2534
- if (marca || (is_PNRR && is_PNRR > 0)) {
2540
+ if (marca || dev_model || (is_PNRR && is_PNRR > 0 || dev_status || dev_gestione)) {
2535
2541
  where_clause += " and ";
2536
2542
  }
2537
2543
  }
2538
2544
  if (marca) {
2539
2545
  where_clause += " d.manifacturer = :marca";
2540
- if (is_PNRR && is_PNRR > 0) {
2546
+ if (dev_model || is_PNRR && is_PNRR > 0 || dev_status || dev_gestione) {
2541
2547
  where_clause += " and ";
2542
2548
  }
2543
2549
  }
2544
2550
  if (is_PNRR && is_PNRR > 0) {
2545
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 ";
2546
2558
  if (dev_status || dev_gestione) {
2547
2559
  where_clause += " and ";
2548
2560
  }
@@ -2569,7 +2581,7 @@ function getDevicesSelectMySQL(search_type, inv_code, dev_type, marca, is_PNRR,
2569
2581
  return query;
2570
2582
  }
2571
2583
 
2572
- 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) {
2573
2585
  var query = "SELECT DISTINCT d.id, d.type as Tipo, d.manifacturer as Marca, d.model as Modello, ";
2574
2586
  query += "case ";
2575
2587
  query += "when d.inv_ict3_number != '' and d.inv_ict3_number is not null then d.inv_ict3_number ";
@@ -2585,7 +2597,7 @@ function getDevicesSelectMySQL2(search_type, inv_code, dev_type, marca, is_PNRR,
2585
2597
  query += "left join device_gestioni dg on d.id = dg.id_device"
2586
2598
 
2587
2599
  var where_clause = " where (d.is_removed is null or d.is_removed = 0) ";
2588
- 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) {
2589
2601
  if (inv_code) {
2590
2602
  if (search_type == "ESATTA") {
2591
2603
  where_clause += " and (d.inv_ict3_number = '" + inv_code + "' or ";
@@ -2606,22 +2618,28 @@ function getDevicesSelectMySQL2(search_type, inv_code, dev_type, marca, is_PNRR,
2606
2618
  where_clause += " and ";
2607
2619
  if (dev_type) {
2608
2620
  where_clause += "d.type = '" + dev_type + "'";
2609
- if (marca || (is_PNRR && is_PNRR > 0) || dev_status) {
2621
+ if (marca || (is_PNRR && is_PNRR > 0) || dev_status || dev_model || dev_gestione) {
2610
2622
  where_clause += " and ";
2611
2623
  }
2612
2624
  }
2613
2625
  if (marca) {
2614
2626
  where_clause += " d.manifacturer = '" + marca + "'";
2615
- if ((is_PNRR && is_PNRR > 0) || dev_status) {
2627
+ if ((is_PNRR && is_PNRR > 0) || dev_status || dev_model || dev_gestione) {
2616
2628
  where_clause += " and ";
2617
2629
  }
2618
2630
  }
2619
2631
  if (is_PNRR && is_PNRR > 0) {
2620
2632
  where_clause += " (d.inv_pnrr_number <> '' and inv_pnrr_number is not null) ";
2621
- if (dev_status || dev_gestione) {
2633
+ if (dev_status || dev_model || dev_gestione) {
2622
2634
  where_clause += " and ";
2623
2635
  }
2624
2636
  }
2637
+ if (dev_model) {
2638
+ where_clause += " d.model = '" + dev_model + "'";
2639
+ if (dev_status || dev_gestione) {
2640
+ where_clause += " and ";
2641
+ }
2642
+ }
2625
2643
  if (dev_status) {
2626
2644
  where_clause += " du.status = " + dev_status + " and CURDATE() >= du.date_status";
2627
2645
  if (dev_gestione) {
@@ -2642,18 +2660,18 @@ function getDevicesSelectMySQL2(search_type, inv_code, dev_type, marca, is_PNRR,
2642
2660
  return query;
2643
2661
  }
2644
2662
 
2645
- 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) {
2646
2664
  var query = "";
2647
2665
  if (db_used) {
2648
2666
  switch (db_used) {
2649
2667
  case 'SQLITE':
2650
- 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);
2651
2669
  break;
2652
2670
  case 'MYSQL':
2653
- 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);
2654
2672
  break;
2655
2673
  case 'MYSQL2':
2656
- 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);
2657
2675
  break;
2658
2676
  }
2659
2677
  }
package/package.json CHANGED
@@ -4,7 +4,7 @@
4
4
  ".": "./lib/modules.js",
5
5
  "./dbconn": "./lib/dbconn.js"
6
6
  },
7
- "version": "2.0.77",
7
+ "version": "2.0.79",
8
8
  "description": "Funzioni per ALSManager",
9
9
  "license": "ISC",
10
10
  "author": "Luca Cattani",