Completed
Push — master ( 0df295...ff7fdb )
by
unknown
02:27
created
code/model/translations/CountryPrice_SiteTreeExtensions.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -56,7 +56,7 @@  discard block
 block discarded – undo
56 56
     public function loadTranslatedValues($countryID = 0, $variableOrMethod = '')
57 57
     {
58 58
         $translation = null;
59
-        if (! $countryID) {
59
+        if (!$countryID) {
60 60
             $countryObject = CountryPrice_EcommerceCountry::get_real_country();
61 61
             if ($countryObject) {
62 62
                 $countryID = $countryObject->ID;
@@ -75,9 +75,9 @@  discard block
 block discarded – undo
75 75
             $fieldsToReplace = $translation->FieldsToReplace();
76 76
             foreach ($fieldsToReplace as $replaceFields) {
77 77
                 $pageField = $replaceFields->PageField;
78
-                $pageFieldTranslated = $pageField . 'Translated';
78
+                $pageFieldTranslated = $pageField.'Translated';
79 79
                 $translationField = $replaceFields->TranslationField;
80
-                if (! $variableOrMethod || $variableOrMethod === $pageField) {
80
+                if (!$variableOrMethod || $variableOrMethod === $pageField) {
81 81
                     if ($translation->hasMethod($translationField)) {
82 82
                         $this->owner->$pageField = $translation->$translationField();
83 83
                         $this->owner->$pageFieldTranslated = $translation->$translationField();
Please login to merge, or discard this patch.
code/model/translations/CountryPrice_Translation.php 1 patch
Spacing   +20 added lines, -20 removed lines patch added patch discarded remove patch
@@ -82,11 +82,11 @@  discard block
 block discarded – undo
82 82
         $countryDropdownField = DropdownField::create(
83 83
             'EcommerceCountryID',
84 84
             $fields->dataFieldByName('EcommerceCountryID')->Title(),
85
-            array('' => '-- make sure to select a country --')+$countries
85
+            array('' => '-- make sure to select a country --') + $countries
86 86
         );
87 87
 
88 88
         $fields->removeFieldFromTab("Root.Main", 'ParentID');
89
-        if($this->WithoutTranslation) {
89
+        if ($this->WithoutTranslation) {
90 90
             return FieldList::create(
91 91
                 array(
92 92
                     $countryDropdownField,
@@ -106,16 +106,16 @@  discard block
 block discarded – undo
106 106
             );
107 107
         }
108 108
         $dbFields = $this->inheritedDatabaseFields();
109
-        foreach($dbFields as $dbField => $fieldType) {
109
+        foreach ($dbFields as $dbField => $fieldType) {
110 110
             $useField = 'UseOriginal'.$dbField;
111
-            if(!empty($this->$useField)) {
111
+            if (!empty($this->$useField)) {
112 112
                 $fields->replaceField(
113 113
                     $dbField,
114 114
                     $fields->dataFieldByName($dbField)->performReadonlyTransformation()
115 115
                 );
116 116
             }
117
-            if($fields->dataFieldByName($useField)){
118
-                $fields->dataFieldByName($useField)->setDescription(_t('CountryPrice_Translation.IGNORE', 'Use original value for ') . $dbField);
117
+            if ($fields->dataFieldByName($useField)) {
118
+                $fields->dataFieldByName($useField)->setDescription(_t('CountryPrice_Translation.IGNORE', 'Use original value for ').$dbField);
119 119
             }
120 120
         }
121 121
         return $fields;
@@ -181,9 +181,9 @@  discard block
 block discarded – undo
181 181
             )
182 182
         );
183 183
         $this->extend('updateFieldsToReplace', $al);
184
-        foreach($al as $fieldToReplace) {
185
-            $ignoreField = 'UseOriginal' . $fieldToReplace->PageField;
186
-            if(!empty($this->owner->$ignoreField)) {
184
+        foreach ($al as $fieldToReplace) {
185
+            $ignoreField = 'UseOriginal'.$fieldToReplace->PageField;
186
+            if (!empty($this->owner->$ignoreField)) {
187 187
                 $al->remove($fieldToReplace);
188 188
             }
189 189
         }
@@ -213,20 +213,20 @@  discard block
 block discarded – undo
213 213
     public function requireDefaultRecords()
214 214
     {
215 215
         parent::requireDefaultRecords();
216
-        if(Config::inst()->get('CountryPrice_Translation', 'automatically_create_dummy_translations_for_products_and_productgroups')) {
216
+        if (Config::inst()->get('CountryPrice_Translation', 'automatically_create_dummy_translations_for_products_and_productgroups')) {
217 217
             $prices = CountryPrice::get();
218 218
             $ecommerceCountries = array();
219
-            foreach($prices as $price) {
220
-                if($countryObject = $price->CountryObject()) {
221
-                    if($buyable = $price->Buyable()) {
222
-                        if($buyable instanceof Product) {
223
-                            if($buyable->ID && $countryObject->ID) {
219
+            foreach ($prices as $price) {
220
+                if ($countryObject = $price->CountryObject()) {
221
+                    if ($buyable = $price->Buyable()) {
222
+                        if ($buyable instanceof Product) {
223
+                            if ($buyable->ID && $countryObject->ID) {
224 224
                                 $filter = array(
225 225
                                     'EcommerceCountryID' => $countryObject->ID,
226 226
                                     'ParentID' => $buyable->ID
227 227
                                 );
228 228
                                 $ecommerceCountries[$countryObject->ID] = $countryObject;
229
-                                if(! CountryPrice_Translation::get()->filter($filter)->first()) {
229
+                                if (!CountryPrice_Translation::get()->filter($filter)->first()) {
230 230
                                     DB::alteration_message(
231 231
                                         'Creating fake translation for '.$buyable->Title.' for country '.$countryObject->Code,
232 232
                                         'created'
@@ -240,14 +240,14 @@  discard block
 block discarded – undo
240 240
                     }
241 241
                 }
242 242
             }
243
-            if(count($ecommerceCountries)) {
244
-                foreach(ProductGroup::get() as $productGroup) {
245
-                    foreach($ecommerceCountries as $countryID => $countryObject) {
243
+            if (count($ecommerceCountries)) {
244
+                foreach (ProductGroup::get() as $productGroup) {
245
+                    foreach ($ecommerceCountries as $countryID => $countryObject) {
246 246
                         $filter = array(
247 247
                             'EcommerceCountryID' => $countryObject->ID,
248 248
                             'ParentID' => $productGroup->ID
249 249
                         );
250
-                        if(! CountryPrice_Translation::get()->filter($filter)->first()) {
250
+                        if (!CountryPrice_Translation::get()->filter($filter)->first()) {
251 251
                             DB::alteration_message(
252 252
                                 'Creating fake translation for '.$productGroup->Title.' for country '.$countryObject->Code,
253 253
                                 'created'
Please login to merge, or discard this patch.