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

Fix for duplicate public ids/keys

This commit is contained in:
Hillel Coren 2017-07-02 16:28:29 +03:00
parent 5e3267a5e4
commit a908e75757

View File

@ -396,6 +396,13 @@ class EntityModel extends Eloquent
$nextId = static::getNextPublicId($this->account_id);
if ($nextId != $this->public_id) {
$this->public_id = $nextId;
if (env('MULTI_DB_ENABLED')) {
if ($this->contact_key) {
$this->contact_key = strtolower(str_random(RANDOM_KEY_LENGTH));
} elseif ($this->invitation_key) {
$this->invitation_key = strtolower(str_random(RANDOM_KEY_LENGTH));
}
}
return $this->save($options);
}
}