added old hard code by database names if necessary...
This commit is contained in:
parent
9fc2b95e49
commit
7c8e6310a9
@ -18,10 +18,30 @@ if(isset($_FILES['f_csv'])) {
|
||||
$spreadsheet = IOFactory::load($file, IReader::READ_DATA_ONLY);
|
||||
$worksheet = $spreadsheet->getActiveSheet();
|
||||
$arr_info = $worksheet->toArray();
|
||||
|
||||
$productsRefNumber_excelName = '';
|
||||
$reportsNumberLab_excelName = '';
|
||||
$partsCode_excelName = '';
|
||||
|
||||
if(count($arr_info) > 1) { //check excel rows
|
||||
$arr_excel_columns = $arr_info[0];
|
||||
$arr_need_columns = array();
|
||||
|
||||
foreach ($arr_associate as $item){
|
||||
if($item['column_name'] == 'products_refnumber'){
|
||||
$productsRefNumber_excelName = $item['headerfile'];
|
||||
}
|
||||
if($item['column_name'] == 'reportsNumberLab'){
|
||||
$reportsNumberLab_excelName = $item['headerfile'];
|
||||
}
|
||||
if($item['column_name'] == 'partsCode'){
|
||||
$partsCode_excelName = $item['headerfile'];
|
||||
}
|
||||
}
|
||||
array_push($arr_need_columns, $productsRefNumber_excelName);
|
||||
array_push($arr_need_columns, $reportsNumberLab_excelName);
|
||||
array_push($arr_need_columns, $partsCode_excelName);
|
||||
|
||||
$result_testNameHeaderFile = ""; //for analysisvocabulary
|
||||
$result_AnalytsNameHeaderFile = ""; //for compundsvocabulary
|
||||
|
||||
|
||||
@ -43,6 +43,10 @@ if (isset($_FILES['f_csv'])) {
|
||||
$arr_associate_data->setQuery("SELECT * FROM template_associate where template_importify_id=$template_id");
|
||||
$arr_associate_data->execute();
|
||||
$arr_associate = $arr_associate_data->Results;
|
||||
|
||||
$productsRefNumber_excelName = '';
|
||||
$reportsNumberLab_excelName = '';
|
||||
$partsCode_excelName = '';
|
||||
|
||||
if (count($arr_associate) > 0) { //check define columns
|
||||
$spreadsheet = IOFactory::load($file);
|
||||
@ -51,6 +55,20 @@ if (isset($_FILES['f_csv'])) {
|
||||
if (count($arr_info) > 1) { //check excel rows
|
||||
$arr_excel_columns = $arr_info[0];
|
||||
$arr_need_columns = array();
|
||||
foreach ($arr_associate as $item){
|
||||
if($item['column_name'] == 'products_refnumber'){
|
||||
$productsRefNumber_excelName = $item['headerfile'];
|
||||
}
|
||||
if($item['column_name'] == 'reportsNumberLab'){
|
||||
$reportsNumberLab_excelName = $item['headerfile'];
|
||||
}
|
||||
if($item['column_name'] == 'partsCode'){
|
||||
$partsCode_excelName = $item['headerfile'];
|
||||
}
|
||||
}
|
||||
array_push($arr_need_columns, $productsRefNumber_excelName);
|
||||
array_push($arr_need_columns, $reportsNumberLab_excelName);
|
||||
array_push($arr_need_columns, $partsCode_excelName);
|
||||
|
||||
// remove empty rows
|
||||
$arr_info = array_filter($arr_info, function ($row) {
|
||||
@ -88,21 +106,6 @@ if (isset($_FILES['f_csv'])) {
|
||||
}
|
||||
}
|
||||
|
||||
$productsRefNumber_excelName = '';
|
||||
$reportsNumberLab_excelName = '';
|
||||
$partsCode_excelName = '';
|
||||
foreach ($arr_associate as $item){
|
||||
if($item['column_name'] == 'products_refnumber'){
|
||||
$productsRefNumber_excelName = $item['headerfile'];
|
||||
}
|
||||
if($item['column_name'] == 'reportsNumberLab'){
|
||||
$reportsNumberLab_excelName = $item['headerfile'];
|
||||
}
|
||||
if($item['column_name'] == 'partsCode'){
|
||||
$partsCode_excelName = $item['headerfile'];
|
||||
}
|
||||
}
|
||||
|
||||
if ($verify_flag) {
|
||||
//separate by products_refnumber - product
|
||||
$idx_sample_code_po = array_search($productsRefNumber_excelName, $arr_excel_columns);
|
||||
@ -128,6 +131,9 @@ if (isset($_FILES['f_csv'])) {
|
||||
array_push($arr_total_products, $tmp_arr_child_products);
|
||||
}
|
||||
|
||||
var_dump($arr_need_columns);
|
||||
die();
|
||||
|
||||
|
||||
//define importcode (timestamp)
|
||||
$importcode = time();
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user