FIX: fix checkbox displayed according to module project setup parameters

This commit is contained in:
Robin 2021-03-18 11:07:48 +01:00 committed by Robin
parent a29a9e5435
commit d852816101
10 changed files with 436 additions and 401 deletions

View File

@ -550,6 +550,8 @@ if ($action == 'create' && $user->rights->projet->creer)
print '<tr><td><span class="fieldrequired">'.$langs->trans("Label").'</span></td><td><input class="minwidth500" type="text" name="title" value="'.dol_escape_htmltag(GETPOST("title", 'none')).'" autofocus></td></tr>';
// Usage (opp, task, bill time, ...)
if (!empty($conf->global->PROJECT_USE_OPPORTUNITIES) || empty($conf->global->PROJECT_HIDE_TASKS))
{
print '<tr><td class="tdtop">';
print $langs->trans("Usage");
print '</td>';
@ -594,6 +596,7 @@ if ($action == 'create' && $user->rights->projet->creer)
print $form->textwithpicto($langs->trans("OrganizeEvent"), $htmltext);*/
print '</td>';
print '</tr>';
}
// Thirdparty
if ($conf->societe->enabled)
@ -841,6 +844,8 @@ elseif ($object->id > 0)
print '</td></tr>';
// Usage
if (!empty($conf->global->PROJECT_USE_OPPORTUNITIES) || empty($conf->global->PROJECT_HIDE_TASKS))
{
print '<tr><td class="tdtop">';
print $langs->trans("Usage");
print '</td>';
@ -880,6 +885,7 @@ elseif ($object->id > 0)
print '<br>';
}
print '</td></tr>';
}
// Thirdparty
if ($conf->societe->enabled)
@ -1022,6 +1028,8 @@ elseif ($object->id > 0)
print '<table class="border tableforfield" width="100%">';
// Usage
if (!empty($conf->global->PROJECT_USE_OPPORTUNITIES) || empty($conf->global->PROJECT_HIDE_TASKS))
{
print '<tr><td class="tdtop">';
print $langs->trans("Usage");
print '</td>';
@ -1040,7 +1048,7 @@ elseif ($object->id > 0)
print $form->textwithpicto($langs->trans("ProjectFollowTasks"), $htmltext);
print '<br>';
}
if (!empty($conf->global->PROJECT_BILL_TIME_SPENT))
if (empty($conf->global->PROJECT_HIDE_TASKS) && !empty($conf->global->PROJECT_BILL_TIME_SPENT))
{
print '<input type="checkbox" disabled name="usage_bill_time"' . (GETPOSTISSET('usage_bill_time') ? (GETPOST('usage_bill_time', 'alpha') != '' ? ' checked="checked"' : '') : ($object->usage_bill_time ? ' checked="checked"' : '')) . '"> ';
$htmltext = $langs->trans("ProjectBillTimeDescription");
@ -1048,6 +1056,7 @@ elseif ($object->id > 0)
print '<br>';
}
print '</td></tr>';
}
// Visibility
print '<tr><td class="titlefield">'.$langs->trans("Visibility").'</td><td>';

View File

@ -184,6 +184,8 @@ if ($id > 0 || !empty($ref))
print '<table class="border tableforfield centpercent">';
// Usage
if (!empty($conf->global->PROJECT_USE_OPPORTUNITIES) || empty($conf->global->PROJECT_HIDE_TASKS))
{
print '<tr><td class="tdtop">';
print $langs->trans("Usage");
print '</td>';
@ -202,7 +204,7 @@ if ($id > 0 || !empty($ref))
print $form->textwithpicto($langs->trans("ProjectFollowTasks"), $htmltext);
print '<br>';
}
if (!empty($conf->global->PROJECT_BILL_TIME_SPENT))
if (empty($conf->global->PROJECT_HIDE_TASKS) && !empty($conf->global->PROJECT_BILL_TIME_SPENT))
{
print '<input type="checkbox" disabled name="usage_bill_time"'.(GETPOSTISSET('usage_bill_time') ? (GETPOST('usage_bill_time', 'alpha') != '' ? ' checked="checked"' : '') : ($object->usage_bill_time ? ' checked="checked"' : '')).'"> ';
$htmltext = $langs->trans("ProjectBillTimeDescription");
@ -210,7 +212,7 @@ if ($id > 0 || !empty($ref))
print '<br>';
}
print '</td></tr>';
}
// Visibility
print '<tr><td class="titlefield">'.$langs->trans("Visibility").'</td><td>';
if ($object->public) print $langs->trans('SharedProject');

