From 633b8f1431c574e4b06e543ba51fa13dd13ac944 Mon Sep 17 00:00:00 2001 From: lmarcouiller Date: Wed, 31 Mar 2021 12:18:31 +0200 Subject: [PATCH] Close #16761 : Info template import --- htdocs/langs/en_US/stocks.lang | 3 ++- htdocs/product/stock/massstockmove.php | 14 ++++++++------ 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/htdocs/langs/en_US/stocks.lang b/htdocs/langs/en_US/stocks.lang index 586595baa94..e3d3ae4e0ae 100644 --- a/htdocs/langs/en_US/stocks.lang +++ b/htdocs/langs/en_US/stocks.lang @@ -244,4 +244,5 @@ UpdateByScaningProductBarcode=Update by scan (product barcode) UpdateByScaningLot=Update by scan (lot|serial barcode) DisableStockChangeOfSubProduct=Deactivate the stock change for all the subproducts of this Kit during this movement. ImportFromCSV=Import CSV list of movement -ChooseFileToImport=Upload file then click on the %s icon to select file as source import file... \ No newline at end of file +ChooseFileToImport=Upload file then click on the %s icon to select file as source import file... +InfoTemplateImport=Uploaded file needs to have this format (* are mandatory fields) : Product_id* | Source_Warehouse_id* | Target_Warehouse_id* | Quantity* | Batch_id \ No newline at end of file diff --git a/htdocs/product/stock/massstockmove.php b/htdocs/product/stock/massstockmove.php index 39962e1bd49..a89e234acfb 100644 --- a/htdocs/product/stock/massstockmove.php +++ b/htdocs/product/stock/massstockmove.php @@ -320,9 +320,9 @@ if ($action == 'importCSV') { while ($i < $nblinesrecord) { $data[] = $importcsv->import_read_record(); $id_product = $data[$i][0]['val']; - $qty = $data[$i][1]['val']; - $id_sw = $data[$i][2]['val']; - $id_tw = $data[$i][3]['val']; + $id_sw = $data[$i][1]['val']; + $id_tw = $data[$i][2]['val']; + $qty = $data[$i][3]['val']; $batch = $data[$i][4]['val']; if (!($id_product > 0)) { @@ -370,9 +370,9 @@ if ($action == 'importCSV') { $id = 1; } $id_product = $data[$key][0]['val']; - $qty = $data[$key][1]['val']; - $id_sw = $data[$key][2]['val']; - $id_tw = $data[$key][3]['val']; + $id_sw = $data[$key][1]['val']; + $id_tw = $data[$key][2]['val']; + $qty = $data[$key][3]['val']; $batch = $data[$key][4]['val']; $listofdata[$key] = array('id'=>$key, 'id_product'=>$id_product, 'qty'=>$qty, 'id_sw'=>$id_sw, 'id_tw'=>$id_tw, 'batch'=>$batch); } @@ -531,6 +531,8 @@ print ''; $s = $langs->trans("ChooseFileToImport", '{s1}'); $s = str_replace('{s1}', img_picto('', 'next'), $s); print $s; +print '

'; +print $langs->trans('InfoTemplateImport'); print '


'; print '
'; // You can use div-table-responsive-no-min if you dont need reserved height for your table