@@ -13,35 +13,35 @@ |
||
13 | 13 | */ |
14 | 14 | class EmailAddressTask extends BuildTask |
15 | 15 | { |
16 | - /** |
|
17 | - * @var string |
|
18 | - */ |
|
19 | - protected $title = 'Email Address Task'; // title of the script |
|
20 | - |
|
21 | - /** |
|
22 | - * @var string |
|
23 | - */ |
|
24 | - protected $description = "Convert depreciated 'Email Address' field to new 'Email' field."; |
|
25 | - |
|
26 | - /** |
|
27 | - * @param HTTPRequest $request |
|
28 | - */ |
|
29 | - public function run($request) |
|
30 | - { |
|
31 | - Config::modify()->set('DataObject', 'validation_enabled', false); |
|
32 | - |
|
33 | - $ct = 0; |
|
34 | - $updateEmail = function ($location) use (&$ct) { |
|
35 | - if (!$location->Email && $location->EmailAddress) { |
|
36 | - $location->Email = $location->EmailAddress; |
|
37 | - $location->write(); |
|
38 | - ++$ct; |
|
39 | - } |
|
40 | - }; |
|
41 | - |
|
42 | - Location::get()->each($updateEmail); |
|
43 | - Config::modify()->set('DataObject', 'validation_enabled', true); |
|
44 | - |
|
45 | - echo '<p>' . $ct . ' Locations updated</p>'; |
|
46 | - } |
|
16 | + /** |
|
17 | + * @var string |
|
18 | + */ |
|
19 | + protected $title = 'Email Address Task'; // title of the script |
|
20 | + |
|
21 | + /** |
|
22 | + * @var string |
|
23 | + */ |
|
24 | + protected $description = "Convert depreciated 'Email Address' field to new 'Email' field."; |
|
25 | + |
|
26 | + /** |
|
27 | + * @param HTTPRequest $request |
|
28 | + */ |
|
29 | + public function run($request) |
|
30 | + { |
|
31 | + Config::modify()->set('DataObject', 'validation_enabled', false); |
|
32 | + |
|
33 | + $ct = 0; |
|
34 | + $updateEmail = function ($location) use (&$ct) { |
|
35 | + if (!$location->Email && $location->EmailAddress) { |
|
36 | + $location->Email = $location->EmailAddress; |
|
37 | + $location->write(); |
|
38 | + ++$ct; |
|
39 | + } |
|
40 | + }; |
|
41 | + |
|
42 | + Location::get()->each($updateEmail); |
|
43 | + Config::modify()->set('DataObject', 'validation_enabled', true); |
|
44 | + |
|
45 | + echo '<p>' . $ct . ' Locations updated</p>'; |
|
46 | + } |
|
47 | 47 | } |
@@ -31,7 +31,7 @@ discard block |
||
31 | 31 | Config::modify()->set('DataObject', 'validation_enabled', false); |
32 | 32 | |
33 | 33 | $ct = 0; |
34 | - $updateEmail = function ($location) use (&$ct) { |
|
34 | + $updateEmail = function($location) use (&$ct) { |
|
35 | 35 | if (!$location->Email && $location->EmailAddress) { |
36 | 36 | $location->Email = $location->EmailAddress; |
37 | 37 | $location->write(); |
@@ -42,6 +42,6 @@ discard block |
||
42 | 42 | Location::get()->each($updateEmail); |
43 | 43 | Config::modify()->set('DataObject', 'validation_enabled', true); |
44 | 44 | |
45 | - echo '<p>' . $ct . ' Locations updated</p>'; |
|
45 | + echo '<p>'.$ct.' Locations updated</p>'; |
|
46 | 46 | } |
47 | 47 | } |