@@ -347,7 +347,7 @@ |
||
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 | { |
@@ -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 | } |
@@ -96,7 +96,6 @@ |
||
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 | */ |
@@ -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); |
@@ -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(); |
@@ -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()) { |
@@ -157,7 +157,7 @@ |
||
157 | 157 | |
158 | 158 | /** |
159 | 159 | * |
160 | - * @return DataList |
|
160 | + * @return string |
|
161 | 161 | */ |
162 | 162 | public function AlternativeHrefLangLinksCachingKey() |
163 | 163 | { |
@@ -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) { |
@@ -99,9 +99,9 @@ discard block |
||
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 |
||
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 | { |
@@ -123,6 +123,7 @@ |
||
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) |
@@ -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(); |
@@ -148,7 +148,7 @@ |
||
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 | ); |
@@ -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) { |