ExcelToJson.php
[Pman.Core] / ExcelToJson.php
index 253d505..be67e4f 100644 (file)
@@ -58,7 +58,7 @@ class Pman_Core_ExcelToJson extends Pman_Roo
             }
             
             if(!$header){
-               $ret[str_replace(':', '', $n[0])] = $n[1];
+               $ret[preg_replace(array('/\s/', '/\:/'), '', $n[0])] = $n[1];
                continue;
             }
             
@@ -94,6 +94,20 @@ class Pman_Core_ExcelToJson extends Pman_Roo
         
         fclose($fh);
         
+        $lc = DB_DataObject::factory('location');
+        if($lc->get('location_name', $ret['From'])){
+            $this->jerr('error occur on getting location with reference ' . $ret['From']);
+        }
+        $ret['invhist_transfer_from'] = $lc->pid();
+        $ret['invhist_transfer_from_location_name'] = $lc->location_name;
+        
+        $lt = DB_DataObject::factory('location');
+        if($lt->get('location_name', $ret['To'])){
+            $this->jerr('error occur on getting location with reference ' . $ret['From']);
+        }
+        $ret['invhist_transfer_to'] = $lt->pid();
+        $ret['invhist_transfer_to_location_name'] = $lt->location_name;
+        
         foreach ($rows as $r){
             $itemsite = DB_DataObject::factory('itemsite');
             $itemsite->autoJoin();