1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-11-10 05:02:36 +01:00

Fix delete company code

This commit is contained in:
Hillel Coren 2017-05-16 11:02:40 +03:00
parent 985356daf2
commit d90ab5bb53

View File

@ -1355,20 +1355,18 @@ class AccountController extends BaseController
$account = Auth::user()->account;
\Log::info("Canceled Account: {$account->name} - {$user->email}");
$company = $account->company;
$refunded = $company->processRefund(Auth::user());
$refunded = false;
if (! $account->hasMultipleAccounts()) {
$company = $account->company;
$refunded = $company->processRefund(Auth::user());
}
Document::scope()->each(function ($item, $key) {
$item->delete();
});
$this->accountRepo->unlinkAccount($account);
if ($account->hasMultipleAccounts()) {
$account->forceDelete();
} else {
$account->company->forceDelete();
}
$account->forceDelete();
Auth::logout();
Session::flush();