{
$contactService = new \Person\Service\Contact();
$contactService->setWorkflow(new \Person\Workflow());
-// $companyService = new \Company\Service\Company();
-// $companyService->setWorkflow(new \Company\Workflow());
+ $companyService = new \Company\Service\Company();
+ $companyService->setWorkflow(new \Company\Workflow());
$profileService = new \User\Service\Profile();
$profileService->setWorkflow(new \User\Workflow());
//\Utility\Debug::errorLog('create contact', $session->Contact);
+
+ $session->Contact['firstName']=$session->Profile['firstName'];
+ $session->Contact['familyName']=$session->Profile['familyName'];
+ $session->Contact['email']=$session->Profile['email'];
+ $session->Contact['mobile']=$session->Profile['mobile'];
+
+
$contact = $contactService->create($session->Contact);
$session->Company['contact'] = $contact->id;
+ $session->Company['name']= $session->Profile['firstName'].' '.$session->Profile['familyName'];
+ $session->Company['businessName']= $session->Profile['firstName'].' '.$session->Profile['familyName'];
+ $session->Company['group']= '3';
+ $session->Company['groupDivision']= '3';
+// $session->Company['region']= '1';
+// $session->Company['city']= '1';
// if (isset($session->BillingContact))
// {
// //\Utility\Debug::errorLog('create billing contact', $session->BillingContact);
// $session->Company['contbillingContactact'] = $billingContact->id;
// }
//\Utility\Debug::errorLog('create company', $session->Company);
-// $company = $companyService->create($session->Company);
-// $session->Profile['company'] = $company->id;
+ $company = $companyService->create($session->Company);
+ $session->Profile['company'] = $company->id;
// if ($session->Profile['permissions'] < 5 || $session->Profile['permissions'] > 8)
// {
// $session->Profile['permissions'] = 5;
// {"value":"Turnover > R3,000,000", "label":"Turnover > R3,000,000"}
// ]);
App.DataStore.loadSelectListData('permissions', true, 'User', 'Permissions.SelectList');
- //App.DataStore.loadSelectListData('countries', true, 'Location', 'Country.SelectList');
+ App.DataStore.loadSelectListData('countries', true, 'Location', 'Country.SelectList');
//App.DataStore.loadSelectListData('groups', true, 'Company', 'Group.SelectList');
//App.DataStore.loadSelectListData('foundmethods', true, 'Company', 'FoundMethod.SelectList');
//
//
//// Adresses and billing contact
- //'country' : {
- // type : 'select',
- // id : 'country',
- // title : 'Country',
- // dataStoreId : 'countries',
- // value : '',
- // onChange : function () {
- // if (!App.DataStore.getItem('BuildSelect:country', false))
- // {
- // App.DataStore.loadSelectListData(
- // 'regions', false, 'Location', 'Region.SelectList', null,
- // {"Filter": {
- // "country" : $(this).val()
- // }}
- // );
- // App.DataStore.setData('cities', []);
- // if ($('#sameAsBusinessAddress').prop('checked'))
- // {
- // $('#billingCountry').selectpicker('val', $('#country').val());
- // }
- // }
- // }
- //},
- //'region' : {
- // type : 'select',
- // id : 'region',
- // title : 'Region',
- // dataStoreId : 'regions',
- // value : '',
- // onChange : function () {
- // if (!App.DataStore.getItem('BuildSelect:region', false))
- // {
- // App.DataStore.loadSelectListData(
- // 'cities', false, 'Location', 'Town.SelectList', null,
- // {"Filter": {
- // "region" : $(this).val()
- // }}
- // );
- // if ($('#sameAsBusinessAddress').prop('checked'))
- // {
- // $('#billingRegion').selectpicker('val', $('#region').val());
- // }
- // }
- // }
- //},
- //'city' : {
- // type : 'select',
- // id : 'city',
- // title : 'Town',
- // dataStoreId : 'cities',
- // value : ''
- //},
- //'street' : {
- // type : 'input',
- // id : 'street',
- // title : 'Street',
- // value : '',
- // maxlength : 75
- //},
- //'postalCode' : {
- // type : 'input',
- // id : 'postalCode',
- // title : 'Code',
- // value : '',
- // maxlength : 10
- //},
+ 'country' : {
+ type : 'select',
+ id : 'country',
+ title : 'Country',
+ dataStoreId : 'countries',
+ value : '',
+ onChange : function () {
+ if (!App.DataStore.getItem('BuildSelect:country', false))
+ {
+ App.DataStore.loadSelectListData(
+ 'regions', false, 'Location', 'Region.SelectList', null,
+ {"Filter": {
+ "country" : $(this).val()
+ }}
+ );
+ App.DataStore.setData('cities', []);
+ if ($('#sameAsBusinessAddress').prop('checked'))
+ {
+ $('#billingCountry').selectpicker('val', $('#country').val());
+ }
+ }
+ }
+ },
+ 'region' : {
+ type : 'select',
+ id : 'region',
+ title : 'Region',
+ dataStoreId : 'regions',
+ value : '',
+ onChange : function () {
+ if (!App.DataStore.getItem('BuildSelect:region', false))
+ {
+ App.DataStore.loadSelectListData(
+ 'cities', false, 'Location', 'Town.SelectList', null,
+ {"Filter": {
+ "region" : $(this).val()
+ }}
+ );
+ if ($('#sameAsBusinessAddress').prop('checked'))
+ {
+ $('#billingRegion').selectpicker('val', $('#region').val());
+ }
+ }
+ }
+ },
+ 'city' : {
+ type : 'select',
+ id : 'city',
+ title : 'Town',
+ dataStoreId : 'cities',
+ value : ''
+ },
+ 'street' : {
+ type : 'input',
+ id : 'street',
+ title : 'Street',
+ value : '',
+ maxlength : 75
+ },
+ 'postalCode' : {
+ type : 'input',
+ id : 'postalCode',
+ title : 'Code',
+ value : '',
+ maxlength : 10
+ },
//'sameAsBusinessAddress' : {
// type : 'checkbox',
// id : 'sameAsBusinessAddress',
//companyRegistrationNumber: {companyReg: true},
//vatNumber: {digits: true},
- //country: {required: true},
- //region: {required: true},
- //city: {required: true},
- //street: {required: true},
- //postalCode: {required: true, digits: true},
+ country: {required: true},
+ region: {required: true},
+ city: {required: true},
+ street: {required: true},
+ postalCode: {required: true, digits: true},
//billingCountry: {required: true},
//billingRegion: {required: true},
//billingCity: {required: true},
"firstName","familyName","permissions","email","confirmEmail",
"pin","confirmPin","idNumber","dateOfBirth","mobile", "subscribeNewsletter"
];
- //var companyFields = [
- // "dealerType","clientType","group","groupDivision","companyType",
- // "businessName","name","companyRegistrationNumber","vatNumber","turmiNumber",
- // "dealerStockNumber","turnover","foundMethod","foundMethodDetail",
- // "country","region","city","street","postalCode",
- // "billingCountry","billingRegion","billingCity","billingStreet","billingPostalCode",
- // "docStockCertificate","docAddressProof","docCopyOfId",
- // "docCopyOfDirectorId","docCompanyRegistration"
- // ];
+ var companyFields = [
+ //"dealerType","clientType","group","groupDivision","companyType",
+ //"businessName","name","companyRegistrationNumber","vatNumber","turmiNumber",
+ //"dealerStockNumber","turnover","foundMethod","foundMethodDetail",
+ "country","region","city","street","postalCode",
+ //"billingCountry","billingRegion","billingCity","billingStreet","billingPostalCode",
+ //"docStockCertificate","docAddressProof","docCopyOfId",
+ //"docCopyOfDirectorId","docCompanyRegistration"
+ ];
var contactFields = {
"contactFirstName" : "firstName",
"contactFamilyName" : "familyName",
};
for (var field in data)
{
- //if (-1 != companyFields.indexOf(field))
- //{
- // postData.Company[field] = '' != data[field] ? data[field] : null;
- //}
- //else
+ if (-1 != companyFields.indexOf(field))
+ {
+ postData.Company[field] = '' != data[field] ? data[field] : null;
+ }
+ else
if (-1 != profileFields.indexOf(field))
{
postData.Profile[field] = '' != data[field] ? data[field] : null;