Completed
Push — master ( 394be6...291a36 )
by Nicolaas
04:43 queued 02:28
created
code/model/buyables/CountryPrice_BuyableExtension.php 2 patches
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -107,11 +107,11 @@  discard block
 block discarded – undo
107 107
     {
108 108
         $countryObject = CountryPrice_EcommerceCountry::get_real_country($countryCode);
109 109
         if ($countryObject) {
110
-            if ($this->debug) {debug::log('found country object: '.$countryObject->Code);}
110
+            if ($this->debug) {debug::log('found country object: '.$countryObject->Code); }
111 111
             $countryCode = $countryObject->Code;
112 112
         }
113 113
         if ($countryCode == '') {
114
-            if ($this->debug) {debug::log('There is no country Code! ');}
114
+            if ($this->debug) {debug::log('There is no country Code! '); }
115 115
 
116 116
             //we can not decide
117 117
             return null;
@@ -119,22 +119,22 @@  discard block
 block discarded – undo
119 119
             $canSell = false;
120 120
             $excluded = $this->owner->getManyManyComponents('ExcludedCountries', "\"Code\" = '$countryCode'")->Count();
121 121
             if ($excluded) {
122
-                if ($this->debug) {debug::log('excluded country');}
122
+                if ($this->debug) {debug::log('excluded country'); }
123 123
 
124 124
                 //no!
125 125
                 return false;
126 126
             }
127 127
             elseif ($this->owner->AllCountries) {
128 128
                 //is there a valid price ???
129
-                if ($this->debug) {debug::log('All countries applies - updated  ... new price = '.floatval($this->owner->updateCalculatedPrice()));}
129
+                if ($this->debug) {debug::log('All countries applies - updated  ... new price = '.floatval($this->owner->updateCalculatedPrice())); }
130 130
                 $canSell = true;
131 131
             } elseif ($countryCode == EcommerceConfig::get('EcommerceCountry', 'default_country_code')) {
132
-                if ($this->debug) {debug::log('we are in the default country! exiting now ... ');}
132
+                if ($this->debug) {debug::log('we are in the default country! exiting now ... '); }
133 133
                 $canSell = true;
134
-            } elseif($this->IncludedCountries()->count()) {
134
+            } elseif ($this->IncludedCountries()->count()) {
135 135
                 $included = $this->owner->getManyManyComponents('IncludedCountries', "\"Code\" = '$countryCode'")->Count();
136 136
                 if ($included) {
137
-                    if ($this->debug) {debug::log('In included countries');}
137
+                    if ($this->debug) {debug::log('In included countries'); }
138 138
                     //null basically means - ignore ...
139 139
                     $canSell = true;
140 140
                 } else {
@@ -142,21 +142,21 @@  discard block
 block discarded – undo
142 142
                     return false;
143 143
                 }
144 144
             }
145
-            if ($this->debug) {debug::log('the product is for '.($canSell ? '' : 'NOT ').'sale in principal... ');}
145
+            if ($this->debug) {debug::log('the product is for '.($canSell ? '' : 'NOT ').'sale in principal... '); }
146 146
             if (
147 147
                 $canSell &&
148 148
                 $this->owner instanceof Product &&
149 149
                 $this->owner->hasMethod('hasVariations') &&
150 150
                 $this->owner->hasVariations()->count()
151 151
             ) {
152
-                if ($this->debug) {debug::log('check variations ... ');}
152
+                if ($this->debug) {debug::log('check variations ... '); }
153 153
                 //check variations ...
154 154
                 return $this->owner->Variations()->First()->canPurchaseByCountry($member, $checkPrice);
155 155
             }
156 156
 
157 157
             //is there a valid price ???
158 158
             $countryPrice = $this->owner->getCalculatedPrice();
159
-            if ($this->debug) {debug::log('nothing applies, but we have a country price... '.$countryPrice);}
159
+            if ($this->debug) {debug::log('nothing applies, but we have a country price... '.$countryPrice); }
160 160
 
161 161
             return floatval($countryPrice) > 0 ? null : false;
162 162
         }
@@ -219,7 +219,7 @@  discard block
 block discarded – undo
219 219
             return null;
220 220
         }
221 221
         $key = $this->owner->ClassName."___".$this->owner->ID.'____'.$countryCode;
222
-        if (! isset(self::$_buyable_price[$key])) {
222
+        if (!isset(self::$_buyable_price[$key])) {
223 223
             //basics
224 224
             $currency = null;
225 225
             $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.
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -123,8 +123,7 @@
 block discarded – undo
123 123
 
124 124
                 //no!
125 125
                 return false;
126
-            }
127
-            elseif ($this->owner->AllCountries) {
126
+            } elseif ($this->owner->AllCountries) {
128 127
                 //is there a valid price ???
129 128
                 if ($this->debug) {debug::log('All countries applies - updated  ... new price = '.floatval($this->owner->updateCalculatedPrice()));}
130 129
                 $canSell = true;
Please login to merge, or discard this patch.