Pman.Gnumeric.js
[Pman.Core] / ExcelToJson.php
index 4ee5703..e981d32 100644 (file)
@@ -12,7 +12,7 @@ class Pman_Core_ExcelToJson extends Pman_Roo
         return parent::getAuth();
     }
     
-    function post()
+    function post($v)
     {
         $this->transObj = DB_DataObject::Factory('invhist_transfer');
         
@@ -29,10 +29,10 @@ class Pman_Core_ExcelToJson extends Pman_Roo
         
         require_once 'File/Convert.php';
         $fc = new File_Convert($img->getStoreName(), $img->mimetype );
-        $csv = $fc->convert('text/csv');
-        $ret = $this->importCsv($csv);
+         $csv = $fc->convert('text/csv');
+         $ret = $this->importCsv($csv);
         
-        print_R($ret);exit;
+       
         
         $this->jdata($ret['data'], false, isset($ret['extra']) ? $ret['extra'] : array() );
         
@@ -54,7 +54,9 @@ class Pman_Core_ExcelToJson extends Pman_Roo
         $extra = array();
         
         while(false !== ($n = fgetcsv($fh,10000, ',', '"'))) {
-            if(!strlen(implode('', $n))){
+          
+            
+            if(!strlen(trim(implode('', $n)))){ // blank line;
                 if ($header) {
                     continue;
                 }
@@ -89,8 +91,7 @@ class Pman_Core_ExcelToJson extends Pman_Roo
         }
         fclose($fh);
         
-        $ret = array('extra' => $extra, 'data' => $rows);
-        echo 'about to return?';print_R($ret);exit;
+     
         
         return array('extra' => $extra, 'data' => $rows);;
     }