public function saveSpreadsheet($uploadedFile) {
if(!empty($uploadedFile) && !empty($uploadedFile['tmp_name'])) {
if($uploadedFile['error'] == UPLOAD_ERR_OK) {
$pulledData = $this->extract($uploadedFile['tmp_name']);
$filePath = WWW_ROOT.'/spreadsheet/' . DS . $uploadedFile['name'] ;
if(!empty($pulledData)){
$pulledData = $this->Policy->Declination->ContactType->setSpreadsheetContactTypeIds($pulledData);
if(!empty($pulledData[$this->alias])) {
$this->save($pulledData[$this->alias]);
unset($pulledData[$this->alias]);
$coverageId = $this->id;
$pulledData = $this->setSpreadsheetCoverageIds($pulledData, $coverageId);
$pulledData = $this->CoverageInsured->setSpreadsheetCoverageInsuredIds($pulledData);
//$pulledData = $this->Policy->Location->setupSpreadsheetPolicyLocation($pulledData, $coverageId);
}
$this->CoverageInsured->save($pulledData['CoverageInsured']);
$this->savePolicyData($pulledData);
$this->Policy->Declination->saveAll($pulledData['Declination']);
move_uploaded_file($uploadedFile['tmp_name'], $filePath);
//$this->Policy->Location->saveAll($pulledData['Location']);
//$this->Policy->Company->saveAll($pulledData['Policy']);
return $coverageId;
}
}
}
return false;
}
This is what I was trying
public function saveSpreadsheet($uploadedFile) {
if(!empty($uploadedFile) && !empty($uploadedFile['tmp_name'])) {
if($uploadedFile['error'] == UPLOAD_ERR_OK) {
$pulledData = $this->extract($uploadedFile['tmp_name']);
$filePath = WWW_ROOT.'/spreadsheet/' . DS . $uploadedFile['name'] ;
if(!empty($pulledData)){
$pulledData = $this->Policy->Declination->ContactType->setSpreadsheetContactTypeIds($pulledData);
if(!empty($pulledData[$this->alias])) {
$this->save($pulledData[$this->alias]);
unset($pulledData[$this->alias]);
$this->save($pulledData['Policy']);
unset($pulledData['Policy']);
$policy_id = $this->Policy->id;
die(debug('$policy_id'));
$coverageId = $this->id;
$pulledData = $this->setSpreadsheetCoverageIds($pulledData, $coverageId);
$pulledData = $this->CoverageInsured->setSpreadsheetCoverageInsuredIds($pulledData);
//$pulledData = $this->Policy->Location->setupSpreadsheetPolicyLocation($pulledData, $coverageId);
}
$this->CoverageInsured->save($pulledData['CoverageInsured']);
$this->savePolicyData($pulledData);
$this->Policy->Declination->saveAll($pulledData['Declination']);
move_uploaded_file($uploadedFile['tmp_name'], $filePath);
//$this->Policy->Location->saveAll($pulledData['Location']);
//$this->Policy->Company->saveAll($pulledData['Policy']);
return $coverageId;
}
}
}
return false;
}
Array
( [0] => Array ( [policy_number] => DGUEP00068 [policy_type] => [policy_fee] => [line_of_buisness] => Equity Protection [premium] => 32.24 [premium_limit] => 520000 [coverage_id] => [producing_id] => 1 [filing_id] => 1 ) [1] => Array ( [policy_number] => DGUEP00058 [policy_type] => [policy_fee] => [line_of_buisness] => Equity Protection [premium] => 25694.52 [premium_limit] => 1200000 [coverage_id] => [producing_id] => 1 [filing_id] => 1 )
--
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP
---
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscribe@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/groups/opt_out.
No comments:
Post a Comment