CMXX - Include updated/by on multiple tables and views

This commit is contained in:
“VeLiTi”
2024-12-12 16:19:16 +01:00
parent 5e858fb785
commit e55c7c271d
19 changed files with 102 additions and 53 deletions

View File

@@ -197,16 +197,16 @@ if (!empty($post_content['sn']) && !empty($post_content['testdetails'])) {
// Insert or UPDATE equipment_history item ++++++++++++++++++++++++
// +++++++++++++++++++++++++++++++++++++++++++++++++++++++
if ($updateObject_visual == 1){
$sql = "UPDATE equipment_history SET description = '$testdetails' WHERE rowID = ?";
$sql = "UPDATE equipment_history SET description = '$testdetails', updatedby = ? WHERE rowID = ?";
$stmt = $pdo->prepare($sql);
$stmt->execute([$visualinspectionID]);
$stmt->execute([$user,$visualinspectionID]);
$last_id = $visualinspectionID;
}
else {
// Insert Equipment
$sql = "INSERT INTO equipment_history (equipmentid,type,description,createdby ) VALUES (?,?,?,?)";
$sql = "INSERT INTO equipment_history (equipmentid,type,description,createdby,updatedby) VALUES (?,?,?,?,?)";
$stmt = $pdo->prepare($sql);
$stmt->execute([$rowID,$historytype,$testdetails,$user]);
$stmt->execute([$rowID,$historytype,$testdetails,$user,$user]);
$last_id = $pdo->lastInsertId();
}
@@ -276,9 +276,9 @@ if (!empty($post_content['sn']) && !empty($post_content['testdetails'])) {
}
//UPDATE equipment_history record
$sql = "UPDATE equipment_history SET type = ? where rowID= ? or rowID= ?";
$sql = "UPDATE equipment_history SET type = ?, updatedby = ? where rowID= ? or rowID= ?";
$stmt = $pdo->prepare($sql);
$stmt->execute([$type15,$visualID,$maintenanceID]);
$stmt->execute([$type15,$user,$visualID,$maintenanceID]);
}
// +++++++++++++++++++++++++++++++++++++++++++++++++++++++
//Update productcode on equipment ++++++++++++++++++++++++++
@@ -322,9 +322,9 @@ if (!empty($post_content['sn']) && !empty($post_content['testdetails'])) {
if($total_servicetool != 0){
// Insert historyitem
$sql = "INSERT INTO equipment_history (equipmentid,type,description,createdby) VALUES (?,?,?,?)";
$sql = "INSERT INTO equipment_history (equipmentid,type,description,createdby,updatedby) VALUES (?,?,?,?,?)";
$stmt = $pdo->prepare($sql);
$stmt->execute([$rowID_servicetool,$historytype,$testdetails,$user]);
$stmt->execute([$rowID_servicetool,$historytype,$testdetails,$user,$user]);
//Update status to InUse
$sql = "UPDATE equipment SET status = ? $whereclause";
$stmt = $pdo->prepare($sql);