Completed
Push — master ( 83ea15...a04582 )
by Nicolaas
03:35
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/control/CountryPrice_ChangeCountryController.php 2 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -69,8 +69,8 @@
 block discarded – undo
69 69
     /**
70 70
      * Remove a query string parameter from an URL.
71 71
      *
72
-     * @param string $url
73 72
      * @param string $varname
73
+     * @param string $newCountryCode
74 74
      *
75 75
      * @return string
76 76
      */
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -114,9 +114,9 @@
 block discarded – undo
114 114
             }
115 115
 
116 116
             $path = isset($parsedUrl['path']) ? $parsedUrl['path'] : '';
117
-            $query = !empty($query) ? '?'. http_build_query($query) : '';
117
+            $query = !empty($query) ? '?'.http_build_query($query) : '';
118 118
 
119
-            $url = $parsedUrl['scheme']. '://'. $parsedUrl['host']. $path. $query;
119
+            $url = $parsedUrl['scheme'].'://'.$parsedUrl['host'].$path.$query;
120 120
 
121 121
             return $url;
122 122
         }
Please login to merge, or discard this patch.
code/model/buyables/CountryPrice_BuyableExtension.php 2 patches
Doc Comments   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -99,7 +99,7 @@  discard block
 block discarded – undo
99 99
     /**
100 100
      * This is called from /ecommerce/code/Product
101 101
      * returning NULL is like returning TRUE, i.e. ignore this.
102
-     * @param Member (optional)   $member
102
+     * @param Member Member   $member
103 103
      * @param bool (optional)     $checkPrice
104 104
      * @return false | null
105 105
      */
@@ -400,7 +400,7 @@  discard block
 block discarded – undo
400 400
      * as long as we do not give distributors access to the Products
401 401
      * this is fairly safe.
402 402
      * @param member (optiona) $member
403
-     * @return null / bool
403
+     * @return boolean / bool
404 404
      */
405 405
     public function canEdit($member = null)
