@@ -198,7 +198,7 @@ |
||
198 | 198 | } else { |
199 | 199 | return $json; |
200 | 200 | } |
201 | - } elseif (409==$code) { |
|
201 | + } elseif (409==$code) { |
|
202 | 202 | throw new ApiError('Wrong API key'); |
203 | 203 | } else { |
204 | 204 | throw new ApiError('Something wrong'); |
@@ -258,14 +258,18 @@ discard block |
||
258 | 258 | { |
259 | 259 | $weekdays = explode(',', $scheduleWeekDays); |
260 | 260 | |
261 | - if (sizeof($weekdays)<1) return FALSE; |
|
261 | + if (sizeof($weekdays)<1) { |
|
262 | + return FALSE; |
|
263 | + } |
|
262 | 264 | |
263 | 265 | $isValid = TRUE; |
264 | 266 | |
265 | 267 | for ($i=0; $i<sizeof($weekdays); $i++) { |
266 | 268 | if (is_numeric($weekdays[$i])) { |
267 | 269 | $wday = intval($weekdays[$i]); |
268 | - if ($wday<1 || $wday>7) $isValid = FALSE; |
|
270 | + if ($wday<1 || $wday>7) { |
|
271 | + $isValid = FALSE; |
|
272 | + } |
|
269 | 273 | } else { |
270 | 274 | $isValid = FALSE; |
271 | 275 | } |
@@ -289,14 +293,18 @@ discard block |
||
289 | 293 | { |
290 | 294 | $monthlyDates = explode(',', $scheduleMonthlyDates); |
291 | 295 | |
292 | - if (sizeof($monthlyDates) <1) return FALSE; |
|
296 | + if (sizeof($monthlyDates) <1) { |
|
297 | + return FALSE; |
|
298 | + } |
|
293 | 299 | |
294 | 300 | $isValid = TRUE; |
295 | 301 | |
296 | 302 | for ($i=0; $i < sizeof($monthlyDates); $i++) { |
297 | 303 | if (is_numeric($monthlyDates[$i])) { |
298 | 304 | $mday = intval($monthlyDates[$i]); |
299 | - if ($mday <1 || $mday > 31) $isValid = FALSE; |
|
305 | + if ($mday <1 || $mday > 31) { |
|
306 | + $isValid = FALSE; |
|
307 | + } |
|
300 | 308 | } else { |
301 | 309 | $isValid = FALSE; |
302 | 310 | } |
@@ -307,7 +315,9 @@ discard block |
||
307 | 315 | |
308 | 316 | public static function validateScheduleNthN($scheduleNthN) |
309 | 317 | { |
310 | - if (!is_numeric($scheduleNthN)) return FALSE; |
|
318 | + if (!is_numeric($scheduleNthN)) { |
|
319 | + return FALSE; |
|
320 | + } |
|
311 | 321 | |
312 | 322 | $schedNthNs = array(1, 2, 3, 4, 5, -1); |
313 | 323 | |
@@ -320,7 +330,9 @@ discard block |
||
320 | 330 | |
321 | 331 | public static function validateScheduleNthWhat($scheduleNthWhat) |
322 | 332 | { |
323 | - if (!is_numeric($scheduleNthWhat)) return FALSE; |
|
333 | + if (!is_numeric($scheduleNthWhat)) { |
|
334 | + return FALSE; |
|
335 | + } |
|
324 | 336 | |
325 | 337 | $schedNthWhats = array(1, 2, 3, 4, 5, 6, 7, 8, 9, 10); |
326 | 338 |
@@ -351,70 +351,70 @@ |
||
351 | 351 | |
352 | 352 | if ($mode!='daily') { |
353 | 353 | switch ($mode) { |
354 | - case 'weekly': |
|
355 | - if (isset($rows[$locationsFieldsMapping['schedule_weekdays']])) { |
|
356 | - if ($this->validateScheduleWeekDays($rows[$locationsFieldsMapping['schedule_weekdays']])) { |
|
357 | - $curSchedule .= '"weekdays":['.$rows[$locationsFieldsMapping['schedule_weekdays']].']}'; |
|
358 | - } else { |
|
359 | - array_push($results['fail'], "$iRow --> Wrong weekdays"); |
|
360 | - } |
|
354 | + case 'weekly': |
|
355 | + if (isset($rows[$locationsFieldsMapping['schedule_weekdays']])) { |
|
356 | + if ($this->validateScheduleWeekDays($rows[$locationsFieldsMapping['schedule_weekdays']])) { |
|
357 | + $curSchedule .= '"weekdays":['.$rows[$locationsFieldsMapping['schedule_weekdays']].']}'; |
|
361 | 358 | } else { |
362 | - array_push($results['fail'], "$iRow --> The parameters sched_weekdays is not set"); |
|
359 | + array_push($results['fail'], "$iRow --> Wrong weekdays"); |
|
363 | 360 | } |
364 | - break; |
|
365 | - case 'monthly': |
|
366 | - $monthlyMode = ""; |
|
367 | - if (isset($rows[$locationsFieldsMapping['monthly_mode']])) { |
|
368 | - if ($this->validateScheduleMonthlyMode($rows[$locationsFieldsMapping['monthly_mode']])) { |
|
369 | - $monthlyMode = $rows[$locationsFieldsMapping['monthly_mode']]; |
|
370 | - $curSchedule .= '"mode": "'.$rows[$locationsFieldsMapping['monthly_mode']].'",'; |
|
371 | - } else { |
|
372 | - array_push($results['fail'], "$iRow --> Wrong monthly mode"); |
|
373 | - } |
|
361 | + } else { |
|
362 | + array_push($results['fail'], "$iRow --> The parameters sched_weekdays is not set"); |
|
363 | + } |
|
364 | + break; |
|
365 | + case 'monthly': |
|
366 | + $monthlyMode = ""; |
|
367 | + if (isset($rows[$locationsFieldsMapping['monthly_mode']])) { |
|
368 | + if ($this->validateScheduleMonthlyMode($rows[$locationsFieldsMapping['monthly_mode']])) { |
|
369 | + $monthlyMode = $rows[$locationsFieldsMapping['monthly_mode']]; |
|
370 | + $curSchedule .= '"mode": "'.$rows[$locationsFieldsMapping['monthly_mode']].'",'; |
|
374 | 371 | } else { |
375 | - array_push($results['fail'], "$iRow --> The parameter sched_monthly_mode is not set"); |
|
372 | + array_push($results['fail'], "$iRow --> Wrong monthly mode"); |
|
376 | 373 | } |
374 | + } else { |
|
375 | + array_push($results['fail'], "$iRow --> The parameter sched_monthly_mode is not set"); |
|
376 | + } |
|
377 | 377 | |
378 | - if ($monthlyMode!="") { |
|
379 | - switch ($monthlyMode) { |
|
380 | - case 'dates': |
|
381 | - if (isset($rows[$locationsFieldsMapping['monthly_dates']])) { |
|
382 | - if ($this->validateScheduleMonthlyDates($rows[$locationsFieldsMapping['monthly_dates']])) { |
|
383 | - $curSchedule .= '"dates":['.$rows[$locationsFieldsMapping['monthly_dates']].']}'; |
|
384 | - } else { |
|
385 | - array_push($results['fail'], "$iRow --> Wrong monthly dates"); |
|
386 | - } |
|
387 | - } |
|
388 | - break; |
|
389 | - case 'nth': |
|
390 | - if (isset($rows[$locationsFieldsMapping['monthly_nth_n']])) { |
|
391 | - if ($this->validateScheduleNthN($rows[$locationsFieldsMapping['monthly_nth_n']])) { |
|
392 | - $curSchedule .= '"nth":{"n":'.$rows[$locationsFieldsMapping['monthly_nth_n']].','; |
|
393 | - } else { |
|
394 | - array_push($results['fail'], "$iRow --> Wrong parameter sched_nth_n"); |
|
395 | - } |
|
396 | - } else { |
|
397 | - array_push($results['fail'], "$iRow --> The parameter sched_nth_n is not set"); |
|
398 | - } |
|
378 | + if ($monthlyMode!="") { |
|
379 | + switch ($monthlyMode) { |
|
380 | + case 'dates': |
|
381 | + if (isset($rows[$locationsFieldsMapping['monthly_dates']])) { |
|
382 | + if ($this->validateScheduleMonthlyDates($rows[$locationsFieldsMapping['monthly_dates']])) { |
|
383 | + $curSchedule .= '"dates":['.$rows[$locationsFieldsMapping['monthly_dates']].']}'; |
|
384 | + } else { |
|
385 | + array_push($results['fail'], "$iRow --> Wrong monthly dates"); |
|
386 | + } |
|
387 | + } |
|
388 | + break; |
|
389 | + case 'nth': |
|
390 | + if (isset($rows[$locationsFieldsMapping['monthly_nth_n']])) { |
|
391 | + if ($this->validateScheduleNthN($rows[$locationsFieldsMapping['monthly_nth_n']])) { |
|
392 | + $curSchedule .= '"nth":{"n":'.$rows[$locationsFieldsMapping['monthly_nth_n']].','; |
|
393 | + } else { |
|
394 | + array_push($results['fail'], "$iRow --> Wrong parameter sched_nth_n"); |
|
395 | + } |
|
396 | + } else { |
|
397 | + array_push($results['fail'], "$iRow --> The parameter sched_nth_n is not set"); |
|
398 | + } |
|
399 | 399 | |
400 | - if ($curSchedule!="") { |
|
401 | - if (isset($rows[$locationsFieldsMapping['monthly_nth_wwhat']])) { |
|
402 | - if ($this->validateScheduleNthWhat($rows[$locationsFieldsMapping['monthly_nth_wwhat']])) { |
|
403 | - $curSchedule .= '"what":'.$rows[$locationsFieldsMapping['monthly_nth_wwhat']].'}}'; |
|
404 | - } else { |
|
405 | - array_push($results['fail'], "$iRow --> Wrong parameter sched_nth_what"); |
|
406 | - } |
|
407 | - } else { |
|
408 | - array_push($results['fail'], "$iRow --> The parameter sched_nth_what is not set"); |
|
409 | - } |
|
410 | - } |
|
411 | - break; |
|
400 | + if ($curSchedule!="") { |
|
401 | + if (isset($rows[$locationsFieldsMapping['monthly_nth_wwhat']])) { |
|
402 | + if ($this->validateScheduleNthWhat($rows[$locationsFieldsMapping['monthly_nth_wwhat']])) { |
|
403 | + $curSchedule .= '"what":'.$rows[$locationsFieldsMapping['monthly_nth_wwhat']].'}}'; |
|
404 | + } else { |
|
405 | + array_push($results['fail'], "$iRow --> Wrong parameter sched_nth_what"); |
|
412 | 406 | } |
407 | + } else { |
|
408 | + array_push($results['fail'], "$iRow --> The parameter sched_nth_what is not set"); |
|
409 | + } |
|
413 | 410 | } |
414 | 411 | break; |
415 | - default: |
|
416 | - $curSchedule = ""; |
|
412 | + } |
|
413 | + } |
|
417 | 414 | break; |
415 | + default: |
|
416 | + $curSchedule = ""; |
|
417 | + break; |
|
418 | 418 | } |
419 | 419 | } |
420 | 420 |
@@ -70,8 +70,12 @@ |
||
70 | 70 | { |
71 | 71 | $terParams = array(); |
72 | 72 | |
73 | - if (isset($params->territory['type'])) $terParams['type'] = $params->territory['type']; |
|
74 | - if (isset($params->territory['data'])) $terParams['data'] = $params->territory['data']; |
|
73 | + if (isset($params->territory['type'])) { |
|
74 | + $terParams['type'] = $params->territory['type']; |
|
75 | + } |
|
76 | + if (isset($params->territory['data'])) { |
|
77 | + $terParams['data'] = $params->territory['data']; |
|
78 | + } |
|
75 | 79 | |
76 | 80 | $abContacts = Route4Me::makeRequst(array( |
77 | 81 | 'url' => Endpoint::AVOIDANCE_ZONE, |
@@ -327,8 +327,7 @@ |
||
327 | 327 | $orderResults = $order->addOrder($orderParameters); |
328 | 328 | |
329 | 329 | array_push($results['success'], "The order with order_id = ".strval($orderResults["order_id"])." added successfuly."); |
330 | - } |
|
331 | - else { |
|
330 | + } else { |
|
332 | 331 | array_push($results['fail'], "$iRow --> one of the parameters cached_lat, cached_lng, address_1 is not set"); |
333 | 332 | } |
334 | 333 |
@@ -98,9 +98,15 @@ |
||
98 | 98 | |
99 | 99 | $vehicles = $this->getVehicles($params); |
100 | 100 | |
101 | - if (is_null($vehicles)) return null; |
|
102 | - if (!isset($vehicles['data'])) return null; |
|
103 | - if (sizeof($vehicles['data'])<1) return null; |
|
101 | + if (is_null($vehicles)) { |
|
102 | + return null; |
|
103 | + } |
|
104 | + if (!isset($vehicles['data'])) { |
|
105 | + return null; |
|
106 | + } |
|
107 | + if (sizeof($vehicles['data'])<1) { |
|
108 | + return null; |
|
109 | + } |
|
104 | 110 | |
105 | 111 | $randomIndex = rand(0, sizeof($vehicles['data'])-1); |
106 | 112 |
@@ -159,7 +159,9 @@ |
||
159 | 159 | |
160 | 160 | foreach ($members['results'] as $memb) { |
161 | 161 | if (isset($memb['member_id']) && isset($memb['member_type'])) { |
162 | - if ($memberType==$memb['member_type']) $memberIDs[]=$memb['member_id']; |
|
162 | + if ($memberType==$memb['member_type']) { |
|
163 | + $memberIDs[]=$memb['member_id']; |
|
164 | + } |
|
163 | 165 | } |
164 | 166 | } |
165 | 167 |