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

@@ -180,10 +180,10 @@ if (isset($post_content['sn']) && isset($post_content['payload'])){
}
// +++++++++++++++++++++++++++++++++++++++++++++++++++++++
// Insert or update history item ++++++++++++++++++++++++
// Insert or UPDATE equipment_history item ++++++++++++++++++++++++
// +++++++++++++++++++++++++++++++++++++++++++++++++++++++
if ($updateObject_visual == 1){
$sql = "UPDATE history SET description = '$testdetails' WHERE rowID = ?";
$sql = "UPDATE equipment_history SET description = '$testdetails' WHERE rowID = ?";
$stmt = $pdo->prepare($sql);
$stmt->execute([$visualinspectionID]);
$last_id = $visualinspectionID;
@@ -249,7 +249,7 @@ if (isset($post_content['sn']) && isset($post_content['payload'])){
changelog($dbname,'equipment',$rowID,'status',$update_status,$user);
}
// +++++++++++++++++++++++++++++++++++++++++++++++++++++++
//Update history type ++++++++++++++++++++++++++
//UPDATE equipment_history type ++++++++++++++++++++++++++
// +++++++++++++++++++++++++++++++++++++++++++++++++++++++
if ($historyUpdate_type == 1){
//Check if servicereport comes from ServiceTool else inhouse
@@ -261,8 +261,8 @@ if (isset($post_content['sn']) && isset($post_content['payload'])){
$visualID = $post_content['payload']['visualinspection'];
}
//Update history record
$sql = "UPDATE history SET type = ? where rowID= ? or rowID= ?";
//UPDATE equipment_history record
$sql = "UPDATE equipment_history SET type = ? where rowID= ? or rowID= ?";
$stmt = $pdo->prepare($sql);
$stmt->execute([$type15,$visualID,$maintenanceID]);
}
@@ -291,7 +291,7 @@ if (isset($post_content['sn']) && isset($post_content['payload'])){
}
// +++++++++++++++++++++++++++++++++++++++++++++++++++++++
// Update history of service tool ++++++++++++++++++++++++++
// UPDATE equipment_history of service tool ++++++++++++++++++++++++++
// +++++++++++++++++++++++++++++++++++++++++++++++++++++++
if ($servicetoolHistoryUpdate == 1 && !empty($sn_service)){
@@ -322,7 +322,7 @@ if (isset($post_content['sn']) && isset($post_content['payload'])){
// +++++++++++++++++++++++++++++++++++++++++++++++++++++++
if ($sendServiceReport == 1){
//GET STORED SERVICE REPORT
$sql = 'SELECT h.rowID as historyID, h.type, h.description, h.created, h.createdby FROM history h WHERE rowID = ?';
$sql = 'SELECT h.rowID as historyID, h.type, h.description, h.created, h.createdby FROM equipment_history h WHERE rowID = ?';
$stmt = $pdo->prepare($sql);
$stmt->execute([$last_id]);
$results = $stmt->fetchAll(PDO::FETCH_ASSOC);
@@ -399,7 +399,7 @@ else {
//QUERY AND VERIFY ALLOWED
if ($command == 'update' && !isset($post_content['delete']) && isAllowed('history',$profile,$permission,'U') === 1){
$sql = 'UPDATE history SET '.$clause.' WHERE rowID = ?';
$sql = 'UPDATE equipment_history SET '.$clause.' WHERE rowID = ?';
$execute_input[] = $id;
$stmt = $pdo->prepare($sql);
$stmt->execute($execute_input);
@@ -410,7 +410,7 @@ else {
$stmt->execute($execute_input);
}
elseif ($command == 'delete' && isAllowed('history',$profile,$permission,'D') === 1){
$stmt = $pdo->prepare('DELETE FROM history WHERE rowID = ?');
$stmt = $pdo->prepare('DELETE FROM equipment_history WHERE rowID = ?');
$stmt->execute([ $id ]);
//Add deletion to changelog