406 406
     {
Please login to merge, or discard this patch.
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -220,7 +220,7 @@  discard block
 block discarded – undo
220 220
         if ($this->debug) {
221 221
             debug::log('TESTING '.$key.'');
222 222
         }
223
-        if (! isset(self::$_buyable_price[$key])) {
223
+        if (!isset(self::$_buyable_price[$key])) {
224 224
             //basics
225 225
             $currency = null;
226 226
             $currencyCode = null;
@@ -307,7 +307,7 @@  discard block
 block discarded – undo
307 307
                 }
308 308
             }
309 309
             //order must have a country and a currency
310
-            if (! $currencyCode ||  ! $countryCode) {
310
+            if (!$currencyCode || !$countryCode) {
311 311
                 if ($this->debug) {
312 312
                     debug::log('No currency ('.$currencyCode.') or no country code ('.$countryCode.') for order: ');
313 313
                 }
@@ -404,7 +404,7 @@  discard block
 block discarded – undo
404 404
      */
405 405
     public function canEdit($member = null)
406 406
     {
407
-        if (! $member) {
407
+        if (!$member) {
408 408
             $member = Member::currentUser();
409 409
         }
410 410
         if ($member) {
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   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -125,7 +125,7 @@  discard block
 block discarded – undo
125 125
      */
126 126
     public function getFullPrice()
127 127
     {
128
-        return "$this->Price $this->Currency" . ($this->isObsolete() ? ' (obsolete!)' : '');
128
+        return "$this->Price $this->Currency".($this->isObsolete() ? ' (obsolete!)' : '');
129 129
     }
130 130
 
131 131
     public function getCMSFields()
@@ -197,7 +197,7 @@  discard block
 block discarded – undo
197 197
     public function canEdit($member = null)
198 198
     {
199 199
         $canEdit = parent::canEdit();
200
-        if (! $canEdit) {
200
+        if (!$canEdit) {
201 201
             $member = Member::currentUser();
202 202
             $distributor = $member->Distributor();
203 203
             if ($distributor->exists()) {
@@ -215,16 +215,16 @@  discard block
 block discarded – undo
215 215
     protected function validate()
216 216
     {
217 217
         $result = parent::validate();
218
-        if (! $this->ObjectClass && isset($_REQUEST["MyObjectClass"])) {
218
+        if (!$this->ObjectClass && isset($_REQUEST["MyObjectClass"])) {
219 219
             if (class_exists($_REQUEST["MyObjectClass"])) {
220 220
                 $this->ObjectClass = Convert::raw2sql($_REQUEST["MyObjectClass"]);
221 221
             }
222 222
         }
223
-        if (! $this->ObjectID && isset($_REQUEST["MyObjectID"])) {
223
+        if (!$this->ObjectID && isset($_REQUEST["MyObjectID"])) {
224 224
             $this->ObjectID = intval($_REQUEST["MyObjectID"]);
225 225
         }
226 226
         //check for duplicates in case it has not been created yet...
227
-        if (! $this->ObjectClass || ! $this->ObjectID) {
227
+        if (!$this->ObjectClass || !$this->ObjectID) {
228 228
             $result->error('Object could not be created. Please contact your developer.');
229 229
             return $result;
230 230
         }
Please login to merge, or discard this patch.
code/model/process/extensions/CountryPrice_OrderDOD.php 3 patches
Doc Comments   +1 added lines patch added patch discarded remove patch
@@ -47,6 +47,7 @@
 block discarded – undo
47 47
      * this method basically makes sure that the Order
48 48
      * has all the localised stuff attached to it, specifically
49 49
      * the right currency
50
+     * @param string $countryCode
50 51
      */
51 52
     public static function localise_order($countryCode = null, $force = false)
52 53
     {
Please login to merge, or discard this patch.
Indentation   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -100,7 +100,7 @@  discard block
 block discarded – undo
100 100
         $order = Order::get()->byID($order->ID);
101 101
         $orderHasBeenChanged = false;
102 102
 
103
-         //check currency ...
103
+            //check currency ...
104 104
         if ($order->CurrencyUsedID != $currencyObject->ID) {
105 105
             $order->SetCurrency($currencyObject);
106 106
             $orderHasBeenChanged = true;
@@ -148,7 +148,7 @@  discard block
 block discarded – undo
148 148
                 'Root.Country',
149 149
                 DropdownField::create(
150 150
                     'DistributorID',
151
-                     _t('Distributor.SINGULAR_NAME', 'Distributor'),
151
+                        _t('Distributor.SINGULAR_NAME', 'Distributor'),
152 152
                     array(''=> '--- Please select ---') + Distributor::get()->map()->toArray()
153 153
                 )
154 154
             );
Please login to merge, or discard this patch.
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -61,7 +61,7 @@  discard block
 block discarded – undo
61 61
         if ($order->IsSubmitted()) {
62 62
             return true;
63 63
         }
64
-        if (! $countryCode) {
64
+        if (!$countryCode) {
65 65
             $countryCode = $order->getCountry();
66 66
         }
67 67
         $currencyObject = CountryPrice_EcommerceCurrency::get_currency_for_country($countryCode);
@@ -75,13 +75,13 @@  discard block
 block discarded – undo
75 75
         //check if the billing and shipping address have a country so that they will not be overridden by previous Orders
76 76
         //we do this to make sure that the previous address can not change the region and thereby destroy the order in the cart
77 77
         if ($billingAddress = $order->CreateOrReturnExistingAddress('BillingAddress')) {
78
-            if (! $billingAddress->Country || $force) {
78
+            if (!$billingAddress->Country || $force) {
79 79
                 $billingAddress->Country = $countryCode;
80 80
                 $billingAddress->write();
81 81
             }
82 82
         }
83 83
         if ($shippingAddress = $order->CreateOrReturnExistingAddress('ShippingAddress')) {
84
-            if (! $shippingAddress->ShippingCountry || $force) {
84
+            if (!$shippingAddress->ShippingCountry || $force) {
85 85
                 $shippingAddress->ShippingCountry = $countryCode;
86 86
                 $shippingAddress->write();
87 87
             }
@@ -90,7 +90,7 @@  discard block
 block discarded – undo
90 90
         //if a country code and currency has been set then all is good
91 91
         //from there we keep it this way
92 92
         if (
93
-            $order->OriginatingCountryCode ==  $countryCode &&
93
+            $order->OriginatingCountryCode == $countryCode &&
94 94
             $order->CurrencyUsedID == $currencyObject->ID
95 95
         ) {
96 96
             return true;
@@ -111,7 +111,7 @@  discard block
 block discarded – undo
111 111
             if ($items) {
112 112
                 foreach ($items as $item) {
113 113
                     $buyable = $item->Buyable(true);
114
-                    if (! $buyable->canPurchase()) {
114
+                    if (!$buyable->canPurchase()) {
115 115
                         $item->delete();
116 116
                     }
117 117
                 }
@@ -162,7 +162,7 @@  discard block
 block discarded – undo
162 162
 
163 163
     public function canEdit($member = null)
164 164
     {
165
-        if (! $member) {
165
+        if (!$member) {
166 166
             $member = Member::currentUser();
167 167
         }
168 168
         if ($member) {
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/translations/CountryPrice_SiteTreeExtions.php 1 patch
Spacing   +5 added lines, -5 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();
@@ -71,12 +71,12 @@  discard block
 block discarded – undo
71 71
                         $this->owner->$pageField = $translation->$translationField;
72 72
                     }
73 73
                 }
74
-                if($variableOrMethod) {
74
+                if ($variableOrMethod) {
75 75
                     return $this->owner->$pageField;
76 76
                 }
77 77
             }
78 78
         } else {
79
-            if($variableOrMethod) {
79
+            if ($variableOrMethod) {
80 80
                 if ($translation->hasMethod($variableOrMethod)) {
81 81
                     return $this->owner->$variableOrMethod();
82 82
                 } else {
Please login to merge, or discard this patch.
code/model/translations/CountryPrice_Translation.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -60,7 +60,7 @@
 block discarded – undo
60 60
             DropdownField::create(
61 61
                 'EcommerceCountryID',
62 62
                 'Country',
63
-                array('' => '-- make sure to select a country --')+$countries
63
+                array('' => '-- make sure to select a country --') + $countries
64 64
             ),
65 65
             'Title'
66 66
         );
Please login to merge, or discard this patch.