Completed
Push — master ( f9bc1b...2d287d )
by
unknown
03:49
created
code/control/cms/CountryPrice_TestController.php 2 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -347,7 +347,7 @@
 block discarded – undo
347 347
     /**
348 348
      * returns the Distributor for the user
349 349
      * Needs to be in model so we can access from the order in the template.
350
-     * @return Varchar Field
350
+     * @return Distributor Field
351 351
      */
352 352
     public function MyDistributor()
353 353
     {
Please login to merge, or discard this patch.
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -16,7 +16,7 @@  discard block
 block discarded – undo
16 16
     public function init()
17 17
     {
18 18
         parent::init();
19
-        if (! Permission::check('ADMIN')) {
19
+        if (!Permission::check('ADMIN')) {
20 20
             return Security::permissionFailure($this, 'This page is secured and you need administrator rights to access it. You can also save the page in the CMS to get 15 minutes access without being logged in.');
21 21
         }
22 22
     }
@@ -181,17 +181,17 @@  discard block
 block discarded – undo
181 181
             "MyCountryCode" => "This is the key function",
182 182
             "MyCountryTitle" => "",
183 183
             "MyCurrency" => "Based on the currency set in the order.",
184
-            "MyDistributor" => "You have to set the ". _t('Distributor.SINGULAR_NAME', 'Distributor') . "'s countries in order to work out someone's ". _t('Distributor.SINGULAR_NAME', 'Distributor') . ".",
184
+            "MyDistributor" => "You have to set the "._t('Distributor.SINGULAR_NAME', 'Distributor')."'s countries in order to work out someone's "._t('Distributor.SINGULAR_NAME', 'Distributor').".",
185 185
             "MyDistributorCountry" => "This is the country that is being used for the sale.  For dodgy countries, we use the backup country.",
186
-            "MyDeliveryCostNote" => "Set in country, ". _t('Distributor.SINGULAR_NAME', 'Distributor') . " and default country.",
187
-            "MyShippingDeliveryInfo" => "Set in country, ". _t('Distributor.SINGULAR_NAME', 'Distributor') . " and default country.",
188
-            "MyShippingReturnInfo" => "Set in country, ". _t('Distributor.SINGULAR_NAME', 'Distributor') . " and default country.",
189
-            "MyProductNotAvailableNote" => "Set in country, ". _t('Distributor.SINGULAR_NAME', 'Distributor') . ", default country, AND the Ecommerce Config.",
186
+            "MyDeliveryCostNote" => "Set in country, "._t('Distributor.SINGULAR_NAME', 'Distributor')." and default country.",
187
+            "MyShippingDeliveryInfo" => "Set in country, "._t('Distributor.SINGULAR_NAME', 'Distributor')." and default country.",
188
+            "MyShippingReturnInfo" => "Set in country, "._t('Distributor.SINGULAR_NAME', 'Distributor')." and default country.",
189
+            "MyProductNotAvailableNote" => "Set in country, "._t('Distributor.SINGULAR_NAME', 'Distributor').", default country, AND the Ecommerce Config.",
190 190
             "MyStockistSearchPage" => "",
191 191
             "MyStockistCountryPage" => "The stockist page that is related to the visitor's country",
192 192
             "MyCountryFAQPage" => "",
193 193
             "MyBackupCountryCode" => "This country is used if the information for the selected country is not available.",
194
-            "MyDefaultDistributor" => "You can set one default ". _t('Distributor.SINGULAR_NAME', 'Distributor') . " (head office) with a tickbox for any ". _t('Distributor.SINGULAR_NAME', 'Distributor') ,
194
+            "MyDefaultDistributor" => "You can set one default "._t('Distributor.SINGULAR_NAME', 'Distributor')." (head office) with a tickbox for any "._t('Distributor.SINGULAR_NAME', 'Distributor'),
195 195
 
196 196
         );
197 197
         $array = array(
@@ -211,7 +211,7 @@  discard block
 block discarded – undo
211 211
             "MyDefaultDistributor" => "Object",
212 212
         );
213 213
         echo "<h1>Current Settings</h1>";
214
-        echo "<p>Most of these settings can be adjusted in the country, ". _t('Distributor.SINGULAR_NAME', 'Distributor') . " and generic e-commerce settings.</p>";
214
+        echo "<p>Most of these settings can be adjusted in the country, "._t('Distributor.SINGULAR_NAME', 'Distributor')." and generic e-commerce settings.</p>";
215 215
         foreach ($array as $name => $type) {
216 216
             $style = "created";
217 217
             $notSet = false;
@@ -245,7 +245,7 @@  discard block
 block discarded – undo
245 245
                     }
246 246
                 }
