/** * Load up the Partner and overwrite the Client * * @author David Stansfield * @param int $signatory, int $partnerID * @return object */ public function partner($signatory = 0, $partnerID = 0) { // -- If nothing passed then just return the object // ------------------------------------------------ if ($signatory == 0 && $partnerID == 0) { return $this; } $this->_clientDetails = \Crm\ClientClass::forge($this->_clientID, $signatory, $partnerID); return $this; }
/** * Load up all the possible extraData for the PPI letters * * @author David Stansfield * @private * @return array */ private function getExtraPPILetterData($clientID, $claimID) { $client = \Crm\ClientClass::forge((int) $clientID); $ppiClient = \Crm\Ppi\Ppi_class::forge($clientID); $claim = null; if ($claimID > 0) { $claim = \Crm\Ppi\Ppi_claims::forge((int) $claimID); } // -- Get the Agents Name list($driver, $user_id) = \Auth::get_user_id(); $agentName = \DB::query("SELECT\n name\n FROM\n users\n WHERE\n id = " . $user_id . "\n LIMIT 1\n ", \DB::select())->execute()->as_array(); $extraData = array('creditorName' => is_object($claim) ? $claim->getCreditorDetails()->name : '', 'creditorAddress' => is_object($claim) ? $claim->getCreditorDetails()->address("<br />") : '', 'inlineClientAddress' => $client->address(), 'accountReference' => is_object($claim) ? $claim->account_ref : '', 'accountNumber' => is_object($claim) ? $claim->account_number : '', 'sortCode' => is_object($claim) ? $claim->sort_code : 'n/a', 'undersigned' => $agentName[0]['name'], 'date' => date("jS F Y"), 'packSentDate' => date("d/m/Y", strtotime($ppiClient->pack_sent_date)), 'claimID' => $claimID > 0 ? $claimID : ''); return $extraData; }
/** * Save Client Information from the Client View Page * @public * @author David Stansfield */ public function post_save_client_information() { $clientID = \Input::post('ClientID'); $client = \Crm\ClientClass::forge($clientID); $client->title = \Input::post('Title'); $client->forename = \Input::post('Firstname'); $client->surname = \Input::post('Surname'); $client->streetAndNumber = \Input::post('Street-and-Name'); $client->area = \Input::post('Area'); $client->district = \Input::post('District'); $client->town = \Input::post('Town'); $client->county = \Input::post('County'); $client->postCode = \Input::post('Post-Code'); $client->dateOfBirth = \Input::post('Date-of-Birth') != 'Not Taken' ? date("Y-m-d", strtotime(\Input::post('Date-of-Birth'))) : false; $client->telHome = \Input::post('Telephone-Home') == 'Not Taken' ? 0 : \Input::post('Telephone-Home'); $client->telMobile = \Input::post('Telephone-Mobile') == 'Not Taken' ? 0 : \Input::post('Telephone-Mobile'); $client->telWork = \Input::post('Telephone-Work') == 'Not Taken' ? 0 : \Input::post('Telephone-Work'); $client->email = \Input::post('Email'); $client->notes = \Input::post('Notes'); $client->save(); Response::redirect('/crm/view_client/' . $clientID . '/'); }