mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2024-09-20 16:31:33 +02:00
Minor fixes for check data
This commit is contained in:
parent
cef753bbd0
commit
fd42442beb
@ -12,6 +12,7 @@
|
|||||||
namespace App\Console\Commands;
|
namespace App\Console\Commands;
|
||||||
|
|
||||||
use App;
|
use App;
|
||||||
|
use App\DataMapper\ClientSettings;
|
||||||
use App\Factory\ClientContactFactory;
|
use App\Factory\ClientContactFactory;
|
||||||
use App\Factory\VendorContactFactory;
|
use App\Factory\VendorContactFactory;
|
||||||
use App\Models\Account;
|
use App\Models\Account;
|
||||||
@ -126,7 +127,7 @@ class CheckData extends Command
|
|||||||
|
|
||||||
$errorEmail = config('ninja.error_email');
|
$errorEmail = config('ninja.error_email');
|
||||||
|
|
||||||
if ($errorEmail) {
|
if (strlen($errorEmail) > 1) {
|
||||||
Mail::raw($this->log, function ($message) use ($errorEmail, $database) {
|
Mail::raw($this->log, function ($message) use ($errorEmail, $database) {
|
||||||
$message->to($errorEmail)
|
$message->to($errorEmail)
|
||||||
->from(config('mail.from.address'), config('mail.from.name'))
|
->from(config('mail.from.address'), config('mail.from.name'))
|
||||||
@ -893,6 +894,45 @@ class CheckData extends Command
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public function checkClientSettings()
|
||||||
|
{
|
||||||
|
|
||||||
|
if ($this->option('fix') == 'true') {
|
||||||
|
|
||||||
|
Client::query()->whereNull('settings->currency_id')->cursor()->each(function ($client){
|
||||||
|
|
||||||
|
if(is_array($client->settings) && count($client->settings) == 0)
|
||||||
|
{
|
||||||
|
$settings = ClientSettings::defaults();
|
||||||
|
$settings->currency_id = $client->company->settings->currency_id;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$settings = $client->settings;
|
||||||
|
$settings->currency_id = $client->company->settings->currency_id;
|
||||||
|
}
|
||||||
|
|
||||||
|
$client->settings = $settings;
|
||||||
|
$client->save();
|
||||||
|
|
||||||
|
$this->logMessage("Fixing currency for # {$client->id}");
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
Client::query()->whereNull('country_id')->cursor()->each(function ($client){
|
||||||
|
|
||||||
|
$client->country_id = $client->company->settings->country_id;
|
||||||
|
$client->save();
|
||||||
|
|
||||||
|
$this->logMessage("Fixing country for # {$client->id}");
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
public function checkBalanceVsPaidStatus()
|
public function checkBalanceVsPaidStatus()
|
||||||
{
|
{
|
||||||
$this->wrong_paid_status = 0;
|
$this->wrong_paid_status = 0;
|
||||||
|
Loading…
Reference in New Issue
Block a user