Fixes for bulk import

This commit is contained in:
David Bomba 2020-11-18 20:35:09 +11:00
parent 6376d5fa98
commit e91c82aa8b
4 changed files with 7 additions and 8 deletions

View File

@ -304,7 +304,7 @@ class CheckData extends Command
if ($ledger && number_format($invoice_balance, 4) != number_format($client->balance, 4)) {
$wrong_balances++;
$this->logMessage($client->present()->name.' - '.$client->number." - Balance Failure - Invoice Balances = {$invoice_balance} Client Balance = {$client->balance} Ledger Balance = {$ledger->balance}");
$this->logMessage("# {$client->id} " . $client->present()->name.' - '.$client->number." - Balance Failure - Invoice Balances = {$invoice_balance} Client Balance = {$client->balance} Ledger Balance = {$ledger->balance}");
$this->isValid = false;
}
@ -341,7 +341,7 @@ class CheckData extends Command
if (round($total_invoice_payments, 2) != round($client->paid_to_date, 2)) {
$wrong_paid_to_dates++;
$this->logMessage($client->present()->name.' - '.$client->id." - Paid to date does not match Client Paid To Date = {$client->paid_to_date} - Invoice Payments = {$total_invoice_payments}");
$this->logMessage($client->present()->name.'id = # '.$client->id." - Paid to date does not match Client Paid To Date = {$client->paid_to_date} - Invoice Payments = {$total_invoice_payments}");
$this->isValid = false;
}

View File

@ -72,6 +72,7 @@ class ImportMigrations extends Command
foreach ($directory as $file) {
if ($file->getExtension() === 'zip') {
$this->info('Started processing: '.$file->getBasename().' at '.now());
info("dispatching");
StartMigration::dispatch($file->getRealPath(), $this->getUser(), $this->getUser()->companies()->first());
}
}
@ -84,7 +85,7 @@ class ImportMigrations extends Command
$user = User::factory()->create([
'account_id' => $account->id,
'email' => $this->faker->email,
'email' => Str::random(10) . "@example.com",
'confirmation_code' => $this->createDbHash(config('database.default')),
]);

View File

@ -148,7 +148,7 @@ class Import implements ShouldQueue
*/
private $ids = [];
public $tries = 1;
public $tries = 0;
public $timeout = 86400;
@ -1192,8 +1192,6 @@ class Import implements ShouldQueue
$user = UserFactory::create($this->company->account->id);
}
info("getting user id = {$user->id} - {$user->email}");
return $user;
}

View File

@ -55,11 +55,11 @@ class WebhookHandler implements ShouldQueue
MultiDB::setDb($this->company->db);
if (! $this->entity->company || $this->entity->company->is_disabled) {
if (! $this->company || $this->company->is_disabled) {
return true;
}
$subscriptions = Webhook::where('company_id', $this->entity->company_id)
$subscriptions = Webhook::where('company_id', $this->company->id)
->where('event_id', $this->event_id)
->get();