display a warning instead of an error if the project_id is a duplicate

This commit is contained in:
Marc Michalsky 2023-08-17 10:41:45 +02:00 committed by Jens Schuppe
parent 96c072eb8e
commit 8d1d93d77a
2 changed files with 8 additions and 2 deletions

View file

@ -568,7 +568,13 @@ class CRM_Twingle_Form_Profile extends CRM_Core_Form {
$profile->validate();
}
catch (ProfileValidationError $e) {
$this->setElementError($e->getAffectedFieldName(), $e->getMessage());
switch ($e->getErrorCode()) {
case ProfileValidationError::ERROR_CODE_PROFILE_VALIDATION_FAILED:
$this->setElementError($e->getAffectedFieldName(), $e->getMessage());
break;
case ProfileValidationError::ERROR_CODE_PROFILE_VALIDATION_WARNING:
CRM_Core_Session::setStatus($e->getMessage(), E::ts('Warning'));
}
}
}