CMXX - Include updated/by on multiple tables and views
This commit is contained in:
@@ -183,16 +183,16 @@ if (isset($post_content['sn']) && isset($post_content['payload'])){
|
||||
// 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();
|
||||
}
|
||||
|
||||
@@ -262,9 +262,9 @@ if (isset($post_content['sn']) && isset($post_content['payload'])){
|
||||
}
|
||||
|
||||
//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 ++++++++++++++++++++++++++
|
||||
@@ -308,9 +308,9 @@ if (isset($post_content['sn']) && isset($post_content['payload'])){
|
||||
|
||||
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);
|
||||
@@ -353,6 +353,8 @@ else {
|
||||
$clause_insert ='';
|
||||
$input_insert = '';
|
||||
|
||||
$post_content['updatedby'] = $username;
|
||||
|
||||
//ADD STANDARD PARAMETERS TO ARRAY BASED ON INSERT OR UPDATE
|
||||
if ($command == 'update' && !isset($post_content['delete'])){
|
||||
|
||||
|
||||
Reference in New Issue
Block a user