1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-11-10 13:12:50 +01:00

Accept activities for import

This commit is contained in:
David Bomba 2023-06-25 20:09:45 +10:00
parent 9363a3f7b6
commit 5cbded2ee1
2 changed files with 7 additions and 4 deletions

View File

@ -105,7 +105,7 @@ class Handler extends ExceptionHandler
if($exception instanceof ThrottleRequestsException && class_exists(\Modules\Admin\Events\ThrottledExceptionRaised::class)) { if($exception instanceof ThrottleRequestsException && class_exists(\Modules\Admin\Events\ThrottledExceptionRaised::class)) {
$uri = urldecode(request()->getRequestUri()); $uri = urldecode(request()->getRequestUri());
event(new \Modules\Admin\Events\ThrottledExceptionRaised(auth()->user()?->account?->key, $uri, request()->ip())); // event(new \Modules\Admin\Events\ThrottledExceptionRaised(auth()->user()?->account?->key, $uri, request()->ip()));
} }
Integration::configureScope(function (Scope $scope): void { Integration::configureScope(function (Scope $scope): void {

View File

@ -304,7 +304,7 @@ class Import implements ShouldQueue
if (round($total_invoice_payments, 2) != round($client->paid_to_date, 2)) { if (round($total_invoice_payments, 2) != round($client->paid_to_date, 2)) {
$client->paid_to_date = $total_invoice_payments; $client->paid_to_date = $total_invoice_payments;
$client->save(); $client->saveQuietly();
} }
}); });
} }
@ -320,12 +320,12 @@ class Import implements ShouldQueue
$company_ledger->notes = 'Migrated Client Balance'; $company_ledger->notes = 'Migrated Client Balance';
$company_ledger->balance = $invoice_balances; $company_ledger->balance = $invoice_balances;
$company_ledger->activity_id = Activity::CREATE_CLIENT; $company_ledger->activity_id = Activity::CREATE_CLIENT;
$company_ledger->save(); $company_ledger->saveQuietly();
$client->company_ledger()->save($company_ledger); $client->company_ledger()->save($company_ledger);
$client->balance = $invoice_balances; $client->balance = $invoice_balances;
$client->save(); $client->saveQuietly();
}); });
} }
@ -1781,6 +1781,7 @@ class Import implements ShouldQueue
{ {
Activity::where('company_id', $this->company->id)->cursor()->each(function ($a){ Activity::where('company_id', $this->company->id)->cursor()->each(function ($a){
$a->forceDelete(); $a->forceDelete();
nlog("deleting {$a->id}");
}); });
Activity::unguard(); Activity::unguard();
@ -1828,6 +1829,8 @@ try {
$modified['client_contact_id'] = $this->transformId('client_contacts', $resource['client_contact_id']); $modified['client_contact_id'] = $this->transformId('client_contacts', $resource['client_contact_id']);
} }
$modified['updated_at'] = $modified['created_at'];
$act = Activity::make($modified); $act = Activity::make($modified);
$act->save(['timestamps' => false]); $act->save(['timestamps' => false]);