alsmanager_lib 2.0.26 → 2.0.27

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 +67 -10
  2. package/package.json +1 -1
package/lib/modules.js CHANGED
@@ -4479,7 +4479,15 @@ function queryDeviceTypes() {
4479
4479
  return query;
4480
4480
  }
4481
4481
  // Define getDevicesNotAllocatedCombo
4482
- function getDevicesNotAllocatedComboSQLite(ordered_by) {
4482
+ function getDevicesNotAllocatedComboSQLite(sel_type, sel_maker, ordered_by) {
4483
+ var sel_type_str = "";
4484
+ if (sel_type) {
4485
+ sel_type_str = sel_type;
4486
+ }
4487
+ var sel_maker_str = "";
4488
+ if (sel_maker) {
4489
+ sel_maker_str = sel_maker;
4490
+ }
4483
4491
  var query = "SELECT d.id, d.type as Tipo, d.manifacturer as Marca, d.model as Modello, ";
4484
4492
  query += "case ";
4485
4493
  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) ";
@@ -4494,6 +4502,12 @@ function getDevicesNotAllocatedComboSQLite(ordered_by) {
4494
4502
  query += "where (d.is_removed is null or d.is_removed = 0) "
4495
4503
  query += "and (ds.id_place is null ";
4496
4504
  query += "or (ds.date_in <= date('now') and ds.date_out >= date('now') and sd.type = 'MAGAZZINO')) ";
4505
+ if (sel_type_str.trim() != '') {
4506
+ query += "and d.type = '" + sel_type_str.trim() + "' ";
4507
+ }
4508
+ if (sel_maker_str.trim() != '') {
4509
+ query += "and d.manifacturer = '" + sel_maker_str.trim() + "' ";
4510
+ }
4497
4511
  if (ordered_by && ordered_by == "ID") {
4498
4512
  query += "order by d.id desc";
4499
4513
  }
@@ -4503,7 +4517,15 @@ function getDevicesNotAllocatedComboSQLite(ordered_by) {
4503
4517
  return query;
4504
4518
  }
4505
4519
 
4506
- function getDevicesNotAllocatedComboMySQL(ordered_by) {
4520
+ function getDevicesNotAllocatedComboMySQL(sel_type, sel_maker,ordered_by) {
4521
+ var sel_type_str = "";
4522
+ if (sel_type) {
4523
+ sel_type_str = sel_type;
4524
+ }
4525
+ var sel_maker_str = "";
4526
+ if (sel_maker) {
4527
+ sel_maker_str = sel_maker;
4528
+ }
4507
4529
  var query = "SELECT d.id, d.type as Tipo, d.manifacturer as Marca, d.model as Modello, ";
4508
4530
  query += "case ";
4509
4531
  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) ";
@@ -4518,6 +4540,12 @@ function getDevicesNotAllocatedComboMySQL(ordered_by) {
4518
4540
  query += "where (d.is_removed is null or d.is_removed = 0) "
4519
4541
  query += "and (ds.id_place is null ";
4520
4542
  query += "or (ds.date_in <= CURDATE() and ds.date_out >= CURDATE() and sd.type = 'MAGAZZINO')) ";
4543
+ if (sel_type_str.trim() != '') {
4544
+ query += "and d.type = :dev_type ";
4545
+ }
4546
+ if (sel_maker_str.trim() != '') {
4547
+ query += "and d.manifacturer = :dev_manifacturer ";
4548
+ }
4521
4549
  if (ordered_by && ordered_by == "ID") {
4522
4550
  query += "order by d.id desc";
4523
4551
  }
@@ -4526,15 +4554,15 @@ function getDevicesNotAllocatedComboMySQL(ordered_by) {
4526
4554
  }
4527
4555
  return query;
4528
4556
  }
4529
- function getDevicesNotAllocatedCombo(db_used,ordered_by) {
4557
+ function getDevicesNotAllocatedCombo(db_used, sel_type, sel_maker, ordered_by) {
4530
4558
  var query = "";
4531
4559
  if (db_used) {
4532
4560
  switch (db_used) {
4533
4561
  case 'SQLITE':
4534
- query = getDevicesNotAllocatedComboSQLite(ordered_by);
4562
+ query = getDevicesNotAllocatedComboSQLite(sel_type, sel_maker, ordered_by);
4535
4563
  break;
4536
4564
  case 'MYSQL':
4537
- query = getDevicesNotAllocatedComboMySQL(ordered_by);
4565
+ query = getDevicesNotAllocatedComboMySQL(sel_type, sel_maker, ordered_by);
4538
4566
  break;
4539
4567
  }
4540
4568
  }
@@ -4542,7 +4570,16 @@ function getDevicesNotAllocatedCombo(db_used,ordered_by) {
4542
4570
  }
4543
4571
  // End getDevicesNotAllocatedCombo
4544
4572
  // Define getDevicesAllocatedCombo
4545
- function getDevicesAllocatedComboSQLite(id_site, id_place, ordered_by) {
4573
+ function getDevicesAllocatedComboSQLite(id_site, id_place, sel_type, sel_maker, ordered_by) {
4574
+ var sel_type_str = "";
4575
+ if (sel_type) {
4576
+ sel_type_str = sel_type;
4577
+ }
4578
+ var sel_maker_str = "";
4579
+ if (sel_maker) {
4580
+ sel_maker_str = sel_maker;
4581
+ }
4582
+
4546
4583
  var query = "SELECT d.id, d.type as Tipo, d.manifacturer as Marca, d.model as Modello, ";
4547
4584
  query += "case ";
4548
4585
  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) ";
@@ -4557,6 +4594,12 @@ function getDevicesAllocatedComboSQLite(id_site, id_place, ordered_by) {
4557
4594
  query += "where (d.is_removed is null or d.is_removed = 0) "
4558
4595
  query += "and (ds.id_place is not null ";
4559
4596
  query += "or (ds.date_in <= date('now') and ds.date_out >= date('now') and ds.id_site <> " + id_site + " and ds.id_place <> '" + id_place + "')) ";
4597
+ if (sel_type_str.trim() != '') {
4598
+ query += "and d.type = '" + sel_type_str.trim() + "' ";
4599
+ }
4600
+ if (sel_maker_str.trim() != '') {
4601
+ query += "and d.manifacturer = '" + sel_maker_str.trim() + "' ";
4602
+ }
4560
4603
  if (ordered_by && ordered_by == "ID") {
4561
4604
  query += "order by d.id desc";
4562
4605
  }
@@ -4565,7 +4608,15 @@ function getDevicesAllocatedComboSQLite(id_site, id_place, ordered_by) {
4565
4608
  }
4566
4609
  return query;
4567
4610
  }
4568
- function getDevicesAllocatedComboMySQL(id_site, id_place, ordered_by) {
4611
+ function getDevicesAllocatedComboMySQL(id_site, id_place, sel_type, sel_maker, ordered_by) {
4612
+ var sel_type_str = "";
4613
+ if (sel_type) {
4614
+ sel_type_str = sel_type;
4615
+ }
4616
+ var sel_maker_str = "";
4617
+ if (sel_maker) {
4618
+ sel_maker_str = sel_maker;
4619
+ }
4569
4620
  var query = "SELECT d.id, d.type as Tipo, d.manifacturer as Marca, d.model as Modello, ";
4570
4621
  query += "case ";
4571
4622
  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) ";
@@ -4580,6 +4631,12 @@ function getDevicesAllocatedComboMySQL(id_site, id_place, ordered_by) {
4580
4631
  query += "where (d.is_removed is null or d.is_removed = 0) "
4581
4632
  query += "and (ds.id_place is not null ";
4582
4633
  query += "or (ds.date_in <= CURDATE() and ds.date_out >= CURDATE() and ds.id_site <> :id_site and ds.id_place <> :id_place)) ";
4634
+ if (sel_type_str.trim() != '') {
4635
+ query += "and d.type = :dev_type ";
4636
+ }
4637
+ if (sel_maker_str.trim() != '') {
4638
+ query += "and d.manifacturer = :dev_manifacturer ";
4639
+ }
4583
4640
  if (ordered_by && ordered_by == "ID") {
4584
4641
  query += "order by d.id desc";
4585
4642
  }
@@ -4588,15 +4645,15 @@ function getDevicesAllocatedComboMySQL(id_site, id_place, ordered_by) {
4588
4645
  }
4589
4646
  return query;
4590
4647
  }
4591
- function getDevicesAllocatedCombo(db_used, id_site, id_place, ordered_by) {
4648
+ function getDevicesAllocatedCombo(db_used, id_site, id_place, sel_type, sel_maker, ordered_by) {
4592
4649
  var query = "";
4593
4650
  if (db_used) {
4594
4651
  switch (db_used) {
4595
4652
  case 'SQLITE':
4596
- query = getDevicesAllocatedComboSQLite(id_site, id_place, ordered_by);
4653
+ query = getDevicesAllocatedComboSQLite(id_site, id_place, sel_type, sel_maker, ordered_by);
4597
4654
  break;
4598
4655
  case 'MYSQL':
4599
- query = getDevicesAllocatedComboMySQL(id_site, id_place, ordered_by);
4656
+ query = getDevicesAllocatedComboMySQL(id_site, id_place, sel_type, sel_maker, ordered_by);
4600
4657
  break;
4601
4658
  }
4602
4659
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "alsmanager_lib",
3
- "version": "2.0.26",
3
+ "version": "2.0.27",
4
4
  "description": "Funzioni per ALSManager",
5
5
  "license": "ISC",
6
6
  "author": "Luca Cattani",