mirror of
https://github.com/jokob-sk/NetAlertX.git
synced 2026-04-15 22:51:37 -07:00
fix dev_Network_Node_MAC bug (rename was needed)
This commit is contained in:
@@ -1555,6 +1555,26 @@ def upgradeDB ():
|
|||||||
);
|
);
|
||||||
""")
|
""")
|
||||||
|
|
||||||
|
# Alter Devices table
|
||||||
|
# dev_Network_Node_MAC_ADDR column
|
||||||
|
dev_Network_Node_MAC_ADDR_missing = sql.execute ("""
|
||||||
|
SELECT COUNT(*) AS CNTREC FROM pragma_table_info('Devices') WHERE name='dev_Network_Node_MAC_ADDR'
|
||||||
|
""").fetchone()[0] == 0
|
||||||
|
|
||||||
|
if dev_Network_Node_MAC_ADDR_missing :
|
||||||
|
sql.execute("""
|
||||||
|
ALTER TABLE "Devices" ADD "dev_Network_Node_MAC_ADDR" TEXT
|
||||||
|
""")
|
||||||
|
|
||||||
|
# dev_Network_Node_port column
|
||||||
|
dev_Network_Node_port_missing = sql.execute ("""
|
||||||
|
SELECT COUNT(*) AS CNTREC FROM pragma_table_info('Devices') WHERE name='dev_Network_Node_port'
|
||||||
|
""").fetchone()[0] == 0
|
||||||
|
|
||||||
|
if dev_Network_Node_port_missing :
|
||||||
|
sql.execute("""
|
||||||
|
ALTER TABLE "Devices" ADD "dev_Network_Node_port" INTEGER
|
||||||
|
""")
|
||||||
|
|
||||||
#-------------------------------------------------------------------------------
|
#-------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
|||||||
@@ -1229,7 +1229,7 @@ function getDeviceData (readAllData=false) {
|
|||||||
$('#txtGroup').val (deviceData['dev_Group']);
|
$('#txtGroup').val (deviceData['dev_Group']);
|
||||||
$('#txtLocation').val (deviceData['dev_Location']);
|
$('#txtLocation').val (deviceData['dev_Location']);
|
||||||
$('#txtComments').val (deviceData['dev_Comments']);
|
$('#txtComments').val (deviceData['dev_Comments']);
|
||||||
$('#txtNetworkNodeMac').val (deviceData['dev_Network_Node_MAC']);
|
$('#txtNetworkNodeMac').val (deviceData['dev_Network_Node_MAC_ADDR']);
|
||||||
$('#txtNetworkPort').val (deviceData['dev_Network_Node_port']);
|
$('#txtNetworkPort').val (deviceData['dev_Network_Node_port']);
|
||||||
|
|
||||||
$('#txtFirstConnection').val (deviceData['dev_FirstConnection']);
|
$('#txtFirstConnection').val (deviceData['dev_FirstConnection']);
|
||||||
|
|||||||
+3
-11
@@ -21,14 +21,6 @@
|
|||||||
$NETWORKTYPES = getNetworkTypes();
|
$NETWORKTYPES = getNetworkTypes();
|
||||||
|
|
||||||
OpenDB();
|
OpenDB();
|
||||||
|
|
||||||
// #####################################
|
|
||||||
// ## Expand Devices Table
|
|
||||||
// #####################################
|
|
||||||
$sql = 'ALTER TABLE "Devices" ADD "dev_Network_Node_MAC" INTEGER';
|
|
||||||
$result = $db->query($sql);
|
|
||||||
$sql = 'ALTER TABLE "Devices" ADD "dev_Network_Node_port" INTEGER';
|
|
||||||
$result = $db->query($sql);
|
|
||||||
?>
|
?>
|
||||||
|
|
||||||
<!-- Page ------------------------------------------------------------------ -->
|
<!-- Page ------------------------------------------------------------------ -->
|
||||||
@@ -156,7 +148,7 @@
|
|||||||
dev_DeviceType as type,
|
dev_DeviceType as type,
|
||||||
dev_LastIP as last_ip,
|
dev_LastIP as last_ip,
|
||||||
(select dev_DeviceType from Devices a where dev_MAC = "'.$node_mac.'") as node_type
|
(select dev_DeviceType from Devices a where dev_MAC = "'.$node_mac.'") as node_type
|
||||||
FROM Devices WHERE dev_Network_Node_MAC = "'.$node_mac.'" order by port asc';
|
FROM Devices WHERE dev_Network_Node_MAC_ADDR = "'.$node_mac.'" order by port asc';
|
||||||
|
|
||||||
global $db;
|
global $db;
|
||||||
$func_result = $db->query($func_sql);
|
$func_result = $db->query($func_sql);
|
||||||
@@ -274,10 +266,10 @@
|
|||||||
) t1
|
) t1
|
||||||
LEFT JOIN
|
LEFT JOIN
|
||||||
(
|
(
|
||||||
SELECT b.dev_Network_Node_MAC as node_mac_2,
|
SELECT b.dev_Network_Node_MAC_ADDR as node_mac_2,
|
||||||
count() as node_ports_count
|
count() as node_ports_count
|
||||||
FROM Devices b
|
FROM Devices b
|
||||||
WHERE b.dev_Network_Node_MAC NOT NULL group by b.dev_Network_Node_MAC
|
WHERE b.dev_Network_Node_MAC_ADDR NOT NULL group by b.dev_Network_Node_MAC_ADDR
|
||||||
) t2
|
) t2
|
||||||
ON (t1.node_mac = t2.node_mac_2);
|
ON (t1.node_mac = t2.node_mac_2);
|
||||||
";
|
";
|
||||||
|
|||||||
@@ -96,7 +96,7 @@ function getDeviceData() {
|
|||||||
$deviceData = $row;
|
$deviceData = $row;
|
||||||
$mac = $deviceData['dev_MAC'];
|
$mac = $deviceData['dev_MAC'];
|
||||||
|
|
||||||
$deviceData['dev_Network_Node_MAC'] = $row['dev_Network_Node_MAC'];
|
$deviceData['dev_Network_Node_MAC_ADDR'] = $row['dev_Network_Node_MAC_ADDR'];
|
||||||
$deviceData['dev_Network_Node_port'] = $row['dev_Network_Node_port'];
|
$deviceData['dev_Network_Node_port'] = $row['dev_Network_Node_port'];
|
||||||
$deviceData['dev_FirstConnection'] = formatDate ($row['dev_FirstConnection']); // Date formated
|
$deviceData['dev_FirstConnection'] = formatDate ($row['dev_FirstConnection']); // Date formated
|
||||||
$deviceData['dev_LastConnection'] = formatDate ($row['dev_LastConnection']); // Date formated
|
$deviceData['dev_LastConnection'] = formatDate ($row['dev_LastConnection']); // Date formated
|
||||||
@@ -167,7 +167,7 @@ function setDeviceData() {
|
|||||||
dev_Group = "'. quotes($_REQUEST['group']) .'",
|
dev_Group = "'. quotes($_REQUEST['group']) .'",
|
||||||
dev_Location = "'. quotes($_REQUEST['location']) .'",
|
dev_Location = "'. quotes($_REQUEST['location']) .'",
|
||||||
dev_Comments = "'. quotes($_REQUEST['comments']) .'",
|
dev_Comments = "'. quotes($_REQUEST['comments']) .'",
|
||||||
dev_Network_Node_MAC = "'. quotes($_REQUEST['networknode']).'",
|
dev_Network_Node_MAC_ADDR = "'. quotes($_REQUEST['networknode']).'",
|
||||||
dev_Network_Node_port = "'. quotes($_REQUEST['networknodeport']).'",
|
dev_Network_Node_port = "'. quotes($_REQUEST['networknodeport']).'",
|
||||||
dev_StaticIP = "'. quotes($_REQUEST['staticIP']) .'",
|
dev_StaticIP = "'. quotes($_REQUEST['staticIP']) .'",
|
||||||
dev_ScanCycle = "'. quotes($_REQUEST['scancycle']) .'",
|
dev_ScanCycle = "'. quotes($_REQUEST['scancycle']) .'",
|
||||||
|
|||||||
Reference in New Issue
Block a user