alsmanager_lib 2.0.30 → 2.0.32

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 +7 -7
  2. package/package.json +1 -1
package/lib/modules.js CHANGED
@@ -4502,7 +4502,7 @@ function queryDeviceTypes() {
4502
4502
  return query;
4503
4503
  }
4504
4504
  // Define getDevicesNotAllocatedCombo
4505
- function getDevicesNotAllocatedComboSQLite(sel_type, sel_maker, ordered_by) {
4505
+ function getDevicesNotAllocatedComboSQLite(id_site, id_place, sel_type, sel_maker, ordered_by) {
4506
4506
  var sel_type_str = "";
4507
4507
  if (sel_type) {
4508
4508
  sel_type_str = sel_type;
@@ -4524,7 +4524,7 @@ function getDevicesNotAllocatedComboSQLite(sel_type, sel_maker, ordered_by) {
4524
4524
  query += "left join site_destinations sd on ds.id_site = sd.id_site ";
4525
4525
  query += "where (d.is_removed is null or d.is_removed = 0) "
4526
4526
  query += "and (ds.id_place is null ";
4527
- query += "or (ds.date_in <= date('now') and ds.date_out >= date('now') and sd.type = 'MAGAZZINO')) ";
4527
+ query += "or ((ds.date_in <= date('now') and ds.date_out >= date('now') and sd.type = 'MAGAZZINO')) and (ds.id_place <> '" + id_place + "' and ds.id_site <> " + id_site + "))) ";
4528
4528
  if (sel_type_str.trim() != '') {
4529
4529
  query += "and d.type = '" + sel_type_str.trim() + "' ";
4530
4530
  }
@@ -4540,7 +4540,7 @@ function getDevicesNotAllocatedComboSQLite(sel_type, sel_maker, ordered_by) {
4540
4540
  return query;
4541
4541
  }
4542
4542
 
4543
- function getDevicesNotAllocatedComboMySQL(sel_type, sel_maker,ordered_by) {
4543
+ function getDevicesNotAllocatedComboMySQL(id_site, id_place, sel_type, sel_maker,ordered_by) {
4544
4544
  var sel_type_str = "";
4545
4545
  if (sel_type) {
4546
4546
  sel_type_str = sel_type;
@@ -4562,7 +4562,7 @@ function getDevicesNotAllocatedComboMySQL(sel_type, sel_maker,ordered_by) {
4562
4562
  query += "left join site_destinations sd on ds.id_site = sd.id_site ";
4563
4563
  query += "where (d.is_removed is null or d.is_removed = 0) "
4564
4564
  query += "and (ds.id_place is null ";
4565
- query += "or (ds.date_in <= CURDATE() and ds.date_out >= CURDATE() and sd.type = 'MAGAZZINO')) ";
4565
+ query += "or ((ds.date_in <= date('now') and ds.date_out >= date('now') and sd.type = 'MAGAZZINO')) and (ds.id_place <> :id_place and ds.id_site <> :id_site))) ";
4566
4566
  if (sel_type_str.trim() != '') {
4567
4567
  query += "and d.type = :dev_type ";
4568
4568
  }
@@ -4577,15 +4577,15 @@ function getDevicesNotAllocatedComboMySQL(sel_type, sel_maker,ordered_by) {
4577
4577
  }
4578
4578
  return query;
4579
4579
  }
4580
- function getDevicesNotAllocatedCombo(db_used, sel_type, sel_maker, ordered_by) {
4580
+ function getDevicesNotAllocatedCombo(db_used, id_site, id_place, sel_type, sel_maker, ordered_by) {
4581
4581
  var query = "";
4582
4582
  if (db_used) {
4583
4583
  switch (db_used) {
4584
4584
  case 'SQLITE':
4585
- query = getDevicesNotAllocatedComboSQLite(sel_type, sel_maker, ordered_by);
4585
+ query = getDevicesNotAllocatedComboSQLite(id_site, id_place, sel_type, sel_maker, ordered_by);
4586
4586
  break;
4587
4587
  case 'MYSQL':
4588
- query = getDevicesNotAllocatedComboMySQL(sel_type, sel_maker, ordered_by);
4588
+ query = getDevicesNotAllocatedComboMySQL(id_site, id_place, sel_type, sel_maker, ordered_by);
4589
4589
  break;
4590
4590
  }
4591
4591
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "alsmanager_lib",
3
- "version": "2.0.30",
3
+ "version": "2.0.32",
4
4
  "description": "Funzioni per ALSManager",
5
5
  "license": "ISC",
6
6
  "author": "Luca Cattani",