247 247
             }
248
-            if (! $string) {
248
+            if (!$string) {
249 249
                 $string = "NOT SET";
250 250
                 $style = "deleted";
251 251
             }
Please login to merge, or discard this patch.
code/model/buyables/CountryPrice_CopyPrices.php 2 patches
Doc Comments   -1 removed lines patch added patch discarded remove patch
@@ -96,7 +96,6 @@
 block discarded – undo
96 96
      *  - ID
97 97
      * searches through children, until all all childpages have been added
98 98
      *
99
-     * @param  string $country [description]
100 99
      * @param  array  $values  [description]
101 100
      * @return array          [description]
102 101
      */
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -25,11 +25,11 @@
 block discarded – undo
25 25
             } else {
26 26
                 $fromCountriesArray = array();
27 27
             }
28
-            $allCountries =  EcommerceCountry::get();
28
+            $allCountries = EcommerceCountry::get();
29 29
             $toCountries = array();
30 30
             foreach ($allCountries as $country) {
31 31
                 $country = CountryPrice_EcommerceCountry::get_real_country($country);
32
-                $toCountries[$country->Code] = $country->Name . ($country->DoNotAllowSales ? ' (Sales not allowed)' : '');
32
+                $toCountries[$country->Code] = $country->Name.($country->DoNotAllowSales ? ' (Sales not allowed)' : '');
33 33
             }
34 34
             $countryCurrencies = CountryPrice_EcommerceCurrency::get_currency_per_country();
35 35
             $link = CountryPrice_CopyPrices_Controller::get_link($this->owner);
Please login to merge, or discard this patch.
code/model/CountryPrice.php 2 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -244,7 +244,7 @@
 block discarded – undo
244 244
 
245 245
     /**
246 246
      * Returns if the currency is an old currency not used anymore.
247
-     * @return Boolean
247
+     * @return boolean|null
248 248
      */
249 249
     public function isObsolete()
