Fix show property "enabled" of extrafields

This commit is contained in:
Laurent Destailleur 2021-02-10 00:18:00 +01:00
parent 33a4355743
commit afeeb40e2e
3 changed files with 15 additions and 1 deletions

View File

@ -169,6 +169,7 @@ $totalizable = $extrafields->attributes[$elementtype]['totalizable'][$attrname];
$help = $extrafields->attributes[$elementtype]['help'][$attrname]; $help = $extrafields->attributes[$elementtype]['help'][$attrname];
$entitycurrentorall = $extrafields->attributes[$elementtype]['entityid'][$attrname]; $entitycurrentorall = $extrafields->attributes[$elementtype]['entityid'][$attrname];
$printable = $extrafields->attributes[$elementtype]['printable'][$attrname]; $printable = $extrafields->attributes[$elementtype]['printable'][$attrname];
$enabled = $extrafields->attributes[$elementtype]['enabled'][$attrname];
if ((($type == 'select') || ($type == 'checkbox') || ($type == 'radio')) && is_array($param)) if ((($type == 'select') || ($type == 'checkbox') || ($type == 'radio')) && is_array($param))
{ {
@ -299,6 +300,14 @@ if (in_array($type, array_keys($typewecanchangeinto)))
<!-- Multicompany entity --> <!-- Multicompany entity -->
<tr><td><?php echo $langs->trans("AllEntities"); ?></td><td class="valeur"><input id="entitycurrentorall" type="checkbox" name="entitycurrentorall"<?php echo (empty($entitycurrentorall) ? ' checked' : ''); ?>></td></tr> <tr><td><?php echo $langs->trans("AllEntities"); ?></td><td class="valeur"><input id="entitycurrentorall" type="checkbox" name="entitycurrentorall"<?php echo (empty($entitycurrentorall) ? ' checked' : ''); ?>></td></tr>
<?php } ?> <?php } ?>
<!-- Show Enabled property when value is not a common value -->
<?php if ($enabled != '1') { ?>
<tr class="help"><td><?php echo $langs->trans("EnabledCondition"); ?></td><td class="valeur">
<?php echo dol_escape_htmltag($enabled); ?>
<?php } ?>
</td></tr>
</table> </table>
<?php print dol_get_fiche_end(); ?> <?php print dol_get_fiche_end(); ?>

View File

@ -76,6 +76,11 @@ if (is_array($extrafields->attributes[$elementtype]['type']) && count($extrafiel
{ {
foreach ($extrafields->attributes[$elementtype]['type'] as $key => $value) foreach ($extrafields->attributes[$elementtype]['type'] as $key => $value)
{ {
/*if (! dol_eval($extrafields->attributes[$elementtype]['enabled'][$key], 1)) {
// TODO Uncomment this to exclude extrafields of modules not enabled. Add a link to "Show extrafields disabled"
// continue;
}*/
// Load language if required // Load language if required
if (!empty($extrafields->attributes[$elementtype]['langfile'][$key])) { if (!empty($extrafields->attributes[$elementtype]['langfile'][$key])) {
$langs->load($extrafields->attributes[$elementtype]['langfile'][$key]); $langs->load($extrafields->attributes[$elementtype]['langfile'][$key]);