projects
/
Pman.Core
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Fix #5884 - add photo to report
[Pman.Core]
/
ExcelToJson.php
diff --git
a/ExcelToJson.php
b/ExcelToJson.php
index
4ee5703
..
e981d32
100644
(file)
--- a/
ExcelToJson.php
+++ b/
ExcelToJson.php
@@
-12,7
+12,7
@@
class Pman_Core_ExcelToJson extends Pman_Roo
return parent::getAuth();
}
return parent::getAuth();
}
- function post()
+ function post(
$v
)
{
$this->transObj = DB_DataObject::Factory('invhist_transfer');
{
$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 );
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() );
$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, ',', '"'))) {
$extra = array();
while(false !== ($n = fgetcsv($fh,10000, ',', '"'))) {
- if(!strlen(implode('', $n))){
+
+
+ if(!strlen(trim(implode('', $n)))){ // blank line;
if ($header) {
continue;
}
if ($header) {
continue;
}
@@
-89,8
+91,7
@@
class Pman_Core_ExcelToJson extends Pman_Roo
}
fclose($fh);
}
fclose($fh);
- $ret = array('extra' => $extra, 'data' => $rows);
- echo 'about to return?';print_R($ret);exit;
+
return array('extra' => $extra, 'data' => $rows);;
}
return array('extra' => $extra, 'data' => $rows);;
}