FIX: project visibility field with two option

If two option of disabled visibility are add on constant, combo is not display
This commit is contained in:
Robin 2021-04-13 10:23:05 +02:00
parent 7004747ca3
commit d6caa057f2

View File

@ -612,7 +612,18 @@ if ($action == 'create' && $user->rights->projet->creer)
$array = array();
if (empty($conf->global->PROJECT_DISABLE_PRIVATE_PROJECT)) $array[0] = $langs->trans("PrivateProject");
if (empty($conf->global->PROJECT_DISABLE_PUBLIC_PROJECT)) $array[1] = $langs->trans("SharedProject");
print $form->selectarray('public', $array, GETPOST('public') ?GETPOST('public') : $object->public, 0, 0, 0, '', 0, 0, 0, '', '', 1);
if (count($array) > 0)
{
print $form->selectarray('public', $array, GETPOSTISSET('public') ? GETPOST('public') : $object->public, 0, 0, 0, '', 0, 0, 0, '', '', 1);
}
else
{
print '<input type="hidden" name="public" id="public" value="'.(GETPOSTISSET('public') ? GETPOST('public') : $object->public).'">';
if ( (GETPOSTISSET('public') ? GETPOST('public') : $object->public)==0) print $langs->trans("PrivateProject");
else print $langs->trans("SharedProject");
}
print '</td></tr>';
// Date start
@ -886,7 +897,18 @@ if ($action == 'create' && $user->rights->projet->creer)
$array = array();
if (empty($conf->global->PROJECT_DISABLE_PRIVATE_PROJECT)) $array[0] = $langs->trans("PrivateProject");
if (empty($conf->global->PROJECT_DISABLE_PUBLIC_PROJECT)) $array[1] = $langs->trans("SharedProject");
print $form->selectarray('public', $array, $object->public, 0, 0, 0, '', 0, 0, 0, '', '', 1);
if (count($array) > 0)
{
print $form->selectarray('public', $array, $object->public, 0, 0, 0, '', 0, 0, 0, '', '', 1);
}
else
{
print '<input type="hidden" id="public" name="public" value="'.$object->public.'">';
if ($object->public==0) print $langs->trans("PrivateProject");
else print $langs->trans("SharedProject");
}
print '</td></tr>';
if (!empty($conf->global->PROJECT_USE_OPPORTUNITIES))