@@ -1,5 +1,5 @@ |
||
1 | 1 | <?php |
2 | - $vdir=$_SERVER['DOCUMENT_ROOT'].'/route4me/examples/'; |
|
2 | + $vdir = $_SERVER['DOCUMENT_ROOT'].'/route4me/examples/'; |
|
3 | 3 | require $vdir.'/../vendor/autoload.php'; |
4 | 4 | |
5 | 5 | use Route4Me\MyQ; |
@@ -64,11 +64,11 @@ discard block |
||
64 | 64 | public $config_key; |
65 | 65 | public $config_value; |
66 | 66 | |
67 | - public function __construct () { } |
|
67 | + public function __construct() { } |
|
68 | 68 | |
69 | 69 | public static function fromArray(array $params) { |
70 | - $member= new Member(); |
|
71 | - foreach($params as $key => $value) { |
|
70 | + $member = new Member(); |
|
71 | + foreach ($params as $key => $value) { |
|
72 | 72 | if (property_exists($member, $key)) { |
73 | 73 | $member->{$key} = $value; |
74 | 74 | } |
@@ -119,7 +119,7 @@ discard block |
||
119 | 119 | 'url' => self::$apiUrlDevice, |
120 | 120 | 'method' => 'POST', |
121 | 121 | 'body' => array( |
122 | - 'device_id' => isset($body->device_id) ? $body->device_id: null, |
|
122 | + 'device_id' => isset($body->device_id) ? $body->device_id : null, |
|
123 | 123 | 'device_type' => isset($body->device_type) ? $body->device_type : null, |
124 | 124 | 'format' => isset($body->format) ? $body->format : null |
125 | 125 | ) |
@@ -134,7 +134,7 @@ discard block |
||
134 | 134 | 'url' => self::$apiUrl, |
135 | 135 | 'method' => 'POST', |
136 | 136 | 'body' => array( |
137 | - 'HIDE_ROUTED_ADDRESSES' => isset($body->HIDE_ROUTED_ADDRESSES) ? $body->HIDE_ROUTED_ADDRESSES: null, |
|
137 | + 'HIDE_ROUTED_ADDRESSES' => isset($body->HIDE_ROUTED_ADDRESSES) ? $body->HIDE_ROUTED_ADDRESSES : null, |
|
138 | 138 | 'member_phone' => isset($body->member_phone) ? $body->member_phone : null, |
139 | 139 | 'member_zipcode' => isset($body->member_zipcode) ? $body->member_zipcode : null, |
140 | 140 | 'route_count' => isset($body->route_count) ? $body->route_count : null, |
@@ -160,9 +160,9 @@ discard block |
||
160 | 160 | 'url' => self::$apiUrl, |
161 | 161 | 'method' => 'PUT', |
162 | 162 | 'body' => array( |
163 | - 'member_id' => isset($body->member_id) ? $body->member_id: null, |
|
163 | + 'member_id' => isset($body->member_id) ? $body->member_id : null, |
|
164 | 164 | 'member_phone' => isset($body->member_phone) ? $body->member_phone : null, |
165 | - 'HIDE_ROUTED_ADDRESSES' => isset($body->HIDE_ROUTED_ADDRESSES) ? $body->HIDE_ROUTED_ADDRESSES: null, |
|
165 | + 'HIDE_ROUTED_ADDRESSES' => isset($body->HIDE_ROUTED_ADDRESSES) ? $body->HIDE_ROUTED_ADDRESSES : null, |
|
166 | 166 | 'member_zipcode' => isset($body->member_zipcode) ? $body->member_zipcode : null, |
167 | 167 | 'route_count' => isset($body->route_count) ? $body->route_count : null, |
168 | 168 | 'member_email' => isset($body->member_email) ? $body->member_email : null, |
@@ -187,7 +187,7 @@ discard block |
||
187 | 187 | 'url' => self::$apiUrl, |
188 | 188 | 'method' => 'DELETE', |
189 | 189 | 'body' => array( |
190 | - 'member_id' => isset($body->member_id) ? $body->member_id: null |
|
190 | + 'member_id' => isset($body->member_id) ? $body->member_id : null |
|
191 | 191 | ) |
192 | 192 | |
193 | 193 | )); |
@@ -200,17 +200,17 @@ discard block |
||
200 | 200 | 'url' => self::$apiUrlRegistr, |
201 | 201 | 'method' => 'POST', |
202 | 202 | 'body' => array( |
203 | - 'strEmail' => isset($body->strEmail) ? $body->strEmail: null, |
|
203 | + 'strEmail' => isset($body->strEmail) ? $body->strEmail : null, |
|
204 | 204 | 'strPassword_1' => isset($body->strPassword_1) ? $body->strPassword_1 : null, |
205 | 205 | 'strPassword_2' => isset($body->strPassword_2) ? $body->strPassword_2 : null, |
206 | - 'strFirstName' => isset($body->strFirstName) ? $body->strFirstName: null, |
|
207 | - 'strLastName' => isset($body->strLastName) ? $body->strLastName: null, |
|
208 | - 'strIndustry' => isset($body->strIndustry) ? $body->strIndustry: null, |
|
209 | - 'chkTerms' => isset($body->chkTerms) ? $body->chkTerms: null, |
|
210 | - 'plan' => isset($body->plan) ? $body->plan: null, |
|
211 | - 'strSubAccountType' => isset($body->strSubAccountType) ? $body->strSubAccountType: null, |
|
212 | - 'blDisableMarketing' => isset($body->blDisableMarketing) ? $body->blDisableMarketing: false, |
|
213 | - 'blDisableAccountActivationEmail' => isset($body->blDisableAccountActivationEmail) ? $body->blDisableAccountActivationEmail: false |
|
206 | + 'strFirstName' => isset($body->strFirstName) ? $body->strFirstName : null, |
|
207 | + 'strLastName' => isset($body->strLastName) ? $body->strLastName : null, |
|
208 | + 'strIndustry' => isset($body->strIndustry) ? $body->strIndustry : null, |
|
209 | + 'chkTerms' => isset($body->chkTerms) ? $body->chkTerms : null, |
|
210 | + 'plan' => isset($body->plan) ? $body->plan : null, |
|
211 | + 'strSubAccountType' => isset($body->strSubAccountType) ? $body->strSubAccountType : null, |
|
212 | + 'blDisableMarketing' => isset($body->blDisableMarketing) ? $body->blDisableMarketing : false, |
|
213 | + 'blDisableAccountActivationEmail' => isset($body->blDisableAccountActivationEmail) ? $body->blDisableAccountActivationEmail : false |
|
214 | 214 | ) |
215 | 215 | )); |
216 | 216 | return $response; |
@@ -222,7 +222,7 @@ discard block |
||
222 | 222 | 'url' => self::$apiUrlSessValid, |
223 | 223 | 'method' => 'GET', |
224 | 224 | 'query' => array( |
225 | - 'session_guid' => isset($params->session_guid) ? $params->session_guid: null, |
|
225 | + 'session_guid' => isset($params->session_guid) ? $params->session_guid : null, |
|
226 | 226 | 'member_id' => isset($params->member_id) ? $params->member_id : null, |
227 | 227 | 'format' => isset($params->format) ? $params->format : null |
228 | 228 | ) |
@@ -236,7 +236,7 @@ discard block |
||
236 | 236 | 'url' => self::$apiUrlAuthen, |
237 | 237 | 'method' => 'POST', |
238 | 238 | 'body' => array( |
239 | - 'strEmail' => isset($body->strEmail) ? $body->strEmail: null, |
|
239 | + 'strEmail' => isset($body->strEmail) ? $body->strEmail : null, |
|
240 | 240 | 'strPassword' => isset($body->strPassword) ? $body->strPassword : null, |
241 | 241 | 'format' => isset($body->format) ? $body->format : null |
242 | 242 | ) |
@@ -251,7 +251,7 @@ discard block |
||
251 | 251 | 'url' => self::$apiUrlWebinar, |
252 | 252 | 'method' => 'POST', |
253 | 253 | 'body' => array( |
254 | - 'email_address' => isset($body->email_address) ? $body->email_address: null, |
|
254 | + 'email_address' => isset($body->email_address) ? $body->email_address : null, |
|
255 | 255 | 'first_name' => isset($body->first_name) ? $body->first_name : null, |
256 | 256 | 'last_name' => isset($body->last_name) ? $body->last_name : null, |
257 | 257 | 'phone_number' => isset($body->phone_number) ? $body->phone_number : null, |
@@ -270,7 +270,7 @@ discard block |
||
270 | 270 | 'url' => self::$apiUrlLicense, |
271 | 271 | 'method' => 'POST', |
272 | 272 | 'body' => array( |
273 | - 'member_id' => isset($body->member_id) ? $body->member_id: null, |
|
273 | + 'member_id' => isset($body->member_id) ? $body->member_id : null, |
|
274 | 274 | 'session_guid' => isset($body->session_guid) ? $body->session_guid : null, |
275 | 275 | 'device_id' => isset($body->device_id) ? $body->device_id : null, |
276 | 276 | 'device_type' => isset($body->device_type) ? $body->device_type : null, |
@@ -290,7 +290,7 @@ discard block |
||
290 | 290 | 'url' => self::$apiMemberConfig, |
291 | 291 | 'method' => 'POST', |
292 | 292 | 'body' => array( |
293 | - 'config_key' => isset($body->config_key) ? $body->config_key: null, |
|
293 | + 'config_key' => isset($body->config_key) ? $body->config_key : null, |
|
294 | 294 | 'config_value' => isset($body->config_value) ? $body->config_value : null |
295 | 295 | ) |
296 | 296 | )); |
@@ -303,7 +303,7 @@ discard block |
||
303 | 303 | 'url' => self::$apiMemberConfig, |
304 | 304 | 'method' => 'DELETE', |
305 | 305 | 'body' => array( |
306 | - 'config_key' => isset($body->config_key) ? $body->config_key: null |
|
306 | + 'config_key' => isset($body->config_key) ? $body->config_key : null |
|
307 | 307 | ) |
308 | 308 | )); |
309 | 309 | return $response; |
@@ -315,7 +315,7 @@ discard block |
||
315 | 315 | 'url' => self::$apiMemberConfig, |
316 | 316 | 'method' => 'GET', |
317 | 317 | 'query' => array( |
318 | - 'config_key' => isset($body->config_key) ? $body->config_key: null |
|
318 | + 'config_key' => isset($body->config_key) ? $body->config_key : null |
|
319 | 319 | ) |
320 | 320 | )); |
321 | 321 | return $response; |
@@ -327,7 +327,7 @@ discard block |
||
327 | 327 | 'url' => self::$apiMemberConfig, |
328 | 328 | 'method' => 'PUT', |
329 | 329 | 'body' => array( |
330 | - 'config_key' => isset($body->config_key) ? $body->config_key: null, |
|
330 | + 'config_key' => isset($body->config_key) ? $body->config_key : null, |
|
331 | 331 | 'config_value' => isset($body->config_value) ? $body->config_value : null |
332 | 332 | ) |
333 | 333 | )); |
@@ -69,10 +69,10 @@ discard block |
||
69 | 69 | 'url' => self::$apiUrl, |
70 | 70 | 'method' => 'POST', |
71 | 71 | 'query' => array( |
72 | - 'directions' => isset($params->directions) ? $params->directions: null, |
|
73 | - 'format' => isset($params->format) ? $params->format: null, |
|
74 | - 'route_path_output' => isset($params->route_path_output) ? $params->route_path_output: null, |
|
75 | - 'optimized_callback_url' => isset($params->optimized_callback_url) ? $params->optimized_callback_url: null |
|
72 | + 'directions' => isset($params->directions) ? $params->directions : null, |
|
73 | + 'format' => isset($params->format) ? $params->format : null, |
|
74 | + 'route_path_output' => isset($params->route_path_output) ? $params->route_path_output : null, |
|
75 | + 'optimized_callback_url' => isset($params->optimized_callback_url) ? $params->optimized_callback_url : null |
|
76 | 76 | ), |
77 | 77 | 'body' => array( |
78 | 78 | 'addresses' => $params->getAddressesArray(), |
@@ -101,7 +101,7 @@ discard block |
||
101 | 101 | |
102 | 102 | if (isset($optimize['optimizations'])) { |
103 | 103 | $problems = array(); |
104 | - foreach($optimize['optimizations'] as $problem) { |
|
104 | + foreach ($optimize['optimizations'] as $problem) { |
|
105 | 105 | $problems[] = OptimizationProblem::fromArray($problem); |
106 | 106 | } |
107 | 107 | return $problems; |
@@ -144,7 +144,7 @@ discard block |
||
144 | 144 | return $this->routes; |
145 | 145 | } |
146 | 146 | |
147 | - public function getRandomOptimizationId($offset,$limit) |
|
147 | + public function getRandomOptimizationId($offset, $limit) |
|
148 | 148 | { |
149 | 149 | $query['limit'] = isset($params['limit']) ? $params['limit'] : 30; |
150 | 150 | $query['offset'] = isset($params['offset']) ? $params['offset'] : 0; |
@@ -156,16 +156,16 @@ discard block |
||
156 | 156 | )); |
157 | 157 | |
158 | 158 | $optimizations = array(); |
159 | - foreach($json as $optimization) { |
|
159 | + foreach ($json as $optimization) { |
|
160 | 160 | if (gettype($optimization)!="array") continue; |
161 | 161 | foreach ($optimization as $otp1) { |
162 | 162 | $optimizations[] = $otp1; |
163 | 163 | } |
164 | 164 | } |
165 | 165 | |
166 | - $num=rand(0,sizeof($optimizations)-1); |
|
166 | + $num = rand(0, sizeof($optimizations) - 1); |
|
167 | 167 | //echo "num=$num.<br>".sizeof($optimizations)."<br>"; |
168 | - $rOptimization=$optimizations[$num]; |
|
168 | + $rOptimization = $optimizations[$num]; |
|
169 | 169 | return $rOptimization; |
170 | 170 | } |
171 | 171 | |
@@ -173,7 +173,7 @@ discard block |
||
173 | 173 | { |
174 | 174 | if ($opt_id==null) return null; |
175 | 175 | |
176 | - $params = array( "optimization_problem_id" => $opt_id ); |
|
176 | + $params = array("optimization_problem_id" => $opt_id); |
|
177 | 177 | |
178 | 178 | $optimization = (array)$this->get($params); |
179 | 179 | |
@@ -187,13 +187,13 @@ discard block |
||
187 | 187 | { |
188 | 188 | $addresses = (array)$this->getAddresses($opt_id); |
189 | 189 | |
190 | - if ($addresses == null) { |
|
190 | + if ($addresses==null) { |
|
191 | 191 | echo "There are no addresses in this optimization!.. Try again."; |
192 | 192 | return null; |
193 | 193 | } |
194 | 194 | |
195 | - $num=rand(0,sizeof($addresses)-1); |
|
196 | - $rAddress=$addresses[$num]; |
|
195 | + $num = rand(0, sizeof($addresses) - 1); |
|
196 | + $rAddress = $addresses[$num]; |
|
197 | 197 | |
198 | 198 | return $rAddress; |
199 | 199 | } |
@@ -1,7 +1,7 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | namespace Route4Me; |
3 | 3 | |
4 | -$vdir=$_SERVER['DOCUMENT_ROOT'].'/route4me/examples/'; |
|
4 | +$vdir = $_SERVER['DOCUMENT_ROOT'].'/route4me/examples/'; |
|
5 | 5 | |
6 | 6 | require $vdir.'/../vendor/autoload.php'; |
7 | 7 | |
@@ -17,35 +17,35 @@ discard block |
||
17 | 17 | |
18 | 18 | Route4Me::setApiKey('bd48828717021141485a701453273458'); |
19 | 19 | |
20 | -$source_file="addresses_1000.csv"; |
|
20 | +$source_file = "addresses_1000.csv"; |
|
21 | 21 | $max_line_length = 512; |
22 | -$delemietr=','; |
|
22 | +$delemietr = ','; |
|
23 | 23 | |
24 | 24 | |
25 | 25 | /* Add Address Book Locations with schedules from a CSV file */ |
26 | 26 | |
27 | 27 | /* Mapping of a CSV file with the address book locations - which of the CSV table column is corresponding to which of the Address Book's field*/ |
28 | -$locationsFieldsMapping['cached_lat']=0; |
|
29 | -$locationsFieldsMapping['cached_lng']=1; |
|
30 | -$locationsFieldsMapping['address_alias']=2; |
|
31 | -$locationsFieldsMapping['address_1']=3; |
|
32 | -$locationsFieldsMapping['address_city']=4; |
|
33 | -$locationsFieldsMapping['address_state_id']=5; |
|
34 | -$locationsFieldsMapping['address_zip']=6; |
|
35 | -$locationsFieldsMapping['address_phone_number']=7; |
|
36 | -$locationsFieldsMapping['schedule_mode']=8; |
|
37 | -$locationsFieldsMapping['schedule_enabled']=9; |
|
38 | -$locationsFieldsMapping['schedule_every']=10; |
|
39 | -$locationsFieldsMapping['schedule_weekdays']=11; |
|
40 | -$locationsFieldsMapping['monthly_mode']=12; |
|
41 | -$locationsFieldsMapping['monthly_dates']=13; |
|
42 | -$locationsFieldsMapping['monthly_nth_n']=16; |
|
43 | -$locationsFieldsMapping['monthly_nth_wwhat']=17; |
|
44 | - |
|
45 | -if (($handle = fopen("$source_file", "r")) !== FALSE) { |
|
28 | +$locationsFieldsMapping['cached_lat'] = 0; |
|
29 | +$locationsFieldsMapping['cached_lng'] = 1; |
|
30 | +$locationsFieldsMapping['address_alias'] = 2; |
|
31 | +$locationsFieldsMapping['address_1'] = 3; |
|
32 | +$locationsFieldsMapping['address_city'] = 4; |
|
33 | +$locationsFieldsMapping['address_state_id'] = 5; |
|
34 | +$locationsFieldsMapping['address_zip'] = 6; |
|
35 | +$locationsFieldsMapping['address_phone_number'] = 7; |
|
36 | +$locationsFieldsMapping['schedule_mode'] = 8; |
|
37 | +$locationsFieldsMapping['schedule_enabled'] = 9; |
|
38 | +$locationsFieldsMapping['schedule_every'] = 10; |
|
39 | +$locationsFieldsMapping['schedule_weekdays'] = 11; |
|
40 | +$locationsFieldsMapping['monthly_mode'] = 12; |
|
41 | +$locationsFieldsMapping['monthly_dates'] = 13; |
|
42 | +$locationsFieldsMapping['monthly_nth_n'] = 16; |
|
43 | +$locationsFieldsMapping['monthly_nth_wwhat'] = 17; |
|
44 | + |
|
45 | +if (($handle = fopen("$source_file", "r"))!==FALSE) { |
|
46 | 46 | $oAbook = new AddressBookLocation(); |
47 | 47 | |
48 | - $results=$oAbook->addLocationsFromCsvFile($handle, $locationsFieldsMapping); //Temporarry |
|
48 | + $results = $oAbook->addLocationsFromCsvFile($handle, $locationsFieldsMapping); //Temporarry |
|
49 | 49 | |
50 | 50 | echo "Errors: <br><br>"; |
51 | 51 | foreach ($results['fail'] as $evalue) { |
@@ -61,23 +61,23 @@ discard block |
||
61 | 61 | |
62 | 62 | /* Add orders with schedules from a CSV file */ |
63 | 63 | |
64 | -$orders_file="orders_baton.csv"; |
|
64 | +$orders_file = "orders_baton.csv"; |
|
65 | 65 | |
66 | 66 | /* Mapping of a CSV file with the orders - which of the CSV table column is corresponding to which of the Order's field */ |
67 | 67 | |
68 | -$ordersFieldsMapping['cached_lat']=1; |
|
69 | -$ordersFieldsMapping['cached_lng']=0; |
|
70 | -$ordersFieldsMapping['address_alias']=2; |
|
71 | -$ordersFieldsMapping['address_1']=3; |
|
72 | -$ordersFieldsMapping['order_city']=4; |
|
73 | -$ordersFieldsMapping['order_state_id']=5; |
|
74 | -$ordersFieldsMapping['order_zip_code']=6; |
|
75 | -$ordersFieldsMapping['EXT_FIELD_phone']=7; |
|
76 | -$ordersFieldsMapping['day_scheduled_for_YYMMDD']=8; |
|
77 | - |
|
78 | -if (($handle = fopen("$orders_file", "r")) !== FALSE) { |
|
68 | +$ordersFieldsMapping['cached_lat'] = 1; |
|
69 | +$ordersFieldsMapping['cached_lng'] = 0; |
|
70 | +$ordersFieldsMapping['address_alias'] = 2; |
|
71 | +$ordersFieldsMapping['address_1'] = 3; |
|
72 | +$ordersFieldsMapping['order_city'] = 4; |
|
73 | +$ordersFieldsMapping['order_state_id'] = 5; |
|
74 | +$ordersFieldsMapping['order_zip_code'] = 6; |
|
75 | +$ordersFieldsMapping['EXT_FIELD_phone'] = 7; |
|
76 | +$ordersFieldsMapping['day_scheduled_for_YYMMDD'] = 8; |
|
77 | + |
|
78 | +if (($handle = fopen("$orders_file", "r"))!==FALSE) { |
|
79 | 79 | $order = new Order(); |
80 | - $results=$order->addOrdersFromCsvFile($handle, $ordersFieldsMapping); |
|
80 | + $results = $order->addOrdersFromCsvFile($handle, $ordersFieldsMapping); |
|
81 | 81 | |
82 | 82 | echo "Errors: <br><br>"; |
83 | 83 | foreach ($results['fail'] as $evalue) { |
@@ -93,7 +93,7 @@ discard block |
||
93 | 93 | |
94 | 94 | /* Get Hybrid Optimization */ |
95 | 95 | |
96 | - $ep = time()+604800; |
|
96 | + $ep = time() + 604800; |
|
97 | 97 | $sched_date = date("Y-m-d", $ep); |
98 | 98 | |
99 | 99 | $hybridParams = array( |
@@ -114,7 +114,7 @@ discard block |
||
114 | 114 | /* Add depots to the Hybrid Optimization */ |
115 | 115 | $depotfile = "depots.csv"; |
116 | 116 | |
117 | - if (($handle = fopen("$depotfile", "r")) !== FALSE) { |
|
117 | + if (($handle = fopen("$depotfile", "r"))!==FALSE) { |
|
118 | 118 | |
119 | 119 | $columns = fgetcsv($handle, $max_line_length, $delemietr); |
120 | 120 | |
@@ -128,15 +128,15 @@ discard block |
||
128 | 128 | 'delete_old_depots' => true, |
129 | 129 | ); |
130 | 130 | |
131 | - $iRow=1; |
|
131 | + $iRow = 1; |
|
132 | 132 | $depotAddresses = array(); |
133 | 133 | |
134 | - while (($rows = fgetcsv($handle, $max_line_length, $delemietr)) !== false) { |
|
135 | - if ($rows[0] && $rows[1] && $rows[3] && array(null) !== $rows) { |
|
136 | - $depotAddress['lat']= $rows[0]; |
|
137 | - $depotAddress['lng']= $rows[1]; |
|
138 | - $depotAddress['address']= $rows[3]; |
|
139 | - array_push($depotAddresses,$depotAddress); |
|
134 | + while (($rows = fgetcsv($handle, $max_line_length, $delemietr))!==false) { |
|
135 | + if ($rows[0] && $rows[1] && $rows[3] && array(null)!==$rows) { |
|
136 | + $depotAddress['lat'] = $rows[0]; |
|
137 | + $depotAddress['lng'] = $rows[1]; |
|
138 | + $depotAddress['address'] = $rows[3]; |
|
139 | + array_push($depotAddresses, $depotAddress); |
|
140 | 140 | } |
141 | 141 | } |
142 | 142 |
@@ -46,11 +46,11 @@ discard block |
||
46 | 46 | public $limit; |
47 | 47 | public $query; |
48 | 48 | |
49 | - public function __construct () { } |
|
49 | + public function __construct() { } |
|
50 | 50 | |
51 | 51 | public static function fromArray(array $params) { |
52 | - $order= new Order(); |
|
53 | - foreach($params as $key => $value) { |
|
52 | + $order = new Order(); |
|
53 | + foreach ($params as $key => $value) { |
|
54 | 54 | if (property_exists($order, $key)) { |
55 | 55 | $order->{$key} = $value; |
56 | 56 | } |
@@ -65,8 +65,8 @@ discard block |
||
65 | 65 | 'url' => self::$apiUrl, |
66 | 66 | 'method' => 'POST', |
67 | 67 | 'body' => array( |
68 | - 'address_1' => isset($params->address_1) ? $params->address_1: null, |
|
69 | - 'address_2' => isset($params->address_2) ? $params->address_2: null, |
|
68 | + 'address_1' => isset($params->address_1) ? $params->address_1 : null, |
|
69 | + 'address_2' => isset($params->address_2) ? $params->address_2 : null, |
|
70 | 70 | 'cached_lat' => isset($params->cached_lat) ? $params->cached_lat : null, |
71 | 71 | 'cached_lng' => isset($params->cached_lng) ? $params->cached_lng : null, |
72 | 72 | 'curbside_lat' => isset($params->curbside_lat) ? $params->curbside_lat : null, |
@@ -75,30 +75,30 @@ discard block |
||
75 | 75 | 'order_icon' => isset($params->order_icon) ? $params->order_icon : null, |
76 | 76 | 'day_scheduled_for_YYMMDD' => isset($params->day_scheduled_for_YYMMDD) ? $params->day_scheduled_for_YYMMDD : null, |
77 | 77 | 'address_alias' => isset($params->address_alias) ? $params->address_alias : null, |
78 | - 'address_city' => isset($params->address_city) ? $params->address_city: null, |
|
79 | - 'local_time_window_start' => isset($params->local_time_window_start) ? $params->local_time_window_start: null, |
|
80 | - 'local_time_window_end' => isset($params->local_time_window_end) ? $params->local_time_window_end: null, |
|
81 | - 'local_time_window_start_2' => isset($params->local_time_window_start_2) ? $params->local_time_window_start_2: null, |
|
82 | - 'local_time_window_end_2' => isset($params->local_time_window_end_2) ? $params->local_time_window_end_2: null, |
|
83 | - 'service_time' => isset($params->service_time) ? $params->service_time: null, |
|
84 | - 'EXT_FIELD_first_name' => isset($params->EXT_FIELD_first_name) ? $params->EXT_FIELD_first_name: null, |
|
85 | - 'EXT_FIELD_last_name' => isset($params->EXT_FIELD_last_name) ? $params->EXT_FIELD_last_name: null, |
|
86 | - 'EXT_FIELD_email' => isset($params->EXT_FIELD_email) ? $params->EXT_FIELD_email: null, |
|
87 | - 'EXT_FIELD_phone' => isset($params->EXT_FIELD_phone) ? $params->EXT_FIELD_phone: null, |
|
88 | - 'EXT_FIELD_custom_data' => isset($params->EXT_FIELD_custom_data) ? $params->EXT_FIELD_custom_data: null, |
|
78 | + 'address_city' => isset($params->address_city) ? $params->address_city : null, |
|
79 | + 'local_time_window_start' => isset($params->local_time_window_start) ? $params->local_time_window_start : null, |
|
80 | + 'local_time_window_end' => isset($params->local_time_window_end) ? $params->local_time_window_end : null, |
|
81 | + 'local_time_window_start_2' => isset($params->local_time_window_start_2) ? $params->local_time_window_start_2 : null, |
|
82 | + 'local_time_window_end_2' => isset($params->local_time_window_end_2) ? $params->local_time_window_end_2 : null, |
|
83 | + 'service_time' => isset($params->service_time) ? $params->service_time : null, |
|
84 | + 'EXT_FIELD_first_name' => isset($params->EXT_FIELD_first_name) ? $params->EXT_FIELD_first_name : null, |
|
85 | + 'EXT_FIELD_last_name' => isset($params->EXT_FIELD_last_name) ? $params->EXT_FIELD_last_name : null, |
|
86 | + 'EXT_FIELD_email' => isset($params->EXT_FIELD_email) ? $params->EXT_FIELD_email : null, |
|
87 | + 'EXT_FIELD_phone' => isset($params->EXT_FIELD_phone) ? $params->EXT_FIELD_phone : null, |
|
88 | + 'EXT_FIELD_custom_data' => isset($params->EXT_FIELD_custom_data) ? $params->EXT_FIELD_custom_data : null, |
|
89 | 89 | ) |
90 | 90 | )); |
91 | 91 | |
92 | 92 | return $response; |
93 | 93 | } |
94 | 94 | |
95 | - public static function addOrder2Route($params,$body) |
|
95 | + public static function addOrder2Route($params, $body) |
|
96 | 96 | { |
97 | 97 | $response = Route4Me::makeRequst(array( |
98 | 98 | 'url' => self::$apiUrlRoute, |
99 | 99 | 'method' => 'PUT', |
100 | 100 | 'query' => array( |
101 | - 'route_id' => isset($params->route_id) ? $params->route_id: null, |
|
101 | + 'route_id' => isset($params->route_id) ? $params->route_id : null, |
|
102 | 102 | 'redirect' => isset($params->redirect) ? $params->redirect : null |
103 | 103 | ), |
104 | 104 | 'body' => (array)$body |
@@ -107,13 +107,13 @@ discard block |
||
107 | 107 | return $response; |
108 | 108 | } |
109 | 109 | |
110 | - public static function addOrder2Destination($params,$body) |
|
110 | + public static function addOrder2Destination($params, $body) |
|
111 | 111 | { |
112 | 112 | $response = Route4Me::makeRequst(array( |
113 | 113 | 'url' => self::$apiUrlOpt, |
114 | 114 | 'method' => 'PUT', |
115 | 115 | 'query' => array( |
116 | - 'optimization_problem_id' => isset($params->optimization_problem_id) ? $params->optimization_problem_id: null, |
|
116 | + 'optimization_problem_id' => isset($params->optimization_problem_id) ? $params->optimization_problem_id : null, |
|
117 | 117 | 'redirect' => isset($params->redirect) ? $params->redirect : null |
118 | 118 | ), |
119 | 119 | 'body' => (array)$body |
@@ -128,7 +128,7 @@ discard block |
||
128 | 128 | 'url' => self::$apiUrl, |
129 | 129 | 'method' => 'GET', |
130 | 130 | 'query' => array( |
131 | - 'order_id' => isset($params->order_id) ? $params->order_id: null, |
|
131 | + 'order_id' => isset($params->order_id) ? $params->order_id : null, |
|
132 | 132 | ) |
133 | 133 | )); |
134 | 134 | |
@@ -151,7 +151,7 @@ discard block |
||
151 | 151 | 'url' => self::$apiUrl, |
152 | 152 | 'method' => 'DELETE', |
153 | 153 | 'body' => array( |
154 | - 'order_ids' => isset($params->order_ids) ? $params->order_ids: null |
|
154 | + 'order_ids' => isset($params->order_ids) ? $params->order_ids : null |
|
155 | 155 | ) |
156 | 156 | )); |
157 | 157 | |
@@ -175,12 +175,12 @@ discard block |
||
175 | 175 | 'url' => self::$apiUrl, |
176 | 176 | 'method' => 'GET', |
177 | 177 | 'query' => array( |
178 | - 'day_added_YYMMDD' => isset($params->day_added_YYMMDD) ? $params->day_added_YYMMDD: null, |
|
179 | - 'scheduled_for_YYMMDD' => isset($params->scheduled_for_YYMMDD) ? $params->scheduled_for_YYMMDD: null, |
|
180 | - 'fields' => isset($params->fields) ? $params->fields: null, |
|
181 | - 'offset' => isset($params->offset) ? $params->offset: null, |
|
182 | - 'limit' => isset($params->limit) ? $params->limit: null, |
|
183 | - 'query' => isset($params->query) ? $params->query: null, |
|
178 | + 'day_added_YYMMDD' => isset($params->day_added_YYMMDD) ? $params->day_added_YYMMDD : null, |
|
179 | + 'scheduled_for_YYMMDD' => isset($params->scheduled_for_YYMMDD) ? $params->scheduled_for_YYMMDD : null, |
|
180 | + 'fields' => isset($params->fields) ? $params->fields : null, |
|
181 | + 'offset' => isset($params->offset) ? $params->offset : null, |
|
182 | + 'limit' => isset($params->limit) ? $params->limit : null, |
|
183 | + 'query' => isset($params->query) ? $params->query : null, |
|
184 | 184 | ) |
185 | 185 | )); |
186 | 186 | |
@@ -208,45 +208,45 @@ discard block |
||
208 | 208 | public function addOrdersFromCsvFile($csvFileHandle, $ordersFieldsMapping) |
209 | 209 | { |
210 | 210 | $max_line_length = 512; |
211 | - $delemietr=','; |
|
211 | + $delemietr = ','; |
|
212 | 212 | |
213 | - $results=array(); |
|
214 | - $results['fail']=array(); |
|
215 | - $results['success']=array(); |
|
213 | + $results = array(); |
|
214 | + $results['fail'] = array(); |
|
215 | + $results['success'] = array(); |
|
216 | 216 | |
217 | 217 | $columns = fgetcsv($csvFileHandle, $max_line_length, $delemietr); |
218 | 218 | |
219 | 219 | if (!empty($columns)) { |
220 | - array_push($results['fail'],'Empty CSV table'); |
|
220 | + array_push($results['fail'], 'Empty CSV table'); |
|
221 | 221 | return ($results); |
222 | 222 | } |
223 | 223 | |
224 | - $iRow=1; |
|
224 | + $iRow = 1; |
|
225 | 225 | |
226 | - while (($rows = fgetcsv($csvFileHandle, $max_line_length, $delemietr)) !== false) { |
|
227 | - if ($rows[$ordersFieldsMapping['cached_lat']] && $rows[$ordersFieldsMapping['cached_lng']] && $rows[$ordersFieldsMapping['address_1']] && array(null) !== $rows) { |
|
226 | + while (($rows = fgetcsv($csvFileHandle, $max_line_length, $delemietr))!==false) { |
|
227 | + if ($rows[$ordersFieldsMapping['cached_lat']] && $rows[$ordersFieldsMapping['cached_lng']] && $rows[$ordersFieldsMapping['address_1']] && array(null)!==$rows) { |
|
228 | 228 | |
229 | - $cached_lat=0.000; |
|
229 | + $cached_lat = 0.000; |
|
230 | 230 | |
231 | 231 | if (!$this->validateLatitude($rows[$ordersFieldsMapping['cached_lat']])) { |
232 | - array_push($results['fail'],"$iRow --> Wrong cached_lat"); |
|
232 | + array_push($results['fail'], "$iRow --> Wrong cached_lat"); |
|
233 | 233 | $iRow++; |
234 | 234 | continue; |
235 | 235 | } |
236 | - else $cached_lat=doubleval($rows[$ordersFieldsMapping['cached_lat']]); |
|
236 | + else $cached_lat = doubleval($rows[$ordersFieldsMapping['cached_lat']]); |
|
237 | 237 | |
238 | - $cached_lng=0.000; |
|
238 | + $cached_lng = 0.000; |
|
239 | 239 | |
240 | 240 | if (!$this->validateLongitude($rows[$ordersFieldsMapping['cached_lng']])) { |
241 | - array_push($results['fail'],"$iRow --> Wrong cached_lng"); |
|
241 | + array_push($results['fail'], "$iRow --> Wrong cached_lng"); |
|
242 | 242 | $iRow++; |
243 | 243 | continue; |
244 | 244 | } |
245 | - else $cached_lng=doubleval($rows[$ordersFieldsMapping['cached_lng']]); |
|
245 | + else $cached_lng = doubleval($rows[$ordersFieldsMapping['cached_lng']]); |
|
246 | 246 | |
247 | 247 | if (isset($ordersFieldsMapping['curbside_lat'])) { |
248 | 248 | if (!$this->validateLatitude($rows[$ordersFieldsMapping['curbside_lat']])) { |
249 | - array_push($results['fail'],"$iRow --> Wrong curbside_lat"); |
|
249 | + array_push($results['fail'], "$iRow --> Wrong curbside_lat"); |
|
250 | 250 | $iRow++; |
251 | 251 | continue; |
252 | 252 | } |
@@ -254,18 +254,18 @@ discard block |
||
254 | 254 | |
255 | 255 | if (isset($ordersFieldsMapping['curbside_lng'])) { |
256 | 256 | if (!$this->validateLongitude($rows[$ordersFieldsMapping['curbside_lng']])) { |
257 | - array_push($results['fail'],"$iRow --> Wrong curbside_lng"); |
|
257 | + array_push($results['fail'], "$iRow --> Wrong curbside_lng"); |
|
258 | 258 | $iRow++; |
259 | 259 | continue; |
260 | 260 | } |
261 | 261 | } |
262 | 262 | |
263 | - $address=$rows[$ordersFieldsMapping['address_1']]; |
|
263 | + $address = $rows[$ordersFieldsMapping['address_1']]; |
|
264 | 264 | |
265 | - if (isset($ordersFieldsMapping['order_city'])) $address.=', '.$rows[$ordersFieldsMapping['order_city']]; |
|
266 | - if (isset($ordersFieldsMapping['order_state_id'])) $address.=', '.$rows[$ordersFieldsMapping['order_state_id']]; |
|
267 | - if (isset($ordersFieldsMapping['order_zip_code'])) $address.=', '.$rows[$ordersFieldsMapping['order_zip_code']]; |
|
268 | - if (isset($ordersFieldsMapping['order_country_id'])) $address.=', '.$rows[$ordersFieldsMapping['order_country_id']]; |
|
265 | + if (isset($ordersFieldsMapping['order_city'])) $address .= ', '.$rows[$ordersFieldsMapping['order_city']]; |
|
266 | + if (isset($ordersFieldsMapping['order_state_id'])) $address .= ', '.$rows[$ordersFieldsMapping['order_state_id']]; |
|
267 | + if (isset($ordersFieldsMapping['order_zip_code'])) $address .= ', '.$rows[$ordersFieldsMapping['order_zip_code']]; |
|
268 | + if (isset($ordersFieldsMapping['order_country_id'])) $address .= ', '.$rows[$ordersFieldsMapping['order_country_id']]; |
|
269 | 269 | |
270 | 270 | echo "$iRow --> ".$ordersFieldsMapping['day_scheduled_for_YYMMDD'].", ".$rows[$ordersFieldsMapping['day_scheduled_for_YYMMDD']]."<br>"; |
271 | 271 | |
@@ -296,10 +296,10 @@ discard block |
||
296 | 296 | |
297 | 297 | $orderResults = $order->addOrder($orderParameters); |
298 | 298 | |
299 | - array_push($results['success'],"The order with order_id = ".strval($orderResults["order_id"])." added successfuly."); |
|
299 | + array_push($results['success'], "The order with order_id = ".strval($orderResults["order_id"])." added successfuly."); |
|
300 | 300 | } |
301 | 301 | else { |
302 | - array_push($results['fail'],"$iRow --> one of the parameters cached_lat, cached_lng, address_1 is not set"); |
|
302 | + array_push($results['fail'], "$iRow --> one of the parameters cached_lat, cached_lng, address_1 is not set"); |
|
303 | 303 | } |
304 | 304 | |
305 | 305 | $iRow++; |
@@ -1,7 +1,7 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | namespace Route4Me; |
3 | 3 | |
4 | - $vdir=$_SERVER['DOCUMENT_ROOT'].'/route4me/examples/'; |
|
4 | + $vdir = $_SERVER['DOCUMENT_ROOT'].'/route4me/examples/'; |
|
5 | 5 | |
6 | 6 | require $vdir.'/../vendor/autoload.php'; |
7 | 7 | |
@@ -11,7 +11,7 @@ discard block |
||
11 | 11 | // Set the api key in the Route4me class |
12 | 12 | Route4Me::setApiKey('11111111111111111111111111111111'); |
13 | 13 | |
14 | - $orderParameters=Order::fromArray(array( |
|
14 | + $orderParameters = Order::fromArray(array( |
|
15 | 15 | "address_1" => "318 S 39th St, Louisville, KY 40212, USA", |
16 | 16 | "cached_lat" => 38.259326, |
17 | 17 | "cached_lng" => -85.814979, |
@@ -1,7 +1,7 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | namespace Route4Me; |
3 | 3 | |
4 | - $vdir=$_SERVER['DOCUMENT_ROOT'].'/route4me/examples/'; |
|
4 | + $vdir = $_SERVER['DOCUMENT_ROOT'].'/route4me/examples/'; |
|
5 | 5 | |
6 | 6 | require $vdir.'/../vendor/autoload.php'; |
7 | 7 | |
@@ -12,7 +12,7 @@ discard block |
||
12 | 12 | Route4Me::setApiKey('11111111111111111111111111111111'); |
13 | 13 | |
14 | 14 | #region // Add a location, scheduled daily with custom data. |
15 | - $AdressBookLocationParameters=AddressBookLocation::fromArray(array( |
|
15 | + $AdressBookLocationParameters = AddressBookLocation::fromArray(array( |
|
16 | 16 | "address_1" => "1604 PARKRIDGE PKWY, Louisville, KY, 40214", |
17 | 17 | "address_alias" => "1604 PARKRIDGE PKWY 40214", |
18 | 18 | "address_group" => "Scheduled daily", |
@@ -32,9 +32,9 @@ discard block |
||
32 | 32 | "service_time" => 900 |
33 | 33 | )); |
34 | 34 | |
35 | - $abContacts1=new AddressBookLocation(); |
|
35 | + $abContacts1 = new AddressBookLocation(); |
|
36 | 36 | |
37 | - $abcResults1=$abContacts1->addAdressBookLocation($AdressBookLocationParameters); |
|
37 | + $abcResults1 = $abContacts1->addAdressBookLocation($AdressBookLocationParameters); |
|
38 | 38 | |
39 | 39 | echo "address_id = ".strval($abcResults1["address_id"])."<br>"; |
40 | 40 | |
@@ -42,7 +42,7 @@ discard block |
||
42 | 42 | #endregion |
43 | 43 | |
44 | 44 | #region // Add a location, scheduled weekly. |
45 | - $AdressBookLocationParameters=AddressBookLocation::fromArray(array( |
|
45 | + $AdressBookLocationParameters = AddressBookLocation::fromArray(array( |
|
46 | 46 | "address_1" => "1407 MCCOY, Louisville, KY, 40215", |
47 | 47 | "address_alias" => "1407 MCCOY 40215", |
48 | 48 | "address_group" => "Scheduled weekly", |
@@ -60,15 +60,15 @@ discard block |
||
60 | 60 | "mode" => "weekly", |
61 | 61 | "weekly" => array( |
62 | 62 | "every" => 1, |
63 | - "weekdays" => array(1,2,3,4,5) |
|
63 | + "weekdays" => array(1, 2, 3, 4, 5) |
|
64 | 64 | ) |
65 | 65 | )), |
66 | 66 | "service_time" => 600 |
67 | 67 | )); |
68 | 68 | |
69 | - $abContacts2=new AddressBookLocation(); |
|
69 | + $abContacts2 = new AddressBookLocation(); |
|
70 | 70 | |
71 | - $abcResults2=$abContacts2->addAdressBookLocation($AdressBookLocationParameters); |
|
71 | + $abcResults2 = $abContacts2->addAdressBookLocation($AdressBookLocationParameters); |
|
72 | 72 | |
73 | 73 | echo "address_id = ".strval($abcResults2["address_id"])."<br>"; |
74 | 74 | |
@@ -76,7 +76,7 @@ discard block |
||
76 | 76 | #endregion |
77 | 77 | |
78 | 78 | #region // Add a location, scheduled monthly (dates mode). |
79 | - $AdressBookLocationParameters=AddressBookLocation::fromArray(array( |
|
79 | + $AdressBookLocationParameters = AddressBookLocation::fromArray(array( |
|
80 | 80 | "address_1" => "4805 BELLEVUE AVE, Louisville, KY, 40215", |
81 | 81 | "address_2" => "4806 BELLEVUE AVE, Louisville, KY, 40215", |
82 | 82 | "address_alias" => "4805 BELLEVUE AVE 40215", |
@@ -99,16 +99,16 @@ discard block |
||
99 | 99 | "monthly" => array( |
100 | 100 | "every" => 1, |
101 | 101 | "mode" => "dates", |
102 | - "dates" => array(20,22,23,24,25) |
|
102 | + "dates" => array(20, 22, 23, 24, 25) |
|
103 | 103 | ) |
104 | 104 | )), |
105 | 105 | "service_time" => 750, |
106 | 106 | "color" => "red" |
107 | 107 | )); |
108 | 108 | |
109 | - $abContacts3=new AddressBookLocation(); |
|
109 | + $abContacts3 = new AddressBookLocation(); |
|
110 | 110 | |
111 | - $abcResults3=$abContacts3->addAdressBookLocation($AdressBookLocationParameters); |
|
111 | + $abcResults3 = $abContacts3->addAdressBookLocation($AdressBookLocationParameters); |
|
112 | 112 | |
113 | 113 | echo "address_id = ".strval($abcResults3["address_id"])."<br>"; |
114 | 114 | |
@@ -117,7 +117,7 @@ discard block |
||
117 | 117 | #endregion |
118 | 118 | |
119 | 119 | #region // AAdd a location, scheduled monthly (nth mode). |
120 | - $AdressBookLocationParameters=AddressBookLocation::fromArray(array( |
|
120 | + $AdressBookLocationParameters = AddressBookLocation::fromArray(array( |
|
121 | 121 | "address_1" => "730 CECIL AVENUE, Louisville, KY, 40211", |
122 | 122 | "address_alias" => "730 CECIL AVENUE 40211", |
123 | 123 | "address_group" => "Scheduled monthly", |
@@ -150,9 +150,9 @@ discard block |
||
150 | 150 | "address_icon" => "emoji/emoji-bus" |
151 | 151 | )); |
152 | 152 | |
153 | - $abContacts4=new AddressBookLocation(); |
|
153 | + $abContacts4 = new AddressBookLocation(); |
|
154 | 154 | |
155 | - $abcResults4=$abContacts4->addAdressBookLocation($AdressBookLocationParameters); |
|
155 | + $abcResults4 = $abContacts4->addAdressBookLocation($AdressBookLocationParameters); |
|
156 | 156 | |
157 | 157 | echo "address_id = ".strval($abcResults4["address_id"])."<br>"; |
158 | 158 | |
@@ -160,7 +160,7 @@ discard block |
||
160 | 160 | #endregion |
161 | 161 | |
162 | 162 | #region // Add a location with the daily scheduling and blacklist. |
163 | - $AdressBookLocationParameters=AddressBookLocation::fromArray(array( |
|
163 | + $AdressBookLocationParameters = AddressBookLocation::fromArray(array( |
|
164 | 164 | |
165 | 165 | "address_1" => "4629 HILLSIDE DRIVE, Louisville, KY, 40216", |
166 | 166 | "address_alias" => "4629 HILLSIDE DRIVE 40216", |
@@ -183,13 +183,13 @@ discard block |
||
183 | 183 | "mode" => "daily", |
184 | 184 | "daily" => array("every" => 1) |
185 | 185 | ), |
186 | - "schedule_blacklist" => array("2017-02-24","2017-02-25"), |
|
186 | + "schedule_blacklist" => array("2017-02-24", "2017-02-25"), |
|
187 | 187 | "service_time" => 300 |
188 | 188 | )); |
189 | 189 | |
190 | - $abContacts5=new AddressBookLocation(); |
|
190 | + $abContacts5 = new AddressBookLocation(); |
|
191 | 191 | |
192 | - $abcResults5=$abContacts5->addAdressBookLocation($AdressBookLocationParameters); |
|
192 | + $abcResults5 = $abContacts5->addAdressBookLocation($AdressBookLocationParameters); |
|
193 | 193 | |
194 | 194 | echo "address_id = ".strval($abcResults5["address_id"])."<br>"; |
195 | 195 |
@@ -32,11 +32,11 @@ discard block |
||
32 | 32 | //public $offset; |
33 | 33 | //public $limit; |
34 | 34 | |
35 | - public function __construct () { } |
|
35 | + public function __construct() { } |
|
36 | 36 | |
37 | 37 | public static function fromArray(array $params) { |
38 | 38 | $addressbooklocation = new AddressBookLocation(); |
39 | - foreach($params as $key => $value) { |
|
39 | + foreach ($params as $key => $value) { |
|
40 | 40 | if (property_exists($addressbooklocation, $key)) { |
41 | 41 | $addressbooklocation->{$key} = $value; |
42 | 42 | } |
@@ -61,14 +61,14 @@ discard block |
||
61 | 61 | |
62 | 62 | public static function searchRoutedLocation($params) |
63 | 63 | { |
64 | - $result= Route4Me::makeRequst(array( |
|
64 | + $result = Route4Me::makeRequst(array( |
|
65 | 65 | 'url' => self::$apiUrl, |
66 | 66 | 'method' => 'GET', |
67 | 67 | 'query' => array( |
68 | - 'display' => isset($params['display']) ? $params['display']: null, |
|
69 | - 'query' => isset($params['query']) ? $params['query']: null, |
|
70 | - 'fields' => isset($params['fields']) ? $params['fields']: null, |
|
71 | - 'limit' => isset($params['limit']) ? $params['limit']: null, |
|
68 | + 'display' => isset($params['display']) ? $params['display'] : null, |
|
69 | + 'query' => isset($params['query']) ? $params['query'] : null, |
|
70 | + 'fields' => isset($params['fields']) ? $params['fields'] : null, |
|
71 | + 'limit' => isset($params['limit']) ? $params['limit'] : null, |
|
72 | 72 | 'offset' => isset($params['offset']) ? $params['offset'] : null, |
73 | 73 | ) |
74 | 74 | )); |
@@ -82,7 +82,7 @@ discard block |
||
82 | 82 | 'url' => self::$apiUrl, |
83 | 83 | 'method' => 'GET', |
84 | 84 | 'query' => array( |
85 | - 'limit' => isset($params->limit) ? $params->limit: null, |
|
85 | + 'limit' => isset($params->limit) ? $params->limit : null, |
|
86 | 86 | 'offset' => isset($params->offset) ? $params->offset : null, |
87 | 87 | ) |
88 | 88 | )); |
@@ -109,41 +109,41 @@ discard block |
||
109 | 109 | 'url' => self::$apiUrl, |
110 | 110 | 'method' => 'POST', |
111 | 111 | 'body' => array( |
112 | - 'address_1' => isset($params->address_1) ? $params->address_1: null, |
|
113 | - 'address_2' => isset($params->address_2) ? $params->address_2: null, |
|
114 | - 'address_alias' => isset($params->address_alias) ? $params->address_alias: null, |
|
112 | + 'address_1' => isset($params->address_1) ? $params->address_1 : null, |
|
113 | + 'address_2' => isset($params->address_2) ? $params->address_2 : null, |
|
114 | + 'address_alias' => isset($params->address_alias) ? $params->address_alias : null, |
|
115 | 115 | 'cached_lat' => isset($params->cached_lat) ? $params->cached_lat : null, |
116 | 116 | 'cached_lng' => isset($params->cached_lng) ? $params->cached_lng : null, |
117 | 117 | 'curbside_lat' => isset($params->curbside_lat) ? $params->curbside_lat : null, |
118 | 118 | 'curbside_lng' => isset($params->curbside_lng) ? $params->curbside_lng : null, |
119 | - 'address_phone_number' => isset($params->address_phone_number) ? $params->address_phone_number: null, |
|
120 | - 'address_group' => isset($params->address_group) ? $params->address_group: null, |
|
121 | - 'first_name' => isset($params->first_name) ? $params->first_name: null, |
|
122 | - 'last_name' => isset($params->last_name) ? $params->last_name: null, |
|
123 | - 'local_time_window_start' => isset($params->local_time_window_start) ? $params->local_time_window_start: null, |
|
124 | - 'local_time_window_end' => isset($params->local_time_window_end) ? $params->local_time_window_end: null, |
|
125 | - 'local_time_window_start_2' => isset($params->local_time_window_start_2) ? $params->local_time_window_start_2: null, |
|
126 | - 'local_time_window_end_2' => isset($params->local_time_window_end_2) ? $params->local_time_window_end_2: null, |
|
127 | - 'address_email' => isset($params->address_email) ? $params->address_email: null, |
|
128 | - 'address_city' => isset($params->address_city) ? $params->address_city: null, |
|
129 | - 'address_state_id' => isset($params->address_state_id) ? $params->address_state_id: null, |
|
130 | - 'address_country_id' => isset($params->address_country_id) ? $params->address_country_id: null, |
|
131 | - 'address_zip' => isset($params->address_zip) ? $params->address_zip: null, |
|
132 | - 'address_custom_data' => isset($params->address_custom_data) ? $params->address_custom_data: null, |
|
133 | - 'schedule' => isset($params->schedule) ? $params->schedule: null, |
|
134 | - 'schedule_blacklist' => isset($params->schedule_blacklist) ? $params->schedule_blacklist: null, |
|
135 | - 'service_time' => isset($params->service_time) ? $params->service_time: null, |
|
136 | - 'local_timezone_string' => isset($params->local_timezone_string) ? $params->local_timezone_string: null, |
|
137 | - 'color' => isset($params->color) ? $params->color: null, |
|
138 | - 'address_icon' => isset($params->address_icon) ? $params->address_icon: null, |
|
139 | - 'address_stop_type' => isset($params->address_stop_type) ? $params->address_stop_type: null, |
|
140 | - 'address_cube' => isset($params->address_cube) ? $params->address_cube: null, |
|
141 | - 'address_pieces' => isset($params->address_pieces) ? $params->address_pieces: null, |
|
142 | - 'address_reference_no' => isset($params->address_reference_no) ? $params->address_reference_no: null, |
|
143 | - 'address_revenue' => isset($params->address_revenue) ? $params->address_revenue: null, |
|
144 | - 'address_weight' => isset($params->address_weight) ? $params->address_weight: null, |
|
145 | - 'address_priority' => isset($params->address_priority) ? $params->address_priority: null, |
|
146 | - 'address_customer_po' => isset($params->address_customer_po) ? $params->address_customer_po: null, |
|
119 | + 'address_phone_number' => isset($params->address_phone_number) ? $params->address_phone_number : null, |
|
120 | + 'address_group' => isset($params->address_group) ? $params->address_group : null, |
|
121 | + 'first_name' => isset($params->first_name) ? $params->first_name : null, |
|
122 | + 'last_name' => isset($params->last_name) ? $params->last_name : null, |
|
123 | + 'local_time_window_start' => isset($params->local_time_window_start) ? $params->local_time_window_start : null, |
|
124 | + 'local_time_window_end' => isset($params->local_time_window_end) ? $params->local_time_window_end : null, |
|
125 | + 'local_time_window_start_2' => isset($params->local_time_window_start_2) ? $params->local_time_window_start_2 : null, |
|
126 | + 'local_time_window_end_2' => isset($params->local_time_window_end_2) ? $params->local_time_window_end_2 : null, |
|
127 | + 'address_email' => isset($params->address_email) ? $params->address_email : null, |
|
128 | + 'address_city' => isset($params->address_city) ? $params->address_city : null, |
|
129 | + 'address_state_id' => isset($params->address_state_id) ? $params->address_state_id : null, |
|
130 | + 'address_country_id' => isset($params->address_country_id) ? $params->address_country_id : null, |
|
131 | + 'address_zip' => isset($params->address_zip) ? $params->address_zip : null, |
|
132 | + 'address_custom_data' => isset($params->address_custom_data) ? $params->address_custom_data : null, |
|
133 | + 'schedule' => isset($params->schedule) ? $params->schedule : null, |
|
134 | + 'schedule_blacklist' => isset($params->schedule_blacklist) ? $params->schedule_blacklist : null, |
|
135 | + 'service_time' => isset($params->service_time) ? $params->service_time : null, |
|
136 | + 'local_timezone_string' => isset($params->local_timezone_string) ? $params->local_timezone_string : null, |
|
137 | + 'color' => isset($params->color) ? $params->color : null, |
|
138 | + 'address_icon' => isset($params->address_icon) ? $params->address_icon : null, |
|
139 | + 'address_stop_type' => isset($params->address_stop_type) ? $params->address_stop_type : null, |
|
140 | + 'address_cube' => isset($params->address_cube) ? $params->address_cube : null, |
|
141 | + 'address_pieces' => isset($params->address_pieces) ? $params->address_pieces : null, |
|
142 | + 'address_reference_no' => isset($params->address_reference_no) ? $params->address_reference_no : null, |
|
143 | + 'address_revenue' => isset($params->address_revenue) ? $params->address_revenue : null, |
|
144 | + 'address_weight' => isset($params->address_weight) ? $params->address_weight : null, |
|
145 | + 'address_priority' => isset($params->address_priority) ? $params->address_priority : null, |
|
146 | + 'address_customer_po' => isset($params->address_customer_po) ? $params->address_customer_po : null, |
|
147 | 147 | ) |
148 | 148 | )); |
149 | 149 | |
@@ -183,7 +183,7 @@ discard block |
||
183 | 183 | 'method' => 'ADD', |
184 | 184 | 'query' => array( |
185 | 185 | 'first_name' => isset($params->first_name) ? $params->first_name : null, |
186 | - 'address_1' => isset($params->address_1) ? $params->address_1: null, |
|
186 | + 'address_1' => isset($params->address_1) ? $params->address_1 : null, |
|
187 | 187 | 'cached_lat' => isset($params->cached_lat) ? $params->cached_lat : null, |
188 | 188 | 'cached_lng' => isset($params->cached_lng) ? $params->cached_lng : null, |
189 | 189 | ) |
@@ -194,14 +194,14 @@ discard block |
||
194 | 194 | |
195 | 195 | public static function validateScheduleMode($scheduleMode) |
196 | 196 | { |
197 | - $schedMmodes=array("daily","weekly","monthly","annually"); |
|
197 | + $schedMmodes = array("daily", "weekly", "monthly", "annually"); |
|
198 | 198 | |
199 | 199 | if (in_array($scheduleMode, $schedMmodes)) return TRUE; else return FALSE; |
200 | 200 | } |
201 | 201 | |
202 | 202 | public static function validateScheduleEnable($scheduleEnabled) |
203 | 203 | { |
204 | - $schedEnambles=array(TRUE,FALSE); |
|
204 | + $schedEnambles = array(TRUE, FALSE); |
|
205 | 205 | |
206 | 206 | if (in_array($scheduleEnabled, $schedEnambles)) return TRUE; else return FALSE; |
207 | 207 | } |
@@ -217,14 +217,14 @@ discard block |
||
217 | 217 | |
218 | 218 | if (sizeof($weekdays)<1) return FALSE; |
219 | 219 | |
220 | - $isValid=TRUE; |
|
220 | + $isValid = TRUE; |
|
221 | 221 | |
222 | - for ($i=0; $i < sizeof($weekdays); $i++) { |
|
222 | + for ($i = 0; $i<sizeof($weekdays); $i++) { |
|
223 | 223 | if (is_numeric($weekdays[$i])) { |
224 | - $wday=intval($weekdays[$i]); |
|
225 | - if ($wday<1 || $wday>7) $isValid=FALSE; |
|
224 | + $wday = intval($weekdays[$i]); |
|
225 | + if ($wday<1 || $wday>7) $isValid = FALSE; |
|
226 | 226 | } |
227 | - else $isValid=FALSE; |
|
227 | + else $isValid = FALSE; |
|
228 | 228 | } |
229 | 229 | //echo $scheduleWeekDays.' --- '. $isValid."<br>"; |
230 | 230 | return $isValid; |
@@ -232,7 +232,7 @@ discard block |
||
232 | 232 | |
233 | 233 | public static function validateScheduleMonthlyMode($scheduleMonthlyMode) |
234 | 234 | { |
235 | - $schedMonthlyMmodes=array("dates","nth"); |
|
235 | + $schedMonthlyMmodes = array("dates", "nth"); |
|
236 | 236 | |
237 | 237 | if (in_array($scheduleMonthlyMode, $schedMonthlyMmodes)) return TRUE; else return FALSE; |
238 | 238 | } |
@@ -243,14 +243,14 @@ discard block |
||
243 | 243 | |
244 | 244 | if (sizeof($monthlyDates)<1) return FALSE; |
245 | 245 | |
246 | - $isValid=TRUE; |
|
246 | + $isValid = TRUE; |
|
247 | 247 | |
248 | - for ($i=0; $i < sizeof($monthlyDates); $i++) { |
|
248 | + for ($i = 0; $i<sizeof($monthlyDates); $i++) { |
|
249 | 249 | if (is_numeric($monthlyDates[$i])) { |
250 | - $mday=intval($monthlyDates[$i]); |
|
251 | - if ($mday<1 || $mday>31) $isValid=FALSE; |
|
250 | + $mday = intval($monthlyDates[$i]); |
|
251 | + if ($mday<1 || $mday>31) $isValid = FALSE; |
|
252 | 252 | } |
253 | - else $isValid=FALSE; |
|
253 | + else $isValid = FALSE; |
|
254 | 254 | } |
255 | 255 | |
256 | 256 | return $isValid; |
@@ -260,7 +260,7 @@ discard block |
||
260 | 260 | { |
261 | 261 | if (!is_numeric($scheduleNthN)) return FALSE; |
262 | 262 | |
263 | - $schedNthNs=array(1,2,3,4,5,-1); |
|
263 | + $schedNthNs = array(1, 2, 3, 4, 5, -1); |
|
264 | 264 | if (in_array($scheduleNthN, $schedNthNs)) return TRUE; else return FALSE; |
265 | 265 | } |
266 | 266 | |
@@ -268,7 +268,7 @@ discard block |
||
268 | 268 | { |
269 | 269 | if (!is_numeric($scheduleNthWhat)) return FALSE; |
270 | 270 | |
271 | - $schedNthWhats=array(1, 2, 3, 4, 5, 6, 7, 8, 9, 10); |
|
271 | + $schedNthWhats = array(1, 2, 3, 4, 5, 6, 7, 8, 9, 10); |
|
272 | 272 | if (in_array($scheduleNthWhat, $schedNthWhats)) return TRUE; else return FALSE; |
273 | 273 | } |
274 | 274 | |
@@ -279,50 +279,50 @@ discard block |
||
279 | 279 | public function addLocationsFromCsvFile($csvFileHandle, $locationsFieldsMapping) |
280 | 280 | { |
281 | 281 | $max_line_length = 512; |
282 | - $delemietr=','; |
|
282 | + $delemietr = ','; |
|
283 | 283 | |
284 | - $results=array(); |
|
285 | - $results['fail']=array(); |
|
286 | - $results['success']=array(); |
|
284 | + $results = array(); |
|
285 | + $results['fail'] = array(); |
|
286 | + $results['success'] = array(); |
|
287 | 287 | |
288 | 288 | $columns = fgetcsv($csvFileHandle, $max_line_length, $delemietr); |
289 | 289 | if (!empty($columns)) { |
290 | - array_push($results['fail'],'Empty CSV table'); |
|
290 | + array_push($results['fail'], 'Empty CSV table'); |
|
291 | 291 | return ($results); |
292 | 292 | } |
293 | 293 | |
294 | - $iRow=1; |
|
294 | + $iRow = 1; |
|
295 | 295 | |
296 | - while (($rows = fgetcsv($csvFileHandle, $max_line_length, $delemietr)) !== false) { |
|
297 | - if ($rows[$locationsFieldsMapping['cached_lat']] && $rows[$locationsFieldsMapping['cached_lng']] && $rows[$locationsFieldsMapping['address_1']] && array(null) !== $rows) { |
|
298 | - $curSchedule=""; |
|
299 | - $mode=""; |
|
296 | + while (($rows = fgetcsv($csvFileHandle, $max_line_length, $delemietr))!==false) { |
|
297 | + if ($rows[$locationsFieldsMapping['cached_lat']] && $rows[$locationsFieldsMapping['cached_lng']] && $rows[$locationsFieldsMapping['address_1']] && array(null)!==$rows) { |
|
298 | + $curSchedule = ""; |
|
299 | + $mode = ""; |
|
300 | 300 | |
301 | 301 | if (isset($rows[$locationsFieldsMapping['schedule_mode']])) { |
302 | 302 | if ($this->validateScheduleMode($rows[$locationsFieldsMapping['schedule_mode']])) { |
303 | - $curSchedule='"mode":"'.$rows[$locationsFieldsMapping['schedule_mode']].'",'; |
|
304 | - $mode=$rows[$locationsFieldsMapping['schedule_mode']]; |
|
303 | + $curSchedule = '"mode":"'.$rows[$locationsFieldsMapping['schedule_mode']].'",'; |
|
304 | + $mode = $rows[$locationsFieldsMapping['schedule_mode']]; |
|
305 | 305 | } |
306 | - else {array_push($results['fail'],"$iRow --> Wrong schedule mode parameter"); $curSchedule="";} |
|
306 | + else {array_push($results['fail'], "$iRow --> Wrong schedule mode parameter"); $curSchedule = ""; } |
|
307 | 307 | } |
308 | - else {array_push($results['fail'],"$iRow --> The schedule mode parameter is not set"); $curSchedule="";} |
|
308 | + else {array_push($results['fail'], "$iRow --> The schedule mode parameter is not set"); $curSchedule = ""; } |
|
309 | 309 | |
310 | 310 | if (isset($rows[$locationsFieldsMapping['schedule_enabled']])) { |
311 | 311 | if ($this->validateScheduleEnable($rows[$locationsFieldsMapping['schedule_enabled']])) { |
312 | - $curSchedule.='"enabled":'.$rows[$locationsFieldsMapping['schedule_enabled']].','; |
|
312 | + $curSchedule .= '"enabled":'.$rows[$locationsFieldsMapping['schedule_enabled']].','; |
|
313 | 313 | } |
314 | - else {array_push($results['fail'],"$iRow --> The schedule enabled parameter is not set "); $curSchedule="";} |
|
314 | + else {array_push($results['fail'], "$iRow --> The schedule enabled parameter is not set "); $curSchedule = ""; } |
|
315 | 315 | } |
316 | 316 | |
317 | 317 | if (isset($rows[$locationsFieldsMapping['schedule_every']])) { |
318 | 318 | if ($this->validateScheduleEvery($rows[$locationsFieldsMapping['schedule_every']])) { |
319 | - $curSchedule.='"'.$mode.'":{'.'"every":'.$rows[$locationsFieldsMapping['schedule_every']].','; |
|
319 | + $curSchedule .= '"'.$mode.'":{'.'"every":'.$rows[$locationsFieldsMapping['schedule_every']].','; |
|
320 | 320 | if ($mode=='daily') { |
321 | - $curSchedule=trim($curSchedule,','); |
|
322 | - $curSchedule.='}'; |
|
321 | + $curSchedule = trim($curSchedule, ','); |
|
322 | + $curSchedule .= '}'; |
|
323 | 323 | } |
324 | 324 | } |
325 | - else {array_push($results['fail'],"$iRow --> The parameter sched_every is not set"); $curSchedule=""; } |
|
325 | + else {array_push($results['fail'], "$iRow --> The parameter sched_every is not set"); $curSchedule = ""; } |
|
326 | 326 | } |
327 | 327 | |
328 | 328 | if ($mode!='daily') { |
@@ -330,50 +330,50 @@ discard block |
||
330 | 330 | case 'weekly': |
331 | 331 | if (isset($rows[$locationsFieldsMapping['schedule_weekdays']])) { |
332 | 332 | if ($this->validateScheduleWeekDays($rows[$locationsFieldsMapping['schedule_weekdays']])) { |
333 | - $curSchedule.='"weekdays":['.$rows[$locationsFieldsMapping['schedule_weekdays']].']}'; |
|
333 | + $curSchedule .= '"weekdays":['.$rows[$locationsFieldsMapping['schedule_weekdays']].']}'; |
|
334 | 334 | } |
335 | - else {array_push($results['fail'],"$iRow --> Wrong weekdays"); $curSchedule="";} |
|
335 | + else {array_push($results['fail'], "$iRow --> Wrong weekdays"); $curSchedule = ""; } |
|
336 | 336 | } |
337 | - else {array_push($results['fail'],"$iRow --> The parameters sched_weekdays is not set"); $curSchedule="";} |
|
337 | + else {array_push($results['fail'], "$iRow --> The parameters sched_weekdays is not set"); $curSchedule = ""; } |
|
338 | 338 | break; |
339 | 339 | case 'monthly': |
340 | - $monthlyMode=""; |
|
340 | + $monthlyMode = ""; |
|
341 | 341 | if (isset($rows[$locationsFieldsMapping['monthly_mode']])) { |
342 | 342 | if ($this->validateScheduleMonthlyMode($rows[$locationsFieldsMapping['monthly_mode']])) { |
343 | - $monthlyMode=$rows[$locationsFieldsMapping['monthly_mode']]; |
|
344 | - $curSchedule.='"mode": "'.$rows[$locationsFieldsMapping['monthly_mode']].'",'; |
|
343 | + $monthlyMode = $rows[$locationsFieldsMapping['monthly_mode']]; |
|
344 | + $curSchedule .= '"mode": "'.$rows[$locationsFieldsMapping['monthly_mode']].'",'; |
|
345 | 345 | } |
346 | - else {array_push($results['fail'],"$iRow --> Wrong monthly mode"); $curSchedule="";} |
|
346 | + else {array_push($results['fail'], "$iRow --> Wrong monthly mode"); $curSchedule = ""; } |
|
347 | 347 | } |
348 | - else {array_push($results['fail'],"$iRow --> The parameter sched_monthly_mode is not set"); $curSchedule="";} |
|
348 | + else {array_push($results['fail'], "$iRow --> The parameter sched_monthly_mode is not set"); $curSchedule = ""; } |
|
349 | 349 | |
350 | 350 | if ($monthlyMode!="") { |
351 | 351 | switch ($monthlyMode) { |
352 | 352 | case 'dates': |
353 | 353 | if (isset($rows[$locationsFieldsMapping['monthly_dates']])) { |
354 | 354 | if ($this->validateScheduleMonthlyDates($rows[$locationsFieldsMapping['monthly_dates']])) { |
355 | - $curSchedule.='"dates":['.$rows[$locationsFieldsMapping['monthly_dates']].']}'; |
|
355 | + $curSchedule .= '"dates":['.$rows[$locationsFieldsMapping['monthly_dates']].']}'; |
|
356 | 356 | } |
357 | - else {array_push($results['fail'],"$iRow --> Wrong monthly dates"); $curSchedule="";} |
|
357 | + else {array_push($results['fail'], "$iRow --> Wrong monthly dates"); $curSchedule = ""; } |
|
358 | 358 | } |
359 | 359 | break; |
360 | 360 | case 'nth': |
361 | 361 | if (isset($rows[$locationsFieldsMapping['monthly_nth_n']])) { |
362 | 362 | if ($this->validateScheduleNthN($rows[$locationsFieldsMapping['monthly_nth_n']])) { |
363 | - $curSchedule.='"nth":{"n":'.$rows[$locationsFieldsMapping['monthly_nth_n']].','; |
|
363 | + $curSchedule .= '"nth":{"n":'.$rows[$locationsFieldsMapping['monthly_nth_n']].','; |
|
364 | 364 | } |
365 | - else {array_push($results['fail'],"$iRow --> Wrong parameter sched_nth_n"); $curSchedule="";} |
|
365 | + else {array_push($results['fail'], "$iRow --> Wrong parameter sched_nth_n"); $curSchedule = ""; } |
|
366 | 366 | } |
367 | - else {array_push($results['fail'],"$iRow --> The parameter sched_nth_n is not set"); $curSchedule="";} |
|
367 | + else {array_push($results['fail'], "$iRow --> The parameter sched_nth_n is not set"); $curSchedule = ""; } |
|
368 | 368 | |
369 | 369 | if ($curSchedule!="") { |
370 | 370 | if (isset($rows[$locationsFieldsMapping['monthly_nth_wwhat']])) { |
371 | 371 | if ($this->validateScheduleNthWhat($rows[$locationsFieldsMapping['monthly_nth_wwhat']])) { |
372 | - $curSchedule.='"what":'.$rows[$locationsFieldsMapping['monthly_nth_wwhat']].'}}'; |
|
372 | + $curSchedule .= '"what":'.$rows[$locationsFieldsMapping['monthly_nth_wwhat']].'}}'; |
|
373 | 373 | } |
374 | - else {array_push($results['fail'],"$iRow --> Wrong parameter sched_nth_what"); $curSchedule="";} |
|
374 | + else {array_push($results['fail'], "$iRow --> Wrong parameter sched_nth_what"); $curSchedule = ""; } |
|
375 | 375 | } |
376 | - else {array_push($results['fail'],"$iRow --> The parameter sched_nth_what is not set"); $curSchedule="";} |
|
376 | + else {array_push($results['fail'], "$iRow --> The parameter sched_nth_what is not set"); $curSchedule = ""; } |
|
377 | 377 | } |
378 | 378 | |
379 | 379 | break; |
@@ -387,15 +387,15 @@ discard block |
||
387 | 387 | |
388 | 388 | } |
389 | 389 | |
390 | - if (($mode=='daily' || $mode=='weekly' || $mode=='monthy') && $curSchedule=="") {$iRow++; continue;} |
|
390 | + if (($mode=='daily' || $mode=='weekly' || $mode=='monthy') && $curSchedule=="") {$iRow++; continue; } |
|
391 | 391 | |
392 | - $curSchedule=strtolower($curSchedule); |
|
392 | + $curSchedule = strtolower($curSchedule); |
|
393 | 393 | |
394 | - $curSchedule='[{'.$curSchedule.'}]'; |
|
394 | + $curSchedule = '[{'.$curSchedule.'}]'; |
|
395 | 395 | |
396 | - $oSchedule= json_decode($curSchedule,TRUE); |
|
396 | + $oSchedule = json_decode($curSchedule, TRUE); |
|
397 | 397 | |
398 | - $AdressBookLocationParameters=AddressBookLocation::fromArray(array( |
|
398 | + $AdressBookLocationParameters = AddressBookLocation::fromArray(array( |
|
399 | 399 | "cached_lat" => $rows[$locationsFieldsMapping['cached_lat']], |
400 | 400 | "cached_lng" => $rows[$locationsFieldsMapping['cached_lng']], |
401 | 401 | "curbside_lat" => isset($locationsFieldsMapping['curbside_lat']) ? $rows[$locationsFieldsMapping['curbside_lat']] : null, |
@@ -433,11 +433,11 @@ discard block |
||
433 | 433 | "address_customer_po" => isset($locationsFieldsMapping['address_customer_po']) ? $rows[$locationsFieldsMapping['address_customer_po']] : null, |
434 | 434 | )); |
435 | 435 | |
436 | - $abContacts=new AddressBookLocation(); |
|
436 | + $abContacts = new AddressBookLocation(); |
|
437 | 437 | |
438 | - $abcResults=$abContacts->addAdressBookLocation($AdressBookLocationParameters); //temporarry |
|
438 | + $abcResults = $abContacts->addAdressBookLocation($AdressBookLocationParameters); //temporarry |
|
439 | 439 | |
440 | - array_push($results['success'],"The schedule location with address_id = ".strval($abcResults["address_id"])." added successfuly."); |
|
440 | + array_push($results['success'], "The schedule location with address_id = ".strval($abcResults["address_id"])." added successfuly."); |
|
441 | 441 | |
442 | 442 | } |
443 | 443 |
@@ -10,9 +10,9 @@ discard block |
||
10 | 10 | class Address extends Common |
11 | 11 | { |
12 | 12 | static public $apiUrl = '/api.v4/address.php'; |
13 | - static public $apiUrlMove='/actions/route/move_route_destination.php'; |
|
14 | - static public $apiUrDeparted='/api/route/mark_address_departed.php'; |
|
15 | - static public $apiUrVisited='/actions/address/update_address_visited.php'; |
|
13 | + static public $apiUrlMove = '/actions/route/move_route_destination.php'; |
|
14 | + static public $apiUrDeparted = '/api/route/mark_address_departed.php'; |
|
15 | + static public $apiUrVisited = '/actions/address/update_address_visited.php'; |
|
16 | 16 | |
17 | 17 | public $route_destination_id; |
18 | 18 | public $alias; |
@@ -70,7 +70,7 @@ discard block |
||
70 | 70 | }*/ |
71 | 71 | |
72 | 72 | $address = new Address(); |
73 | - foreach($params as $key => $value) { |
|
73 | + foreach ($params as $key => $value) { |
|
74 | 74 | if (property_exists($address, $key)) { |
75 | 75 | $address->{$key} = $value; |
76 | 76 | } |
@@ -102,7 +102,7 @@ discard block |
||
102 | 102 | 'url' => self::$apiUrl, |
103 | 103 | 'method' => 'GET', |
104 | 104 | 'query' => array( |
105 | - 'route_id' => isset($noteParams['route_id']) ? $noteParams['route_id']: null, |
|
105 | + 'route_id' => isset($noteParams['route_id']) ? $noteParams['route_id'] : null, |
|
106 | 106 | 'route_destination_id' => isset($noteParams['route_destination_id']) ? $noteParams['route_destination_id'] : null, |
107 | 107 | 'notes' => 1, |
108 | 108 | ) |
@@ -132,7 +132,7 @@ discard block |
||
132 | 132 | 'url' => self::$apiUrl, |
133 | 133 | 'method' => 'PUT', |
134 | 134 | 'query' => array( |
135 | - 'route_id' => isset($params['route_id']) ? $params['route_id']: null, |
|
135 | + 'route_id' => isset($params['route_id']) ? $params['route_id'] : null, |
|
136 | 136 | 'route_destination_id' => isset($params['route_destination_id']) ? $params['route_destination_id'] : null, |
137 | 137 | ), |
138 | 138 | 'body' => $body |
@@ -147,10 +147,10 @@ discard block |
||
147 | 147 | 'url' => self::$apiUrDeparted, |
148 | 148 | 'method' => 'GET', |
149 | 149 | 'query' => array( |
150 | - 'route_id' => isset($params['route_id']) ? $params['route_id']: null, |
|
151 | - 'address_id' => isset($params['address_id']) ? $params['address_id']: null, |
|
152 | - 'is_departed' => isset($params['is_departed']) ? $params['is_departed']: null, |
|
153 | - 'member_id' => isset($params['member_id']) ? $params['member_id']: null, |
|
150 | + 'route_id' => isset($params['route_id']) ? $params['route_id'] : null, |
|
151 | + 'address_id' => isset($params['address_id']) ? $params['address_id'] : null, |
|
152 | + 'is_departed' => isset($params['is_departed']) ? $params['is_departed'] : null, |
|
153 | + 'member_id' => isset($params['member_id']) ? $params['member_id'] : null, |
|
154 | 154 | ), |
155 | 155 | )); |
156 | 156 | |
@@ -163,10 +163,10 @@ discard block |
||
163 | 163 | 'url' => self::$apiUrVisited, |
164 | 164 | 'method' => 'GET', |
165 | 165 | 'query' => array( |
166 | - 'route_id' => isset($params['route_id']) ? $params['route_id']: null, |
|
167 | - 'address_id' => isset($params['address_id']) ? $params['address_id']: null, |
|
168 | - 'is_visited' => isset($params['is_visited']) ? $params['is_visited']: null, |
|
169 | - 'member_id' => isset($params['member_id']) ? $params['member_id']: null, |
|
166 | + 'route_id' => isset($params['route_id']) ? $params['route_id'] : null, |
|
167 | + 'address_id' => isset($params['address_id']) ? $params['address_id'] : null, |
|
168 | + 'is_visited' => isset($params['is_visited']) ? $params['is_visited'] : null, |
|
169 | + 'member_id' => isset($params['member_id']) ? $params['member_id'] : null, |
|
170 | 170 | ), |
171 | 171 | )); |
172 | 172 |