1
|
|
|
<?php |
2
|
|
|
/** |
3
|
|
|
* m'Manager | Invoices Management System |
4
|
|
|
* |
5
|
|
|
* This content is released under the Proprietary License (Proprietary) |
6
|
|
|
* |
7
|
|
|
* Copyright (c) 2017, Eric Claver AKAFFOU - All Rights Reserved |
8
|
|
|
* Unauthorized copying of this file, via any medium is strictly prohibited |
9
|
|
|
* Proprietary and confidential |
10
|
|
|
* |
11
|
|
|
* @package m'Manager |
12
|
|
|
* @author Eric Claver AKAFFOU |
13
|
|
|
* @copyright Copyright (c) 2017, on'Eric Computing, Inc. (https://www.onericcomputing.com/) |
14
|
|
|
* @license https://www.mmanager.fr Proprietary License |
15
|
|
|
* @link https://codecanyon.net/item/mmanager-invoices-management-system/19866435?s_rank=1 |
16
|
|
|
* @since Version 1.0.0 |
17
|
|
|
* @filesource |
18
|
|
|
*/ |
19
|
|
|
|
20
|
|
|
namespace Mmanager\Extensions\Mrepair; |
21
|
|
|
use Mmanager\Extensions\Database\Builder; |
22
|
|
|
|
23
|
|
|
class Functions { |
24
|
|
|
protected $db; |
25
|
|
|
protected $builder; |
26
|
|
|
protected $options; |
27
|
|
|
|
28
|
|
|
public function __construct() { |
29
|
|
|
$this->builder = new Builder(); |
30
|
|
|
$this->db = $this->builder->getDB(); |
31
|
|
|
$this->options = $this->getOptions(); |
32
|
|
|
} |
33
|
|
|
|
34
|
|
|
public function getOptions() { |
35
|
|
|
$query = "SELECT * FROM oc_options"; |
36
|
|
|
return $this->db->get_results($query); |
37
|
|
|
} |
38
|
|
|
public function getOption($option_name) { |
39
|
|
|
$options = $this->getOptions(); |
40
|
|
|
foreach ($options as $option) { |
41
|
|
|
if ($option->option_name == $option_name) { |
42
|
|
|
return $option->option_value; |
43
|
|
|
} |
44
|
|
|
} |
45
|
|
|
} |
46
|
|
|
|
47
|
|
|
public function createTables() { |
48
|
|
|
if ( ! db_table_exists('oc_tickets')) |
49
|
|
|
{ |
50
|
|
|
$this->db->query("CREATE TABLE IF NOT EXISTS `oc_tickets` (`id` int(11) NOT NULL AUTO_INCREMENT, `client_id` int(11) NOT NULL DEFAULT 0,`user_id` int(11) NULL,`updated_by` int(11) NULL,`name_company` varchar(225) NULL,`client_phone` varchar(225) NULL,`ticket_number` int(11) NOT NULL,`ticket_reference` VARCHAR(225) NULL, `ticket_external_reference` VARCHAR(225) NULL,`ticket_status` INT(11) NULL,`ticket_title` varchar(225) NOT NULL,`notification_emails` TEXT NULL,`issue_type` int(11) NULL,`issue_description` TEXT NULL, `is_approved_to_proceed` tinyint(1) NOT NULL DEFAULT 1,`is_prediagnosed` tinyint(1) NOT NULL DEFAULT 1,`email_opt_out` tinyint(1) NOT NULL DEFAULT 0,`appointment_type` int(11) NULL,`appointment_location` TEXT NULL,`appointment_datetime` DATETIME NULL,`appointment_owner` INT(11) NULL,`appointment_attendees` TEXT NULL,`attachments` TEXT NULL,`asset_type` INT(11) NULL,`asset_name` VARCHAR(225) NULL,`asset_lock_code` VARCHAR(225) NULL,`asset_serial` VARCHAR(225) NULL,`asset_model` VARCHAR(225) NULL,`asset_make` VARCHAR(225) NULL,`asset_imei` VARCHAR(225) NULL,`asset_brand` VARCHAR(225) NULL,`asset_vin` VARCHAR(225) NULL, `qa_diagnosis` TEXT NULL,`pre_diagnosis` TEXT NULL,`post_diagnosis` TEXT NULL, `created_on` DATETIME NULL,`updated_on` TIMESTAMP DEFAULT CURRENT_TIMESTAMP, PRIMARY KEY (`id`)) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=1 ;"); |
51
|
|
|
$this->db->query("CREATE TABLE IF NOT EXISTS `oc_tickets_issue_types` (`id` int(11) NOT NULL AUTO_INCREMENT,`name` VARCHAR(225) NULL, PRIMARY KEY (`id`)) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=1 ;"); |
52
|
|
|
$this->db->query("CREATE TABLE IF NOT EXISTS `oc_tickets_canned_responses` (`id` int(11) NOT NULL AUTO_INCREMENT,`category_id` int(11) NOT NULL DEFAULT 0, `ticket_canned_response_title` VARCHAR(225) NULL, `ticket_canned_response_body` LONGTEXT NULL, PRIMARY KEY (`id`)) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=1 ;"); |
53
|
|
|
$this->db->query("CREATE TABLE IF NOT EXISTS `oc_tickets_canned_responses_categories` (`id` int(11) NOT NULL AUTO_INCREMENT,`category_name` VARCHAR(225) NULL, PRIMARY KEY (`id`)) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=1 ;"); |
54
|
|
|
$this->db->query("CREATE TABLE IF NOT EXISTS `oc_tickets_messaging` (`id` int(11) NOT NULL AUTO_INCREMENT, `ticket_id` int(11) NULL, `ticket_reference` varchar(225) NULL,`message_from` int(11) DEFAULT NULL, `message_to` int(11) DEFAULT NULL, `message` text, `account_id` int(11) NULL, `user_id` int(11) NULL,`is_client` int(11) NOT NULL DEFAULT 0, `is_read` tinyint(1) NULL DEFAULT 0, `created_on` TIMESTAMP DEFAULT CURRENT_TIMESTAMP, PRIMARY KEY (`id`)) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=1 ;"); |
55
|
|
|
|
56
|
|
|
// Alter tables |
57
|
|
|
if ( ! col_exists('ticket', 'quote_number')) { |
58
|
|
|
$this->db->query("ALTER TABLE `oc_tickets` ADD `quote_number` VARCHAR(20) DEFAULT NULL"); |
59
|
|
|
} |
60
|
|
|
if ( ! col_exists('ticket', 'invoice_number')) { |
61
|
|
|
$this->db->query("ALTER TABLE `oc_tickets` ADD `invoice_number` VARCHAR(20) DEFAULT NULL"); |
62
|
|
|
} |
63
|
|
|
if ( ! col_exists('purchases', 'repair_number')) { |
64
|
|
|
$this->db->query("ALTER TABLE `oc_purchases` ADD `repair_number` VARCHAR(20) DEFAULT NULL"); |
65
|
|
|
} |
66
|
|
|
if ( ! col_exists('purchases_items', 'repair_number')) { |
67
|
|
|
$this->db->query("ALTER TABLE `oc_purchaseitems` ADD `repair_number` VARCHAR(20) DEFAULT NULL"); |
68
|
|
|
} |
69
|
|
|
if ( ! col_exists('invoices', 'repair_number')) { |
70
|
|
|
$this->db->query("ALTER TABLE `oc_invoices` ADD `repair_number` VARCHAR(20) DEFAULT NULL"); |
71
|
|
|
} |
72
|
|
|
if ( ! col_exists('invoices_items', 'repair_number')) { |
73
|
|
|
$this->db->query("ALTER TABLE `oc_invoiceitems` ADD `repair_number` VARCHAR(20) DEFAULT NULL"); |
74
|
|
|
} |
75
|
|
|
if ( ! col_exists('quotes', 'repair_number')) { |
76
|
|
|
$this->db->query("ALTER TABLE `oc_quotes` ADD `repair_number` VARCHAR(20) DEFAULT NULL"); |
77
|
|
|
} |
78
|
|
|
if ( ! col_exists('quotes_items', 'repair_number')) { |
79
|
|
|
$this->db->query("ALTER TABLE `oc_quoteitems` ADD `repair_number` VARCHAR(20) DEFAULT NULL"); |
80
|
|
|
} |
81
|
|
|
|
82
|
|
|
$this->registerPluginMenu([ |
83
|
|
|
__('link_repair_center') => [ |
84
|
|
|
'id' => 'repaircenter', |
85
|
|
|
'settings-id' => 'repairsettings', |
86
|
|
|
'settings-arrowid' => 'repairsettingsarrow', |
87
|
|
|
'href' => 'index.php/repair', |
88
|
|
|
'settings_href' => 'index.php/repair/settings', |
89
|
|
|
'icon' => 'icon-wrench', |
90
|
|
|
'title' => __('link_repair_center'), |
91
|
|
|
'settings_title' => __('label_repair_settings') |
92
|
|
|
], |
93
|
|
|
]); |
94
|
|
|
} |
95
|
|
|
} |
96
|
|
|
|
97
|
|
|
public function getRepairTickets() { |
98
|
|
|
return $this->db->get_results("SELECT * FROM oc_tickets ORDER BY id DESC"); |
99
|
|
|
} |
100
|
|
|
public function getClientRepairTickets($client_id) { |
101
|
|
|
if ($client_id) { |
102
|
|
|
return $this->db->get_results("SELECT * FROM oc_tickets WHERE client_id = {$client_id} ORDER BY id DESC"); |
103
|
|
|
} else { |
104
|
|
|
return []; |
105
|
|
|
} |
106
|
|
|
} |
107
|
|
|
|
108
|
|
|
public function getRepairTicket($id, $var = null) { |
109
|
|
|
if ( ! $var) { |
110
|
|
|
return $this->db->get_row("SELECT * FROM oc_tickets WHERE id = {$id}"); |
111
|
|
|
} else { |
112
|
|
|
if (is_numeric($id)) { |
113
|
|
|
return $this->db->get_row("SELECT $var FROM oc_tickets WHERE id = {$id}")->{$var}; |
114
|
|
|
} else { |
115
|
|
|
return $this->db->get_row("SELECT $var FROM oc_tickets WHERE ticket_reference LIKE '{$id}'")->{$var}; |
116
|
|
|
} |
117
|
|
|
} |
118
|
|
|
} |
119
|
|
|
|
120
|
|
|
public function get_repair_status_by_reference($ref) { |
121
|
|
|
return $this->db->get_row("SELECT ticket_status FROM oc_tickets WHERE ticket_reference LIKE '{$ref}'")->ticket_status; |
122
|
|
|
} |
123
|
|
|
|
124
|
|
|
public function searchRepairByReference($ref) { |
125
|
|
|
return $this->db->get_results("SELECT * FROM oc_tickets WHERE ticket_reference LIKE '{$ref}' OR ticket_external_reference LIKE '{$ref}'"); |
126
|
|
|
} |
127
|
|
|
public function generateRepairReference() { |
128
|
|
|
$time = time(); |
|
|
|
|
129
|
|
|
return 'REPAIR-'.date('ymd').'-'.strtoupper($this->generateRandomString()); |
130
|
|
|
} |
131
|
|
|
public function generateRandomString($length = 5) { |
132
|
|
|
$characters = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'; |
133
|
|
|
$charactersLength = strlen($characters); |
134
|
|
|
$randomString = ''; |
135
|
|
|
for ($i = 0; $i < $length; $i++) { |
136
|
|
|
$randomString .= $characters[rand(0, $charactersLength - 1)]; |
137
|
|
|
} |
138
|
|
|
return $randomString; |
139
|
|
|
} |
140
|
|
|
public function getTicketIssueTypes($id = null) { |
141
|
|
|
if ( ! $id) { |
142
|
|
|
return $this->db->get_results("SELECT * FROM oc_tickets_issue_types ORDER BY name"); |
143
|
|
|
} else { |
144
|
|
|
return $this->db->get_row("SELECT name FROM oc_tickets_issue_types WHERE id = '{$id}'")->name; |
145
|
|
|
} |
146
|
|
|
} |
147
|
|
View Code Duplication |
public function getTicketAdditionalEmailsToNotify() { |
|
|
|
|
148
|
|
|
$list = []; |
149
|
|
|
|
150
|
|
|
$results = $this->db->get_results("SELECT id, email FROM users"); |
151
|
|
|
if ($results) { |
152
|
|
|
foreach ($results as $user) { |
153
|
|
|
array_push($list, array('id' => $user->id, 'text' => $user->email)); |
154
|
|
|
} |
155
|
|
|
} |
156
|
|
|
return $list; |
157
|
|
|
} |
158
|
|
View Code Duplication |
public function getTicketCannedResponsesCategories() { |
|
|
|
|
159
|
|
|
$list = []; |
160
|
|
|
|
161
|
|
|
$results = $this->db->get_results("SELECT id, category_name FROM oc_tickets_canned_responses_categories"); |
162
|
|
|
if ($results) { |
163
|
|
|
foreach ($results as $cat) { |
164
|
|
|
array_push($list, array('id' => $cat->id, 'text' => $cat->category_name)); |
165
|
|
|
} |
166
|
|
|
} |
167
|
|
|
return $list; |
168
|
|
|
} |
169
|
|
View Code Duplication |
public function getTicketCannedResponses() { |
|
|
|
|
170
|
|
|
$list = []; |
171
|
|
|
|
172
|
|
|
$results = $this->db->get_results("SELECT id, ticket_canned_response_title FROM oc_tickets_canned_responses"); |
173
|
|
|
if ($results) { |
174
|
|
|
foreach ($results as $response) { |
175
|
|
|
array_push($list, array('id' => $response->id, 'text' => $response->ticket_canned_response_title)); |
176
|
|
|
} |
177
|
|
|
} |
178
|
|
|
return $list; |
179
|
|
|
} |
180
|
|
|
public function getTicketResponseCategoryId($name) { |
181
|
|
|
$name = addslashes($name); |
182
|
|
|
return $this->db->get_row("SELECT id FROM oc_tickets_canned_responses_categories where category_name LIKE '{$name}'")->id; |
183
|
|
|
} |
184
|
|
|
public function getTicketResponseBody($id) { |
185
|
|
|
return $this->db->get_row("SELECT ticket_canned_response_body FROM oc_tickets_canned_responses where id = '{$id}'")->ticket_canned_response_body; |
186
|
|
|
} |
187
|
|
|
public function getTicketsAppointments() { |
188
|
|
|
$list = []; |
189
|
|
|
|
190
|
|
|
$results = $this->db->get_results("SELECT id, ticket_reference, appointment_datetime, appointment_owner, appointment_attendees, client_id FROM oc_tickets"); |
191
|
|
|
if ($results) { |
192
|
|
|
foreach ($results as $appointment) { |
193
|
|
|
if ($appointment->appointment_datetime) { |
194
|
|
|
array_push($list, array( |
195
|
|
|
'id' => $appointment->id, |
196
|
|
|
'title' => $appointment->ticket_reference.' ( '.$appointment->appointment_datetime.' ) ', |
197
|
|
|
'start' => $appointment->appointment_datetime, |
198
|
|
|
)); |
199
|
|
|
} |
200
|
|
|
} |
201
|
|
|
} |
202
|
|
|
return $list; |
203
|
|
|
} |
204
|
|
|
public function format_appointment_address() { |
205
|
|
|
return array( |
206
|
|
|
'user_address1' => get_option('address1'), |
207
|
|
|
'user_address2' => get_option('address2'), |
208
|
|
|
'user_city' => get_option('city'), |
209
|
|
|
'user_postcode' => get_option('postcode'), |
210
|
|
|
'user_state' => get_option('state'), |
211
|
|
|
'user_country' => 'None' == get_countries(get_option('country')) ? '' : get_countries(get_option('country')) |
212
|
|
|
); |
213
|
|
|
} |
214
|
|
|
|
215
|
|
|
public function getRepairStatuses($id = null, $str = false) { |
216
|
|
|
$statuses = array( |
217
|
|
|
'1' => __('label_new'), |
218
|
|
|
'2' => __('label_progress'), |
219
|
|
|
'3' => __('label_resolved'), |
220
|
|
|
'4' => __('label_invoiced'), |
221
|
|
|
'5' => __('label_waiting_for_parts'), |
222
|
|
|
'6' => __('label_waiting_on_customer'), |
223
|
|
|
'7' => __('label_scheduled'), |
224
|
|
|
'8' => __('label_customer_reply') |
225
|
|
|
); |
226
|
|
|
|
227
|
|
|
if ( ! $id && ! $str) { |
228
|
|
|
return $statuses; |
229
|
|
|
} else { |
230
|
|
|
return $statuses[$id]; |
231
|
|
|
} |
232
|
|
|
} |
233
|
|
|
|
234
|
|
|
public function getAppointmentTypes($id = null, $str = false) { |
235
|
|
|
if ( ! $id) { |
236
|
|
|
$id = 1; |
237
|
|
|
} |
238
|
|
|
$types = array( |
239
|
|
|
'1' => array('id' => 1, 'value' => __('label_in_shop')), |
240
|
|
|
'2' => array('id' => 2, 'value' => __('label_onsite')), |
241
|
|
|
'3' => array('id' => 3, 'value' => __('label_phone_call')), |
242
|
|
|
); |
243
|
|
|
|
244
|
|
|
if ( ! $id && ! $str) { |
245
|
|
|
return $types; |
246
|
|
|
} else { |
247
|
|
|
return $types[$id]['value']; |
248
|
|
|
} |
249
|
|
|
} |
250
|
|
|
|
251
|
|
|
public function booleanToYesNo($int) { |
252
|
|
|
return 1 == $int ? __('label_yes') : __('label_no'); |
253
|
|
|
} |
254
|
|
|
|
255
|
|
View Code Duplication |
public function ticketNotificationEmails($id) { |
|
|
|
|
256
|
|
|
$list = []; |
257
|
|
|
|
258
|
|
|
$ccs = json_decode($this->getRepairTicket($id, 'notification_emails'), true); |
259
|
|
|
if ($ccs) { |
260
|
|
|
foreach ($ccs as $cc) { |
261
|
|
|
array_push($list, get_user_var($cc, 'email')); |
262
|
|
|
} |
263
|
|
|
return $list; |
264
|
|
|
} |
265
|
|
|
return []; |
266
|
|
|
} |
267
|
|
|
|
268
|
|
View Code Duplication |
public function ticketAttendees($id) { |
|
|
|
|
269
|
|
|
$list = []; |
270
|
|
|
|
271
|
|
|
$atts = json_decode($this->getRepairTicket($id, 'appointment_attendees'), true); |
272
|
|
|
if ($atts) { |
273
|
|
|
foreach ($atts as $att) { |
274
|
|
|
array_push($list, get_user_var($att, 'first_name')); |
275
|
|
|
} |
276
|
|
|
return $list; |
277
|
|
|
} |
278
|
|
|
return []; |
279
|
|
|
} |
280
|
|
|
|
281
|
|
View Code Duplication |
public function getTicketAttachemnts($id) { |
|
|
|
|
282
|
|
|
$list = []; |
283
|
|
|
|
284
|
|
|
$atts = json_decode($this->getRepairTicket($id, 'attachments'), true); |
285
|
|
|
if ($atts) { |
286
|
|
|
foreach ($atts as $att) { |
287
|
|
|
array_push($list, $att); |
288
|
|
|
} |
289
|
|
|
return $list; |
290
|
|
|
} |
291
|
|
|
return []; |
292
|
|
|
} |
293
|
|
|
|
294
|
|
|
public function implodeAddress($id = null, $context) { |
295
|
|
|
|
296
|
|
|
switch ($context) { |
297
|
|
|
case 'client': |
298
|
|
|
return implode(', ', array_values(array_filter((array) client($id, 'address')))); |
299
|
|
|
case 'company': |
300
|
|
|
$user_address = array( |
301
|
|
|
'user_address1' => get_option('address1'), |
302
|
|
|
'user_address2' => get_option('address2'), |
303
|
|
|
'user_city' => get_option('city'), |
304
|
|
|
'user_postcode' => get_option('postcode'), |
305
|
|
|
'user_state' => get_option('state'), |
306
|
|
|
'user_country' => 'None' == get_countries(get_option('country')) ? '' : get_countries(get_option('country')) |
307
|
|
|
); |
308
|
|
|
return implode(', ', array_values(array_filter($user_address))); |
309
|
|
|
} |
310
|
|
|
} |
311
|
|
|
|
312
|
|
|
public function getTicketDiagnosis($id = null, $var = null, $context = null) { |
313
|
|
|
switch ($context) { |
314
|
|
View Code Duplication |
case 'qa': |
|
|
|
|
315
|
|
|
$response = json_decode($this->getRepairTicket($id, 'qa_diagnosis'), true); |
316
|
|
|
if ($response) { |
317
|
|
|
if ($var) { |
318
|
|
|
foreach ($response as $key => $value) { |
319
|
|
|
if ($key == $var) { |
320
|
|
|
return $value; |
321
|
|
|
} |
322
|
|
|
} |
323
|
|
|
} else { |
324
|
|
|
return $response; |
325
|
|
|
} |
326
|
|
|
} |
327
|
|
View Code Duplication |
case 'pre': |
|
|
|
|
328
|
|
|
$response = json_decode($this->getRepairTicket($id, 'pre_diagnosis'), true); |
329
|
|
|
if ($response) { |
330
|
|
|
if ($var) { |
331
|
|
|
foreach ($response as $key => $value) { |
332
|
|
|
if ($key == $var) { |
333
|
|
|
return $value; |
334
|
|
|
} |
335
|
|
|
} |
336
|
|
|
} else { |
337
|
|
|
return $response; |
338
|
|
|
} |
339
|
|
|
} |
340
|
|
View Code Duplication |
case 'post': |
|
|
|
|
341
|
|
|
$response = json_decode($this->getRepairTicket($id, 'post_diagnosis'), true); |
342
|
|
|
if ($response) { |
343
|
|
|
if ($var) { |
344
|
|
|
foreach ($response as $key => $value) { |
345
|
|
|
if ($key == $var) { |
346
|
|
|
return $value; |
347
|
|
|
} |
348
|
|
|
} |
349
|
|
|
} else { |
350
|
|
|
return $response; |
351
|
|
|
} |
352
|
|
|
} |
353
|
|
|
} |
354
|
|
|
} |
355
|
|
|
|
356
|
|
|
public function getRepairMessages($id) { |
357
|
|
|
if (is_numeric($id)) { |
358
|
|
|
return $this->db->get_results("SELECT * FROM oc_tickets_messaging WHERE ticket_id = {$id} ORDER BY id DESC"); |
359
|
|
|
} else { |
360
|
|
|
return $this->db->get_results("SELECT * FROM oc_tickets_messaging WHERE ticket_reference LIKE '{$id}' ORDER BY id DESC"); |
361
|
|
|
} |
362
|
|
|
} |
363
|
|
|
public function registerPluginMenu($menu) { |
364
|
|
|
set_plugings($menu); |
365
|
|
|
} |
366
|
|
|
public function renderRepairDiagnosisKey($key) { |
367
|
|
|
switch ($key) { |
368
|
|
|
case 'qa_is_testable': |
369
|
|
|
case 'pre_is_testable': |
370
|
|
|
case 'post_is_testable': |
371
|
|
|
return __('label_is_testable'); |
372
|
|
|
case 'qa_water_damaged': |
373
|
|
|
case 'pre_water_damaged': |
374
|
|
|
case 'post_water_damaged': |
375
|
|
|
return __('label_water_damaged'); |
376
|
|
|
case 'qa_digitizer_test': |
377
|
|
|
case 'pre_digitizer_test': |
378
|
|
|
case 'post_digitizer_test': |
379
|
|
|
return __('label_digitizer_test'); |
380
|
|
|
case 'qa_lcd_test': |
381
|
|
|
case 'pre_lcd_test': |
382
|
|
|
case 'post_lcd_test': |
383
|
|
|
return __('label_lcd_test'); |
384
|
|
|
case 'qa_volume_test': |
385
|
|
|
case 'pre_volume_test': |
386
|
|
|
case 'post_volume_test': |
387
|
|
|
return __('label_volume_test'); |
388
|
|
|
case 'qa_power_button_test': |
389
|
|
|
case 'pre_power_button_test': |
390
|
|
|
case 'post_power_button_test': |
391
|
|
|
return __('label_power_button_test'); |
392
|
|
|
case 'qa_wifi_test': |
393
|
|
|
case 'pre_wifi_test': |
394
|
|
|
case 'post_wifi_test': |
395
|
|
|
return __('label_wifi_test'); |
396
|
|
|
case 'qa_other_buttons_test': |
397
|
|
|
case 'pre_other_buttons_test': |
398
|
|
|
case 'post_other_buttons_test': |
399
|
|
|
return __('label_other_buttons_test'); |
400
|
|
|
case 'qa_front_camera_test': |
401
|
|
|
case 'pre_front_camera_test': |
402
|
|
|
case 'post_front_camera_test': |
403
|
|
|
return __('label_front_camera_test'); |
404
|
|
|
case 'qa_back_camera_test': |
405
|
|
|
case 'pre_back_camera_test': |
406
|
|
|
case 'post_back_camera_test': |
407
|
|
|
return __('label_back_camera_test'); |
408
|
|
|
case 'qa_proximity_sensor_test': |
409
|
|
|
case 'pre_proximity_sensor_test': |
410
|
|
|
case 'post_proximity_sensor_test': |
411
|
|
|
return __('label_proximity_sensor_test'); |
412
|
|
|
case 'qa_touch_id_test': |
413
|
|
|
case 'pre_touch_id_test': |
414
|
|
|
case 'post_touch_id_test': |
415
|
|
|
return __('label_touch_id_test'); |
416
|
|
|
} |
417
|
|
|
} |
418
|
|
|
public function renderRepairDiagnosisValue($val) { |
419
|
|
|
switch ($val) { |
420
|
|
|
case '0': |
421
|
|
|
return __('label_n_a'); |
422
|
|
|
case '1': |
423
|
|
|
return __('label_yes'); |
424
|
|
|
case '2': |
425
|
|
|
return __('label_no'); |
426
|
|
|
case 'fail': |
427
|
|
|
return __('label_fail'); |
428
|
|
|
case 'pass': |
429
|
|
|
return __('label_pass'); |
430
|
|
|
default: |
431
|
|
|
return __('label_n_a'); |
432
|
|
|
} |
433
|
|
|
} |
434
|
|
|
} |
435
|
|
|
|
436
|
|
|
|
This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.
Both the
$myVar
assignment in line 1 and the$higher
assignment in line 2 are dead. The first because$myVar
is never used and the second because$higher
is always overwritten for every possible time line.