View File

@ -163,6 +163,8 @@ print '<div class="underbanner clearboth"></div>';
print '<table class="border tableforfield centpercent">';
// Usage
if (!empty($conf->global->PROJECT_USE_OPPORTUNITIES) || empty($conf->global->PROJECT_HIDE_TASKS))
{
print '<tr><td class="tdtop">';
print $langs->trans("Usage");
print '</td>';
@ -181,7 +183,7 @@ if (empty($conf->global->PROJECT_HIDE_TASKS))
print $form->textwithpicto($langs->trans("ProjectFollowTasks"), $htmltext);
print '<br>';
}
if (!empty($conf->global->PROJECT_BILL_TIME_SPENT))
if (empty($conf->global->PROJECT_HIDE_TASKS) && !empty($conf->global->PROJECT_BILL_TIME_SPENT))
{
print '<input type="checkbox" disabled name="usage_bill_time"'.(GETPOSTISSET('usage_bill_time') ? (GETPOST('usage_bill_time', 'alpha') != '' ? ' checked="checked"' : '') : ($object->usage_bill_time ? ' checked="checked"' : '')).'"> ';
$htmltext = $langs->trans("ProjectBillTimeDescription");
@ -189,6 +191,7 @@ if (!empty($conf->global->PROJECT_BILL_TIME_SPENT))
print '<br>';
}
print '</td></tr>';
}
// Visibility
print '<tr><td class="titlefield">'.$langs->trans("Visibility").'</td><td>';

View File

@ -409,6 +409,8 @@ if ($id > 0 || !empty($ref))
print '<table class="border tableforfield" width="100%">';
// Usage
if (!empty($conf->global->PROJECT_USE_OPPORTUNITIES) || empty($conf->global->PROJECT_HIDE_TASKS))
{
print '<tr><td class="tdtop">';
print $langs->trans("Usage");
print '</td>';
@ -427,7 +429,7 @@ if ($id > 0 || !empty($ref))
print $form->textwithpicto($langs->trans("ProjectFollowTasks"), $htmltext);
print '<br>';
}
if (!empty($conf->global->PROJECT_BILL_TIME_SPENT))
if (empty($conf->global->PROJECT_HIDE_TASKS) && !empty($conf->global->PROJECT_BILL_TIME_SPENT))
{
print '<input type="checkbox" disabled name="usage_bill_time"'.(GETPOSTISSET('usage_bill_time') ? (GETPOST('usage_bill_time', 'alpha') != '' ? ' checked="checked"' : '') : ($object->usage_bill_time ? ' checked="checked"' : '')).'"> ';
$htmltext = $langs->trans("ProjectBillTimeDescription");
@ -435,6 +437,7 @@ if ($id > 0 || !empty($ref))
print '<br>';
}
print '</td></tr>';
}
// Visibility
print '<tr><td class="titlefield">'.$langs->trans("Visibility").'</td><td>';

View File

