importify various fixing
This commit is contained in:
parent
fccdaada7e
commit
d83f4e0e34
@ -17,6 +17,13 @@ if (count($his_info) > 0) {
|
|||||||
$deleteQuery->addFilter("importcode", "=", "s", "" . $importcode . "");
|
$deleteQuery->addFilter("importcode", "=", "s", "" . $importcode . "");
|
||||||
$deleteQuery->execute();
|
$deleteQuery->execute();
|
||||||
|
|
||||||
|
$deleteQuery = new WA_MySQLi_Query($repnew);
|
||||||
|
$deleteQuery->Action = "delete";
|
||||||
|
$deleteQuery->Table = "`analysis_project`";
|
||||||
|
|
||||||
|
$deleteQuery->addFilter("importcode", "=", "s", "" . $importcode . "");
|
||||||
|
$deleteQuery->execute();
|
||||||
|
|
||||||
|
|
||||||
$deleteQuery = new WA_MySQLi_Query($repnew);
|
$deleteQuery = new WA_MySQLi_Query($repnew);
|
||||||
$deleteQuery->Action = "delete";
|
$deleteQuery->Action = "delete";
|
||||||
|
|||||||
@ -56,14 +56,14 @@ if (isset($_FILES['f_csv'])) {
|
|||||||
if (count($arr_info) > 1) { //check excel rows
|
if (count($arr_info) > 1) { //check excel rows
|
||||||
$arr_excel_columns = $arr_info[0];
|
$arr_excel_columns = $arr_info[0];
|
||||||
$arr_need_columns = array();
|
$arr_need_columns = array();
|
||||||
foreach ($arr_associate as $item){
|
foreach ($arr_associate as $item) {
|
||||||
if($item['column_name'] == 'products_refnumber'){
|
if ($item['column_name'] == 'products_refnumber') {
|
||||||
$productsRefNumber_excelName = $item['headerfile'];
|
$productsRefNumber_excelName = $item['headerfile'];
|
||||||
}
|
}
|
||||||
if($item['column_name'] == 'reportsNumberLab'){
|
if ($item['column_name'] == 'reportsNumberLab') {
|
||||||
$reportsNumberLab_excelName = $item['headerfile'];
|
$reportsNumberLab_excelName = $item['headerfile'];
|
||||||
}
|
}
|
||||||
if($item['column_name'] == 'partsCode'){
|
if ($item['column_name'] == 'partsCode') {
|
||||||
$partsCode_excelName = $item['headerfile'];
|
$partsCode_excelName = $item['headerfile'];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -151,7 +151,6 @@ if (isset($_FILES['f_csv'])) {
|
|||||||
// 'importcode' => $importcode
|
// 'importcode' => $importcode
|
||||||
// ]);
|
// ]);
|
||||||
|
|
||||||
|
|
||||||
post_async($_SERVER['SERVER_NAME'] . ":" . $_SERVER['SERVER_PORT'] . $_SERVER['REQUEST_URI'] . "/../importify_bg_script.php", [
|
post_async($_SERVER['SERVER_NAME'] . ":" . $_SERVER['SERVER_PORT'] . $_SERVER['REQUEST_URI'] . "/../importify_bg_script.php", [
|
||||||
'arr_project' => json_encode($arr_total_products),
|
'arr_project' => json_encode($arr_total_products),
|
||||||
'arr_excel_columns' => json_encode($arr_excel_columns),
|
'arr_excel_columns' => json_encode($arr_excel_columns),
|
||||||
|
|||||||
1
public/userarea/importify/import_log.txt
Normal file
1
public/userarea/importify/import_log.txt
Normal file
File diff suppressed because one or more lines are too long
@ -168,10 +168,10 @@ foreach ($arr_total_products as $product) {
|
|||||||
|
|
||||||
//insert to parts table
|
//insert to parts table
|
||||||
foreach ($arr_total_parts as $part) {
|
foreach ($arr_total_parts as $part) {
|
||||||
//check exist parts item
|
// Check if the part already exists
|
||||||
$part_no = $part[0][$idx_part_no_po];
|
$part_no = $part[0][$idx_part_no_po];
|
||||||
$part_query = new WA_MySQLi_RS("getquery", $repnew, 0);
|
$part_query = new WA_MySQLi_RS("getquery", $repnew, 0);
|
||||||
$part_query->setQuery("SELECT * FROM parts WHERE partsCode='$part_no' and idreports='$idreports' and idproducts='$idproducts'");
|
$part_query->setQuery("SELECT * FROM parts WHERE partsCode='$part_no' AND idreports='$idreports' AND idproducts='$idproducts'");
|
||||||
$part_query->execute();
|
$part_query->execute();
|
||||||
|
|
||||||
$part_info = $part_query->Results;
|
$part_info = $part_query->Results;
|
||||||
@ -179,109 +179,168 @@ foreach ($arr_total_products as $product) {
|
|||||||
|
|
||||||
if (count($part_info) > 0) {
|
if (count($part_info) > 0) {
|
||||||
$idparts = $part_info[0]['idParts'];
|
$idparts = $part_info[0]['idParts'];
|
||||||
} else { // have to insert new
|
} else {
|
||||||
|
// Build the `arr_part_need_idx` array with template data
|
||||||
$arr_part_need_idx = array();
|
$arr_part_need_idx = array();
|
||||||
for ($i = 0; $i < count($arr_associate); $i++) {
|
for ($i = 0; $i < count($arr_associate); $i++) {
|
||||||
if ($arr_associate[$i]->table_name == "parts") {
|
if ($arr_associate[$i]->table_name == "parts") {
|
||||||
array_push($arr_part_need_idx, array($arr_associate[$i]->column_name, array_search($arr_associate[$i]->headerfile, $arr_excel_columns)));
|
// Verifica se l'elemento ha un valore di template
|
||||||
|
array_push($arr_part_need_idx, array($arr_associate[$i]->column_name, array_search($arr_associate[$i]->headerfile, $arr_excel_columns), 0));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// Insert new part
|
||||||
$InsertQuery = new WA_MySQLi_Query($repnew);
|
$InsertQuery = new WA_MySQLi_Query($repnew);
|
||||||
$InsertQuery->Action = "insert";
|
$InsertQuery->Action = "insert";
|
||||||
$InsertQuery->Table = "`parts`";
|
$InsertQuery->Table = "parts";
|
||||||
$InsertQuery->bindColumn("partsCode", "s", $part[0][$idx_part_no_po] . "", "WA_DEFAULT");
|
$InsertQuery->bindColumn("partsCode", "s", $part_no, "WA_DEFAULT");
|
||||||
$InsertQuery->bindColumn("idproducts", "i", "" . $idproducts . "", "WA_DEFAULT");
|
$InsertQuery->bindColumn("idproducts", "i", $idproducts, "WA_DEFAULT");
|
||||||
$InsertQuery->bindColumn("idreports", "i", "" . $idreports . "", "WA_DEFAULT");
|
$InsertQuery->bindColumn("idreports", "i", $idreports, "WA_DEFAULT");
|
||||||
$InsertQuery->bindColumn("importcode", "i", "" . $importcode . "", "WA_DEFAULT");
|
$InsertQuery->bindColumn("importcode", "i", $importcode, "WA_DEFAULT");
|
||||||
for ($i = 0; $i < count($arr_part_need_idx); $i++) {
|
|
||||||
$InsertQuery->bindColumn($arr_part_need_idx[$i][0], "s", $part[0][$arr_part_need_idx[$i][1]], "WA_DEFAULT");
|
// Add template data for parts
|
||||||
|
foreach ($arr_part_need_idx as $item) {
|
||||||
|
if ($item[2] > 0) {
|
||||||
|
$InsertQuery->bindColumn($item[0], "s", $item[1], "WA_DEFAULT");
|
||||||
|
} else {
|
||||||
|
$InsertQuery->bindColumn($item[0], "s", $part[0][$item[1]], "WA_DEFAULT");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$InsertQuery->saveInSession("");
|
$InsertQuery->saveInSession("");
|
||||||
$InsertQuery->execute();
|
$InsertQuery->execute();
|
||||||
|
|
||||||
$part_query = new WA_MySQLi_RS("getquery", $repnew, 0);
|
// Retrieve the newly inserted part ID
|
||||||
$part_query->setQuery("SELECT * FROM parts WHERE partsCode='$part_no' and idreports='$idreports' and idproducts='$idproducts'");
|
$part_query->setQuery("SELECT * FROM parts WHERE partsCode='$part_no' AND idreports='$idreports' AND idproducts='$idproducts'");
|
||||||
$part_query->execute();
|
$part_query->execute();
|
||||||
|
|
||||||
$part_info = $part_query->Results;
|
$part_info = $part_query->Results;
|
||||||
if (count($part_info) > 0) {
|
$idparts = $part_info[0]['idParts'] ?? '';
|
||||||
$idparts = $part_info[0]['idParts'];
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($idparts == "") {
|
if ($idparts == "") {
|
||||||
die("server_error");
|
die("server_error");
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------- result_project table ------------------
|
// Iterate over each row in `part` to handle analysis and results
|
||||||
foreach ($part as $result_project) {
|
foreach ($part as $result_project) {
|
||||||
//check exist result_project item
|
// Extract analysis name from Excel and convert it into an analysis ID
|
||||||
// $result_project_query = new WA_MySQLi_RS("getquery", $repnew, 0);
|
$result_TestName = $result_project[array_search("result_TestName", $arr_excel_columns)] ?? '';
|
||||||
// $sql_result_project_query = "SELECT * FROM result_project WHERE idPart='$idparts' and idreports='$idreports' and idproducts='$idproducts'";
|
$group_code_index = array_search("analysisgroupcode", array_column($arr_associate, 'column_name'));
|
||||||
//
|
$group_code_val = $result_project[array_search($arr_associate[$group_code_index]->headerfile, $arr_excel_columns)];
|
||||||
$arr_result_project_need_idx = array();
|
$trim_group_code = str_replace("\n", "", str_replace("'", "\'", $group_code_val));
|
||||||
|
|
||||||
|
$analysis_query = new WA_MySQLi_RS("getquery", $repnew, 0);
|
||||||
|
$analysis_query->setQuery("SELECT * FROM analysisvocabulary WHERE analysiscode LIKE '$trim_group_code'");
|
||||||
|
$analysis_query->execute();
|
||||||
|
|
||||||
|
$analysis_data = $analysis_query->Results;
|
||||||
|
$idanalysisvocabulary = 0;
|
||||||
|
|
||||||
|
if (count($analysis_data) > 0 && $trim_group_code != "") {
|
||||||
|
$idanalysisvocabulary = $analysis_data[0]['idanalysisvocabulary'];
|
||||||
|
} else {
|
||||||
|
$tmp_val = $result_project[array_search($arr_associate[$group_code_index]->headerfile, $arr_excel_columns)];
|
||||||
|
$trim_item = str_replace("\n", "", str_replace("'", "\'", $tmp_val));
|
||||||
|
$analysis_query->setQuery("SELECT * FROM analysisvocabulary WHERE nameanalysisvoc LIKE '$trim_item'");
|
||||||
|
$analysis_query->execute();
|
||||||
|
|
||||||
|
$analysis_data = $analysis_query->Results;
|
||||||
|
if (count($analysis_data) > 0) {
|
||||||
|
$idanalysisvocabulary = ($analysis_data[0]['refid'] == 0) ? $analysis_data[0]['idanalysisvocabulary'] : $analysis_data[0]['refid'];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Check if an analysis already exists with the same parameters
|
||||||
|
$analysis_project_query = new WA_MySQLi_RS("getquery", $repnew, 0);
|
||||||
|
$analysis_project_query->setQuery(
|
||||||
|
"SELECT * FROM analysis_project WHERE idPart='$idparts' AND idreports='$idreports' AND idproducts='$idproducts' AND result_TestName='$idanalysisvocabulary'"
|
||||||
|
);
|
||||||
|
$analysis_project_query->execute();
|
||||||
|
$analysis_project_info = $analysis_project_query->Results;
|
||||||
|
$idanalysis_project = "";
|
||||||
|
|
||||||
|
if (count($analysis_project_info) > 0) {
|
||||||
|
$idanalysis_project = $analysis_project_info[0]['idAnalysis_Project'];
|
||||||
|
} else {
|
||||||
|
|
||||||
|
// Build the `arr_analysis_project_need_idx` array with template data
|
||||||
|
$arr_analysis_project_need_idx = array();
|
||||||
|
for ($i = 0; $i < count($arr_associate); $i++) {
|
||||||
|
if ($arr_associate[$i]->table_name == "analysis_project") {
|
||||||
|
if ($arr_associate[$i]->column_name == "result_TestName") {
|
||||||
|
// Handle `result_TestName` with the ID of the analysis as it is already mapped.
|
||||||
|
array_push($arr_analysis_project_need_idx, array($arr_associate[$i]->column_name, $idanalysisvocabulary, 1));
|
||||||
|
} else {
|
||||||
|
// Map other fields using the headerfile index from the Excel columns.
|
||||||
|
array_push($arr_analysis_project_need_idx, array($arr_associate[$i]->column_name, array_search($arr_associate[$i]->headerfile, $arr_excel_columns), 0));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Insert a new row into `analysis_project` with template data
|
||||||
|
$InsertQuery = new WA_MySQLi_Query($repnew);
|
||||||
|
$InsertQuery->Action = "insert";
|
||||||
|
$InsertQuery->Table = "analysis_project";
|
||||||
|
$InsertQuery->bindColumn("idPart", "i", $idparts, "WA_DEFAULT");
|
||||||
|
$InsertQuery->bindColumn("idproducts", "i", $idproducts, "WA_DEFAULT");
|
||||||
|
$InsertQuery->bindColumn("idreports", "i", $idreports, "WA_DEFAULT");
|
||||||
|
$InsertQuery->bindColumn("result_TestName", "i", $idanalysisvocabulary, "WA_DEFAULT");
|
||||||
|
$InsertQuery->bindColumn("importcode", "i", $importcode, "WA_DEFAULT");
|
||||||
|
|
||||||
|
// Add template data for `analysis_project`
|
||||||
|
foreach ($arr_analysis_project_need_idx as $item) {
|
||||||
|
if ($item[2] > 0) {
|
||||||
|
$InsertQuery->bindColumn($item[0], "s", $item[1], "WA_DEFAULT");
|
||||||
|
} else {
|
||||||
|
$InsertQuery->bindColumn($item[0], "s", $result_project[$item[1]], "WA_DEFAULT");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$InsertQuery->saveInSession("");
|
||||||
|
$InsertQuery->execute();
|
||||||
|
|
||||||
|
// Retrieve the newly inserted analysis ID
|
||||||
|
$analysis_project_query->setQuery("SELECT LAST_INSERT_ID() as idAnalysis_Project");
|
||||||
|
$analysis_project_query->execute();
|
||||||
|
$analysis_project_info = $analysis_project_query->Results;
|
||||||
|
$idanalysis_project = $analysis_project_info[0]['idAnalysis_Project'] ?? '';
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if ($idanalysis_project == "") {
|
||||||
|
die("server_error");
|
||||||
|
}
|
||||||
|
|
||||||
|
// Build the `arr_result_project_need_idx` array with template data
|
||||||
|
$arr_result_project_need_idx = array();
|
||||||
for ($i = 0; $i < count($arr_associate); $i++) {
|
for ($i = 0; $i < count($arr_associate); $i++) {
|
||||||
if ($arr_associate[$i]->table_name == "result_project") {
|
if ($arr_associate[$i]->table_name == "result_project") {
|
||||||
if ($arr_associate[$i]->column_name == "result_TestName") {
|
if ($arr_associate[$i]->column_name == "result_AnalytsName") {
|
||||||
$group_code_index = array_search("analysisgroupcode", array_column($arr_associate, 'column_name'));
|
// Process `result_AnalytsName` and CAS
|
||||||
$group_code_val = $result_project[array_search($arr_associate[$group_code_index]->headerfile, $arr_excel_columns)];
|
|
||||||
|
|
||||||
$trim_group_code = str_replace("\n", "", str_replace("'", "\'", $group_code_val));
|
|
||||||
$analysis_query = new WA_MySQLi_RS("getquery", $repnew, 0);
|
|
||||||
$analysis_query->setQuery("SELECT * FROM analysisvocabulary WHERE analysiscode like '$trim_group_code'");
|
|
||||||
$analysis_query->execute();
|
|
||||||
|
|
||||||
$analysis_data = $analysis_query->Results;
|
|
||||||
$ref_id = 0;
|
|
||||||
if (count($analysis_data) > 0 && $trim_group_code != "") {
|
|
||||||
$ref_id = $analysis_data[0]['idanalysisvocabulary'];
|
|
||||||
} else {
|
|
||||||
$tmp_val = $result_project[array_search($arr_associate[$i]->headerfile, $arr_excel_columns)];
|
|
||||||
$trim_item = str_replace("\n", "", str_replace("'", "\'", $tmp_val));
|
|
||||||
$analysis_query = new WA_MySQLi_RS("getquery", $repnew, 0);
|
|
||||||
$analysis_query->setQuery("SELECT * FROM analysisvocabulary WHERE nameanalysisvoc like '$trim_item'");
|
|
||||||
$analysis_query->execute();
|
|
||||||
|
|
||||||
$analysis_data = $analysis_query->Results;
|
|
||||||
$ref_id = 0;
|
|
||||||
if (count($analysis_data) > 0) {
|
|
||||||
if($analysis_data[0]['refid'] == 0){
|
|
||||||
$ref_id = $analysis_data[0]['idanalysisvocabulary'];
|
|
||||||
}else{
|
|
||||||
$ref_id = $analysis_data[0]['refid'];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
array_push($arr_result_project_need_idx, array($arr_associate[$i]->column_name, $ref_id, 1));
|
|
||||||
} else if ($arr_associate[$i]->column_name == "result_AnalytsName") {
|
|
||||||
$cas_index = array_search("cas", array_column($arr_associate, 'column_name'));
|
$cas_index = array_search("cas", array_column($arr_associate, 'column_name'));
|
||||||
$cas_val = $result_project[array_search($arr_associate[$cas_index]->headerfile, $arr_excel_columns)];
|
$cas_val = $result_project[array_search($arr_associate[$cas_index]->headerfile, $arr_excel_columns)];
|
||||||
|
|
||||||
$trim_cas_val = str_replace("\n", "", str_replace("'", "\'", $cas_val));
|
$trim_cas_val = str_replace("\n", "", str_replace("'", "\'", $cas_val));
|
||||||
$analysis_query = new WA_MySQLi_RS("getquery", $repnew, 0);
|
|
||||||
$analysis_query->setQuery("SELECT * FROM compundsvocabulary WHERE cascompoundvocabulary like '%$trim_cas_val%'");
|
|
||||||
$analysis_query->execute();
|
|
||||||
|
|
||||||
$analysis_data = $analysis_query->Results;
|
$compound_query = new WA_MySQLi_RS("getquery", $repnew, 0);
|
||||||
|
$compound_query->setQuery("SELECT * FROM compundsvocabulary WHERE cascompoundvocabulary LIKE '%$trim_cas_val%'");
|
||||||
|
$compound_query->execute();
|
||||||
|
|
||||||
|
$compound_data = $compound_query->Results;
|
||||||
$ref_id = 0;
|
$ref_id = 0;
|
||||||
if (count($analysis_data) > 0 && $trim_cas_val != "" && $trim_cas_val != "-") {
|
|
||||||
$ref_id = $analysis_data[0]['idcompoundsvocabulary'];
|
if (count($compound_data) > 0 && !empty($trim_cas_val) && $trim_cas_val != "-" && $trim_cas_val != "") {
|
||||||
|
|
||||||
|
$ref_id = $compound_data[0]['idcompoundsvocabulary'];
|
||||||
} else {
|
} else {
|
||||||
$tmp_val = $result_project[array_search($arr_associate[$i]->headerfile, $arr_excel_columns)];
|
$tmp_val = $result_project[array_search($arr_associate[$i]->headerfile, $arr_excel_columns)];
|
||||||
$trim_item = str_replace("\n", "", str_replace("'", "\'", $tmp_val));
|
$trim_item = str_replace("\n", "", str_replace("'", "\'", $tmp_val));
|
||||||
$analysis_query = new WA_MySQLi_RS("getquery", $repnew, 0);
|
$compound_query->setQuery("SELECT * FROM compundsvocabulary WHERE namecompoundsvocabulary LIKE '$trim_item'");
|
||||||
$analysis_query->setQuery("SELECT * FROM compundsvocabulary WHERE namecompoundsvocabulary like '$tmp_val'");
|
$compound_query->execute();
|
||||||
$analysis_query->execute();
|
|
||||||
|
|
||||||
$analysis_data = $analysis_query->Results;
|
$compound_data = $compound_query->Results;
|
||||||
$ref_id = 0;
|
if (count($compound_data) > 0) {
|
||||||
if (count($analysis_data) > 0) {
|
$ref_id = ($compound_data[0]['refid'] == 0) ? $compound_data[0]['idcompoundsvocabulary'] : $compound_data[0]['refid'];
|
||||||
if($analysis_data[0]['refid'] == 0){
|
|
||||||
$ref_id = $analysis_data[0]['idcompoundsvocabulary'];
|
|
||||||
}else{
|
|
||||||
$ref_id = $analysis_data[0]['refid'];
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -291,34 +350,29 @@ foreach ($arr_total_products as $product) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//
|
|
||||||
// foreach($arr_result_project_need_idx as $q) {
|
// Insert each result into `result_project`, linking it to `idanalysis_project`
|
||||||
// $sql_result_project_query .= " and ".$q[0]."='".$q[0]."'";
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// $result_project_query->setQuery($sql_result_project_query);
|
|
||||||
// $result_project_query->execute();
|
|
||||||
//
|
|
||||||
// $result_project_info = $result_project_query->Results;
|
|
||||||
//
|
|
||||||
// if (count($result_project_info) == 0) {
|
|
||||||
$InsertQuery = new WA_MySQLi_Query($repnew);
|
$InsertQuery = new WA_MySQLi_Query($repnew);
|
||||||
$InsertQuery->Action = "insert";
|
$InsertQuery->Action = "insert";
|
||||||
$InsertQuery->Table = "`result_project`";
|
$InsertQuery->Table = "result_project";
|
||||||
$InsertQuery->bindColumn("idPart", "s", $idparts . "", "WA_DEFAULT");
|
$InsertQuery->bindColumn("idPart", "i", $idparts, "WA_DEFAULT");
|
||||||
$InsertQuery->bindColumn("idproducts", "i", "" . $idproducts . "", "WA_DEFAULT");
|
$InsertQuery->bindColumn("idproducts", "i", $idproducts, "WA_DEFAULT");
|
||||||
$InsertQuery->bindColumn("idreports", "i", "" . $idreports . "", "WA_DEFAULT");
|
$InsertQuery->bindColumn("idreports", "i", $idreports, "WA_DEFAULT");
|
||||||
$InsertQuery->bindColumn("importcode", "i", "" . $importcode . "", "WA_DEFAULT");
|
$InsertQuery->bindColumn("idanalysis_project", "i", $idanalysis_project, "WA_DEFAULT");
|
||||||
for ($i = 0; $i < count($arr_result_project_need_idx); $i++) {
|
$InsertQuery->bindColumn("importcode", "i", $importcode, "WA_DEFAULT");
|
||||||
if ($arr_result_project_need_idx[$i][2] > 0) {
|
|
||||||
$InsertQuery->bindColumn($arr_result_project_need_idx[$i][0], "s", $arr_result_project_need_idx[$i][1], "WA_DEFAULT");
|
// Add data for `result_project`
|
||||||
|
foreach ($arr_result_project_need_idx as $item) {
|
||||||
|
if ($item[2] > 0) {
|
||||||
|
$InsertQuery->bindColumn($item[0], "s", $item[1], "WA_DEFAULT");
|
||||||
} else {
|
} else {
|
||||||
$InsertQuery->bindColumn($arr_result_project_need_idx[$i][0], "s", $result_project[$arr_result_project_need_idx[$i][1]], "WA_DEFAULT");
|
$InsertQuery->bindColumn($item[0], "s", $result_project[$item[1]], "WA_DEFAULT");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Save and execute the insert for `result_project`
|
||||||
$InsertQuery->saveInSession("");
|
$InsertQuery->saveInSession("");
|
||||||
$InsertQuery->execute();
|
$InsertQuery->execute();
|
||||||
// }
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -16,10 +16,11 @@ if (isset($_POST['productId'])) {
|
|||||||
// Query per ottenere le analisi associate a ogni report con LEFT JOIN su analysisvocabulary
|
// Query per ottenere le analisi associate a ogni report con LEFT JOIN su analysisvocabulary
|
||||||
$reportId = $report['idreports'];
|
$reportId = $report['idreports'];
|
||||||
$queryAnalysis = "
|
$queryAnalysis = "
|
||||||
SELECT rp.*, av.nameanalysisvoc
|
SELECT av.nameanalysisvoc, ap.test_Rating AS analysis_test_Rating
|
||||||
FROM result_project rp
|
FROM result_project rp
|
||||||
LEFT JOIN analysisvocabulary av ON rp.result_TestName = av.idanalysisvocabulary
|
LEFT JOIN analysis_project ap ON rp.idanalysis_project = ap.idAnalysis_Project
|
||||||
WHERE rp.idreports = $reportId";
|
LEFT JOIN analysisvocabulary av ON ap.result_TestName = av.idanalysisvocabulary
|
||||||
|
WHERE rp.idreports = $reportId";
|
||||||
$resultAnalysis = $conn->query($queryAnalysis);
|
$resultAnalysis = $conn->query($queryAnalysis);
|
||||||
|
|
||||||
// Mappa per aggregare i risultati delle analisi in base a 'result_TestName' e calcolare il peggior rating
|
// Mappa per aggregare i risultati delle analisi in base a 'result_TestName' e calcolare il peggior rating
|
||||||
@ -28,7 +29,7 @@ if (isset($_POST['productId'])) {
|
|||||||
$testName = $analysis['nameanalysisvoc'];
|
$testName = $analysis['nameanalysisvoc'];
|
||||||
|
|
||||||
// Normalizza il rating per confrontare varianti diverse
|
// Normalizza il rating per confrontare varianti diverse
|
||||||
$normalizedRating = strtoupper(trim($analysis['test_Rating']));
|
$normalizedRating = strtoupper(trim($analysis['analysis_test_Rating']));
|
||||||
|
|
||||||
// Gestiamo anche varianti come "Complies", "Doesn't Comply", "//" e "N/A"
|
// Gestiamo anche varianti come "Complies", "Doesn't Comply", "//" e "N/A"
|
||||||
if ($normalizedRating === 'P' || $normalizedRating === 'PASS' || $normalizedRating === 'COMPLIES') {
|
if ($normalizedRating === 'P' || $normalizedRating === 'PASS' || $normalizedRating === 'COMPLIES') {
|
||||||
|
|||||||
@ -19,17 +19,23 @@ $reportDetails = $stmt->get_result()->fetch_assoc();
|
|||||||
|
|
||||||
// Query per ottenere le parti e i risultati del report con il nome dell'analista e delle parti
|
// Query per ottenere le parti e i risultati del report con il nome dell'analista e delle parti
|
||||||
$queryPartsAndResults = "
|
$queryPartsAndResults = "
|
||||||
SELECT rp.*,
|
SELECT
|
||||||
a.nameanalysisvoc AS testName,
|
rp.*,
|
||||||
cv.namecompoundsvocabulary AS analytsName,
|
a.nameanalysisvoc AS testName,
|
||||||
pr.partsDescription,
|
cv.namecompoundsvocabulary AS analytsName,
|
||||||
rp.result_UnitofMeasure -- Aggiunge l'unità di misura
|
pr.partsDescription,
|
||||||
|
pr.partsCode,
|
||||||
|
rp.result_UnitofMeasure,
|
||||||
|
rp.result_AnalytsRating AS analytsRating -- Renamed the field for clarity
|
||||||
FROM result_project rp
|
FROM result_project rp
|
||||||
LEFT JOIN analysisvocabulary a ON rp.result_TestName = a.idanalysisvocabulary
|
LEFT JOIN analysis_project ap ON rp.idanalysis_project = ap.idAnalysis_Project
|
||||||
|
LEFT JOIN analysisvocabulary a ON ap.result_TestName = a.idanalysisvocabulary
|
||||||
LEFT JOIN compundsvocabulary cv ON rp.result_AnalytsName = cv.idcompoundsvocabulary
|
LEFT JOIN compundsvocabulary cv ON rp.result_AnalytsName = cv.idcompoundsvocabulary
|
||||||
LEFT JOIN parts pr ON rp.idPart = pr.idParts
|
LEFT JOIN parts pr ON rp.idPart = pr.idParts
|
||||||
WHERE rp.idreports = ?
|
WHERE rp.idreports = ?
|
||||||
ORDER BY rp.result_TestName, rp.idPart";
|
ORDER BY ap.result_TestName, rp.idPart;
|
||||||
|
";
|
||||||
|
|
||||||
|
|
||||||
$stmtParts = $conn->prepare($queryPartsAndResults);
|
$stmtParts = $conn->prepare($queryPartsAndResults);
|
||||||
$stmtParts->bind_param("i", $idreports);
|
$stmtParts->bind_param("i", $idreports);
|
||||||
@ -209,6 +215,7 @@ $partsAndResults = $stmtParts->get_result();
|
|||||||
$currentPart = ''; // Variabile per tracciare la parte corrente
|
$currentPart = ''; // Variabile per tracciare la parte corrente
|
||||||
|
|
||||||
while ($row = $partsAndResults->fetch_assoc()) {
|
while ($row = $partsAndResults->fetch_assoc()) {
|
||||||
|
//print_r($row);
|
||||||
// Se il nome dell'analisi cambia, crea una nuova sezione per l'analisi
|
// Se il nome dell'analisi cambia, crea una nuova sezione per l'analisi
|
||||||
if ($currentTestName != $row['testName']) {
|
if ($currentTestName != $row['testName']) {
|
||||||
if ($currentTestName != '') {
|
if ($currentTestName != '') {
|
||||||
@ -247,9 +254,9 @@ $partsAndResults = $stmtParts->get_result();
|
|||||||
|
|
||||||
// Classificazione del rating
|
// Classificazione del rating
|
||||||
$ratingClass = '';
|
$ratingClass = '';
|
||||||
if (strtoupper($row['test_Rating']) == 'FAIL' || strtoupper($row['test_Rating']) == "DOESN'T COMPLY") {
|
if (strtoupper($row['analytsRating']) == 'FAIL' || strtoupper($row['analytsRating']) == "DOESN'T COMPLY" || strtoupper($row['analytsRating']) == "F") {
|
||||||
$ratingClass = 'rating-fail';
|
$ratingClass = 'rating-fail';
|
||||||
} elseif (strtoupper($row['test_Rating']) == 'PASS' || strtoupper($row['test_Rating']) == 'COMPLIES') {
|
} elseif (strtoupper($row['analytsRating']) == 'PASS' || strtoupper($row['analytsRating']) == 'COMPLIES' || strtoupper($row['analytsRating']) == 'P') {
|
||||||
$ratingClass = 'rating-pass';
|
$ratingClass = 'rating-pass';
|
||||||
} else {
|
} else {
|
||||||
$ratingClass = 'rating-ambiguous';
|
$ratingClass = 'rating-ambiguous';
|
||||||
@ -257,7 +264,7 @@ $partsAndResults = $stmtParts->get_result();
|
|||||||
|
|
||||||
// Stampa i dettagli dell'analita
|
// Stampa i dettagli dell'analita
|
||||||
echo '<tr>';
|
echo '<tr>';
|
||||||
echo '<td>' . (!empty($row['analytsName']) ? $row['analytsName'] . ' (ID: ' . $row['result_AnalytsName'] . ')' : ' ') . '</td>';
|
echo '<td>' . (!empty($row['analytsName']) ? $row['analytsName'] . ' (CAS: ' . $row['cas'] . ')' : ' ') . '</td>';
|
||||||
echo '<td>' . (!empty($row['result_Value']) ? htmlspecialchars($row['result_Value'], ENT_QUOTES, 'UTF-8') : ' ');
|
echo '<td>' . (!empty($row['result_Value']) ? htmlspecialchars($row['result_Value'], ENT_QUOTES, 'UTF-8') : ' ');
|
||||||
|
|
||||||
// Aggiungi l'unità di misura se presente
|
// Aggiungi l'unità di misura se presente
|
||||||
@ -266,7 +273,7 @@ $partsAndResults = $stmtParts->get_result();
|
|||||||
}
|
}
|
||||||
|
|
||||||
echo '</td>';
|
echo '</td>';
|
||||||
echo '<td class="' . $ratingClass . '">' . (!empty($row['test_Rating']) ? htmlspecialchars($row['test_Rating'], ENT_QUOTES, 'UTF-8') : ' ') . '</td>';
|
echo '<td class="' . $ratingClass . '">' . (!empty($row['analytsRating']) ? htmlspecialchars($row['analytsRating'], ENT_QUOTES, 'UTF-8') : ' ') . '</td>';
|
||||||
echo '</tr>';
|
echo '</tr>';
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -354,7 +361,7 @@ $partsAndResults = $stmtParts->get_result();
|
|||||||
if (selectedRating === '' ||
|
if (selectedRating === '' ||
|
||||||
(selectedRating === 'pass' && (ratingText === 'pass' || ratingText === 'complies')) ||
|
(selectedRating === 'pass' && (ratingText === 'pass' || ratingText === 'complies')) ||
|
||||||
(selectedRating === 'fail' && (ratingText === 'fail' || ratingText === "doesn't comply")) ||
|
(selectedRating === 'fail' && (ratingText === 'fail' || ratingText === "doesn't comply")) ||
|
||||||
(selectedRating === 'ambiguous' && (ratingText === 'n/a' || ratingText === 'ambiguous' || ratingText === '//'))) {
|
(selectedRating === 'ambiguous' && (ratingText === 'n/a' || ratingText === 'data' || ratingText === '//'))) {
|
||||||
$(this).show();
|
$(this).show();
|
||||||
visibleRows++;
|
visibleRows++;
|
||||||
} else {
|
} else {
|
||||||
@ -440,7 +447,7 @@ $partsAndResults = $stmtParts->get_result();
|
|||||||
if (selectedRating === '' ||
|
if (selectedRating === '' ||
|
||||||
(selectedRating === 'pass' && (ratingText === 'pass' || ratingText === 'complies')) ||
|
(selectedRating === 'pass' && (ratingText === 'pass' || ratingText === 'complies')) ||
|
||||||
(selectedRating === 'fail' && (ratingText === 'fail' || ratingText === "doesn't comply")) ||
|
(selectedRating === 'fail' && (ratingText === 'fail' || ratingText === "doesn't comply")) ||
|
||||||
(selectedRating === 'ambiguous' && (ratingText === 'n/a' || ratingText === 'ambiguous' || ratingText === '//'))) {
|
(selectedRating === 'ambiguous' && (ratingText === 'n/a' || ratingText === 'data' || ratingText === '//'))) {
|
||||||
$(this).show();
|
$(this).show();
|
||||||
} else {
|
} else {
|
||||||
$(this).hide();
|
$(this).hide();
|
||||||
|
|||||||
@ -9,10 +9,13 @@ $reportId = isset($_POST['reportId']) ? $_POST['reportId'] : 0;
|
|||||||
|
|
||||||
// Query per ottenere le analisi associate al report, comprese le parti
|
// Query per ottenere le analisi associate al report, comprese le parti
|
||||||
$query = "
|
$query = "
|
||||||
SELECT a.nameanalysisvoc AS name, rp.result_Rating AS finalRating
|
SELECT
|
||||||
FROM result_project rp
|
a.nameanalysisvoc AS name,
|
||||||
LEFT JOIN analysisvocabulary a ON rp.result_TestName = a.idanalysisvocabulary
|
ap.test_Rating AS finalRating
|
||||||
WHERE rp.idreports = ?";
|
FROM result_project rp
|
||||||
|
LEFT JOIN analysis_project ap ON rp.idanalysis_project = ap.idAnalysis_Project
|
||||||
|
LEFT JOIN analysisvocabulary a ON ap.result_TestName = a.idanalysisvocabulary
|
||||||
|
WHERE rp.idreports = ?";
|
||||||
$stmt = $conn->prepare($query);
|
$stmt = $conn->prepare($query);
|
||||||
$stmt->bind_param("i", $reportId);
|
$stmt->bind_param("i", $reportId);
|
||||||
$stmt->execute();
|
$stmt->execute();
|
||||||
@ -24,23 +27,34 @@ $analysis = [];
|
|||||||
// Raggruppa le analisi e seleziona il rating più restrittivo
|
// Raggruppa le analisi e seleziona il rating più restrittivo
|
||||||
while ($row = $result->fetch_assoc()) {
|
while ($row = $result->fetch_assoc()) {
|
||||||
$name = $row['name'];
|
$name = $row['name'];
|
||||||
$rating = strtoupper($row['finalRating']); // Normalizziamo tutto in maiuscolo per uniformità
|
$rating = strtoupper(trim($row['finalRating'])); // Normalize to uppercase and trim spaces
|
||||||
|
|
||||||
|
// Convert specific terms into normalized ratings
|
||||||
|
if ($rating === 'COMPLIES') {
|
||||||
|
$rating = 'PASS';
|
||||||
|
}
|
||||||
|
|
||||||
|
// Initialize the rating if not set
|
||||||
if (!isset($analysis[$name])) {
|
if (!isset($analysis[$name])) {
|
||||||
// Se l'analisi non è ancora presente, la aggiungiamo
|
|
||||||
$analysis[$name] = $rating;
|
$analysis[$name] = $rating;
|
||||||
} else {
|
} else {
|
||||||
// Applica il rating più restrittivo: Fail > N/A > Pass
|
// Apply the most restrictive rating: Fail > Data > N/A > // > Pass
|
||||||
if ($analysis[$name] != 'FAIL' && ($rating == 'FAIL' || $rating == "DOESN'T COMPLY")) {
|
if ($analysis[$name] != 'FAIL' && ($rating == 'FAIL' || $rating == "DOESN'T COMPLY")) {
|
||||||
$analysis[$name] = 'FAIL';
|
$analysis[$name] = 'FAIL';
|
||||||
} elseif ($analysis[$name] != 'FAIL' && $analysis[$name] != 'N/A' && ($rating == 'N/A' || $rating == '//')) {
|
} elseif ($analysis[$name] != 'FAIL' && $analysis[$name] != 'DATA' && $rating == 'DATA') {
|
||||||
|
$analysis[$name] = 'DATA';
|
||||||
|
} elseif ($analysis[$name] != 'FAIL' && $analysis[$name] != 'DATA' && $analysis[$name] != 'N/A' && $rating == 'N/A') {
|
||||||
$analysis[$name] = 'N/A';
|
$analysis[$name] = 'N/A';
|
||||||
} elseif ($analysis[$name] == 'PASS' && ($rating == 'PASS' || $rating == 'COMPLIES')) {
|
} elseif ($analysis[$name] != 'FAIL' && $analysis[$name] != 'DATA' && $analysis[$name] != 'N/A' && $analysis[$name] != '//' && $rating == '//') {
|
||||||
|
$analysis[$name] = '//';
|
||||||
|
} elseif ($analysis[$name] == 'PASS' && $rating == 'PASS') {
|
||||||
$analysis[$name] = 'PASS';
|
$analysis[$name] = 'PASS';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// Trasforma i dati in un array
|
// Trasforma i dati in un array
|
||||||
$finalAnalysis = [];
|
$finalAnalysis = [];
|
||||||
foreach ($analysis as $name => $finalRating) {
|
foreach ($analysis as $name => $finalRating) {
|
||||||
|
|||||||
@ -308,7 +308,7 @@ $result = $conn->query($query);
|
|||||||
ratingClass = 'bg-danger text-white';
|
ratingClass = 'bg-danger text-white';
|
||||||
} else if (analysis.finalRating === 'PASS') {
|
} else if (analysis.finalRating === 'PASS') {
|
||||||
ratingClass = 'bg-success text-white';
|
ratingClass = 'bg-success text-white';
|
||||||
} else if (analysis.finalRating === '//' || analysis.finalRating === 'N/A') {
|
} else if (analysis.finalRating === '//' || analysis.finalRating === 'N/A' || analysis.finalRating === 'DATA') {
|
||||||
ratingClass = 'bg-warning text-dark';
|
ratingClass = 'bg-warning text-dark';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -165,9 +165,10 @@ $failedReportsPercent = ($totalReports > 0) ? ($failedReports / $totalReports) *
|
|||||||
|
|
||||||
// Statistic 4: Total number of tests performed (distinct tests)
|
// Statistic 4: Total number of tests performed (distinct tests)
|
||||||
$totalTestsQuery = "
|
$totalTestsQuery = "
|
||||||
SELECT COUNT(DISTINCT rp.idreports, rp.idPart, rp.result_TestName) AS totalTests
|
SELECT COUNT(DISTINCT ap.idreports, ap.idPart, ap.result_TestName) AS totalTests
|
||||||
FROM result_project rp
|
FROM analysis_project ap
|
||||||
LEFT JOIN reports r ON rp.idreports = r.idreports
|
LEFT JOIN result_project rp ON ap.idAnalysis_Project = rp.idanalysis_project
|
||||||
|
LEFT JOIN reports r ON ap.idreports = r.idreports
|
||||||
LEFT JOIN products p ON r.idproducts = p.idproducts
|
LEFT JOIN products p ON r.idproducts = p.idproducts
|
||||||
$filters
|
$filters
|
||||||
";
|
";
|
||||||
@ -176,12 +177,14 @@ $totalTests = $totalTestsResult->fetch_assoc()['totalTests'];
|
|||||||
|
|
||||||
// Statistic 5: Number of 'fail' tests and percentage (case-insensitive for rating fail)
|
// Statistic 5: Number of 'fail' tests and percentage (case-insensitive for rating fail)
|
||||||
$failedTestsQuery = "
|
$failedTestsQuery = "
|
||||||
SELECT COUNT(DISTINCT rp.idreports, rp.idPart, rp.result_TestName) AS failedTests
|
SELECT COUNT(DISTINCT ap.idreports, ap.idPart, ap.result_TestName) AS failedTests
|
||||||
FROM result_project rp
|
FROM analysis_project ap
|
||||||
LEFT JOIN reports r ON rp.idreports = r.idreports
|
LEFT JOIN result_project rp ON ap.idAnalysis_Project = rp.idanalysis_project
|
||||||
|
LEFT JOIN reports r ON ap.idreports = r.idreports
|
||||||
LEFT JOIN products p ON r.idproducts = p.idproducts
|
LEFT JOIN products p ON r.idproducts = p.idproducts
|
||||||
$filters AND UPPER(rp.result_Rating) IN ('FAIL', 'F', 'DOESN\'T COMPLY')
|
$filters AND UPPER(ap.test_Rating) IN ('FAIL', 'F', 'DOESN\'T COMPLY')
|
||||||
";
|
";
|
||||||
|
|
||||||
$failedTestsResult = $conn->query($failedTestsQuery);
|
$failedTestsResult = $conn->query($failedTestsQuery);
|
||||||
$failedTests = $failedTestsResult->fetch_assoc()['failedTests'];
|
$failedTests = $failedTestsResult->fetch_assoc()['failedTests'];
|
||||||
$failedTestsPercent = ($totalTests > 0) ? ($failedTests / $totalTests) * 100 : 0;
|
$failedTestsPercent = ($totalTests > 0) ? ($failedTests / $totalTests) * 100 : 0;
|
||||||
@ -216,16 +219,18 @@ $otherReportsPie = $otherReportsPieResult->fetch_assoc()['otherReports'];
|
|||||||
|
|
||||||
// Query to get the top 10 analyses with the most 'Fail' results
|
// Query to get the top 10 analyses with the most 'Fail' results
|
||||||
$topFailingAnalysisQuery = "
|
$topFailingAnalysisQuery = "
|
||||||
SELECT a.nameanalysisvoc AS analysisName, COUNT(DISTINCT rp.idreports, rp.idPart, rp.result_TestName) AS failCount
|
SELECT a.nameanalysisvoc AS analysisName, COUNT(DISTINCT ap.idreports, ap.idPart, ap.result_TestName) AS failCount
|
||||||
FROM result_project rp
|
FROM analysis_project ap
|
||||||
LEFT JOIN reports r ON rp.idreports = r.idreports
|
LEFT JOIN result_project rp ON ap.idAnalysis_Project = rp.idanalysis_project
|
||||||
|
LEFT JOIN reports r ON ap.idreports = r.idreports
|
||||||
LEFT JOIN products p ON r.idproducts = p.idproducts
|
LEFT JOIN products p ON r.idproducts = p.idproducts
|
||||||
LEFT JOIN analysisvocabulary a ON rp.result_TestName = a.idanalysisvocabulary
|
LEFT JOIN analysisvocabulary a ON ap.result_TestName = a.idanalysisvocabulary
|
||||||
$filters AND UPPER(rp.result_Rating) IN ('FAIL', 'F', 'DOESN\'T COMPLY')
|
$filters AND UPPER(ap.test_Rating) IN ('FAIL', 'F', 'DOESN\'T COMPLY')
|
||||||
GROUP BY rp.result_TestName
|
GROUP BY ap.result_TestName
|
||||||
ORDER BY failCount DESC
|
ORDER BY failCount DESC
|
||||||
LIMIT 10
|
LIMIT 10
|
||||||
";
|
";
|
||||||
|
|
||||||
$topFailingAnalysisResult = $conn->query($topFailingAnalysisQuery);
|
$topFailingAnalysisResult = $conn->query($topFailingAnalysisQuery);
|
||||||
$topFailingAnalysis = [];
|
$topFailingAnalysis = [];
|
||||||
while ($row = $topFailingAnalysisResult->fetch_assoc()) {
|
while ($row = $topFailingAnalysisResult->fetch_assoc()) {
|
||||||
@ -379,16 +384,17 @@ while ($row = $numberLabsResult->fetch_assoc()) {
|
|||||||
|
|
||||||
// New Query: Distribution of analyses (for pie chart)
|
// New Query: Distribution of analyses (for pie chart)
|
||||||
$analysisDistributionQuery = "
|
$analysisDistributionQuery = "
|
||||||
SELECT a.nameanalysisvoc AS analysisName, COUNT(DISTINCT rp.idreports, rp.idPart, rp.result_TestName) AS totalTests
|
SELECT a.nameanalysisvoc AS analysisName, COUNT(DISTINCT ap.idreports, ap.idPart, ap.result_TestName) AS totalTests
|
||||||
FROM result_project rp
|
FROM analysis_project ap
|
||||||
LEFT JOIN analysisvocabulary a ON rp.result_TestName = a.idanalysisvocabulary
|
LEFT JOIN analysisvocabulary a ON ap.result_TestName = a.idanalysisvocabulary
|
||||||
LEFT JOIN reports r ON rp.idreports = r.idreports
|
LEFT JOIN reports r ON ap.idreports = r.idreports
|
||||||
LEFT JOIN products p ON r.idproducts = p.idproducts
|
LEFT JOIN products p ON r.idproducts = p.idproducts
|
||||||
$filters
|
$filters
|
||||||
GROUP BY rp.result_TestName
|
GROUP BY ap.result_TestName
|
||||||
ORDER BY totalTests DESC
|
ORDER BY totalTests DESC
|
||||||
";
|
";
|
||||||
|
|
||||||
|
|
||||||
$analysisDistributionResult = $conn->query($analysisDistributionQuery);
|
$analysisDistributionResult = $conn->query($analysisDistributionQuery);
|
||||||
$analysisDistribution = [];
|
$analysisDistribution = [];
|
||||||
while ($row = $analysisDistributionResult->fetch_assoc()) {
|
while ($row = $analysisDistributionResult->fetch_assoc()) {
|
||||||
|
|||||||
BIN
vendor.zip
Normal file
BIN
vendor.zip
Normal file
Binary file not shown.
Loading…
x
Reference in New Issue
Block a user