Total Complexity | 8 |
Total Lines | 191 |
Duplicated Lines | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
5 | class SalesforceContactLog extends DataObject |
||
6 | { |
||
7 | |||
8 | /** |
||
9 | * create contact log |
||
10 | * @param string $type |
||
11 | * @param array $fieldsSent |
||
12 | * @param array $filters |
||
13 | * |
||
14 | * @return SalesforceContactLog |
||
15 | */ |
||
16 | public static function create_contact_log($type, array $fieldsSent, array $filters) : SalesforceContactLog |
||
|
|||
17 | { |
||
18 | $fieldsSent = serialize($fieldsSent); |
||
19 | $filters = serialize($fieldsSent); |
||
20 | $obj = SalesforceContactLog::create( |
||
21 | [ |
||
22 | 'Type' => $type, |
||
23 | 'FieldsSent' => $fieldsSent, |
||
24 | 'Filters' => $filters, |
||
25 | ] |
||
26 | ); |
||
27 | $id = $obj->write(); |
||
28 | |||
29 | return SalesforceContactLog::get()->byID($id); |
||
30 | } |
||
31 | |||
32 | /** |
||
33 | * returns true if the contact update was successful |
||
34 | * @param SalesforceContactLog $obj |
||
35 | * @param mixed $response |
||
36 | * |
||
37 | * @return bool |
||
38 | */ |
||
39 | public function endContactLog(SalesforceContactLog $obj, $response) : bool |
||
40 | { |
||
41 | $id = ''; |
||
42 | $errors = ''; |
||
43 | print_r($response); |
||
44 | die(); |
||
45 | $obj->SalesforceIdentifier = $errors; |
||
46 | $obj->Errors = $id; |
||
47 | $obj->write(); |
||
48 | |||
49 | return $obj->SalesforceIdentifier ? true : false; |
||
50 | } |
||
51 | |||
52 | /** |
||
53 | * Singular name for CMS |
||
54 | * @var string |
||
55 | */ |
||
56 | private static $singular_name = 'Sales Force Contact Log'; |
||
1 ignored issue
–
show
|
|||
57 | |||
58 | /** |
||
59 | * Plural name for CMS |
||
60 | * @var string |
||
61 | */ |
||
62 | private static $plural_name = 'Sales Force Contact Log Entries'; |
||
1 ignored issue
–
show
|
|||
63 | |||
64 | /** |
||
65 | * SS4 prep! |
||
66 | * @var string |
||
67 | */ |
||
68 | private static $table_name = 'SalesforceContactLog'; |
||
1 ignored issue
–
show
|
|||
69 | |||
70 | private static $db = [ |
||
1 ignored issue
–
show
|
|||
71 | 'SalesforceIdentifier' => 'Varchar(40)', |
||
72 | 'Type' => 'Enum("Created,Updated")', |
||
73 | 'FieldsSent' => 'Text', |
||
74 | 'Filters' => 'Text', |
||
75 | 'Errors' => 'Text', |
||
76 | ]; |
||
77 | |||
78 | |||
79 | private static $default_sort = [ |
||
1 ignored issue
–
show
|
|||
80 | 'ID' => 'DESC' |
||
81 | ]; |
||
82 | |||
83 | /** |
||
84 | * Defines a default list of filters for the search context |
||
85 | * @var array |
||
86 | */ |
||
87 | private static $searchable_fields = [ |
||
1 ignored issue
–
show
|
|||
88 | 'SentToSalesforce' => 'ExactMatchFilter', |
||
89 | 'Type' => 'ExactMatchFilter', |
||
90 | 'SalesforceIdentifier' => 'PartialMatchField', |
||
91 | 'FieldsSent' => 'PartialMatchField', |
||
92 | 'Filters' => 'PartialMatchField', |
||
93 | 'Errors' => 'PartialMatchField', |
||
94 | ]; |
||
95 | |||
96 | /** |
||
97 | * Defines summary fields commonly used in table columns |
||
98 | * as a quick overview of the data for this dataobject |
||
99 | * @var array |
||
100 | */ |
||
101 | private static $summary_fields = [ |
||
1 ignored issue
–
show
|
|||
102 | 'SentToSalesforce' => 'Sent to SF', |
||
103 | 'SalesforceIdentifier' => 'SF ID', |
||
104 | 'Type' => 'Type', |
||
105 | 'Errors' => 'Errors' |
||
106 | ]; |
||
107 | |||
108 | private static $indexes = [ |
||
1 ignored issue
–
show
|
|||
109 | 'Created' => true, |
||
110 | 'LastEdited' => true, |
||
111 | 'SentToSalesforce' => true, |
||
112 | 'SalesforceIdentifier' => true, |
||
113 | 'FirstName' => true, |
||
114 | 'LastName' => true, |
||
115 | 'Email' => true, |
||
116 | ]; |
||
117 | |||
118 | /** |
||
119 | * CMS Fields |
||
120 | * @return FieldList |
||
121 | */ |
||
122 | public function getCMSFields() |
||
154 | } |
||
155 | |||
156 | /** |
||
157 | * DataObject create permissions |
||
158 | * @param Member $member |
||
159 | * @return bool |
||
160 | */ |
||
161 | public function canCreate($member = null) |
||
162 | { |
||
163 | return false; |
||
164 | } |
||
165 | |||
166 | /** |
||
167 | * DataObject edit permissions |
||
168 | * @param Member $member |
||
169 | * @return bool |
||
170 | */ |
||
171 | public function canEdit($member = null) |
||
172 | { |
||
173 | return false; |
||
174 | } |
||
175 | |||
176 | /** |
||
177 | * DataObject delete permissions |
||
178 | * @param Member $member |
||
179 | * @return bool |
||
180 | */ |
||
181 | public function canDelete($member = null) |
||
182 | { |
||
183 | return false; |
||
184 | } |
||
185 | |||
186 | /** |
||
187 | * |
||
188 | * @param string $serializedString (serialised data) |
||
189 | * @return string (html) |
||
190 | */ |
||
191 | protected function serializedToHTML($serializedString) |
||
196 | } |
||
197 | |||
198 | } |
||
199 |
This check looks for parameters that have been defined for a function or method, but which are not used in the method body.