mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2024-11-10 05:02:36 +01:00
Installation on 3.8.1 fails: Exception AccountRepository.php #1738
This commit is contained in:
parent
05ad79e207
commit
443c2193d5
@ -59,29 +59,31 @@ class AccountRepository
|
|||||||
$account->company_id = $company->id;
|
$account->company_id = $company->id;
|
||||||
|
|
||||||
// Set default language/currency based on IP
|
// Set default language/currency based on IP
|
||||||
$data = unserialize(file_get_contents('http://www.geoplugin.net/php.gp?ip=' . $account->ip));
|
if (\Cache::get('currencies')) {
|
||||||
$currencyCode = strtolower($data['geoplugin_currencyCode']);
|
$data = unserialize(file_get_contents('http://www.geoplugin.net/php.gp?ip=' . $account->ip));
|
||||||
$countryCode = strtolower($data['geoplugin_countryCode']);
|
$currencyCode = strtolower($data['geoplugin_currencyCode']);
|
||||||
|
$countryCode = strtolower($data['geoplugin_countryCode']);
|
||||||
|
|
||||||
$currency = \Cache::get('currencies')->filter(function ($item) use ($currencyCode) {
|
$currency = \Cache::get('currencies')->filter(function ($item) use ($currencyCode) {
|
||||||
return strtolower($item->code) == $currencyCode;
|
return strtolower($item->code) == $currencyCode;
|
||||||
})->first();
|
})->first();
|
||||||
if ($currency) {
|
if ($currency) {
|
||||||
$account->currency_id = $currency->id;
|
$account->currency_id = $currency->id;
|
||||||
}
|
}
|
||||||
|
|
||||||
$country = \Cache::get('countries')->filter(function ($item) use ($countryCode) {
|
$country = \Cache::get('countries')->filter(function ($item) use ($countryCode) {
|
||||||
return strtolower($item->iso_3166_2) == $countryCode || strtolower($item->iso_3166_3) == $countryCode;
|
return strtolower($item->iso_3166_2) == $countryCode || strtolower($item->iso_3166_3) == $countryCode;
|
||||||
})->first();
|
})->first();
|
||||||
if ($country) {
|
if ($country) {
|
||||||
$account->country_id = $country->id;
|
$account->country_id = $country->id;
|
||||||
}
|
}
|
||||||
|
|
||||||
$language = \Cache::get('languages')->filter(function ($item) use ($countryCode) {
|
$language = \Cache::get('languages')->filter(function ($item) use ($countryCode) {
|
||||||
return strtolower($item->locale) == $countryCode;
|
return strtolower($item->locale) == $countryCode;
|
||||||
})->first();
|
})->first();
|
||||||
if ($language) {
|
if ($language) {
|
||||||
$account->language_id = $language->id;
|
$account->language_id = $language->id;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$account->save();
|
$account->save();
|
||||||
|
Loading…
Reference in New Issue
Block a user