2 namespace User\Service;
7 * Registration, login and forgot password functionality.
10 class Registration extends \User\DataBin\Registration
14 * ExecuteAfter: RegisterFinal.
15 * Register a new dealership and its primary user.
17 * @param object|null $jobRecord
18 * @param object|null $record
19 * @param \Workspace\Utility\ServiceInputParams $contract
22 public function RegisterCompany($meta, $jobRecord, $session, \Workspace\Utility\ServiceInputParams $contract)
24 $contactService = new \Person\Service\Contact();
25 $contactService->setWorkflow(new \Person\Workflow());
26 $companyService = new \Company\Service\Company();
27 $companyService->setWorkflow(new \Company\Workflow());
28 $profileService = new \User\Service\Profile();
29 $profileService->setWorkflow(new \User\Workflow());
30 //\Utility\Debug::errorLog('create contact', $session->Contact);
31 $contact = $contactService->create($session->Contact);
32 $session->Company['contact'] = $contact->id;
33 if (isset($session->BillingContact))
35 //\Utility\Debug::errorLog('create billing contact', $session->BillingContact);
36 $billingContact = $contactService->create($session->BillingContact);
37 $session->Company['contbillingContactact'] = $billingContact->id;
39 //\Utility\Debug::errorLog('create company', $session->Company);
40 $company = $companyService->create($session->Company);
41 $session->Profile['company'] = $company->id;
42 if ($session->Profile['permissions'] < 5 || $session->Profile['permissions'] > 8)
44 $session->Profile['permissions'] = 5;
46 //\Utility\Debug::errorLog('create profile', $session->Profile);
47 $profile = $profileService->create($session->Profile);
49 $toCompanyId = $company->id;
50 $toProfileId = $profile->id;
51 $email = $profile->email;
54 $templateName = 'activation-pending';
57 $params['firstName'] = $profile->firstName;
58 $params['familyName'] = $profile->familyName;
59 $params['message'] = 'Thank you for registering. Your registration was submitted for approval '
60 . 'and you will receive email confirmation once your account has been verified.'
61 . 'Please note that if any documents were not uploaded they need to be emailed'
62 . ' (info@bid4cars.co.za) or faxed (086 618 5584) before we can approve your '
65 #-> Send welcome notification to User.
66 $oNotify = new \Utility\Comms\Notification();
67 $oNotify->sendFromTemplate(
69 $toCompanyId, $toProfileId,
77 #-> Send welcome notification to Admin.
78 $oNotify = new \Utility\Comms\Notification();
79 $oNotify->sendFromTemplate(
81 $toCompanyId, $toProfileId,
82 'info@bid4cars.co.za', $mobile,