1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-11-08 20:22:42 +01:00

Multi-db fixes

This commit is contained in:
Hillel Coren 2017-05-10 13:04:07 +03:00
parent fec7f6ad9b
commit 474790df69
6 changed files with 23 additions and 13 deletions

View File

@ -182,7 +182,7 @@ class UserController extends BaseController
->withInput();
}
if (! \App\Models\LookupUser::validateEmail($email, $user)) {
if (! \App\Models\LookupUser::validateEmail(Input::get('email'), $user)) {
return Redirect::to($userPublicId ? 'users/edit' : 'users/create')
->withError(trans('texts.email_taken'))
->withInput();

View File

@ -50,7 +50,9 @@ AccountToken::creating(function ($token)
AccountToken::deleted(function ($token)
{
LookupAccountToken::deleteWhere([
'token' => $token->token
]);
if ($token->forceDeleting) {
LookupAccountToken::deleteWhere([
'token' => $token->token
]);
}
});

View File

@ -176,7 +176,9 @@ Contact::creating(function ($contact)
Contact::deleted(function ($contact)
{
LookupContact::deleteWhere([
'contact_key' => $contact->contact_key,
]);
if ($contact->forceDeleting) {
LookupContact::deleteWhere([
'contact_key' => $contact->contact_key,
]);
}
});

View File

@ -173,7 +173,9 @@ Invitation::creating(function ($invitation)
Invitation::deleted(function ($invitation)
{
LookupInvitation::deleteWhere([
'invitation_key' => $invitation->invitation_key,
]);
if ($invitation->forceDeleting) {
LookupInvitation::deleteWhere([
'invitation_key' => $invitation->invitation_key,
]);
}
});

View File

@ -17,6 +17,7 @@ class LookupUser extends LookupModel
'lookup_account_id',
'email',
'user_id',
'confirmation_code',
];
public static function updateUser($accountKey, $userId, $email, $confirmationCode)

View File

@ -418,6 +418,7 @@ User::created(function ($user)
LookupUser::createNew($user->account->account_key, [
'email' => $user->email,
'user_id' => $user->id,
'confirmation_code' => $user->confirmation_code,
]);
});
@ -440,7 +441,9 @@ User::deleted(function ($user)
return;
}
LookupUser::deleteWhere([
'email' => $user->email
]);
if ($user->forceDeleting) {
LookupUser::deleteWhere([
'email' => $user->email
]);
}
});