Add hidden option MAIN_CAN_HIDE_EXTRAFIELDS to disable a feature that

seems useless.
This commit is contained in:
Laurent Destailleur 2016-02-06 12:26:12 +01:00
parent cb66448148
commit 2e1011ca0c
4 changed files with 13 additions and 8 deletions

View File

@ -117,9 +117,11 @@
<!-- Required -->
<tr><td><?php echo $langs->trans("Required"); ?></td><td class="valeur"><input id="required" type="checkbox" name="required" <?php echo (GETPOST('required')?' checked':''); ?>></td></tr>
<!-- Always editable -->
<tr><td><?php echo $langs->trans("AlwaysEditable"); ?></td><td class="valeur"><input id="alwayseditable" type="checkbox" name="alwayseditable" <?php echo (GETPOST('alwayseditable')?' checked':''); ?>></td></tr>
<tr><td><?php echo $langs->trans("AlwaysEditable"); ?></td><td class="valeur"><input id="alwayseditable" type="checkbox" name="alwayseditable" <?php echo ((GETPOST('alwayseditable') || ! GETPOST('button'))?' checked':''); ?>></td></tr>
<!-- Is visible or not -->
<tr><td><?php echo $langs->trans("IsHidden"); ?></td><td class="valeur"><input id="ishidden" type="checkbox" name="ishidden" <?php echo (GETPOST('ishidden') ?' checked':''); ?>></td></tr>
<?php if (! empty($conf->global->MAIN_CAN_HIDE_EXTRAFIELDS)) { ?>
<tr><td><?php echo $langs->trans("Hidden"); ?></td><td class="valeur"><input id="ishidden" type="checkbox" name="ishidden" <?php echo (GETPOST('ishidden') ?' checked' : ''); ?>></td></tr>
<?php } ?>
<?php if ($conf->global->MAIN_FEATURES_LEVEL >= 2) { ?>
<!-- By default visible into list -->
<tr><td><?php echo $langs->trans("ByDefaultInList"); ?>

View File

@ -119,7 +119,11 @@ if(($type == 'select') || ($type == 'sellist') || ($type == 'checkbox') || ($typ
<!-- Always editable -->
<tr><td><?php echo $langs->trans("AlwaysEditable"); ?></td><td class="valeur"><input id="alwayseditable" type="checkbox" name="alwayseditable" <?php echo ($alwayseditable?' checked':''); ?>></td></tr>
<!-- Is visible or not -->
<tr><td><?php echo $langs->trans("IsHidden"); ?></td><td class="valeur"><input id="ishidden" type="checkbox" name="ishidden" <?php echo ($ishidden ?' checked':''); ?>></td></tr>
<?php if (! empty($conf->global->MAIN_CAN_HIDE_EXTRAFIELDS)) { ?>
<tr><td><?php echo $langs->trans("Hidden"); ?></td><td class="valeur"><input id="ishidden" type="checkbox" name="ishidden" <?php echo ($ishidden ?' checked':''); ?>></td></tr>
<?php } else {
print '<input id="ishidden" type="hidden" name="ishidden" value="'.($ishidden?1:0).'">';
}?>
<!-- By default visible into list -->
<?php if ($conf->global->MAIN_FEATURES_LEVEL >= 2) { ?>
<tr><td><?php echo $langs->trans("ByDefaultInList"); ?>

View File

@ -44,7 +44,7 @@ print '<td align="right">'.$langs->trans("Size").'</td>';
print '<td align="center">'.$langs->trans("Unique").'</td>';
print '<td align="center">'.$langs->trans("Required").'</td>';
print '<td align="center">'.$langs->trans("AlwaysEditable").'</td>';
print '<td align="center">'.$langs->trans("IsHidden").'</td>';
if (! empty($conf->global->MAIN_CAN_HIDE_EXTRAFIELDS)) print '<td align="center">'.$langs->trans("Hidden").'</td>';
print '<td width="80">&nbsp;</td>';
print "</tr>\n";
@ -61,11 +61,10 @@ foreach($extrafields->attribute_type as $key => $value)
print '<td align="center">'.yn($extrafields->attribute_unique[$key])."</td>\n";
print '<td align="center">'.yn($extrafields->attribute_required[$key])."</td>\n";
print '<td align="center">'.yn($extrafields->attribute_alwayseditable[$key])."</td>\n";
print '<td align="center">'.yn($extrafields->attribute_hidden[$key])."</td>\n";
if (! empty($conf->global->MAIN_CAN_HIDE_EXTRAFIELDS)) print '<td align="center">'.yn($extrafields->attribute_hidden[$key])."</td>\n"; // Add hidden option on not working feature. Why hide if user can't see it.
print '<td align="right"><a href="'.$_SERVER["PHP_SELF"].'?action=edit&attrname='.$key.'">'.img_edit().'</a>';
print "&nbsp; <a href=\"".$_SERVER["PHP_SELF"]."?action=delete&attrname=$key\">".img_delete()."</a></td>\n";
print "</tr>";
// $i++;
}
print "</table>";

View File

@ -33,6 +33,6 @@ create table llx_extrafields
pos integer DEFAULT 0,
alwayseditable integer DEFAULT 0, -- 1 if field can be edited whatever is element status
param text, -- extra parameters to define possible values of field
list integer DEFAULT 0 -- list of values for field that are combo lists
,ishidden integer DEFAULT 0
list integer DEFAULT 0, -- list of values for field that are combo lists
ishidden integer DEFAULT 0 -- ??? example of use case ???
)ENGINE=innodb;