mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2024-11-10 21:22:58 +01:00
Merge pull request #7720 from turbo124/v5-stable
Fixes for company token generation
This commit is contained in:
commit
a16744311d
1
.gitignore
vendored
1
.gitignore
vendored
@ -3,6 +3,7 @@
|
||||
/public/storage
|
||||
/public/react
|
||||
/storage/*.key
|
||||
/storage/debugbar
|
||||
/vendor
|
||||
/.idea
|
||||
/.vscode
|
||||
|
@ -15,6 +15,7 @@ use App\DataMapper\CompanySettings;
|
||||
use App\Events\User\UserWasArchived;
|
||||
use App\Events\User\UserWasDeleted;
|
||||
use App\Events\User\UserWasRestored;
|
||||
use App\Jobs\Company\CreateCompanyToken;
|
||||
use App\Models\CompanyUser;
|
||||
use App\Models\User;
|
||||
use App\Utils\Ninja;
|
||||
@ -56,10 +57,11 @@ class UserRepository extends BaseRepository
|
||||
$account = $company->account;
|
||||
|
||||
/* If hosted and Enterprise we need to increment the num_users field on the accounts table*/
|
||||
if (! $user->id && $account->isEnterpriseClient()) {
|
||||
$account->num_users++;
|
||||
$account->save();
|
||||
}
|
||||
// 05-08-2022 This is an error, the num_users should _never_ increment
|
||||
// if (! $user->id && $account->isEnterpriseClient()) {
|
||||
// $account->num_users++;
|
||||
// $account->save();
|
||||
// }
|
||||
|
||||
$user->fill($details);
|
||||
|
||||
@ -94,6 +96,12 @@ class UserRepository extends BaseRepository
|
||||
$cu->restore();
|
||||
$cu->tokens()->restore();
|
||||
$cu->save();
|
||||
|
||||
//05-08-2022
|
||||
if($cu->tokens()->count() == 0){
|
||||
(new CreateCompanyToken($cu->company, $cu->user, 'restored_user'))->handle();
|
||||
}
|
||||
|
||||
} else {
|
||||
$cu->notifications = $data['company_user']['notifications'];
|
||||
$cu->settings = $data['company_user']['settings'];
|
||||
|
Loading…
Reference in New Issue
Block a user