Last active
December 20, 2018 05:25
-
-
Save iniakunhuda/ed69bbc7179c3be28265cf831bc579a5 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public function yard_post_return(){ | |
log_message('error',file_get_contents('php://input')); | |
if(!$this->_auth) { | |
$this->setjson(false); | |
return; | |
} | |
$insp = json_decode(file_get_contents('php://input'), true); | |
$dt = $this->ino_inspection->GetId($insp['_id']); | |
$items=array(); | |
for($i=0;$i<count($insp['items']);$i++){ | |
unset($item); | |
$item['id_item'] = $insp['items'][$i]['id_item']; | |
$item['batch'] = $insp['items'][$i]['batch']; | |
$item['owned'] = $insp['items'][$i]['owned']; | |
$item['qty'] = $insp['items'][$i]['qty']; | |
$item['heatno'] = $insp['items'][$i]['heatno']; | |
$item['pin'] = ($insp['items'][$i]['pin']) ? array_map('trim', explode(',', $insp['items'][$i]['pin'])) : []; | |
$item['body'] = ($insp['items'][$i]['body']) ? array_map('trim', explode(',', $insp['items'][$i]['body'])) : []; | |
$item['box'] = ($insp['items'][$i]['box']) ? array_map('trim', explode(',', $insp['items'][$i]['box'])) : []; | |
$item['cr'] = $insp['items'][$i]['cr']; | |
if($insp['items'][$i]['files']){ | |
for($k=0;$k<count($insp['items'][$i]['files']);$k++){ | |
$item['files'][$k]['src'] = "data:image/png;base64,".$insp['items'][$i]['files'][$k]; | |
} | |
} else { | |
$item['files'] = null; | |
} | |
$items['items'][] = $item; | |
} | |
$dt['items'] = $items['items']; | |
$dt['notes']['initial']['msg'] = $insp['notes']; | |
$dt['notes']['initial']['by'] = 'YARD'; | |
//-- parsing status Draft dr android | |
if($insp['status'] == "Draft"){ | |
$dt['status'] = "Ongoing"; | |
} else { | |
$dt['status'] = "For Review"; | |
} | |
$id = $this->ino_inspection->SaveTrans('itemtrans',$dt); | |
if($id) return $this->setjson(true); | |
if(!$id) return $this->setjson(false); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment