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 $session->Profile['permissions'] = 12;
47 \Utility\Debug::errorLog('create profile', $session->Profile);
48 $profile = $profileService->create($session->Profile);
51 $toProfileId = $profile->id;
52 $email = $profile->email;
55 $templateName = 'activation-pending';
58 $params['firstName'] = $profile->firstName;
59 $params['familyName'] = $profile->familyName;
60 $params['message'] = 'Thank you for registering. Your registration was submitted for approval '
61 . 'and you will receive email confirmation once your account has been verified.'
62 . 'Please note that if any documents were not uploaded they need to be emailed'
63 . ' (info@bid4cars.com.na) or faxed (086 618 5584) before we can approve your '
66 #-> Send welcome notification to User.
67 $oNotify = new \Utility\Comms\Notification();
68 $oNotify->sendFromTemplate(
70 $toCompanyId, $toProfileId,
78 #-> Send welcome notification to Admin.
79 $oNotify = new \Utility\Comms\Notification();
80 $oNotify->sendFromTemplate(
82 $toCompanyId, $toProfileId,
83 'info@bid4cars.com.na', $mobile,