<?php
session_start();
// SOAP_CLIENT_BASEDIR - folder that contains the PHP Toolkit and your WSDL
// $USERNAME - variable that contains your Salesforce.com username (must be in the form of an email)
// $PASSWORD - variable that contains your Salesforce.ocm password
define("SOAP_CLIENT_BASEDIR", "../../../../soapclient");
define("USERNAME", "tmiller1@thrivest.com");
define("PASSWORD", "Thr1v3st!");
define("SECURITY_TOKEN", "b7XEfBOM2ikfsFkF2vg7RoLG1");
require_once (SOAP_CLIENT_BASEDIR.'/SforceEnterpriseClient.php');
require_once (SOAP_CLIENT_BASEDIR.'/SforceHeaderOptions.php');
require_once ('../../../../samples/userAuth.php');
// Creating the salesforce REAL ESTATE
function salesforce_create_realestate($request,$postval)
{
try {
$mySforceConnection = new SforceEnterpriseClient();
$mySoapClient = $mySforceConnection->createConnection(SOAP_CLIENT_BASEDIR.'/enterprise.wsdl.xml');
$mylogin = $mySforceConnection->login(USERNAME, PASSWORD.SECURITY_TOKEN);
// Real estate information
$sObject = new stdclass();
$sObject->Name = $request['name'];
$sObject->Name_of_Realtor__c = $request['name'];
$sObject->Realtor_s_Phone_Number__c = $request['phone'];
$sObject->Email_Address__c = $request['email'];
$sObject->Home_Street_Address__c = $request['address'];
$sObject->Home_State__c = $request['state'];
$sObject->Home_Zip_Code__c = $request['zip'];
$sObject->Home_City__c = $request['city'];
$sObject->Date_of_Birth__c = $request['dob'];
$sObject->Advance_Amount_Requested__c = $request['amount'];
//$sObject->When_Do_You_Need_Loan_By__c = $request['dob'];
$sObject->Reason_for_Advance__c = $request['advance'];
$sObject->Status__c = 'Applied';
// Company Information
$sObject->Company_You_Work_With__c = $request['company_name'];
$sObject->Phone_Number_of_Company__c = $request['company_phone'];
$sObject->Company_Address__c = $request['company_address'];
$sObject->Company_City__c = $request['company_city'];
$sObject->Company_State__c = $request['company_state'];
$sObject->Company_Zip_Code__c = $request['company_zip'];
$sObject->Company_Web_Address__c = $request['company_web'];
$sObject->Supervising_Managing_Broker__c =$request['broker_name'];
$sObject->Length_of_Time_Worked_at_Company__c = ucwords($request['time_worked']);
//$sObject->of_Years_in_Business__c = 4;
$sObject->How_Did_You_Hear_About_Us__c = $request['source'];
// Property Information
$sObject->Property_Address__c = $request['property_address'];
$sObject->Property_City__c = $request['property_city'];
$sObject->Property_State__c = $request['property_state'];
$sObject->Property_Zip_Code__c = $request['property_zip'];
$sObject->Buyer_Name__c = $request['buyer_name'];
$sObject->Seller_Name__c = $request['seller_name'];
$sObject->Ratification_Date__c = $request['ratification_date'];
$sObject->Final_Sale_Price__c = $request['sale_price'];
$sObject->Who_the_Agent_Represents__c = $request['agent_represent'];
$sObject->Closing_Date_of_Property__c = $request['closing_date_of_property'];
$sObject->New_Construction__c = $request['new_construction'];
// Lender Information
$sObject->Lender_s_Name__c = $request['lenders_name'];
$sObject->Lender_s_Phone_Number__c = $request['lenders_ph_no'];
$sObject->Lender_s_State__c = $request['lenders_state'];
$sObject->Lender_s_Zip_Code__c = $request['lenders_zip'];
$sObject->Lender_s_City__c = $request['lenders_city'];
$sObject->Lender_s_Address__c = $request['lenders_address'];
$sObject->Loan_Officer__c = $request['loan_officer_name'];
// Pipline Data
$sObject->of_Transactions_in_last_6_months__c = $request['no_of_trans_completed'];
$sObject->of_Current_Pending_Transactions__c = $request['no_of_cur_pending_trans'];
$sObject->of_Current_Active_Listings__c = $request['no_of_cur_active_listing'];
$sObject->Active_Listing_1__c = $request['list_linking_1'];
$sObject->Active_Listing_2__c = $request['list_linking_2'];
$sObject->Active_Listing_3__c = $request['list_linking_3'];
// Title Company information
$sObject->Name_of_Title_Company__c = $postval['name_of_title_company'];
$sObject->Address_of_Title_Company__c = $postval['address_of_title_company'];
$sObject->City_of_Title_Company__c = $postval['city_of_title_company'];
$sObject->State_of_Title_Company__c = $postval['state_of_title_company'];
$sObject->Zip_Code_of_Title_Company__c = $postval['zip_of_title_company'];
$sObject->Name_of_Closing_Agent__c = $postval['name_of_closing_agent'];
$sObject->Phone_Number_of_Closing_Agent__c = $postval['ph_no_for_closing_agent'];
$createResponse = $mySforceConnection->create(array($sObject), 'Real_Estate_Commission__c');
$ids = array();
foreach ($createResponse as $createResult) {
print_r($createResult);
array_push($ids, $createResult->id);
}
} catch (Exception $e) {
echo $mySforceConnection->getLastRequest();
echo $e->faultstring;
}
}
?>