alsmanager_lib 1.0.90 → 1.0.91

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 +47 -7
  2. package/package.json +1 -1
package/lib/modules.js CHANGED
@@ -1577,6 +1577,7 @@ function getPCProperties(db_used, id_device) {
1577
1577
  }
1578
1578
  function createPCPropertiesMySQLObj(id_device, dev_prop) {
1579
1579
  var obj = {};
1580
+ obj.id = dev_prop.id;
1580
1581
  obj.id_device = id_device;
1581
1582
  obj.pc_name = dev_prop.pc_name;
1582
1583
  obj.os = dev_prop.os;
@@ -1631,7 +1632,8 @@ function updatePCPropertiesSQLite(id_device, dev_prop) {
1631
1632
  query += "smartboard_ready = " + dev_prop.smartboard_ready + ", ";
1632
1633
  query += "note = '" + dev_prop.note + "', ";
1633
1634
  query += "da_properties = " + dev_prop.da_properties + " ";
1634
- query += "where id_device = " + id_device
1635
+ query += "where id_device = " + id_device + " ";
1636
+ query += "and id = " + dev_prop.id;
1635
1637
  return query;
1636
1638
  }
1637
1639
 
@@ -1652,9 +1654,46 @@ function updatePCProperties(db_used, id_device, dev_prop) {
1652
1654
  }
1653
1655
  return query;
1654
1656
  }
1657
+ function getLastPCPropertiesInsertedSQLite(id_device) {
1658
+ var query = "select dp.id as id_prop, d.id as Id, d.type as Tipo, d.manifacturer as Marca, d.model as Modello,";
1659
+ 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, ";
1660
+ query += "dp.smartboard_ready as SB_Ready, dp.video_card as VideoCardAdded, ";
1661
+ query += "dp.RAM_GB as RAM, dp.note, dp.da_properties ";
1662
+ query += "from device_pc dp ";
1663
+ query += "left join devices d on dp.id_device = d.id ";
1664
+ query += "where dp.id_device = " + id_device + " ";
1665
+ query += "order by id desc LIMIT 1";
1666
+ return query;
1667
+ }
1668
+ function getLastPCPropertiesInsertedMySQL(id_device) {
1669
+ var query = "select dp.id as id_prop, d.id as Id, d.type as Tipo, d.manifacturer as Marca, d.model as Modello,";
1670
+ 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, ";
1671
+ query += "dp.smartboard_ready as SB_Ready, dp.video_card as VideoCardAdded, ";
1672
+ query += "dp.RAM_GB as RAM, dp.note, dp.da_properties ";
1673
+ query += "from device_pc dp ";
1674
+ query += "left join devices d on dp.id_device = d.id ";
1675
+ query += "where dp.id_device = :id_device ";
1676
+ query += "order by id desc LIMIT 1";
1677
+ return query;
1678
+ }
1679
+ function getLastPCPropertiesInserted(db_used, id_device) {
1680
+ var query = "";
1681
+ if (db_used) {
1682
+ switch (db_used) {
1683
+ case 'SQLITE':
1684
+ query = getLastPCPropertiesInsertedSQLite(id_device);
1685
+ break;
1686
+ case 'MYSQL':
1687
+ query = getLastPCPropertiesInsertedMySQL(id_device);
1688
+ break;
1689
+ }
1690
+ }
1691
+ return query;
1692
+ }
1693
+
1655
1694
  //
1656
1695
  function getPCPropertiesByConfigSQLite(id_device, id_conf) {
1657
- var query = "select d.id as Id, d.type as Tipo, d.manifacturer as Marca, d.model as Modello,";
1696
+ var query = "select dp.id as id_prop, d.id as Id, d.type as Tipo, d.manifacturer as Marca, d.model as Modello,";
1658
1697
  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, ";
1659
1698
  query += "dp.smartboard_ready as SB_Ready, dp.video_card as VideoCardAdded, ";
1660
1699
  query += "dp.RAM_GB as RAM, dp.note, dp.da_properties ";
@@ -1662,15 +1701,15 @@ function getPCPropertiesByConfigSQLite(id_device, id_conf) {
1662
1701
  query += "left join device_pc dp on d.id = dp.id_device ";
1663
1702
  query += "where d.id = " + id_device + " ";
1664
1703
  if (id_conf > 0) {
1665
- query += "and d.id in (select id_part from change_config where id_conf = " + id_conf + ")";
1704
+ query += "and dp.id in (select id_part from change_config where id_conf = " + id_conf + ")";
1666
1705
  }
1667
1706
  else {
1668
- query += "and d.id in (select id_part from change_config where id_device = " + id_device + " and part_type = 'PC' order by id desc LIMIT 1)"
1707
+ query += "and dp.id in (select id_part from change_config where id_device = " + id_device + " and part_type = 'PC' order by id desc LIMIT 1)"
1669
1708
  }
1670
1709
  return query;
1671
1710
  }
1672
1711
  function getPCPropertiesByConfigMySQL(id_device, id_conf) {
1673
- var query = "select d.id as Id, d.type as Tipo, d.manifacturer as Marca, d.model as Modello,";
1712
+ var query = "select dp.id as id_prop, d.id as Id, d.type as Tipo, d.manifacturer as Marca, d.model as Modello,";
1674
1713
  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, ";
1675
1714
  query += "dp.smartboard_ready as SB_Ready, dp.video_card as VideoCardAdded, ";
1676
1715
  query += "dp.RAM_GB as RAM, dp.note, dp.da_properties ";
@@ -1678,10 +1717,10 @@ function getPCPropertiesByConfigMySQL(id_device, id_conf) {
1678
1717
  query += "left join device_pc dp on d.id = dp.id_device ";
1679
1718
  query += "where d.id = :id_device ";
1680
1719
  if (id_conf > 0) {
1681
- query += "and d.id in (select id_part from change_config where id_conf = :id_conf)";
1720
+ query += "and dp.id in (select id_part from change_config where id_conf = :id_conf)";
1682
1721
  }
1683
1722
  else {
1684
- query += "and d.id in (select id_part from change_config where id_device = :id_device and part_type = 'PC' order by id desc LIMIT 1)"
1723
+ query += "and dp.id in (select id_part from change_config where id_device = :id_device and part_type = 'PC' order by id desc LIMIT 1)"
1685
1724
  }
1686
1725
  return query;
1687
1726
  }
@@ -8871,6 +8910,7 @@ module.exports = {
8871
8910
  createPCPropertiesMySQLObj,
8872
8911
  insertPCProperties,
8873
8912
  updatePCProperties,
8913
+ getLastPCPropertiesInserted,
8874
8914
  getPCPropertiesByConfig,
8875
8915
  existsDisplayProperties,
8876
8916
  getDisplayProperties,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "alsmanager_lib",
3
- "version": "1.0.90",
3
+ "version": "1.0.91",
4
4
  "description": "Funzioni per ALSManager",
5
5
  "license": "ISC",
6
6
  "author": "Luca Cattani",