Completed
Push — master ( fb0bef...1ce86f )
by Nicolaas
02:37
created
code/model/address/CountryPrice_EcommerceCountry.php 2 patches
Indentation   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -163,9 +163,9 @@
 block discarded – undo
163 163
     }
164 164
 
165 165
     /**
166
-    * checks if the country has a distributor
167
-    * and returns the primary country for the distributor.
168
-    * If not, returns the defaulf country.
166
+     * checks if the country has a distributor
167
+     * and returns the primary country for the distributor.
168
+     * If not, returns the defaulf country.
169 169
      *
170 170
      * @return EcommerceCountry
171 171
      *
Please login to merge, or discard this patch.
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -88,7 +88,7 @@  discard block
 block discarded – undo
88 88
                     'Root.FAQPage',
89 89
                     new LiteralField(
90 90
                         "FAQPageExplanation",
91
-                        "<p class=\"message warning\">FAQ information can only be added to the main country for a ". _t('Distributor.SINGULAR_NAME', 'Distributor') ."</p>"
91
+                        "<p class=\"message warning\">FAQ information can only be added to the main country for a "._t('Distributor.SINGULAR_NAME', 'Distributor')."</p>"
92 92
                     )
93 93
                 );
94 94
             }
@@ -196,7 +196,7 @@  discard block
 block discarded – undo
196 196
      */
197 197
     public static function get_real_country($country = null)
