CMXX - Changed history to equipment_history

This commit is contained in:
“VeLiTi”
2024-12-02 15:40:05 +01:00
parent 868d73c6b5
commit ad51669e32
17 changed files with 103 additions and 68 deletions

View File

@@ -56,7 +56,7 @@ case 'validateSerial':
//BUILD SQL
$whereclause = "WHERE description like '%$filter1%'";
$sql = "SELECT rowID from history $whereclause";
$sql = "SELECT rowID FROM equipment_history $whereclause";
$stmt = $pdo->prepare($sql);
$stmt->execute();
//Get results
@@ -115,11 +115,11 @@ $sn_found = 0;
switch ($_GET['type']) {
case 'latest':
if ($sn_found == 1){
$whereclause .= ' AND h.rowID in (Select MAX(h.rowID) AS row_ID FROM history h GROUP BY h.equipmentid)';
$whereclause .= ' AND h.rowID in (Select MAX(h.rowID) AS row_ID FROM equipment_history h GROUP BY h.equipmentid)';
}
else
{
$whereclause = "WHERE h.rowID in (Select MAX(h.rowID) AS row_ID FROM history h WHERE h.description like '%historycreated%' GROUP BY h.equipmentid)";
$whereclause = "WHERE h.rowID in (Select MAX(h.rowID) AS row_ID FROM equipment_history h WHERE h.description like '%historycreated%' GROUP BY h.equipmentid)";
}
break;
@@ -152,7 +152,7 @@ $sn_found = 0;
// +++++++++++++++++++++++++++++++++++++++++++++++++++++++
$pdo = dbConnect($dbname);
$sql = "SELECT h.rowID, h.description from history h $whereclause";
$sql = "SELECT h.rowID, h.description FROM equipment_history h $whereclause";
$stmt = $pdo->prepare($sql);
$stmt->execute();
//Get results
@@ -338,7 +338,7 @@ case 'getCartest':
//CONNECT TO DB
$pdo = dbConnect($dbname);
$sql = "SELECT * from history where type='cartest' group by SUBSTRING_INDEX(SUBSTRING_INDEX(description, '$filter1', -1),'$filter2',1), SUBSTRING_INDEX(SUBSTRING_INDEX(description, '$filter2', -1),'$filter3',1) ORDER BY description ASC";
$sql = "SELECT * FROM equipment_history where type='cartest' group by SUBSTRING_INDEX(SUBSTRING_INDEX(description, '$filter1', -1),'$filter2',1), SUBSTRING_INDEX(SUBSTRING_INDEX(description, '$filter2', -1),'$filter3',1) ORDER BY description ASC";
$stmt = $pdo->prepare($sql);
$stmt->execute();
//Get results