forked from Wavyzz/dolibarr
Manage field showoncombobox
This commit is contained in:
@@ -127,15 +127,18 @@ function rebuildObjectClass($destdir, $module, $objectname, $newmask, $readdir='
|
|||||||
{
|
{
|
||||||
$i++;
|
$i++;
|
||||||
$texttoinsert.= "\t\t'".$key."' => array('type'=>'".$val['type']."', 'label'=>'".$val['label']."',";
|
$texttoinsert.= "\t\t'".$key."' => array('type'=>'".$val['type']."', 'label'=>'".$val['label']."',";
|
||||||
$texttoinsert.= " 'visible'=>".($val['visible']!=''?$val['visible']:-1).",";
|
|
||||||
$texttoinsert.= " 'enabled'=>".($val['enabled']!=''?$val['enabled']:1).",";
|
$texttoinsert.= " 'enabled'=>".($val['enabled']!=''?$val['enabled']:1).",";
|
||||||
|
$texttoinsert.= " 'visible'=>".($val['visible']!=''?$val['visible']:-1).",";
|
||||||
$texttoinsert.= " 'position'=>".($val['position']!=''?$val['position']:50).",";
|
$texttoinsert.= " 'position'=>".($val['position']!=''?$val['position']:50).",";
|
||||||
$texttoinsert.= " 'notnull'=>".($val['notnull']!=''?$val['notnull']:-1).",";
|
$texttoinsert.= " 'notnull'=>".($val['notnull']!=''?$val['notnull']:-1).",";
|
||||||
if ($val['index']) $texttoinsert.= " 'index'=>".$val['index'].",";
|
if ($val['default']) $texttoinsert.= " 'default'=>'".$val['default']."',";
|
||||||
if ($val['searchall']) $texttoinsert.= " 'searchall'=>".$val['searchall'].",";
|
if ($val['index']) $texttoinsert.= " 'index'=>".$val['index'].",";
|
||||||
if ($val['comment']) $texttoinsert.= " 'comment'=>\"".preg_replace('/"/', '', $val['comment'])."\","; // addslashes is escape for PHP
|
if ($val['searchall']) $texttoinsert.= " 'searchall'=>".$val['searchall'].",";
|
||||||
if ($val['isameasure']) $texttoinsert.= " 'isameasure'=>'".$val['isameasure']."',";
|
if ($val['isameasure']) $texttoinsert.= " 'isameasure'=>'".$val['isameasure']."',";
|
||||||
if ($val['help']) $texttoinsert.= " 'help'=>\"".preg_replace('/"/', '', $val['help'])."\","; // addslashes is escape for PHP
|
if ($val['foreignkey']) $texttoinsert.= " 'foreignkey'=>'".$val['foreignkey']."',";
|
||||||
|
if ($val['help']) $texttoinsert.= " 'help'=>\"".preg_replace('/"/', '', $val['help'])."\",";
|
||||||
|
if ($val['comment']) $texttoinsert.= " 'comment'=>\"".preg_replace('/"/', '', $val['comment'])."\",";
|
||||||
|
if ($val['showoncombobox']) $texttoinsert.= " 'showoncombobox'=>'".$val['showoncombobox']."',";
|
||||||
if ($val['arrayofkeyval'])
|
if ($val['arrayofkeyval'])
|
||||||
{
|
{
|
||||||
$texttoinsert.= " 'arrayofkeyval'=>array(";
|
$texttoinsert.= " 'arrayofkeyval'=>array(";
|
||||||
|
|||||||
@@ -60,6 +60,7 @@ class MyObject extends CommonObject
|
|||||||
* 'enabled' is a condition when the field must be managed.
|
* '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. 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).
|
* '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.
|
* 'index' if we want an index in database.
|
||||||
* 'foreignkey'=>'tablename.field' if the field is a foreign key (it is recommanded to name the field fk_...).
|
* 'foreignkey'=>'tablename.field' if the field is a foreign key (it is recommanded to name the field fk_...).
|
||||||
* 'position' is the sort order of field.
|
* 'position' is the sort order of field.
|
||||||
@@ -67,8 +68,8 @@ class MyObject extends CommonObject
|
|||||||
* 'isameasure' must be set to 1 if you want to have a total on list for this field. Field type must be summable like integer or double(24,8).
|
* 'isameasure' must be set to 1 if you want to have a total on list for this field. Field type must be summable like integer or double(24,8).
|
||||||
* 'help' is a string visible as a tooltip on field
|
* 'help' is a string visible as a tooltip on field
|
||||||
* 'comment' is not used. You can store here any text of your choice. It is not used by application.
|
* 'comment' is not used. You can store here any text of your choice. It is not used by application.
|
||||||
* 'default' is a default value for creation (can still be replaced by the global setup of default values)
|
|
||||||
* 'showoncombobox' if value of the field must be visible into the label of the combobox that list record
|
* 'showoncombobox' if value of the field must be visible into the label of the combobox that list record
|
||||||
|
* 'arraykeyval' to set list of value if type is a list of predefined values. For example: array("0"=>"Draft","1"=>"Active","-1"=>"Cancel")
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// BEGIN MODULEBUILDER PROPERTIES
|
// BEGIN MODULEBUILDER PROPERTIES
|
||||||
@@ -79,7 +80,7 @@ class MyObject extends CommonObject
|
|||||||
'rowid' =>array('type'=>'integer', 'label'=>'TechnicalID', 'enabled'=>1, 'visible'=>-2, 'notnull'=>1, 'index'=>1, 'position'=>1, 'comment'=>'Id'),
|
'rowid' =>array('type'=>'integer', 'label'=>'TechnicalID', 'enabled'=>1, 'visible'=>-2, 'notnull'=>1, 'index'=>1, 'position'=>1, 'comment'=>'Id'),
|
||||||
'ref' =>array('type'=>'varchar(128)', 'label'=>'Ref', 'enabled'=>1, 'visible'=>1, 'notnull'=>1, 'showoncombobox'=>1, 'index'=>1, 'position'=>10, 'searchall'=>1, 'comment'=>'Reference of object'),
|
'ref' =>array('type'=>'varchar(128)', 'label'=>'Ref', 'enabled'=>1, 'visible'=>1, 'notnull'=>1, 'showoncombobox'=>1, 'index'=>1, 'position'=>10, 'searchall'=>1, 'comment'=>'Reference of object'),
|
||||||
'entity' =>array('type'=>'integer', 'label'=>'Entity', 'enabled'=>1, 'visible'=>0, 'default'=>1, 'notnull'=>1, 'index'=>1, 'position'=>20),
|
'entity' =>array('type'=>'integer', 'label'=>'Entity', 'enabled'=>1, 'visible'=>0, 'default'=>1, 'notnull'=>1, 'index'=>1, 'position'=>20),
|
||||||
'label' =>array('type'=>'varchar(255)', 'label'=>'Label', 'enabled'=>1, 'visible'=>1, 'position'=>30, 'searchall'=>1, 'css'=>'minwidth200', 'help'=>'Help text'),
|
'label' =>array('type'=>'varchar(255)', 'label'=>'Label', 'enabled'=>1, 'visible'=>1, 'position'=>30, 'searchall'=>1, 'css'=>'minwidth200', 'help'=>'Help text', 'showoncombobox'=>1),
|
||||||
'amount' =>array('type'=>'double(24,8)', 'label'=>'Amount', 'enabled'=>1, 'visible'=>1, 'default'=>'null', 'position'=>40, 'searchall'=>0, 'isameasure'=>1, 'help'=>'Help text'),
|
'amount' =>array('type'=>'double(24,8)', 'label'=>'Amount', 'enabled'=>1, 'visible'=>1, 'default'=>'null', 'position'=>40, 'searchall'=>0, 'isameasure'=>1, 'help'=>'Help text'),
|
||||||
'fk_soc' =>array('type'=>'integer:Societe:societe/class/societe.class.php', 'label'=>'ThirdParty', 'visible'=>1, 'enabled'=>1, 'position'=>50, 'notnull'=>-1, 'index'=>1, 'help'=>'LinkToThirparty'),
|
'fk_soc' =>array('type'=>'integer:Societe:societe/class/societe.class.php', 'label'=>'ThirdParty', 'visible'=>1, 'enabled'=>1, 'position'=>50, 'notnull'=>-1, 'index'=>1, 'help'=>'LinkToThirparty'),
|
||||||
'description' =>array('type'=>'text', 'label'=>'Descrption', 'enabled'=>1, 'visible'=>0, 'position'=>60),
|
'description' =>array('type'=>'text', 'label'=>'Descrption', 'enabled'=>1, 'visible'=>0, 'position'=>60),
|
||||||
|
|||||||
Reference in New Issue
Block a user