latest update
[namibia] / module / Dispute / src / Dispute / Service / Dispute.php
1 <?php
2 namespace Dispute\Service;
3
4
5
6 /**
7  * Manage Dispute data.
8  * @author andre.fourie
9  */
10 class Dispute extends \Dispute\DataBin\Dispute
11 {
12
13
14         /**
15          * ExecuteAfter: Create.
16          * New dispute created, notifications be required.
17          * @param array $meta
18          * @param object|null $jobRecord
19          * @param object|null $record
20          * @param \Workspace\Utility\ServiceInputParams $contract
21          */
22         public function sendDisputeNotification($meta, $jobRecord, $record, \Workspace\Utility\ServiceInputParams $contract)
23         {
24                 #-> Collect.
25                 $vehicle = $record->auction->stock->type->model->make->name
26                                 . ', ' . $record->auction->stock->type->model->name
27                                 . ', ' . $record->auction->stock->type->name
28                                 . ' (' . $record->auction->stock->vehicleYear->name . ')';
29                 $params = array(
30                                                 'vehicle'                               => $vehicle,
31                                                 'complaint'                     => $record->complaint,
32                                                 'plaintive'                     => $record->fromCompany->name,
33                                                 'defendant'                     => $record->againstCompany->name,
34                                                 'reference_number'              => $record->id,
35                                                 'registration_number'   => $record->auction->stock->registrationNumber,
36                                                 'plaintive_contact'     => $record->fromCompany->contact->firstName
37                                                 . ' ' . $record->fromCompany->contact->familyName,
38                                                 'plaintive_telephone'   => $record->fromCompany->contact->office,
39                                                 'plaintive_mobile'              => $record->fromCompany->contact->mobile,
40                                                 'plaintive_email'               => $record->fromCompany->contact->email,
41                                                 'defendant_contact'     => $record->againstCompany->contact->firstName
42                                                 . ' ' . $record->againstCompany->contact->familyName,
43                                                 'defendant_telephone'   => $record->againstCompany->contact->office,
44                                                 'defendant_mobile'              => $record->againstCompany->contact->mobile,
45                                                 'defendant_email'               => $record->againstCompany->contact->email
46                                 );
47
48                 #-> Send.
49                 $oNotify = new \Utility\Comms\Notification();
50                 $oNotify->sendFromTemplate(
51                                 $record->fromCompany->id, $record->createdBy->id,
52                                 $record->fromCompany->id, $record->createdBy->id,
53                                 $record->fromCompany->contact->email, null,
54                                 null, 'new-dispute', $params
55                 );
56                 $oNotify->sendFromTemplate(
57                                 $record->fromCompany->id, $record->createdBy->id,
58                                 $record->againstCompany->id, null,
59                                 $record->againstCompany->contact->email, null,
60                                 null, 'new-dispute', $params
61                 );
62                 $oNotify->sendFromTemplate(
63                                 $record->fromCompany->id, $record->createdBy->id,
64                                 null, null,
65                                 \Utility\Definitions\Locale::getAdminEmailAddress(), null,
66                                 null, 'new-dispute', $params
67                 );
68     $oNotify->sendFromTemplate(
69                                 $record->fromCompany->id, $record->createdBy->id,
70                                 null, null,
71                                 'info@bid4cars.com.na', null,
72                                 null, 'new-dispute', $params
73                 );
74         }
75
76
77
78 }