Completed
Push — master ( 00b45d...3dd24a )
by Nicolaas
02:44
created
code/model/translations/CountryPrice_SiteTreeExtions.php 1 patch
Doc Comments   +1 added lines patch added patch discarded remove patch
@@ -123,6 +123,7 @@
 block discarded – undo
123 123
     /**
124 124
      * @var int $countryID
125 125
      *
126
+     * @param integer $countryID
126 127
      * @return CountryPrice_Translation | null
127 128
      */
128 129
     public function getEcommerceTranslation($countryID)
Please login to merge, or discard this patch.
code/model/CountryPrice.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -65,9 +65,9 @@  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
-            if ( class_exists($this->ObjectClass) ) {
70
+            if (class_exists($this->ObjectClass)) {
71 71
                 $this->_myBuyable = $className::get()->byID($this->ObjectID);
72 72
             }
73 73
         }
@@ -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/model/translations/CountryPrice_Translation.php 1 patch
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -75,7 +75,7 @@  discard block
 block discarded – undo
75 75
             DropdownField::create(
76 76
                 'EcommerceCountryID',
77 77
                 $fields->dataFieldByName('EcommerceCountryID')->Title(),
78
-                array('' => '-- make sure to select a country --')+$countries
78
+                array('' => '-- make sure to select a country --') + $countries
79 79
             ),
80 80
             'Title'
81 81
         );
@@ -183,19 +183,19 @@  discard block
 block discarded – undo
183 183
     public function requireDefaultRecords()
184 184
     {
185 185
         parent::requireDefaultRecords();
186
-        if(Config::inst()->get('CountryPrice_Translation', 'automatically_create_dummy_translations_for_products_and_productgroups')) {
186
+        if (Config::inst()->get('CountryPrice_Translation', 'automatically_create_dummy_translations_for_products_and_productgroups')) {
187 187
             $prices = CountryPrice::get();
188 188
             $ecommerceCountries = array();
189
-            foreach($prices as $price) {
190
-                if($countryObject = $price->CountryObject()) {
191
-                    if($buyable = $price->Buyable()) {
192
-                        if($buyable instanceof Product) {
189
+            foreach ($prices as $price) {
190
+                if ($countryObject = $price->CountryObject()) {
191
+                    if ($buyable = $price->Buyable()) {
192
+                        if ($buyable instanceof Product) {
193 193
                             $filter = array(
194 194
                                 'EcommerceCountryID' => $countryObject->ID,
195 195
                                 'ParentID' => $buyable->ID
196 196
                             );
197 197
                             $ecommerceCountries[$countryObject->ID] = $countryObject;
198
-                            if(! CountryPrice_Translation::get()->filter($filter)->first()) {
198
+                            if (!CountryPrice_Translation::get()->filter($filter)->first()) {
199 199
                                 DB::alteration_message(
200 200
                                     'Creating fake translation for '.$buyable->Title.' for country '.$countryObject->Code,
201 201
                                     'created'
@@ -208,14 +208,14 @@  discard block
 block discarded – undo
208 208
                     }
209 209
                 }
210 210
             }
211
-            if(count($ecommerceCountries)) {
212
-                foreach(ProductGroup::get() as $productGroup) {
213
-                    foreach($ecommerceCountries as $countryID => $countryObject) {
211
+            if (count($ecommerceCountries)) {
212
+                foreach (ProductGroup::get() as $productGroup) {
213
+                    foreach ($ecommerceCountries as $countryID => $countryObject) {
214 214
                         $filter = array(
215 215
                             'EcommerceCountryID' => $countryObject->ID,
216 216
                             'ParentID' => $productGroup->ID
217 217
                         );
218
-                        if(! CountryPrice_Translation::get()->filter($filter)->first()) {
218
+                        if (!CountryPrice_Translation::get()->filter($filter)->first()) {
219 219
                             DB::alteration_message(
220 220
                                 'Creating fake translation for '.$productGroup->Title.' for country '.$countryObject->Code,
221 221
                                 'created'
Please login to merge, or discard this patch.