@@ -69,7 +69,7 @@ discard block |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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,7 +424,7 @@ discard block |
||
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'); |
@@ -441,15 +441,15 @@ discard block |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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, |
@@ -44,10 +44,10 @@ discard block |
||
44 | 44 | $currencyCode = isset($currencyPerCountry[$countryCode]) ? $currencyPerCountry[$countryCode] : EcommerceCurrency::default_currency_code(); |
45 | 45 | $currencyDO = EcommerceCurrency::get_one_from_code($currencyCode); |
46 | 46 | } |
47 | - if (! $currencyDO) { |
|
47 | + if (!$currencyDO) { |
|
48 | 48 | $currencyDO = EcommerceCurrency::create_new($currencyCode); |
49 | 49 | } |
50 | - if (! $currencyDO) { |
|
50 | + if (!$currencyDO) { |
|
51 | 51 | $currencyDO = EcommerceCurrency::get_default(); |
52 | 52 | } |
53 | 53 | return $currencyDO; |
@@ -67,7 +67,7 @@ discard block |
||
67 | 67 | { |
68 | 68 | $cachekey = "EcommerceCurrencyCountryMatrix"; |
69 | 69 | $cache = SS_Cache::factory('CountryPrice_EcommerceCurrency'); |
70 | - if (! ($serializedArray = $cache->load($cachekey))) { |
|
70 | + if (!($serializedArray = $cache->load($cachekey))) { |
|
71 | 71 | $countries = CountryPrice_EcommerceCountry::get_real_countries_list(); |
72 | 72 | $unserializedArray = array(); |
73 | 73 | $defaultCurrencyCode = EcommerceCurrency::default_currency_code(); |
@@ -130,7 +130,7 @@ discard block |
||
130 | 130 | return null; |
131 | 131 | } |
132 | 132 | $key = $this->owner->ClassName.'____'.$countryCode; |
133 | - if (! isset(self::$_money_object_currency[$key])) { |
|
133 | + if (!isset(self::$_money_object_currency[$key])) { |
|
134 | 134 | if (is_null($currencyCode)) { |
135 | 135 | $currency = CountryPrice_EcommerceCurrency::get_currency_for_country($countryCode); |
136 | 136 | if ($currency) { |
@@ -88,7 +88,7 @@ discard block |
||
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 | } |
@@ -210,7 +210,7 @@ discard block |
||
210 | 210 | $originalCountry = $country; |
211 | 211 | |
212 | 212 | //no country provided |
213 | - if (! $country) { |
|
213 | + if (!$country) { |
|
214 | 214 | $urlCountryCode = CountryPrice_Translation::get_country_url_provider()->CurrentCountrySegment(); |
215 | 215 | |
216 | 216 | // 2. CHECK WHAT THE SYSTEM THINKS THE COUNTRY CHOULD BE |
@@ -225,7 +225,7 @@ discard block |
||
225 | 225 | } |
226 | 226 | |
227 | 227 | //if we still dont have a country then we use the standard e-commerce methods ... |
228 | - if (! $countryCode) { |
|
228 | + if (!$countryCode) { |
|
229 | 229 | $countryCode = EcommerceCountry::get_country(); |
230 | 230 | } |
231 | 231 | |
@@ -244,7 +244,7 @@ discard block |
||
244 | 244 | if ( |
245 | 245 | ($country && $country->Code !== $urlCountryCode) |
246 | 246 | || |
247 | - ! $country |
|
247 | + !$country |
|
248 | 248 | |
249 | 249 | ) { |
250 | 250 | $country = DataObject::get_one('EcommerceCountry', ['Code' => $urlCountryCode]); |
@@ -314,9 +314,9 @@ discard block |
||
314 | 314 | public static function get_backup_country() |
315 | 315 | { |
316 | 316 | $obj = EcommerceCountry::get()->filter(array("IsBackupCountry" => true))->first(); |
317 | - if (! $obj) { |
|
317 | + if (!$obj) { |
|
318 | 318 | $obj = EcommerceCountry::get()->filter(array("Code" => EcommerceConfig::get('EcommerceCountry', 'default_country_code')))->first(); |
319 | - if (! $obj) { |
|
319 | + if (!$obj) { |
|
320 | 320 | $obj = EcommerceCountry::get()->first(); |
321 | 321 | } |
322 | 322 | } |
@@ -303,6 +303,10 @@ |
||
303 | 303 | return self::$_get_real_country_cache[$cacheKey]; |
304 | 304 | } |
305 | 305 | |
306 | + /** |
|
307 | + * @param string $countryOrCountryCodeA |
|
308 | + * @param string $countryOrCountryCodeB |
|
309 | + */ |
|
306 | 310 | public static function countries_belong_to_same_group($countryOrCountryCodeA, $countryOrCountryCodeB) |
307 | 311 | { |
308 | 312 | $countryA = EcommerceCountry::get_country_from_mixed_var($countryOrCountryCodeA); |
@@ -168,9 +168,9 @@ |
||
168 | 168 | } |
169 | 169 | |
170 | 170 | /** |
171 | - * checks if the country has a distributor |
|
172 | - * and returns the primary country for the distributor. |
|
173 | - * If not, returns the default country. |
|
171 | + * checks if the country has a distributor |
|
172 | + * and returns the primary country for the distributor. |
|
173 | + * If not, returns the default country. |
|
174 | 174 | * |
175 | 175 | * @return EcommerceCountry |
176 | 176 | * |
@@ -85,7 +85,7 @@ discard block |
||
85 | 85 | |
86 | 86 | //redirect now |
87 | 87 | if (isset($_GET['force']) && $_GET['force']) { |
88 | - return $this->redirect($this->Link($newCountryCode) . '?force-back-home'); |
|
88 | + return $this->redirect($this->Link($newCountryCode).'?force-back-home'); |
|
89 | 89 | } |
90 | 90 | if (isset($_GET['force-back-home']) && $_GET['force-back-home']) { |
91 | 91 | return $this->redirect(Director::baseURL('/')); |
@@ -106,7 +106,7 @@ discard block |
||
106 | 106 | $action |
107 | 107 | ); |
108 | 108 | |
109 | - return $link . '/'; |
|
109 | + return $link.'/'; |
|
110 | 110 | } |
111 | 111 | |
112 | 112 | /** |
@@ -160,10 +160,10 @@ discard block |
||
160 | 160 | |
161 | 161 | $path = isset($parsedUrl['path']) ? $parsedUrl['path'] : ''; |
162 | 162 | |
163 | - $query = empty($query) ? '' : '?'. http_build_query($query); |
|
163 | + $query = empty($query) ? '' : '?'.http_build_query($query); |
|
164 | 164 | $newURL = |
165 | - $parsedUrl['scheme'] . |
|
166 | - '://' . |
|
165 | + $parsedUrl['scheme']. |
|
166 | + '://'. |
|
167 | 167 | Controller::join_links( |
168 | 168 | $parsedUrl['host'], |
169 | 169 | $parsedUrl['path'] |
@@ -92,14 +92,14 @@ |
||
92 | 92 | } |
93 | 93 | $parsedUrl['path'] = implode('/', $pathParts); |
94 | 94 | $newURL = |
95 | - $parsedUrl['scheme'] . |
|
96 | - '://' . |
|
95 | + $parsedUrl['scheme']. |
|
96 | + '://'. |
|
97 | 97 | Controller::join_links( |
98 | 98 | $parsedUrl['host'], |
99 | 99 | $parsedUrl['path'] |
100 | 100 | ); |
101 | 101 | if (isset($parsedUrl['query'])) { |
102 | - $newURL = $newURL . '?' . $parsedUrl['query']; |
|
102 | + $newURL = $newURL.'?'.$parsedUrl['query']; |
|
103 | 103 | } |
104 | 104 | } |
105 | 105 | if (trim($oldURL, '/') !== trim($newURL, '/')) { |
@@ -100,7 +100,7 @@ discard block |
||
100 | 100 | $countryDropdownField = DropdownField::create( |
101 | 101 | 'EcommerceCountryID', |
102 | 102 | $fields->dataFieldByName('EcommerceCountryID')->Title(), |
103 | - array('' => '-- make sure to select a country --')+$countries |
|
103 | + array('' => '-- make sure to select a country --') + $countries |
|
104 | 104 | ); |
105 | 105 | |
106 | 106 | // //$fields->removeFieldFromTab("Root.Main", 'ParentID'); |
@@ -133,7 +133,7 @@ discard block |
||
133 | 133 | ); |
134 | 134 | } |
135 | 135 | if ($fields->dataFieldByName($useField)) { |
136 | - $fields->dataFieldByName($useField)->setDescription(_t('CountryPrice_Translation.IGNORE', 'Use untranslated value for ') . $dbField); |
|
136 | + $fields->dataFieldByName($useField)->setDescription(_t('CountryPrice_Translation.IGNORE', 'Use untranslated value for ').$dbField); |
|
137 | 137 | } |
138 | 138 | } |
139 | 139 | if ($this->exists() && $this->ParentID) { |
@@ -166,12 +166,12 @@ discard block |
||
166 | 166 | { |
167 | 167 | $validation = parent::validate(); |
168 | 168 | if ($validation->valid()) { |
169 | - if (! $this->EcommerceCountryID) { |
|
169 | + if (!$this->EcommerceCountryID) { |
|
170 | 170 | $validation->error( |
171 | 171 | 'You can not create a translation without seleting a country.' |
172 | 172 | ); |
173 | 173 | } |
174 | - if (! $this->ParentID) { |
|
174 | + if (!$this->ParentID) { |
|
175 | 175 | $validation->error( |
176 | 176 | 'You can not create a translation without attaching it to a page.' |
177 | 177 | ); |
@@ -221,7 +221,7 @@ discard block |
||
221 | 221 | ); |
222 | 222 | $this->extend('updateFieldsToReplace', $al); |
223 | 223 | foreach ($al as $fieldToReplace) { |
224 | - $ignoreField = 'UseOriginal' . $fieldToReplace->PageField; |
|
224 | + $ignoreField = 'UseOriginal'.$fieldToReplace->PageField; |
|
225 | 225 | if (!empty($this->owner->$ignoreField)) { |
226 | 226 | $al->remove($fieldToReplace); |
227 | 227 | } |
@@ -278,7 +278,7 @@ discard block |
||
278 | 278 | 'ParentID' => $buyable->ID |
279 | 279 | ); |
280 | 280 | $ecommerceCountries[$countryObject->ID] = $countryObject; |
281 | - if (! CountryPrice_Translation::get()->filter($filter)->first()) { |
|
281 | + if (!CountryPrice_Translation::get()->filter($filter)->first()) { |
|
282 | 282 | DB::alteration_message( |
283 | 283 | 'Creating fake translation for '.$buyable->Title.' for country '.$countryObject->Code, |
284 | 284 | 'created' |
@@ -299,7 +299,7 @@ discard block |
||
299 | 299 | 'EcommerceCountryID' => $countryObject->ID, |
300 | 300 | 'ParentID' => $productGroup->ID |
301 | 301 | ); |
302 | - if (! CountryPrice_Translation::get()->filter($filter)->first()) { |
|
302 | + if (!CountryPrice_Translation::get()->filter($filter)->first()) { |
|
303 | 303 | DB::alteration_message( |
304 | 304 | 'Creating fake translation for '.$productGroup->Title.' for country '.$countryObject->Code, |
305 | 305 | 'created' |