alsmanager_lib 1.0.87 → 1.0.89
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.
- package/lib/modules.js +60 -2
- package/package.json +1 -1
package/lib/modules.js
CHANGED
|
@@ -1108,8 +1108,13 @@ function getDeviceConfigurationById(db_used, id_conf) {
|
|
|
1108
1108
|
}
|
|
1109
1109
|
|
|
1110
1110
|
function insertDeviceConfigurationSQLite(id_device, data, note) {
|
|
1111
|
+
var data_str = "";
|
|
1112
|
+
if (data) {
|
|
1113
|
+
var d = new Date(data);
|
|
1114
|
+
data_str = d.getFullYear() + "-" + String((d.getMonth() + 1)).padStart(2, '0') + "-" + String(d.getDate()).padStart(2, '0');
|
|
1115
|
+
}
|
|
1111
1116
|
var query = "insert into device_changes (id_device, date_conf, note) values (";
|
|
1112
|
-
query += id_device + ", '" +
|
|
1117
|
+
query += id_device + ", '" + data_str + "', '" + note + "')";
|
|
1113
1118
|
return query;
|
|
1114
1119
|
}
|
|
1115
1120
|
function insertDeviceConfigurationMySQL(id_device, data, note) {
|
|
@@ -1133,8 +1138,13 @@ function insertDeviceConfiguration(db_used, id_device, data, note) {
|
|
|
1133
1138
|
}
|
|
1134
1139
|
|
|
1135
1140
|
function updateDeviceConfigurationSQLite(id_conf, data, note) {
|
|
1141
|
+
var data_str = "";
|
|
1142
|
+
if (data) {
|
|
1143
|
+
var d = new Date(data);
|
|
1144
|
+
data_str = d.getFullYear() + "-" + String((d.getMonth() + 1)).padStart(2, '0') + "-" + String(d.getDate()).padStart(2, '0');
|
|
1145
|
+
}
|
|
1136
1146
|
var query = "update device_changes set ";
|
|
1137
|
-
query += "date_conf = '" +
|
|
1147
|
+
query += "date_conf = '" + data_str +"',";
|
|
1138
1148
|
query += "note = '" + note + "' ";
|
|
1139
1149
|
query += "where id = " + id_conf;
|
|
1140
1150
|
return query;
|
|
@@ -1642,6 +1652,53 @@ function updatePCProperties(db_used, id_device, dev_prop) {
|
|
|
1642
1652
|
}
|
|
1643
1653
|
return query;
|
|
1644
1654
|
}
|
|
1655
|
+
//
|
|
1656
|
+
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,";
|
|
1658
|
+
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
|
+
query += "dp.smartboard_ready as SB_Ready, dp.video_card as VideoCardAdded, ";
|
|
1660
|
+
query += "dp.RAM_GB as RAM, dp.note, dp.da_properties ";
|
|
1661
|
+
query += "from devices d ";
|
|
1662
|
+
query += "left join device_pc dp on d.id = dp.id_device ";
|
|
1663
|
+
query += "where d.id = " + id_device;
|
|
1664
|
+
if (id_conf > 0) {
|
|
1665
|
+
query += "and d.id in (select id_part from change_config where id_conf = " + id_conf + ")";
|
|
1666
|
+
}
|
|
1667
|
+
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)"
|
|
1669
|
+
}
|
|
1670
|
+
return query;
|
|
1671
|
+
}
|
|
1672
|
+
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,";
|
|
1674
|
+
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
|
+
query += "dp.smartboard_ready as SB_Ready, dp.video_card as VideoCardAdded, ";
|
|
1676
|
+
query += "dp.RAM_GB as RAM, dp.note, dp.da_properties ";
|
|
1677
|
+
query += "from devices d ";
|
|
1678
|
+
query += "left join device_pc dp on d.id = dp.id_device ";
|
|
1679
|
+
query += "where d.id = :id_device ";
|
|
1680
|
+
if (id_conf > 0) {
|
|
1681
|
+
query += "and d.id in (select id_part from change_config where id_conf = :id_conf)";
|
|
1682
|
+
}
|
|
1683
|
+
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)"
|
|
1685
|
+
}
|
|
1686
|
+
return query;
|
|
1687
|
+
}
|
|
1688
|
+
function getPCPropertiesByConfig(db_used, id_device, id_conf) {
|
|
1689
|
+
var query = "";
|
|
1690
|
+
if (db_used) {
|
|
1691
|
+
switch (db_used) {
|
|
1692
|
+
case 'SQLITE':
|
|
1693
|
+
query = getPCPropertiesByConfigSQLite(id_device, id_conf);
|
|
1694
|
+
break;
|
|
1695
|
+
case 'MYSQL':
|
|
1696
|
+
query = getPCPropertiesByConfigMySQL(id_device, id_conf);
|
|
1697
|
+
break;
|
|
1698
|
+
}
|
|
1699
|
+
}
|
|
1700
|
+
return query;
|
|
1701
|
+
}
|
|
1645
1702
|
//End Manage PC Properties
|
|
1646
1703
|
// Manage Display Part Properties
|
|
1647
1704
|
function getDisplayPartPropertiesSQLite(id_device) {
|
|
@@ -8814,6 +8871,7 @@ module.exports = {
|
|
|
8814
8871
|
createPCPropertiesMySQLObj,
|
|
8815
8872
|
insertPCProperties,
|
|
8816
8873
|
updatePCProperties,
|
|
8874
|
+
getPCPropertiesByConfig,
|
|
8817
8875
|
existsDisplayProperties,
|
|
8818
8876
|
getDisplayProperties,
|
|
8819
8877
|
createDisplayPropertiesMySQLObj,
|