FIX: still prevent project creation if PROJECTLEADER role unavailable, but with a specific error message

This commit is contained in:
Marc de Lima Lucio 2022-03-08 15:07:02 +01:00
parent 7239fa3605
commit f837845c12
2 changed files with 6 additions and 2 deletions

View File

@ -267,4 +267,5 @@ NewInvoice=New invoice
OneLinePerTask=One line per task
OneLinePerPeriod=One line per period
RefTaskParent=Ref. Parent Task
ProfitIsCalculatedWith=Profit is calculated using
ProfitIsCalculatedWith=Profit is calculated using
ErrorPROJECTLEADERRoleMissingOrDeActivatedPleaseRestoreItInContactTypesDictionary=The "PROJECTLEADER" role is missing or has been de-activited, please restore in the dictionary of contact types

View File

@ -178,7 +178,10 @@ if (empty($reshook))
$result = $object->add_contact($user->id, $typeofcontact, 'internal');
// -3 means type not found (PROJECTLEADER renamed, de-activated or deleted), so don't prevent creation if it has been the case
if ($result < 0 && $result != -3) {
if ($result == -3) {
setEventMessage('ErrorPROJECTLEADERRoleMissingOrDeActivatedPleaseRestoreItInContactTypesDictionary', 'errors');
$error++;
} elseif ($result < 0) {
$langs->load("errors");
setEventMessages($object->error, $object->errors, 'errors');
$error++;