From: <dai...@us...> - 2015-09-05 22:20:46
|
Revision: 7347 http://sourceforge.net/p/web-erp/reponame/7347 Author: daintree Date: 2015-09-05 22:20:44 +0000 (Sat, 05 Sep 2015) Log Message: ----------- Wes Wolfenbarger: Fix to Z_ImportStocks.php Modified Paths: -------------- trunk/Z_ImportStocks.php trunk/doc/Change.log trunk/doc/Manual/ManualContributors.html Modified: trunk/Z_ImportStocks.php =================================================================== --- trunk/Z_ImportStocks.php 2015-08-27 08:27:16 UTC (rev 7346) +++ trunk/Z_ImportStocks.php 2015-09-05 22:20:44 UTC (rev 7347) @@ -1,4 +1,4 @@ -<?php + <?php /* $Id$*/ include('includes/session.inc'); @@ -13,6 +13,9 @@ // If this script is called with the gettemplate flag, then a template file is served // Otherwise, a file upload form is displayed +// The CSV file must be saved in a format like the template in the import module I.E. "RECVALUE","RECVALUE2". The CSV file needs ANSI encoding for the import to work properly. + + $FieldHeadings = array( 'StockID', // 0 'STOCKID', 'Description', // 1 'DESCRIPTION', @@ -49,7 +52,7 @@ $FileHandle = fopen($TempName, 'r'); //get the header row - $headRow = fgetcsv($FileHandle, 10000, ","); + $headRow = fgetcsv($FileHandle, 10000, ",",'"'); // Modified to handle " "" " enclosed csv - useful if you need to include commas in your text descriptions //check for correct number of fields if ( count($headRow) != count($FieldHeadings) ) { @@ -63,7 +66,7 @@ $head = 0; foreach ($headRow as $headField) { if ( mb_strtoupper($headField) != mb_strtoupper($FieldHeadings[$head]) ) { - prnMsg (_('File contains incorrect headers ('. mb_strtoupper($headField). ' != '. mb_strtoupper($header[$head]). '. Try downloading a new template.'),'error'); + prnMsg (_('File contains incorrect headers '. mb_strtoupper($headField). ' != '. mb_strtoupper($FieldHeadings[$head]). '. Try downloading a new template.'),'error'); //Fixed $FieldHeadings from $headings fclose($FileHandle); include('includes/footer.inc'); exit; Modified: trunk/doc/Change.log =================================================================== --- trunk/doc/Change.log 2015-08-27 08:27:16 UTC (rev 7346) +++ trunk/doc/Change.log 2015-09-05 22:20:44 UTC (rev 7347) @@ -1,5 +1,6 @@ webERP Change Log +4/9/15 Wes Wolfenbarger: Fix to Z_ImportStocks.php added quotes to descriptions - also fixes error message when the csv does not match the template 27/08/15 Exson: Fixed the allocation status of involved invoice and credit notes in Credit_Invoice.php. 19/08/15 RChacon: In AnalysisHorizontalIncome.php, delete variable $period because it is not used anywhere (thanks Tim). Extract header.inc from if. 13/08/15 RChacon: In doc/ManualGeneralLedger.html, add help for the horizontal analysis. Modified: trunk/doc/Manual/ManualContributors.html =================================================================== --- trunk/doc/Manual/ManualContributors.html 2015-08-27 08:27:16 UTC (rev 7346) +++ trunk/doc/Manual/ManualContributors.html 2015-09-05 22:20:44 UTC (rev 7347) @@ -168,6 +168,8 @@ <br /> Jeff Trickett<br /> <br /> + Wes Wolfenbarger + <br /> Mark Yeager (MRP)<br /> <br /> Zhiguo Yuan</td> |