@ -151,6 +151,8 @@ if ($id > 0 || !empty($ref))
print '<table class="border centpercent">';
// Usage
if (!empty($conf->global->PROJECT_USE_OPPORTUNITIES) || empty($conf->global->PROJECT_HIDE_TASKS))
{
print '<tr><td class="tdtop">';
print $langs->trans("Usage");
print '</td>';
@ -169,7 +171,7 @@ if ($id > 0 || !empty($ref))
print $form->textwithpicto($langs->trans("ProjectFollowTasks"), $htmltext);
print '<br>';
}
if (!empty($conf->global->PROJECT_BILL_TIME_SPENT))
if (empty($conf->global->PROJECT_HIDE_TASKS) && !empty($conf->global->PROJECT_BILL_TIME_SPENT))
{
print '<input type="checkbox" disabled name="usage_bill_time"'.(GETPOSTISSET('usage_bill_time') ? (GETPOST('usage_bill_time', 'alpha') != '' ? ' checked="checked"' : '') : ($projectstatic->usage_bill_time ? ' checked="checked"' : '')).'"> ';
$htmltext = $langs->trans("ProjectBillTimeDescription");
@ -177,6 +179,7 @@ if ($id > 0 || !empty($ref))
print '<br>';
}
print '</td></tr>';
}
// Visibility
print '<tr><td class="titlefield">'.$langs->trans("Visibility").'</td><td>';

View File

@ -223,6 +223,8 @@ if ($id > 0 || !empty($ref))
print '<table class="border tableforfield centpercent">';
// Usage
if (!empty($conf->global->PROJECT_USE_OPPORTUNITIES) || empty($conf->global->PROJECT_HIDE_TASKS))
{
print '<tr><td class="tdtop">';
print $langs->trans("Usage");
print '</td>';
@ -241,7 +243,7 @@ if ($id > 0 || !empty($ref))
print $form->textwithpicto($langs->trans("ProjectFollowTasks"), $htmltext);
print '<br>';
}
if (!empty($conf->global->PROJECT_BILL_TIME_SPENT))
if (empty($conf->global->PROJECT_HIDE_TASKS) && !empty($conf->global->PROJECT_BILL_TIME_SPENT))
{
print '<input type="checkbox" disabled name="usage_bill_time"'.(GETPOSTISSET('usage_bill_time') ? (GETPOST('usage_bill_time', 'alpha') != '' ? ' checked="checked"' : '') : ($projectstatic->usage_bill_time ? ' checked="checked"' : '')).'"> ';
$htmltext = $langs->trans("ProjectBillTimeDescription");
@ -249,6 +251,7 @@ if ($id > 0 || !empty($ref))
print '<br>';
}
print '</td></tr>';
}
// Visibility
print '<tr><td class="titlefield">'.$langs->trans("Visibility").'</td><td>';

View File

@ -167,6 +167,8 @@ if ($object->id > 0)
print '<table class="border tableforfield centpercent">';
// Usage
if (!empty($conf->global->PROJECT_USE_OPPORTUNITIES) || empty($conf->global->PROJECT_HIDE_TASKS))
{
print '<tr><td class="tdtop">';
print $langs->trans("Usage");
print '</td>';
@ -185,7 +187,7 @@ if ($object->id > 0)
print $form->textwithpicto($langs->trans("ProjectFollowTasks"), $htmltext);
print '<br>';
}
if (!empty($conf->global->PROJECT_BILL_TIME_SPENT))
if (empty($conf->global->PROJECT_HIDE_TASKS) && !empty($conf->global->PROJECT_BILL_TIME_SPENT))
{
print '<input type="checkbox" disabled name="usage_bill_time"'.(GETPOSTISSET('usage_bill_time') ? (GETPOST('usage_bill_time', 'alpha') != '' ? ' checked="checked"' : '') : ($projectstatic->usage_bill_time ? ' checked="checked"' : '')).'"> ';
$htmltext = $langs->trans("ProjectBillTimeDescription");
@ -193,6 +195,7 @@ if ($object->id > 0)
print '<br>';
}
print '</td></tr>';
}
// Visibility
print '<tr><td class="titlefield">'.$langs->trans("Visibility").'</td><td>';

View File

