alsmanager_lib 1.0.91 → 1.0.93

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 +50 -14
  2. package/package.json +1 -1
package/lib/modules.js CHANGED
@@ -1323,6 +1323,41 @@ function getLastPartInserted(db_used, id_device, id_conf, part_type) {
1323
1323
  }
1324
1324
  return query;
1325
1325
  }
1326
+
1327
+ function existPartInConfigSQLite(id_device, id_conf, id_part, part_type) {
1328
+ var query = "select count(*) as num from change_config ";
1329
+ query += "where id_device = " + id_device + " ";
1330
+ query += "and part_type = '" + part_type + "' ";
1331
+ query += "and id_conf = " + id_conf + " ";
1332
+ query += "and id_part = " + id_part;
1333
+ return query;
1334
+ }
1335
+
1336
+ function existPartInConfigMySQL(id_device, id_conf, id_part, part_type) {
1337
+ var query = "select count(*) as num from change_config ";
1338
+ query += "where id_device = :id_device ";
1339
+ query += "and part_type = :part_type ";
1340
+ query += "and id_conf = :id_conf ";
1341
+ query += "and id_part = :id_part";
1342
+ return query;
1343
+ }
1344
+
1345
+ function existPartInConfig(db_used, id_device, id_conf, id_part, part_type) {
1346
+ var query = "";
1347
+ if (db_used) {
1348
+ switch (db_used) {
1349
+ case 'SQLITE':
1350
+ query = existPartInConfigSQLite(id_device, id_conf, id_part, part_type);
1351
+ break;
1352
+ case 'MYSQL':
1353
+ query = existPartInConfigMySQL(id_device, id_conf, id_part, part_type);
1354
+ break;
1355
+ }
1356
+ }
1357
+ return query;
1358
+ }
1359
+
1360
+
1326
1361
  //End Device configurations
1327
1362
  // Disk usage
1328
1363
  function getDiskUsagesByIdStorageSQLite(id_storage) {
@@ -1540,23 +1575,23 @@ function existsPCProperties(db_used, id_device) {
1540
1575
  return query;
1541
1576
  }
1542
1577
  function getPCPropertiesSQLite(id_device) {
1543
- var query = "select d.id as Id, d.type as Tipo, d.manifacturer as Marca, d.model as Modello,";
1578
+ var query = "select dp.id as id_prop, d.id as Id, d.type as Tipo, d.manifacturer as Marca, d.model as Modello,";
1544
1579
  query += "dp.pc_name as Name, dp.CPU as CPU, dp.CPU_arch as CPUArch, dp.OS_arch as OSArch, dp.OS as OS, dp.OS_version as OSVersion, ";
1545
1580
  query += "dp.smartboard_ready as SB_Ready, dp.video_card as VideoCardAdded, ";
1546
1581
  query += "dp.RAM_GB as RAM, dp.note, dp.da_properties ";
1547
- query += "from devices d ";
1548
- query += "left join device_pc dp on d.id = dp.id_device ";
1549
- query += "where d.id = " + id_device;
1582
+ query += "from device_pc dp ";
1583
+ query += "left join devices d on dp.id_device = d.id ";
1584
+ query += "where dp.id = " + id_device;
1550
1585
 
1551
1586
  return query;
1552
1587
  }
1553
1588
  function getPCPropertiesMySQL(id_device) {
1554
- var query = "select d.id as Id, d.type as Tipo, d.manifacturer as Marca, d.model as Modello,";
1589
+ var query = "select dp.id as id_prop, d.id as Id, d.type as Tipo, d.manifacturer as Marca, d.model as Modello,";
1555
1590
  query += "dp.pc_name as Name, dp.CPU as CPU, dp.CPU_arch as CPUArch, dp.OS_arch as OSArch, dp.OS as OS, dp.OS_version as OSVersion, ";
1556
1591
  query += "dp.smartboard_ready as SB_Ready, dp.video_card as VideoCardAdded, ";
1557
1592
  query += "dp.RAM_GB as RAM, dp.note, dp.da_properties ";
1558
- query += "from devices d ";
1559
- query += "left join device_pc dp on d.id = dp.id_device ";
1593
+ query += "from device_pc dp ";
1594
+ query += "left join devices d on dp.id_device = d.id ";
1560
1595
  query += "where d.id = :id_device";
1561
1596
  return query;
1562
1597
  }
@@ -1577,7 +1612,7 @@ function getPCProperties(db_used, id_device) {
1577
1612
  }
1578
1613
  function createPCPropertiesMySQLObj(id_device, dev_prop) {
1579
1614
  var obj = {};
1580
- obj.id = dev_prop.id;
1615
+ obj.id = dev_prop.id_prop;
1581
1616
  obj.id_device = id_device;
1582
1617
  obj.pc_name = dev_prop.pc_name;
1583
1618
  obj.os = dev_prop.os;
@@ -1697,9 +1732,9 @@ function getPCPropertiesByConfigSQLite(id_device, id_conf) {
1697
1732
  query += "dp.pc_name as Name, dp.CPU as CPU, dp.CPU_arch as CPUArch, dp.OS_arch as OSArch, dp.OS as OS, dp.OS_version as OSVersion, ";
1698
1733
  query += "dp.smartboard_ready as SB_Ready, dp.video_card as VideoCardAdded, ";
1699
1734
  query += "dp.RAM_GB as RAM, dp.note, dp.da_properties ";
1700
- query += "from devices d ";
1701
- query += "left join device_pc dp on d.id = dp.id_device ";
1702
- query += "where d.id = " + id_device + " ";
1735
+ query += "from device_pc dp ";
1736
+ query += "left join devices d on dp.id_device = d.id ";
1737
+ query += "where dp.id_device = " + id_device + " ";
1703
1738
  if (id_conf > 0) {
1704
1739
  query += "and dp.id in (select id_part from change_config where id_conf = " + id_conf + ")";
1705
1740
  }
@@ -1713,9 +1748,9 @@ function getPCPropertiesByConfigMySQL(id_device, id_conf) {
1713
1748
  query += "dp.pc_name as Name, dp.CPU as CPU, dp.CPU_arch as CPUArch, dp.OS_arch as OSArch, dp.OS as OS, dp.OS_version as OSVersion, ";
1714
1749
  query += "dp.smartboard_ready as SB_Ready, dp.video_card as VideoCardAdded, ";
1715
1750
  query += "dp.RAM_GB as RAM, dp.note, dp.da_properties ";
1716
- query += "from devices d ";
1717
- query += "left join device_pc dp on d.id = dp.id_device ";
1718
- query += "where d.id = :id_device ";
1751
+ query += "from device_pc dp ";
1752
+ query += "left join devices d on dp.id_device = d.id ";
1753
+ query += "where dp.id_device = :id_device ";
1719
1754
  if (id_conf > 0) {
1720
1755
  query += "and dp.id in (select id_part from change_config where id_conf = :id_conf)";
1721
1756
  }
@@ -8970,6 +9005,7 @@ module.exports = {
8970
9005
  updatePartChanged,
8971
9006
  removePartChanged,
8972
9007
  getLastPartInserted,
9008
+ existPartInConfig,
8973
9009
  //
8974
9010
  selectBeneDaInventario,
8975
9011
  getDevicesSelectForInventarioRaw,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "alsmanager_lib",
3
- "version": "1.0.91",
3
+ "version": "1.0.93",
4
4
  "description": "Funzioni per ALSManager",
5
5
  "license": "ISC",
6
6
  "author": "Luca Cattani",