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/storage
|
||||||
/public/react
|
/public/react
|
||||||
/storage/*.key
|
/storage/*.key
|
||||||
|
/storage/debugbar
|
||||||
/vendor
|
/vendor
|
||||||
/.idea
|
/.idea
|
||||||
/.vscode
|
/.vscode
|
||||||
|
@ -15,6 +15,7 @@ use App\DataMapper\CompanySettings;
|
|||||||
use App\Events\User\UserWasArchived;
|
use App\Events\User\UserWasArchived;
|
||||||
use App\Events\User\UserWasDeleted;
|
use App\Events\User\UserWasDeleted;
|
||||||
use App\Events\User\UserWasRestored;
|
use App\Events\User\UserWasRestored;
|
||||||
|
use App\Jobs\Company\CreateCompanyToken;
|
||||||
use App\Models\CompanyUser;
|
use App\Models\CompanyUser;
|
||||||
use App\Models\User;
|
use App\Models\User;
|
||||||
use App\Utils\Ninja;
|
use App\Utils\Ninja;
|
||||||
@ -56,10 +57,11 @@ class UserRepository extends BaseRepository
|
|||||||
$account = $company->account;
|
$account = $company->account;
|
||||||
|
|
||||||
/* If hosted and Enterprise we need to increment the num_users field on the accounts table*/
|
/* If hosted and Enterprise we need to increment the num_users field on the accounts table*/
|
||||||
if (! $user->id && $account->isEnterpriseClient()) {
|
// 05-08-2022 This is an error, the num_users should _never_ increment
|
||||||
$account->num_users++;
|
// if (! $user->id && $account->isEnterpriseClient()) {
|
||||||
$account->save();
|
// $account->num_users++;
|
||||||
}
|
// $account->save();
|
||||||
|
// }
|
||||||
|
|
||||||
$user->fill($details);
|
$user->fill($details);
|
||||||
|
|
||||||
@ -94,6 +96,12 @@ class UserRepository extends BaseRepository
|
|||||||
$cu->restore();
|
$cu->restore();
|
||||||
$cu->tokens()->restore();
|
$cu->tokens()->restore();
|
||||||
$cu->save();
|
$cu->save();
|
||||||
|
|
||||||
|
//05-08-2022
|
||||||
|
if($cu->tokens()->count() == 0){
|
||||||
|
(new CreateCompanyToken($cu->company, $cu->user, 'restored_user'))->handle();
|
||||||
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
$cu->notifications = $data['company_user']['notifications'];
|
$cu->notifications = $data['company_user']['notifications'];
|
||||||
$cu->settings = $data['company_user']['settings'];
|
$cu->settings = $data['company_user']['settings'];
|
||||||
|
Loading…
Reference in New Issue
Block a user