NEW Add visibility with value 4 in framework to define fields to show on

forms and list but not on creation forms.
This commit is contained in:
Laurent Destailleur 2019-03-12 17:45:19 +01:00
parent 30c327c702
commit fe6b682ec0
8 changed files with 11 additions and 12 deletions

View File

@ -72,8 +72,6 @@ include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be inclu
/*
* Actions
*
* Put here all code to do according to value of "action" parameter
*/
$parameters=array();

View File

@ -64,7 +64,7 @@ class BOM extends CommonObject
* 'type' if the field format.
* 'label' the translation key.
* 'enabled' is a condition when the field must be managed.
* 'visible' says if field is visible in list (Examples: 0=Not visible, 1=Visible on list and create/update/view forms, 2=Visible on list only. Using a negative value means field is not shown by default on list but can be selected for viewing)
* 'visible' says if field is visible in list (Examples: 0=Not visible, 1=Visible on list and create/update/view forms, 2=Visible on list only, 3=Visible on create/update/view form only (not list), 4=Visible on list and update/view form only (not create). Using a negative value means field is not shown by default on list but can be selected for viewing)
* 'notnull' is set to 1 if not null in database. Set to -1 if we must set data to null if empty ('' or 0).
* 'default' is a default value for creation (can still be replaced by the global setup of default values)
* 'index' if we want an index in database.
@ -85,7 +85,7 @@ class BOM extends CommonObject
*/
public $fields=array(
'rowid' => array('type'=>'integer', 'label'=>'TechnicalID', 'enabled'=>1, 'visible'=>-1, 'position'=>1, 'notnull'=>1, 'index'=>1, 'comment'=>"Id",),
'ref' => array('type'=>'varchar(128)', 'label'=>'Ref', 'enabled'=>1, 'visible'=>1, 'position'=>10, 'notnull'=>1, 'index'=>1, 'searchall'=>1, 'comment'=>"Reference of BOM", 'showoncombobox'=>'1',),
'ref' => array('type'=>'varchar(128)', 'label'=>'Ref', 'enabled'=>1, 'visible'=>4, 'position'=>10, 'notnull'=>1, 'index'=>1, 'searchall'=>1, 'comment'=>"Reference of BOM", 'showoncombobox'=>'1',),
'label' => array('type'=>'varchar(255)', 'label'=>'Label', 'enabled'=>1, 'visible'=>1, 'position'=>30, 'notnull'=>1, 'searchall'=>1, 'showoncombobox'=>'1',),
'description' => array('type'=>'text', 'label'=>'Description', 'enabled'=>1, 'visible'=>-1, 'position'=>60, 'notnull'=>-1,),
'note_public' => array('type'=>'html', 'label'=>'NotePublic', 'enabled'=>1, 'visible'=>-1, 'position'=>61, 'notnull'=>-1,),

View File

@ -1587,7 +1587,7 @@ function print_left_eldy_menu($db, $menu_array_before, $menu_array_after, &$tabM
$newmenu->add("/expedition/stats/index.php?leftmenu=sendings", $langs->trans("Statistics"), 1, $user->rights->expedition->lire);
}
// Receptions
// Receptions
if (! empty($conf->reception->enabled))
{
$langs->load("receptions");
@ -1611,7 +1611,7 @@ function print_left_eldy_menu($db, $menu_array_before, $menu_array_after, &$tabM
{
$langs->load("mrp");
$newmenu->add("", $langs->trans("BOM"), 0, $user->rights->service->lire, '', $mainmenu, 'service');
$newmenu->add("", $langs->trans("MenuBOM"), 0, $user->rights->service->lire, '', $mainmenu, 'service');
$newmenu->add("/bom/bom_card.php?leftmenu=bom&action=create", $langs->trans("NewBOM"), 1, $user->rights->bom->write);
$newmenu->add("/bom/bom_list.php?leftmenu=bom", $langs->trans("List"), 1, $user->rights->bom->read);
}

View File

@ -38,7 +38,7 @@ $object->fields = dol_sort_array($object->fields, 'position');
foreach($object->fields as $key => $val)
{
// Discard if extrafield is a hidden field on form
if (abs($val['visible']) != 1) continue;
if (abs($val['visible']) != 1 && abs($val['visible']) != 4) continue;
if (array_key_exists('enabled', $val) && isset($val['enabled']) && ! verifCond($val['enabled'])) continue; // We don't want this field

View File

@ -40,7 +40,7 @@ $object->fields = dol_sort_array($object->fields, 'position');
foreach($object->fields as $key => $val)
{
// Discard if extrafield is a hidden field on form
if (abs($val['visible']) != 1) continue;
if (abs($val['visible']) != 1 && abs($val['visible']) != 4) continue;
if (array_key_exists('enabled', $val) && isset($val['enabled']) && ! verifCond($val['enabled'])) continue; // We don't want this field
if (in_array($key, array('ref','status'))) continue; // Ref and status are already in dol_banner

View File

@ -76,7 +76,7 @@ ListOfMenusEntries=List of menu entries
ListOfPermissionsDefined=List of defined permissions
SeeExamples=See examples here
EnabledDesc=Condition to have this field active (Examples: 1 or $conf->global->MYMODULE_MYOPTION)
VisibleDesc=Is the field visible ? (Examples: 0=Never visible, 1=Visible on list and create/update/view forms, 2=Visible on list only, 3=Visible on create/update/view form only. Using a negative value means field is not shown by default on list but can be selected for viewing). It can be an expression, for example: preg_match('/public/', $_SERVER['PHP_SELF'])?0:1
VisibleDesc=Is the field visible ? (Examples: 0=Never visible, 1=Visible on list and create/update/view forms, 2=Visible on list only, 3=Visible on create/update/view form only (not list), 4=Visible on list and update/view form only (not create). Using a negative value means field is not shown by default on list but can be selected for viewing). It can be an expression, for example: preg_match('/public/', $_SERVER['PHP_SELF'])?0:1
IsAMeasureDesc=Can the value of field be cumulated to get a total into list? (Examples: 1 or 0)
SearchAllDesc=Is the field used to make a search from the quick search tool? (Examples: 1 or 0)
SpecDefDesc=Enter here all documentation you want to provide with your module that is not already defined by other tabs. You can use .md or better, the rich .asciidoc syntax.

View File

@ -1,6 +1,7 @@
MenuBOM=Bills Of Materials
BOMsSetup=Setup of module BOM
ListOfBOMs=List of BOMs
NewBOM=New BOM
ListOfBOMs=List of Bills Of Materials
NewBOM=New bill of material
ProductBOMHelp=Product to create with this BOM
BOMsNumberingModules=BOMs numbering templates
BOMsModelModule=BOMS document templates

View File

@ -62,7 +62,7 @@ class MyObject extends CommonObject
* 'type' if the field format.
* 'label' the translation key.
* 'enabled' is a condition when the field must be managed.
* 'visible' says if field is visible in list (Examples: 0=Not visible, 1=Visible on list and create/update/view forms, 2=Visible on list only. Using a negative value means field is not shown by default on list but can be selected for viewing)
* 'visible' says if field is visible in list (Examples: 0=Not visible, 1=Visible on list and create/update/view forms, 2=Visible on list only, 3=Visible on create/update/view form only (not list), 4=Visible on list and update/view form only (not create). Using a negative value means field is not shown by default on list but can be selected for viewing)
* 'notnull' is set to 1 if not null in database. Set to -1 if we must set data to null if empty ('' or 0).
* 'default' is a default value for creation (can still be replaced by the global setup of default values)
* 'index' if we want an index in database.