Merge pull request #17245 from Robin-Yann/13-fix-project-visibility-field

FIX: project visibility field with two option
This commit is contained in:
Laurent Destailleur 2021-04-13 15:40:04 +02:00 committed by GitHub
commit 6b542a89f6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

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,11 +897,21 @@ 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))
{
if (!empty($conf->global->PROJECT_USE_OPPORTUNITIES)) {
$classfortr = ($object->usage_opportunity ? '' : ' hideobject');
// Opportunity status
print '<tr class="classuseopportunity'.$classfortr.'"><td>'.$langs->trans("OpportunityStatus").'</td>';