@@ -12,7 +12,7 @@ |
||
| 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 | } |
@@ -111,7 +111,7 @@ discard block |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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(); |
@@ -25,11 +25,11 @@ |
||
| 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); |
@@ -8,7 +8,7 @@ |
||
| 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()) { |
@@ -16,7 +16,7 @@ discard block |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 245 | 245 | } |
| 246 | 246 | } |
| 247 | 247 | } |
| 248 | - if (! $string) { |
|
| 248 | + if (!$string) { |
|
| 249 | 249 | $string = "NOT SET"; |
| 250 | 250 | $style = "deleted"; |
| 251 | 251 | } |
@@ -223,7 +223,7 @@ discard block |
||
| 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 |
||
| 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 |
||
| 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) { |
@@ -56,7 +56,7 @@ discard block |
||
| 56 | 56 | public function loadTranslatedValues($countryID = 0, $variableOrMethod = '') |
| 57 | 57 | { |
| 58 | 58 | $translation = null; |
| 59 | - if (! $countryID) { |
|
| 59 | + if (!$countryID) { |
|
| 60 | 60 | $countryObject = CountryPrice_EcommerceCountry::get_real_country(); |
| 61 | 61 | if ($countryObject) { |
| 62 | 62 | $countryID = $countryObject->ID; |
@@ -75,9 +75,9 @@ discard block |
||
| 75 | 75 | $fieldsToReplace = $translation->FieldsToReplace(); |
| 76 | 76 | foreach ($fieldsToReplace as $replaceFields) { |
| 77 | 77 | $pageField = $replaceFields->PageField; |
| 78 | - $pageFieldTranslated = $pageField . 'Translated'; |
|
| 78 | + $pageFieldTranslated = $pageField.'Translated'; |
|
| 79 | 79 | $translationField = $replaceFields->TranslationField; |
| 80 | - if (! $variableOrMethod || $variableOrMethod === $pageField) { |
|
| 80 | + if (!$variableOrMethod || $variableOrMethod === $pageField) { |
|
| 81 | 81 | if ($translation->hasMethod($translationField)) { |
| 82 | 82 | $this->owner->$pageField = $translation->$translationField(); |
| 83 | 83 | $this->owner->$pageFieldTranslated = $translation->$translationField(); |
@@ -98,7 +98,7 @@ discard block |
||
| 98 | 98 | $countryDropdownField = DropdownField::create( |
| 99 | 99 | 'EcommerceCountryID', |
| 100 | 100 | $fields->dataFieldByName('EcommerceCountryID')->Title(), |
| 101 | - array('' => '-- make sure to select a country --')+$countries |
|
| 101 | + array('' => '-- make sure to select a country --') + $countries |
|
| 102 | 102 | ); |
| 103 | 103 | |
| 104 | 104 | // //$fields->removeFieldFromTab("Root.Main", 'ParentID'); |
@@ -131,7 +131,7 @@ discard block |
||
| 131 | 131 | ); |
| 132 | 132 | } |
| 133 | 133 | if ($fields->dataFieldByName($useField)) { |
| 134 | - $fields->dataFieldByName($useField)->setDescription(_t('CountryPrice_Translation.IGNORE', 'Use untranslated value for ') . $dbField); |
|
| 134 | + $fields->dataFieldByName($useField)->setDescription(_t('CountryPrice_Translation.IGNORE', 'Use untranslated value for ').$dbField); |
|
| 135 | 135 | } |
| 136 | 136 | } |
| 137 | 137 | if ($this->exists() && $this->ParentID) { |
@@ -210,7 +210,7 @@ discard block |
||
| 210 | 210 | ); |
| 211 | 211 | $this->extend('updateFieldsToReplace', $al); |
| 212 | 212 | foreach ($al as $fieldToReplace) { |
| 213 | - $ignoreField = 'UseOriginal' . $fieldToReplace->PageField; |
|
| 213 | + $ignoreField = 'UseOriginal'.$fieldToReplace->PageField; |
|
| 214 | 214 | if (!empty($this->owner->$ignoreField)) { |
| 215 | 215 | $al->remove($fieldToReplace); |
| 216 | 216 | } |
@@ -261,7 +261,7 @@ discard block |
||
| 261 | 261 | 'ParentID' => $buyable->ID |
| 262 | 262 | ); |
| 263 | 263 | $ecommerceCountries[$countryObject->ID] = $countryObject; |
| 264 | - if (! CountryPrice_Translation::get()->filter($filter)->first()) { |
|
| 264 | + if (!CountryPrice_Translation::get()->filter($filter)->first()) { |
|
| 265 | 265 | DB::alteration_message( |
| 266 | 266 | 'Creating fake translation for '.$buyable->Title.' for country '.$countryObject->Code, |
| 267 | 267 | 'created' |
@@ -282,7 +282,7 @@ discard block |
||
| 282 | 282 | 'EcommerceCountryID' => $countryObject->ID, |
| 283 | 283 | 'ParentID' => $productGroup->ID |
| 284 | 284 | ); |
| 285 | - if (! CountryPrice_Translation::get()->filter($filter)->first()) { |
|
| 285 | + if (!CountryPrice_Translation::get()->filter($filter)->first()) { |
|
| 286 | 286 | DB::alteration_message( |
| 287 | 287 | 'Creating fake translation for '.$productGroup->Title.' for country '.$countryObject->Code, |
| 288 | 288 | 'created' |
@@ -62,7 +62,7 @@ discard block |
||
| 62 | 62 | if ($order->IsSubmitted()) { |
| 63 | 63 | return true; |
| 64 | 64 | } |
| 65 | - if (! $countryCode) { |
|
| 65 | + if (!$countryCode) { |
|
| 66 | 66 | $countryCode = $order->getCountry(); |
| 67 | 67 | } |
| 68 | 68 | $currencyObject = CountryPrice_EcommerceCurrency::get_currency_for_country($countryCode); |
@@ -76,13 +76,13 @@ discard block |
||
| 76 | 76 | //check if the billing and shipping address have a country so that they will not be overridden by previous Orders |
| 77 | 77 | //we do this to make sure that the previous address can not change the region and thereby destroy the order in the cart |
| 78 | 78 | if ($billingAddress = $order->CreateOrReturnExistingAddress('BillingAddress')) { |
| 79 | - if (! $billingAddress->Country || $force) { |
|
| 79 | + if (!$billingAddress->Country || $force) { |
|
| 80 | 80 | $billingAddress->Country = $countryCode; |
| 81 | 81 | $billingAddress->write(); |
| 82 | 82 | } |
| 83 | 83 | } |
| 84 | 84 | if ($shippingAddress = $order->CreateOrReturnExistingAddress('ShippingAddress')) { |
| 85 | - if (! $shippingAddress->ShippingCountry || $force) { |
|
| 85 | + if (!$shippingAddress->ShippingCountry || $force) { |
|
| 86 | 86 | $shippingAddress->ShippingCountry = $countryCode; |
| 87 | 87 | $shippingAddress->write(); |
| 88 | 88 | } |
@@ -91,7 +91,7 @@ discard block |
||
| 91 | 91 | //if a country code and currency has been set then all is good |
| 92 | 92 | //from there we keep it this way |
| 93 | 93 | if ( |
| 94 | - $order->OriginatingCountryCode == $countryCode && |
|
| 94 | + $order->OriginatingCountryCode == $countryCode && |
|
| 95 | 95 | $order->CurrencyUsedID == $currencyObject->ID |
| 96 | 96 | ) { |
| 97 | 97 | return true; |
@@ -113,7 +113,7 @@ discard block |
||
| 113 | 113 | if ($items) { |
| 114 | 114 | foreach ($items as $item) { |
| 115 | 115 | $buyable = $item->Buyable(true); |
| 116 | - if (! $buyable->canPurchase()) { |
|
| 116 | + if (!$buyable->canPurchase()) { |
|
| 117 | 117 | $item->delete(); |
| 118 | 118 | } |
| 119 | 119 | } |
@@ -160,7 +160,7 @@ discard block |
||
| 160 | 160 | */ |
| 161 | 161 | public function onAfterWrite() |
| 162 | 162 | { |
| 163 | - if (! $this->owner->DistributorID) { |
|
| 163 | + if (!$this->owner->DistributorID) { |
|
| 164 | 164 | if ($defaultDistributor = Distributor::get_default_distributor()) { |
| 165 | 165 | if ($defaultDistributor->exists()) { |
| 166 | 166 | if ($defaultDistributor->ID) { |
@@ -179,7 +179,7 @@ discard block |
||
| 179 | 179 | |
| 180 | 180 | public function canEdit($member = null) |
| 181 | 181 | { |
| 182 | - if (! $member) { |
|
| 182 | + if (!$member) { |
|
| 183 | 183 | $member = Member::currentUser(); |
| 184 | 184 | } |
| 185 | 185 | if ($member) { |