diff --git a/application/Espo/Hooks/Common/NextNumber.php b/application/Espo/Hooks/Common/NextNumber.php index e509a79154..c9e48e5ceb 100644 --- a/application/Espo/Hooks/Common/NextNumber.php +++ b/application/Espo/Hooks/Common/NextNumber.php @@ -75,7 +75,10 @@ class NextNumber extends \Espo\Core\Hooks\Base 'fieldName' => $fieldName, 'entityType' => $entity->getEntityType() ))->findOne(); - if (!$nextNumber) continue; + if (!$nextNumber) { + $this->getEntityManager()->getPdo()->query('UNLOCK TABLES'); + continue; + } $entity->set($fieldName, $this->composeNumberAttribute($nextNumber)); $value = $nextNumber->get('value');