Fix opp statusbrequires even if PROJECT_USE_OPPORTUNITIES off

If I modify a project and do not have PROJECT_USE_OPPORTUNITIES enabled, I cannot change the project budget. I get the error message that ErrorOppStatusRequiredIfAmount. However, I do not have the opportunities enabled and it does not make sense for that message to appear when I have not added any opportunities.
This commit is contained in:
laurantines 2021-07-28 16:14:38 +02:00 committed by GitHub
parent ae2866ccd7
commit f8563ace0d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -136,9 +136,11 @@ if (empty($reshook)) {
$error++;
}
if (GETPOST('opp_amount') != '' && !(GETPOST('opp_status') > 0)) {
$error++;
setEventMessages($langs->trans("ErrorOppStatusRequiredIfAmount"), null, 'errors');
if (!empty($conf->global->PROJECT_USE_OPPORTUNITIES)) {
if (GETPOST('opp_amount') != '' && !(GETPOST('opp_status') > 0)) {
$error++;
setEventMessages($langs->trans("ErrorOppStatusRequiredIfAmount"), null, 'errors');
}
}
// Create with status validated immediatly
@ -274,9 +276,11 @@ if (empty($reshook)) {
}
}
if ($object->opp_amount && ($object->opp_status <= 0)) {
$error++;
setEventMessages($langs->trans("ErrorOppStatusRequiredIfAmount"), null, 'errors');
if (!empty($conf->global->PROJECT_USE_OPPORTUNITIES)) {
if ($object->opp_amount && ($object->opp_status <= 0)) {
$error++;
setEventMessages($langs->trans("ErrorOppStatusRequiredIfAmount"), null, 'errors');
}
}
if (!$error) {