250 250
     {
Please login to merge, or discard this patch.
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -65,7 +65,7 @@  discard block
 block discarded – undo
65 65
      */
66 66
     public function Buyable()
67 67
     {
68
-        if (! $this->_myBuyable) {
68
+        if (!$this->_myBuyable) {
69 69
             $className = $this->ObjectClass;
70 70
             if (class_exists($this->ObjectClass)) {
71 71
                 $this->_myBuyable = $className::get()->byID($this->ObjectID);
@@ -87,9 +87,9 @@  discard block
 block discarded – undo
87 87
      */
88 88
     public function CountryObject()
89 89
     {
90
-        if (! $this->_myCountryObject) {
90
+        if (!$this->_myCountryObject) {
91 91
             if ($this->Country) {
92
-                $this->_myCountryObject =  EcommerceCountry::get()
92
+                $this->_myCountryObject = EcommerceCountry::get()
93 93
                     ->filter(array("Code" => $this->Country))
94 94
                     ->First();
95 95
             }
@@ -146,7 +146,7 @@  discard block
 block discarded – undo
146 146
      */
147 147
     public function getFullPrice()
148 148
     {
149
-        return "$this->Price $this->Currency" . ($this->isObsolete() ? ' (obsolete!)' : '');
149
+        return "$this->Price $this->Currency".($this->isObsolete() ? ' (obsolete!)' : '');
150 150
     }
151 151
 
152 152
     public function getCMSFields()
@@ -218,7 +218,7 @@  discard block
 block discarded – undo
218 218
     public function canEdit($member = null)
219 219
     {
220 220
         $canEdit = parent::canEdit();
221
-        if (! $canEdit) {
221
+        if (!$canEdit) {
222 222
             $member = Member::currentUser();
223 223
             $distributor = $member->Distributor();
224 224
             if ($distributor->exists()) {
@@ -236,16 +236,16 @@  discard block
 block discarded – undo
236 236
     protected function validate()
237 237
     {
238 238
         $result = parent::validate();
239
-        if (! $this->ObjectClass && isset($_REQUEST["MyObjectClass"])) {
239
+        if (!$this->ObjectClass && isset($_REQUEST["MyObjectClass"])) {
240 240
             if (class_exists($_REQUEST["MyObjectClass"])) {
241 241
                 $this->ObjectClass = Convert::raw2sql($_REQUEST["MyObjectClass"]);
242 242
             }
243 243
         }
244
-        if (! $this->ObjectID && isset($_REQUEST["MyObjectID"])) {
244
+        if (!$this->ObjectID && isset($_REQUEST["MyObjectID"])) {
245 245
             $this->ObjectID = intval($_REQUEST["MyObjectID"]);
246 246
         }
247 247
         //check for duplicates in case it has not been created yet...
248
-        if (! $this->ObjectClass || ! $this->ObjectID) {
248
+        if (!$this->ObjectClass || !$this->ObjectID) {
249 249
             $result->error('Object could not be created. Please contact your developer.');
250 250
             return $result;
251 251
         }
Please login to merge, or discard this patch.
code/forms/CountryPrice_OrderFormAddressExtension.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -12,7 +12,7 @@
 block discarded – undo
12 12
         if ($allowedCountries->count()) {
13 13
             $allowedCountryCodes = $allowedCountries->column('Code');
14 14
             foreach ($newSource as $key => $value) {
15
-                if (! in_array($key, $allowedCountryCodes)) {
15
+                if (!in_array($key, $allowedCountryCodes)) {
16 16
                     unset($newSource[$key]);
17 17
                 }
18 18
             }
Please login to merge, or discard this patch.
code/model/Distributor.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -111,7 +111,7 @@  discard block
 block discarded – undo
111 111
         //secondary for another country
112 112
         $fields->removeByName('Versions');
113 113
         if ($listOfCountriesCovered && $listOfCountriesCovered->count()) {
114
-            $countryArray =  array(" -- please select --") + $listOfCountriesCovered->toArray();
114
+            $countryArray = array(" -- please select --") + $listOfCountriesCovered->toArray();
115 115
             $fields->addFieldToTab("Root.CountryDetails", DropdownField::create("PrimaryCountryID", "Primary Country", $countryArray));
116 116
         } else {
117 117
             $fields->removeByName('PrimaryCountryID');
@@ -143,7 +143,7 @@  discard block
 block discarded – undo
143 143
                         'IsDefault' => 'Default',
144 144
                         'Email' => 'Email'
145 145
                     );
146
-                    $table = '<table class="versions"><thead><tr><th>' . implode('</th><th>', $columns) . '</th></tr></thead><tbody>';
146
+                    $table = '<table class="versions"><thead><tr><th>'.implode('</th><th>', $columns).'</th></tr></thead><tbody>';
147 147
                     $version = $this->Version - 1;
148 148
                     while ($version > 0) {
149 149
                         $versionDO = Versioned::get_version('Distributor', $this->ID, $version--);
@@ -151,7 +151,7 @@  discard block
 block discarded – undo
151 151
                         foreach ($columns as $column => $title) {
152 152
                             $values[] = $versionDO->$column;
153 153
                         }
154
-                        $table .= '<tr><td>' . implode('</td><td>', $values) . '</td></tr>';
154
+                        $table .= '<tr><td>'.implode('</td><td>', $values).'</td></tr>';
155 155
                     }
156 156
                     $table .= '</tbody></table>';
157 157
                     $table .= "<style type=\"text/css\">
@@ -234,7 +234,7 @@  discard block
 block discarded – undo
234 234
         }
235 235
         if ($this->PrimaryCountryID > 0 && EcommerceCountry::get()->byID(intval($this->PrimaryCountryID))) {
236 236
             $primaryCountry = $this->PrimaryCountry();
237
-            if (! $this->Countries()->byID($this->PrimaryCountryID)) {
237
+            if (!$this->Countries()->byID($this->PrimaryCountryID)) {
238 238
                 $this->Countries()->add($primaryCountry);
239 239
             }
240 240
         } else {
@@ -253,7 +253,7 @@  discard block
 block discarded – undo
253 253
     public function onAfterWrite()
254 254
     {
255 255
         parent::onAfterWrite();
256
-        if (! self::$_ran_after_write) {
256
+        if (!self::$_ran_after_write) {
257 257
             self::$_ran_after_write = true;
258 258
             $this->setupUser();
259 259
         }
@@ -371,7 +371,7 @@  discard block
 block discarded – undo
371 371
                 $member = Member::create($filter);
372 372
                 //$thisMember->SetPassword = substr(session_id, 0, 8);
373 373
             }
374
-            $member->FirstName = trim(_t('Distributor.SINGULAR_NAME', 'Distributor') . _t('Distributor.FOR', ' for '));
374
+            $member->FirstName = trim(_t('Distributor.SINGULAR_NAME', 'Distributor')._t('Distributor.FOR', ' for '));
375 375
             $member->Surname = $this->Name;
376 376
             $member->DistributorID = $this->ID;
377 377
             $member->write();
Please login to merge, or discard this patch.
model/process/extensions/CountryPrice_OrderStatusLog_AND_OrderAtribute.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -8,7 +8,7 @@
 block discarded – undo
8 8
     }
9 9
     public function canView($member = null)
10 10
     {
11
-        if (! $this->owner->ID) {
11
+        if (!$this->owner->ID) {
12 12
             return true;
13 13
         } elseif ($member && $member->DistributorID) {
14 14
             if ($order = $this->owner->Order()) {
Please login to merge, or discard this patch.
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   +6 added lines, -6 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
             }
@@ -210,7 +210,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
         }
Please login to merge, or discard this patch.
code/control/CountryPrice_Page_Controller_Extension.php 1 patch
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -157,7 +157,7 @@
 block discarded – undo
157 157
 
158 158
     /**
159 159
      *
160
-     * @return DataList
160
+     * @return string
161 161
      */
162 162
     public function AlternativeHrefLangLinksCachingKey()
163 163
     {
Please login to merge, or discard this patch.
code/model/buyables/CountryPrice_BuyableExtension.php 2 patches
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -223,7 +223,7 @@  discard block
 block discarded – undo
223 223
             return null;
224 224
         }
225 225
         $key = $this->owner->ClassName."___".$this->owner->ID.'____'.$countryCode;
226
-        if (! isset(self::$_buyable_price[$key])) {
226
+        if (!isset(self::$_buyable_price[$key])) {
227 227
             //basics
228 228
             $currency = null;
229 229
             $currencyCode = null;
@@ -311,7 +311,7 @@  discard block
 block discarded – undo
311 311
                 }
312 312
             }
313 313
             //order must have a country and a currency
314
-            if (! $currencyCode ||  ! $countryCode) {
314
+            if (!$currencyCode || !$countryCode) {
315 315
                 if ($this->debug) {
316 316
                     debug::log('No currency ('.$currencyCode.') or no country code ('.$countryCode.') for order: ');
317 317
                 }
@@ -408,7 +408,7 @@  discard block
 block discarded – undo
408 408
      */
409 409
     public function canEdit($member = null)
410 410
     {
411
-        if (! $member) {
411
+        if (!$member) {
412 412
             $member = Member::currentUser();
413 413
         }
414 414
         if ($member) {
Please login to merge, or discard this patch.
Doc Comments   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -99,9 +99,9 @@  discard block
 block discarded – undo
99 99
     /**
100 100
      * This is called from /ecommerce/code/Product
101 101
      * returning NULL is like returning TRUE OR FALSE, i.e. ignore this.
102
-     * @param Member (optional)   $member
102
+     * @param Member Member   $member
103 103
      * @param bool (optional)     $checkPrice
104
-     * @return false | null
104
+     * @return null|false | null
105 105
      */
106 106
     public function canPurchaseByCountry(Member $member = null, $checkPrice = true, $countryCode = '')
107 107
     {
@@ -399,7 +399,7 @@  discard block
 block discarded – undo
399 399
      * as long as we do not give distributors access to the Products
400 400
      * this is fairly safe.
401 401
      * @param member (optiona) $member
402
-     * @return null / bool
402
+     * @return boolean / bool
403 403
      */
404 404
     public function canEdit($member = null)
405 405
     {
Please login to merge, or discard this patch.