@ -146,6 +146,8 @@ if ($object->id > 0)
print '<table class="border tableforfield centpercent">';
// Usage
if (!empty($conf->global->PROJECT_USE_OPPORTUNITIES) || empty($conf->global->PROJECT_HIDE_TASKS))
{
print '<tr><td class="tdtop">';
print $langs->trans("Usage");
print '</td>';
@ -164,7 +166,7 @@ if ($object->id > 0)
print $form->textwithpicto($langs->trans("ProjectFollowTasks"), $htmltext);
print '<br>';
}
if (!empty($conf->global->PROJECT_BILL_TIME_SPENT))
if (empty($conf->global->PROJECT_HIDE_TASKS) && !empty($conf->global->PROJECT_BILL_TIME_SPENT))
{
print '<input type="checkbox" disabled name="usage_bill_time"'.(GETPOSTISSET('usage_bill_time') ? (GETPOST('usage_bill_time', 'alpha') != '' ? ' checked="checked"' : '') : ($projectstatic->usage_bill_time ? ' checked="checked"' : '')).'"> ';
$htmltext = $langs->trans("ProjectBillTimeDescription");
@ -172,6 +174,7 @@ if ($object->id > 0)
print '<br>';
}
print '</td></tr>';
}
// Visibility
print '<tr><td class="titlefield">'.$langs->trans("Visibility").'</td><td>';

View File

@ -261,6 +261,8 @@ if ($id > 0 || !empty($ref))
print '<table class="border tableforfield centpercent">';
// Usage
if (!empty($conf->global->PROJECT_USE_OPPORTUNITIES) || empty($conf->global->PROJECT_HIDE_TASKS))
{
print '<tr><td class="tdtop">';
print $langs->trans("Usage");
print '</td>';
@ -279,7 +281,7 @@ if ($id > 0 || !empty($ref))
print $form->textwithpicto($langs->trans("ProjectFollowTasks"), $htmltext);
print '<br>';
}
if (!empty($conf->global->PROJECT_BILL_TIME_SPENT))
if (empty($conf->global->PROJECT_HIDE_TASKS) && !empty($conf->global->PROJECT_BILL_TIME_SPENT))
{
print '<input type="checkbox" disabled name="usage_bill_time"'.(GETPOSTISSET('usage_bill_time') ? (GETPOST('usage_bill_time', 'alpha') != '' ? ' checked="checked"' : '') : ($projectstatic->usage_bill_time ? ' checked="checked"' : '')).'"> ';
$htmltext = $langs->trans("ProjectBillTimeDescription");
@ -287,6 +289,7 @@ if ($id > 0 || !empty($ref))
print '<br>';
}
print '</td></tr>';
}
// Visibility
print '<tr><td class="titlefield">'.$langs->trans("Visibility").'</td><td>';

View File

@ -656,6 +656,8 @@ if (($id > 0 || !empty($ref)) || $projectidforalltimes > 0)
print '<table class="border tableforfield centpercent">';
// Usage
if (!empty($conf->global->PROJECT_USE_OPPORTUNITIES) || empty($conf->global->PROJECT_HIDE_TASKS))
{
print '<tr><td class="tdtop">';
print $langs->trans("Usage");
print '</td>';
@ -674,7 +676,7 @@ if (($id > 0 || !empty($ref)) || $projectidforalltimes > 0)
print $form->textwithpicto($langs->trans("ProjectFollowTasks"), $htmltext);
print '<br>';
}
if (!empty($conf->global->PROJECT_BILL_TIME_SPENT))
if (empty($conf->global->PROJECT_HIDE_TASKS) && !empty($conf->global->PROJECT_BILL_TIME_SPENT))
{
print '<input type="checkbox" disabled name="usage_bill_time"'.(GETPOSTISSET('usage_bill_time') ? (GETPOST('usage_bill_time', 'alpha') != '' ? ' checked="checked"' : '') : ($projectstatic->usage_bill_time ? ' checked="checked"' : '')).'"> ';
$htmltext = $langs->trans("ProjectBillTimeDescription");
@ -682,6 +684,7 @@ if (($id > 0 || !empty($ref)) || $projectidforalltimes > 0)
print '<br>';
}
print '</td></tr>';
}
// Visibility
print '<tr><td class="titlefield">'.$langs->trans("Visibility").'</td><td>';