Merge pull request #18272 from laurantines/patch-3

Fix opp status required even if PROJECT_USE_OPPORTUNITIES off
This commit is contained in:
Laurent Destailleur 2021-07-28 18:57:03 +02:00 committed by GitHub
commit fea4210570
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) {