CMXX - Cartest update
This commit is contained in:
@@ -2262,17 +2262,30 @@ $messages = $stmt->fetchAll(PDO::FETCH_ASSOC);
|
||||
$questions = json_encode($cartest["Questions"] ??'');
|
||||
$datapoints = json_encode($cartest["plugDataPoints"] ?? '');
|
||||
$nametester = $cartest["NameTester"] ?? 'Unknown';
|
||||
$plug_sn = $cartest["SN"] ?? 0;
|
||||
$accounthierarchy = '';
|
||||
|
||||
//get header data only
|
||||
unset($cartest["Questions"]);
|
||||
unset($cartest["plugDataPoints"]);
|
||||
$header = json_encode($cartest);
|
||||
|
||||
//GET ACCOUNTHIERARCHY FROM SN OF
|
||||
if ($plug_sn !=0){
|
||||
$sql ='SELECT accounthierarchy FROM equipment WHERE serialnumber = ?';
|
||||
$stmt = $pdo->prepare($sql);
|
||||
//Excute Query
|
||||
$stmt->execute([$plug_sn]);
|
||||
//Get results
|
||||
$messages = $stmt->fetchAll(PDO::FETCH_ASSOC);
|
||||
$accounthierarchy = $messages[0]['accounthierarchy'];
|
||||
}
|
||||
|
||||
//INSERT INTO CARTEST
|
||||
$sql = 'INSERT INTO cartest (carbrand, cartype,header,questions,datapoints,createdby) VALUES (?,?,?,?,?,?)';
|
||||
$sql = 'INSERT INTO cartest (carbrand, cartype,header,questions,datapoints,createdby,accounthierarchy) VALUES (?,?,?,?,?,?,?)';
|
||||
$stmt = $pdo->prepare($sql);
|
||||
//Excute Query
|
||||
$stmt->execute([$carbrand,$cartype,$header,$questions,$datapoints,$nametester]);
|
||||
$stmt->execute([$carbrand,$cartype,$header,$questions,$datapoints,$nametester,$accounthierarchy]);
|
||||
|
||||
//MARK HISTORY ITEM FOR DELETATION
|
||||
$sql = 'UPDATE history SET type = "delete" WHERE rowID = '.$message['rowID'];
|
||||
|
||||
Reference in New Issue
Block a user