public function confirmValues(Request $request) { $id = $request->input("id"); $fc = new \Stratum\Controller\FormController(); $cc = new \Stratum\Controller\CandidateController(); $cuc = new CorporateUserController(); $entityBody = Storage::disk('local')->get($id . '.txt'); $formResult = $fc->parse($entityBody); $c2 = new \Stratum\Model\Candidate(); $c2 = $cc->populate($c2, $formResult); $form = $formResult->get("form"); $candidate = new \Stratum\Model\Candidate(); $candidate = $cc->populateFromRequest($candidate, $request->all(), $c2, $formResult); if ($candidate->get("validated") != 'true') { $data['errormessage']['message'] = "You must confirm that this form is correct and accurate. Use the Browser Back button to avoid losing your edits."; $error['propertyName'] = "validated"; $error['severity'] = 'Validation Failure'; $error['type'] = 'Must Accept Form'; $data['errormessage']['errors'][] = $error; $data['message'] = "Validation Failure: Data Not Uploaded"; } else { if (!$candidate->get("customText16")) { $candidate->set("tier", $candidate->get("customText16")); //must transfer to human-readable attribute name $data['errormessage']['message'] = "You must assign a Tier to this Candidate. Use the Browser Back button to avoid losing your edits."; $error['propertyName'] = "tier"; $error['severity'] = 'Validation Failure'; $error['type'] = 'Must Assign Tier'; $data['errormessage']['errors'][] = $error; $data['message'] = "Validation Failure: Data Not Uploaded"; } else { $now = new \DateTime(); $stamp = $now->format("U") * 1000; $candidate->set("customDate1", $stamp); $candidate->set("customDate2", $stamp); //$data['message'] = 'Debugging only, nothing uploaded to Bullhorn'; $bc = new \Stratum\Controller\BullhornController(); $c1 = new \Stratum\Model\Candidate(); $c1->set("id", $id); $c1 = $bc->loadFully($c1); //$c1 is the bullhorn existing candidate $c2->set("formResult", $formResult); //trojan horse to get formResult to pdf $pdf_data = $this->generatePDF($id, $c1, $c2, $candidate, $bc); $this->uploadPDF($candidate, $pdf_data, $bc); Log::debug("Uploaded PDF record from form"); // to shortcut to html view //return view('export_the_pdf')->with($pdf_data); $retval = $bc->submit($candidate); if (array_key_exists("errorMessage", $retval)) { $data['errormessage']['message'] = $retval['errorMessage']; $data['errormessage']['errors'] = $retval['errors']; $data['message'] = "Problem uploading data"; } else { $data['message'] = "Data Uploaded"; $bc->updateCandidateStatus($candidate, "Interview Done"); $cuc->flushCandidatesFromCache(); Log::debug("sending email to admin@stratum-int.com about Interview completion"); $user = Auth::user(); $maildata['candidateName'] = $candidate->getName(); $maildata['candidateID'] = $id; $maildata['consultantName'] = $user->name; $maildata['date'] = date(DATE_RFC2822); Mail::send('email.interview_complete', $maildata, function ($m) use($candidate, $id) { $m->from('*****@*****.**', 'Plum Data Integration Service'); $m->to('*****@*****.**')->subject('Interview Complete ' . $candidate->getName() . ' ' . $id); }); } } } $data['candidates'] = $cuc->load_candidates(); $data['thecandidate'] = $candidate; $fc = new \Stratum\Controller\FormController(); $data['form'] = $fc->setupForm(); return view('candidate')->with($data); }