198 198
     {
199
-        if ($country && (! is_object($country))) {
199
+        if ($country && (!is_object($country))) {
200 200
             if (isset(self::$_get_real_country_cache[$country])) {
201 201
                 return self::$_get_real_country_cache[$country];
202 202
             } else {
@@ -204,10 +204,10 @@  discard block
 block discarded – undo
204 204
             }
205 205
         }
206 206
         $order = ShoppingCart::current_order();
207
-        if (! $country) {
207
+        if (!$country) {
208 208
             $country = $order->getCountry();
209 209
         }
210
-        if (! $country) {
210
+        if (!$country) {
211 211
             $country = EcommerceCountry::get_country();
212 212
         }
213 213
         if ($country instanceof EcommerceCountry) {
@@ -229,7 +229,7 @@  discard block
 block discarded – undo
229 229
                 }
230 230
             }
231 231
         }
232
-        if (! $country instanceof EcommerceCountry) {
232
+        if (!$country instanceof EcommerceCountry) {
233 233
             user_error('No country could be found');
234 234
         }
235 235
         if (!empty($originalCode)) {
@@ -244,9 +244,9 @@  discard block
 block discarded – undo
244 244
     public static function get_backup_country()
245 245
     {
246 246
         $obj = EcommerceCountry::get()->filter(array("IsBackupCountry" => true))->first();
247
-        if (! $obj) {
247
+        if (!$obj) {
248 248
             $obj = EcommerceCountry::get()->filter(array("Code" => EcommerceConfig::get('EcommerceCountry', 'default_country_code')))->first();
249
-            if (! $obj) {
249
+            if (!$obj) {
250 250
                 $obj = EcommerceCountry::get()->first();
251 251
             }
252 252
         }
@@ -296,7 +296,7 @@  discard block
 block discarded – undo
296 296
      */
297 297
     public function ComputedLanguageAndCountryCode()
298 298
     {
299
-        if($this->owner->LanguageAndCountryCode) {
299
+        if ($this->owner->LanguageAndCountryCode) {
300 300
             return $this->owner->LanguageAndCountryCode;
301 301
         }
302 302
         return strtolower('en-'.$this->owner->Code);
Please login to merge, or discard this patch.
code/control/cms/CountryPrice_DistributorManagementTool.php 1 patch
Spacing   +29 added lines, -29 removed lines patch added patch discarded remove patch
@@ -69,7 +69,7 @@  discard block
 block discarded – undo
69 69
                         return $this->redirect(CountryPrices_ChangeCountryController::new_country_link($distributorPrimaryCountryCode));
70 70
                     }
71 71
                 } else {
72
-                    die("ERROR: No primary country has been set for this ".  _t('Distributor.SINGULAR_NAME', 'Distributor') .".");
72
+                    die("ERROR: No primary country has been set for this "._t('Distributor.SINGULAR_NAME', 'Distributor').".");
73 73
                 }
74 74
             }
75 75
             if ($countries && $countries->count()) {
@@ -77,7 +77,7 @@  discard block
 block discarded – undo
77 77
             }
78 78
         }
79 79
         if (!$canViewAndEdit) {
80
-            Security::permissionFailure($this, 'Please log in first or log in as a '. _t('Distributor.SINGULAR_NAME', 'Distributor'). '.');
80
+            Security::permissionFailure($this, 'Please log in first or log in as a '._t('Distributor.SINGULAR_NAME', 'Distributor').'.');
81 81
         }
82 82
     }
83 83
 
@@ -106,7 +106,7 @@  discard block
 block discarded – undo
106 106
         $fields['Price'] = 'Price';
107 107
 
108 108
         foreach ($fields as $field) {
109
-            if (! isset($_REQUEST[$field])) {
109
+            if (!isset($_REQUEST[$field])) {
110 110
                 return "$field value missing";
111 111
             }
112 112
         }
@@ -121,13 +121,13 @@  discard block
 block discarded – undo
121 121
                 $valid = true;
122 122
             }
123 123
         }
124
-        if (! $valid) {
124
+        if (!$valid) {
125 125
             return 'ObjectClass value incorrect';
126 126
         }
127 127
 
128 128
         $objectID = intval($_REQUEST['ObjectID']);
129 129
         $object = $objectClass::get()->byID($objectID);
130
-        if (! $object) {
130
+        if (!$object) {
131 131
             return 'ObjectID value incorrect';
132 132
         }
133 133
 
@@ -143,12 +143,12 @@  discard block
 block discarded – undo
143 143
             $valid = true;
144 144
             if ($this->distributor) {
145 145
                 $countries = $this->distributor->Countries()->map('Code', 'Code')->toArray();
146
-                if (! in_array($countryCode, $countries)) {
146
+                if (!in_array($countryCode, $countries)) {
147 147
                     $valid = false;
148 148
                 }
149 149
             }
150 150
         }
151
-        if (! $valid) {
151
+        if (!$valid) {
152 152
             return 'Country value incorrect';
153 153
         }
154 154
 
@@ -158,7 +158,7 @@  discard block
 block discarded – undo
158 158
         }
159 159
 
160 160
         $price = $_REQUEST['Price'];
161
-        if (! is_numeric($price)) {
161
+        if (!is_numeric($price)) {
162 162
             return 'Price value incorrect';
163 163
         }
164 164
 
@@ -179,13 +179,13 @@  discard block
 block discarded – undo
179 179
      */
180 180
     public function setobjectfield()
181 181
     {
182
-        if (isset($_REQUEST["F"]) && $_REQUEST["F"]== "TESTONLY") {
182
+        if (isset($_REQUEST["F"]) && $_REQUEST["F"] == "TESTONLY") {
183 183
             return "THIS IS FOR TESTING ONLY";
184 184
         }
185 185
         // 1) Check that all parameters have been specified
186 186
 
187 187
         foreach (array('T', 'I', 'F', 'V') as $field) {
188
-            if (! isset($_REQUEST[$field])) {
188
+            if (!isset($_REQUEST[$field])) {
189 189
                 return "$field value missing";
190 190
             }
191 191
         }
@@ -195,7 +195,7 @@  discard block
 block discarded – undo
195 195
         $result = 1; // Updated
196 196
 
197 197
         $objectClass = $_REQUEST['T'];
198
-        if (! class_exists($objectClass)) {
198
+        if (!class_exists($objectClass)) {
199 199
             return 'ObjectClass value incorrect';
200 200
         }
201 201
 
@@ -207,7 +207,7 @@  discard block
 block discarded – undo
207 207
         } elseif (intval($objectID)) {
208 208
             $objectID = intval($objectID);
209 209
             $object = $objectClass::get()->byID($objectID);
210
-            if (! $object) {
210
+            if (!$object) {
211 211
                 return 'ObjectID (ID: $objectID, Class Name: $objectClass) value incorrect';
212 212
             }
213 213
         } else {
@@ -221,7 +221,7 @@  discard block
 block discarded – undo
221 221
         $fieldName = Convert::raw2sql($_REQUEST['F']);
222 222
         $value = $_REQUEST['V'];
223 223
 
224
-        if ($fieldName == 'Price' && (! is_numeric($value) || $value < 0)) {
224
+        if ($fieldName == 'Price' && (!is_numeric($value) || $value < 0)) {
225 225
             return 'Price value incorrect';
226 226
         }
227 227
         if ($value == '0') {
@@ -333,7 +333,7 @@  discard block
 block discarded – undo
333 333
                 }
334 334
                 if (Permission::check("ADMIN")) {
335 335
                     $html .= $this->createEditNode(
336
-                        "Default " . _t('Distributor.SINGULAR_NAME', 'Distributor'),
336
+                        "Default "._t('Distributor.SINGULAR_NAME', 'Distributor'),
337 337
                         $distributor->IsDefault ? "YES" : "NO"
338 338
                     );
339 339
                 }
@@ -342,7 +342,7 @@  discard block
 block discarded – undo
342 342
                 $countryList = array();
343 343
                 $countries = $distributor->Countries();
344 344
                 foreach ($countries as $country) {
345
-                    $countryList[] = $country->Name . ($country->DoNotAllowSales ? ' (Sales not allowed)' : '');
345
+                    $countryList[] = $country->Name.($country->DoNotAllowSales ? ' (Sales not allowed)' : '');
346 346
                 }
347 347
                 $html .= $this->createEditNode(
348 348
                     'Countries',
@@ -424,14 +424,14 @@  discard block
 block discarded – undo
424 424
                 $data = array('T' => 'EcommerceCountry', 'I' => $country->ID);
425 425
                 $distributorName = $country->Distributor()->Name;
426 426
                 if (!$distributorName) {
427
-                    $distributorName = "<p class=\"message bad\">No ". _t('Distributor.SINGULAR_NAME', 'Distributor') ." has been assigned to this country.</p>";
427
+                    $distributorName = "<p class=\"message bad\">No "._t('Distributor.SINGULAR_NAME', 'Distributor')." has been assigned to this country.</p>";
428 428
                 }
429 429
                 $html .= $this->createTreeNode($country->Code." - ".$country->Name, $country->Code, array($country));
430 430
                 $distributorTitlePlural = _t('Distributor.PLURAL_NAME', 'Distributor');
431 431
                 $distributorTitleSingluar = _t('Distributor.SINGULAR_NAME', 'Distributor');
432 432
                 $html .= $this->createEditNode($distributorTitleSingluar, $distributorName);
433 433
                 $html .= $this->createEditNode("FAQ Content", "", $country->FAQContent, $data + array("F" => "FAQContent"), "textarea");
434
-                $html .= $this->createEditNode("Top Bar Message", "",  $country->TopBarMessage, $data + array("F" => "TopBarMessage"), "");
434
+                $html .= $this->createEditNode("Top Bar Message", "", $country->TopBarMessage, $data + array("F" => "TopBarMessage"), "");
435 435
                 $html .= $this->createEditNode("Country Specific Messages", $countrySpecificMessages);
436 436
                 $html .= $this->createEditNode("Delivery Options", $deliveryOptions);
437 437
                 $html .= $this->createEditNode("Taxes", $taxes);
@@ -441,15 +441,15 @@  discard block
 block discarded – undo
441 441
                 $html .= $this->closeTreeNode();
442 442
             }
443 443
         }
444
-        $countries =  EcommerceCountry::get()->filter(array("DistributorID" => 0, "DoNotAllowSales" => 0));
444
+        $countries = EcommerceCountry::get()->filter(array("DistributorID" => 0, "DoNotAllowSales" => 0));
445 445
         if ($countries && $countries->count()) {
446 446
             $list = implode(", ", $countries->map("ID", "Code")->toArray());
447
-            $html .= $this->createEditNode("Countries without a ". _t('Distributor.SINGULAR_NAME', 'Distributor') ." that allow sales", $list);
447
+            $html .= $this->createEditNode("Countries without a "._t('Distributor.SINGULAR_NAME', 'Distributor')." that allow sales", $list);
448 448
         }
449
-        $countries =  EcommerceCountry::get()->filter(array("DistributorID" => 0, "DoNotAllowSales" => 1));
449
+        $countries = EcommerceCountry::get()->filter(array("DistributorID" => 0, "DoNotAllowSales" => 1));
450 450
         if ($countries && $countries->count()) {
451 451
             $list = implode(", ", $countries->map("ID", "Code")->toArray());
452
-            $html .= $this->createEditNode("Countries without a ". _t('Distributor.SINGULAR_NAME', 'Distributor') ." that do not allow sales", $list);
452
+            $html .= $this->createEditNode("Countries without a "._t('Distributor.SINGULAR_NAME', 'Distributor')." that do not allow sales", $list);
453 453
         }
454 454
         return $html;
455 455
     }
@@ -470,7 +470,7 @@  discard block
 block discarded – undo
470 470
         $defaultPriceText = ' (N.B. This is default for new variations ONLY - set actual prices under variations)';
471 471
         if ($products && $products->count()) {
472 472
             foreach ($products as $product) {
473
-                $withDefaultPrices = Permission::check('ADMIN') || (! $product->hasVariations());
473
+                $withDefaultPrices = Permission::check('ADMIN') || (!$product->hasVariations());
474 474
                 $html .= $this->createTreeNode($product->FullName, "pricing", array($product));
475 475
 
476 476
                 //country exceptions
@@ -492,7 +492,7 @@  discard block
 block discarded – undo
492 492
                     //only show default price for ShopAdmin
493 493
                     if ($withDefaultPrices) {
494 494
                         $html .= $this->createEditNode(
495
-                            'Default Price' . ($product->hasVariations() ? $defaultPriceText : ''),
495
+                            'Default Price'.($product->hasVariations() ? $defaultPriceText : ''),
496 496
                             EcommercePayment::site_currency(),
497 497
                             $product->Price,
498 498
                             array(
@@ -508,7 +508,7 @@  discard block
 block discarded – undo
508 508
                 $outstandingCountries = $this->countryArray;
509 509
                 if ($withDefaultPrices) {
510 510
                     $html .= $this->createTreeNode(
511
-                        'Country Prices' . ($product->hasVariations() ? $defaultPriceText : ''),
511
+                        'Country Prices'.($product->hasVariations() ? $defaultPriceText : ''),
512 512
                         " pricing countryPrices"
513 513
                     );
514 514
                 }
@@ -532,7 +532,7 @@  discard block
 block discarded – undo
532 532
                             $countryName = EcommerceCountry::find_title($countryPricesObject->Country);
533 533
                             if ($withDefaultPrices) {
534 534
                                 $html .= $this->createEditNode(
535
-                                    $countryPricesObject->Country . ' - '. $countryName,
535
+                                    $countryPricesObject->Country.' - '.$countryName,
536 536
                                     $countryPricesObject->Currency,
537 537
                                     $countryPricesObject->Price,
538 538
                                     $data,
@@ -566,7 +566,7 @@  discard block
 block discarded – undo
566 566
                         $countryName = EcommerceCountry::find_title($countryCode);
567 567
                         if ($withDefaultPrices) {
568 568
                             $html .= $this->createEditNode(
569
-                                $countryCode . ' - '. $countryName,
569
+                                $countryCode.' - '.$countryName,
570 570
                                 $currencyObject->Code,
571 571
                                 $addText,
572 572
                                 $data,
@@ -619,8 +619,8 @@  discard block
 block discarded – undo
619 619
                                                 "F" => "Price"
620 620
                                             );
621 621
                                             $countryName = EcommerceCountry::find_title($countryPricesObject->Country);
622
-                                            $html .=  $this->createEditNode(
623
-                                                $countryPricesObject->Country . ' - '. $countryName,
622
+                                            $html .= $this->createEditNode(
623
+                                                $countryPricesObject->Country.' - '.$countryName,
624 624
                                                 $countryPricesObject->Currency,
625 625
                                                 $countryPricesObject->Price,
626 626
                                                 $data,
@@ -666,7 +666,7 @@  discard block
 block discarded – undo
666 666
                                         );
667 667
                                         $countryName = EcommerceCountry::find_title($countryCode);
668 668
                                         $html .= $this->createEditNode(
669
-                                            $countryCode . ' - '. $countryName,
669
+                                            $countryCode.' - '.$countryName,
670 670
                                             $currency->Code,
671 671
                                             $addText,
672 672
                                             $data,
Please login to merge, or discard this patch.
code/model/translations/CountryPrice_SiteTreeExtions.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -34,7 +34,7 @@  discard block
 block discarded – undo
34 34
     public function loadTranslatedValues($countryID = 0, $variableOrMethod = '')
35 35
     {
36 36
         $translation = null;
37
-        if (! $countryID) {
37
+        if (!$countryID) {
38 38
             $countryObject = CountryPrice_EcommerceCountry::get_real_country();
39 39
             if ($countryObject) {
40 40
                 $countryID = $countryObject->ID;
@@ -42,7 +42,7 @@  discard block
 block discarded – undo
42 42
         }
43 43
         if ($countryID) {
44 44
             $key = $this->owner->ID.'_'.$countryID;
45
-            if (! isset(self::$_translations[$key])) {
45
+            if (!isset(self::$_translations[$key])) {
46 46
                 $translation = $this->owner
47 47
                     ->CountryPriceTranslations()
48 48
                     ->filter(
@@ -62,7 +62,7 @@  discard block
 block discarded – undo
62 62
             foreach ($fieldsToReplace as $replaceFields) {
63 63
                 $pageField = $replaceFields->PageField;
64 64
                 $translationField = $replaceFields->TranslationField;
65
-                if (! $variableOrMethod || $variableOrMethod === $pageField) {
65
+                if (!$variableOrMethod || $variableOrMethod === $pageField) {
66 66
                     if ($translation->hasMethod($translationField)) {
67 67
                         $pageFieldTranslated = $pageField.'Translated';
68 68
                         $this->owner->$pageField = $translation->$translationField();
Please login to merge, or discard this patch.
code/control/CountryPrice_Page_Controller_Extension.php 2 patches
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -39,7 +39,7 @@  discard block
 block discarded – undo
39 39
         if ($countryObject) {
40 40
             $countryID = $countryObject->ID;
41 41
             $newURL = $this->addCountryCodeToUrlIfRequired($countryObject->Code);
42
-            if($newURL) {
42
+            if ($newURL) {
43 43
                 $this->owner->redirect($newURL);
44 44
             }
45 45
         }
@@ -95,7 +95,7 @@  discard block
 block discarded – undo
95 95
         parse_str($urlParts['query'], $params);
96 96
 
97 97
         $param = Config::inst()->get('CountryPrice_Translation', 'locale_get_parameter');
98
-        $params[$param] = $countryCode;     // Overwrite if exists
98
+        $params[$param] = $countryCode; // Overwrite if exists
99 99
 
100 100
         // Note that this will url_encode all values
101 101
         $urlParts['query'] = http_build_query($params);
@@ -104,7 +104,7 @@  discard block
 block discarded – undo
104 104
         if (function_exists('http_build_url')) {
105 105
             $newURL = http_build_url($urlParts);
106 106
         } else {
107
-            $newURL =  $urlParts['scheme'] . '://' . $urlParts['host'] . $urlParts['path'] . '?' . $urlParts['query'];
107
+            $newURL = $urlParts['scheme'].'://'.$urlParts['host'].$urlParts['path'].'?'.$urlParts['query'];
108 108
         }
109 109
 
110 110
         if ($oldURL !== $newURL && self::$_redirection_count < 3) {
Please login to merge, or discard this patch.
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -152,7 +152,7 @@
 block discarded – undo
152 152
 
153 153
     /**
154 154
      * 
155
-     * @return DataList
155
+     * @return string
156 156
      */
157 157
     function AlternativeHrefLangLinksCachingKey()
158 158
     {
Please login to merge, or discard this patch.
code/model/translations/CountryPrice_Translation.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -68,7 +68,7 @@  discard block
 block discarded – undo
68 68
             DropdownField::create(
69 69
                 'EcommerceCountryID',
70 70
                 $fields->dataFieldByName('EcommerceCountryID')->Title(),
71
-                array('' => '-- make sure to select a country --')+$countries
71
+                array('' => '-- make sure to select a country --') + $countries
72 72
             ),
73 73
             'Title'
74 74
         );
@@ -151,7 +151,7 @@  discard block
 block discarded – undo
151 151
     function Link()
152 152
     {
153 153
         $link = $this->Parent()->Link();
154
-        if($this->EcommerceCountryID) {
154
+        if ($this->EcommerceCountryID) {
155 155
             $link .= '?'.$this->Config()->get('locale_get_parameter').'='.$this->EcommerceCountry()->Code;
156 156
         }
157 157
         return $link;
Please login to merge, or discard this patch.