@@ -172,7 +172,7 @@ discard block |
||
172 | 172 | } |
173 | 173 | } |
174 | 174 | |
175 | - $num = rand(0,sizeof($optimizations)-1); |
|
175 | + $num = rand(0, sizeof($optimizations) - 1); |
|
176 | 176 | |
177 | 177 | $rOptimization = $optimizations[$num]; |
178 | 178 | |
@@ -185,7 +185,7 @@ discard block |
||
185 | 185 | return null; |
186 | 186 | } |
187 | 187 | |
188 | - $params = array("optimization_problem_id" => $opt_id ); |
|
188 | + $params = array("optimization_problem_id" => $opt_id); |
|
189 | 189 | |
190 | 190 | $optimization = (array)$this->get($params); |
191 | 191 | |
@@ -203,7 +203,7 @@ discard block |
||
203 | 203 | return null; |
204 | 204 | } |
205 | 205 | |
206 | - $num = rand(0, sizeof($addresses)-1); |
|
206 | + $num = rand(0, sizeof($addresses) - 1); |
|
207 | 207 | |
208 | 208 | $rAddress = $addresses[$num]; |
209 | 209 |
@@ -132,7 +132,7 @@ discard block |
||
132 | 132 | public static function getOrder($params) |
133 | 133 | { |
134 | 134 | $query = array(); |
135 | - $allGetParameters = array('order_id', 'fields', 'day_added_YYMMDD', 'scheduled_for_YYMMDD', 'query', 'offset', 'limit' ); |
|
135 | + $allGetParameters = array('order_id', 'fields', 'day_added_YYMMDD', 'scheduled_for_YYMMDD', 'query', 'offset', 'limit'); |
|
136 | 136 | |
137 | 137 | foreach ($allGetParameters as $getParameter) { |
138 | 138 | if (isset($params->{$getParameter})) $query[$getParameter] = $params->{$getParameter}; |
@@ -230,7 +230,7 @@ discard block |
||
230 | 230 | public static function searchOrder($params) |
231 | 231 | { |
232 | 232 | $query = array(); |
233 | - $allSearchParameters = array('fields', 'day_added_YYMMDD', 'scheduled_for_YYMMDD', 'query', 'offset', 'limit' ); |
|
233 | + $allSearchParameters = array('fields', 'day_added_YYMMDD', 'scheduled_for_YYMMDD', 'query', 'offset', 'limit'); |
|
234 | 234 | |
235 | 235 | foreach ($allSearchParameters as $searchParameter) { |
236 | 236 | if (isset($params->{$searchParameter})) $query[$searchParameter] = $params->{$searchParameter}; |
@@ -282,17 +282,17 @@ discard block |
||
282 | 282 | |
283 | 283 | $columns = fgetcsv($csvFileHandle, $max_line_length, $delemietr); |
284 | 284 | |
285 | - $allOrderFields = array("curbside_lat","curbside_lng","color","day_scheduled_for_YYMMDD", |
|
286 | - "address_alias","address_1","address_2","local_time_window_start","local_time_window_end","local_time_window_start_2", |
|
287 | - "local_time_window_end_2","service_time","EXT_FIELD_first_name","EXT_FIELD_last_name","EXT_FIELD_email","EXT_FIELD_phone", |
|
288 | - "EXT_FIELD_custom_data","order_icon"); |
|
285 | + $allOrderFields = array("curbside_lat", "curbside_lng", "color", "day_scheduled_for_YYMMDD", |
|
286 | + "address_alias", "address_1", "address_2", "local_time_window_start", "local_time_window_end", "local_time_window_start_2", |
|
287 | + "local_time_window_end_2", "service_time", "EXT_FIELD_first_name", "EXT_FIELD_last_name", "EXT_FIELD_email", "EXT_FIELD_phone", |
|
288 | + "EXT_FIELD_custom_data", "order_icon"); |
|
289 | 289 | |
290 | 290 | if (!empty($columns)) { |
291 | - array_push($results['fail'],'Empty CSV table'); |
|
291 | + array_push($results['fail'], 'Empty CSV table'); |
|
292 | 292 | return ($results); |
293 | 293 | } |
294 | 294 | |
295 | - $iRow=1; |
|
295 | + $iRow = 1; |
|
296 | 296 | |
297 | 297 | while (($rows = fgetcsv($csvFileHandle, $max_line_length, $delemietr))!==false) { |
298 | 298 | if ($rows[$ordersFieldsMapping['cached_lat']] && $rows[$ordersFieldsMapping['cached_lng']] && $rows[$ordersFieldsMapping['address_1']] && array(null)!==$rows) { |
@@ -336,19 +336,19 @@ discard block |
||
336 | 336 | $address = $rows[$ordersFieldsMapping['address_1']]; |
337 | 337 | |
338 | 338 | if (isset($ordersFieldsMapping['order_city'])) { |
339 | - $address.=', '.$rows[$ordersFieldsMapping['order_city']]; |
|
339 | + $address .= ', '.$rows[$ordersFieldsMapping['order_city']]; |
|
340 | 340 | } |
341 | 341 | |
342 | 342 | if (isset($ordersFieldsMapping['order_state_id'])) { |
343 | - $address.=', '.$rows[$ordersFieldsMapping['order_state_id']]; |
|
343 | + $address .= ', '.$rows[$ordersFieldsMapping['order_state_id']]; |
|
344 | 344 | } |
345 | 345 | |
346 | 346 | if (isset($ordersFieldsMapping['order_zip_code'])) { |
347 | - $address.=', '.$rows[$ordersFieldsMapping['order_zip_code']]; |
|
347 | + $address .= ', '.$rows[$ordersFieldsMapping['order_zip_code']]; |
|
348 | 348 | } |
349 | 349 | |
350 | 350 | if (isset($ordersFieldsMapping['order_country_id'])) { |
351 | - $address.=', '.$rows[$ordersFieldsMapping['order_country_id']]; |
|
351 | + $address .= ', '.$rows[$ordersFieldsMapping['order_country_id']]; |
|
352 | 352 | } |
353 | 353 | |
354 | 354 | echo "$iRow --> ".$ordersFieldsMapping['day_scheduled_for_YYMMDD'].", ".$rows[$ordersFieldsMapping['day_scheduled_for_YYMMDD']]."<br>"; |
@@ -134,7 +134,7 @@ |
||
134 | 134 | |
135 | 135 | if ($file!=null) { |
136 | 136 | curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 0); |
137 | - $fp=fopen($file, 'r'); |
|
137 | + $fp = fopen($file, 'r'); |
|
138 | 138 | curl_setopt($ch, CURLOPT_INFILE, $fp); |
139 | 139 | curl_setopt($ch, CURLOPT_INFILESIZE, filesize($file)); |
140 | 140 | } |
@@ -388,7 +388,7 @@ discard block |
||
388 | 388 | $result = Route4Me::makeRequst(array( |
389 | 389 | 'url' => Endpoint::ROUTE_V4, |
390 | 390 | 'method' => 'DELETE', |
391 | - 'query' => array('route_id' => $route_id ) |
|
391 | + 'query' => array('route_id' => $route_id) |
|
392 | 392 | )); |
393 | 393 | |
394 | 394 | $result = Route4Me::makeRequst(array( |
@@ -405,7 +405,7 @@ discard block |
||
405 | 405 | |
406 | 406 | public function GetAddressesFromRoute($route_id) |
407 | 407 | { |
408 | - $route1 = Route::getRoutes($route_id,null); |
|
408 | + $route1 = Route::getRoutes($route_id, null); |
|
409 | 409 | |
410 | 410 | if (isset($route1)) { |
411 | 411 | return $route1->addresses; |
@@ -262,7 +262,7 @@ discard block |
||
262 | 262 | |
263 | 263 | $isValid = TRUE; |
264 | 264 | |
265 | - for ($i=0; $i<sizeof($weekdays); $i++) { |
|
265 | + for ($i = 0; $i<sizeof($weekdays); $i++) { |
|
266 | 266 | if (is_numeric($weekdays[$i])) { |
267 | 267 | $wday = intval($weekdays[$i]); |
268 | 268 | if ($wday<1 || $wday>7) $isValid = FALSE; |
@@ -289,14 +289,14 @@ discard block |
||
289 | 289 | { |
290 | 290 | $monthlyDates = explode(',', $scheduleMonthlyDates); |
291 | 291 | |
292 | - if (sizeof($monthlyDates) <1) return FALSE; |
|
292 | + if (sizeof($monthlyDates)<1) return FALSE; |
|
293 | 293 | |
294 | 294 | $isValid = TRUE; |
295 | 295 | |
296 | - for ($i=0; $i < sizeof($monthlyDates); $i++) { |
|
296 | + for ($i = 0; $i<sizeof($monthlyDates); $i++) { |
|
297 | 297 | if (is_numeric($monthlyDates[$i])) { |
298 | 298 | $mday = intval($monthlyDates[$i]); |
299 | - if ($mday <1 || $mday > 31) $isValid = FALSE; |
|
299 | + if ($mday<1 || $mday>31) $isValid = FALSE; |
|
300 | 300 | } else { |
301 | 301 | $isValid = FALSE; |
302 | 302 | } |
@@ -346,11 +346,11 @@ discard block |
||
346 | 346 | |
347 | 347 | $columns = fgetcsv($csvFileHandle, $max_line_length, $delemietr); |
348 | 348 | |
349 | - $addressBookFields = array("cached_lat","cached_lng","curbside_lat","curbside_lng","address_alias","address_1","address_2","address_city", |
|
350 | - "address_state_id","address_zip","address_phone_number","schedule","address_group","first_name","last_name","local_time_window_start", |
|
351 | - "local_time_window_end","local_time_window_start_2","local_time_window_end_2","address_email","address_country_id","address_custom_data", |
|
352 | - "schedule_blacklist","service_time","local_timezone_string","color","address_icon","address_stop_type","address_cube","address_pieces", |
|
353 | - "address_reference_no","address_revenue","address_weight","address_priority","address_customer_po"); |
|
349 | + $addressBookFields = array("cached_lat", "cached_lng", "curbside_lat", "curbside_lng", "address_alias", "address_1", "address_2", "address_city", |
|
350 | + "address_state_id", "address_zip", "address_phone_number", "schedule", "address_group", "first_name", "last_name", "local_time_window_start", |
|
351 | + "local_time_window_end", "local_time_window_start_2", "local_time_window_end_2", "address_email", "address_country_id", "address_custom_data", |
|
352 | + "schedule_blacklist", "service_time", "local_timezone_string", "color", "address_icon", "address_stop_type", "address_cube", "address_pieces", |
|
353 | + "address_reference_no", "address_revenue", "address_weight", "address_priority", "address_customer_po"); |
|
354 | 354 | |
355 | 355 | if (empty($columns)) { |
356 | 356 | array_push($results['fail'], 'Empty CSV table'); |
@@ -359,7 +359,7 @@ discard block |
||
359 | 359 | |
360 | 360 | $iRow = 1; |
361 | 361 | |
362 | - while (($rows = fgetcsv($csvFileHandle, $max_line_length, $delemietr)) !== false) { |
|
362 | + while (($rows = fgetcsv($csvFileHandle, $max_line_length, $delemietr))!==false) { |
|
363 | 363 | if ($rows[$locationsFieldsMapping['cached_lat']] |
364 | 364 | && $rows[$locationsFieldsMapping['cached_lng']] |
365 | 365 | && $rows[$locationsFieldsMapping['address_1']] |
@@ -391,10 +391,10 @@ discard block |
||
391 | 391 | |
392 | 392 | if (isset($rows[$locationsFieldsMapping['schedule_every']])) { |
393 | 393 | if ($this->validateScheduleEvery($rows[$locationsFieldsMapping['schedule_every']])) { |
394 | - $curSchedule.='"'.$mode.'":{'.'"every":'.$rows[$locationsFieldsMapping['schedule_every']].','; |
|
395 | - if ($mode == 'daily') { |
|
396 | - $curSchedule = trim($curSchedule,','); |
|
397 | - $curSchedule.='}'; |
|
394 | + $curSchedule .= '"'.$mode.'":{'.'"every":'.$rows[$locationsFieldsMapping['schedule_every']].','; |
|
395 | + if ($mode=='daily') { |
|
396 | + $curSchedule = trim($curSchedule, ','); |
|
397 | + $curSchedule .= '}'; |
|
398 | 398 | } |
399 | 399 | } else { |
400 | 400 | array_push($results['fail'], "$iRow --> The parameter sched_every is not set"); |
@@ -432,7 +432,7 @@ discard block |
||
432 | 432 | $curSchedule = ""; |
433 | 433 | } |
434 | 434 | |
435 | - if ($monthlyMode != "") { |
|
435 | + if ($monthlyMode!="") { |
|
436 | 436 | switch ($monthlyMode) { |
437 | 437 | case 'dates': |
438 | 438 | if (isset($rows[$locationsFieldsMapping['monthly_dates']])) { |
@@ -457,7 +457,7 @@ discard block |
||
457 | 457 | $curSchedule = ""; |
458 | 458 | } |
459 | 459 | |
460 | - if ($curSchedule != "") { |
|
460 | + if ($curSchedule!="") { |
|
461 | 461 | if (isset($rows[$locationsFieldsMapping['monthly_nth_wwhat']])) { |
462 | 462 | if ($this->validateScheduleNthWhat($rows[$locationsFieldsMapping['monthly_nth_wwhat']])) { |
463 | 463 | $curSchedule .= '"what":'.$rows[$locationsFieldsMapping['monthly_nth_wwhat']].'}}'; |
@@ -480,7 +480,7 @@ discard block |
||
480 | 480 | } |
481 | 481 | } |
482 | 482 | |
483 | - if (($mode == 'daily' || $mode == 'weekly' || $mode == 'monthy') && $curSchedule == "") { |
|
483 | + if (($mode=='daily' || $mode=='weekly' || $mode=='monthy') && $curSchedule=="") { |
|
484 | 484 | $iRow++; |
485 | 485 | continue; |
486 | 486 | } |
@@ -489,7 +489,7 @@ discard block |
||
489 | 489 | |
490 | 490 | $curSchedule = '[{'.$curSchedule.'}]'; |
491 | 491 | |
492 | - $oSchedule = json_decode($curSchedule,TRUE); |
|
492 | + $oSchedule = json_decode($curSchedule, TRUE); |
|
493 | 493 | |
494 | 494 | $parametersArray = array(); |
495 | 495 |