diff --git a/htdocs/contrat/admin/contract_extrafields.php b/htdocs/contrat/admin/contract_extrafields.php
index abfc2b2b65d..8a0476fb674 100644
--- a/htdocs/contrat/admin/contract_extrafields.php
+++ b/htdocs/contrat/admin/contract_extrafields.php
@@ -95,7 +95,7 @@ if ($action != 'create' && $action != 'edit')
if ($action == 'create')
{
- print "
";
+ print '
';
print load_fiche_titre($langs->trans('NewAttribute'));
require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_add.tpl.php';
@@ -108,7 +108,7 @@ if ($action == 'create')
/* ************************************************************************** */
if ($action == 'edit' && ! empty($attrname))
{
- print "
";
+ print '
';
print load_fiche_titre($langs->trans("FieldEdition", $attrname));
require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_edit.tpl.php';
diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php
index c510c29a101..5c7c692a1dc 100644
--- a/htdocs/core/class/commonobject.class.php
+++ b/htdocs/core/class/commonobject.class.php
@@ -4761,12 +4761,17 @@ abstract class CommonObject
$objectid = $this->id;
- $label=$val['label'];
- $type =$val['type'];
- $size =$val['css'];
+ $label= $val['label'];
+ $type = $val['type'];
+ $size = $val['css'];
// Convert var to be able to share same code than showInputField of extrafields
- if (preg_match('/varchar/', $type)) $type = 'varchar'; // convert varchar(xx) int varchar
+ if (preg_match('/varchar\((\d+)\)/', $type, $reg))
+ {
+ $type = 'varchar'; // convert varchar(xx) int varchar
+ $size = $reg[1];
+ }
+ elseif (preg_match('/varchar/', $type)) $type = 'varchar'; // convert varchar(xx) int varchar
if (is_array($val['arrayofkeyval'])) $type='select';
if (preg_match('/^integer:(.*):(.*)/i', $val['type'], $reg)) $type='link';
@@ -4835,6 +4840,7 @@ abstract class CommonObject
}
}
}
+ //var_dump($showsize.' '.$size);
if (in_array($type,array('date','datetime')))
{
@@ -4864,6 +4870,12 @@ abstract class CommonObject
$out='';
}
elseif ($type == 'text')
+ {
+ require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
+ $doleditor=new DolEditor($keyprefix.$key.$keysuffix,$value,'',200,'dolibarr_notes','In',false,false,0,ROWS_5,'90%');
+ $out=$doleditor->Create(1);
+ }
+ elseif ($type == 'html')
{
require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
$doleditor=new DolEditor($keyprefix.$key.$keysuffix,$value,'',200,'dolibarr_notes','In',false,false,! empty($conf->fckeditor->enabled) && $conf->global->FCKEDITOR_ENABLE_SOCIETE,ROWS_5,'90%');
@@ -5287,12 +5299,17 @@ abstract class CommonObject
}
$objectid = $this->id;
- $label=$val['label'];
- $type =$val['type'];
- $size =$val['css'];
+ $label = $val['label'];
+ $type = $val['type'];
+ $size = $val['css'];
// Convert var to be able to share same code than showOutputField of extrafields
- if (preg_match('/varchar/', $type)) $type = 'varchar'; // convert varchar(xx) int varchar
+ if (preg_match('/varchar\((\d+)\)/', $type, $reg))
+ {
+ $type = 'varchar'; // convert varchar(xx) int varchar
+ $size = $reg[1];
+ }
+ elseif (preg_match('/varchar/', $type)) $type = 'varchar'; // convert varchar(xx) int varchar
if (is_array($val['arrayofkeyval'])) $type='select';
if (preg_match('/^integer:(.*):(.*)/i', $val['type'], $reg)) $type='link';
@@ -5327,20 +5344,42 @@ abstract class CommonObject
{
if ($type == 'date')
{
- $showsize=10;
+ //$showsize=10;
+ $showsize = 'minwidth100imp';
}
elseif ($type == 'datetime')
{
- $showsize=19;
+ //$showsize=19;
+ $showsize = 'minwidth200imp';
}
- elseif ($type == 'int' || $type == 'integer')
+ elseif (in_array($type,array('int','double','price')))
{
- $showsize=10;
+ //$showsize=10;
+ $showsize = 'maxwidth75';
+ }
+ elseif ($type == 'url')
+ {
+ $showsize='minwidth400';
+ }
+ elseif ($type == 'boolean')
+ {
+ $showsize='';
}
else
{
- $showsize=round($size);
- if ($showsize > 48) $showsize=48;
+ if (round($size) < 12)
+ {
+ $showsize = 'minwidth100';
+ }
+ else if (round($size) <= 48)
+ {
+ $showsize = 'minwidth200';
+ }
+ else
+ {
+ //$showsize=48;
+ $showsize = 'minwidth400';
+ }
}
}
@@ -5581,7 +5620,7 @@ abstract class CommonObject
}
}
}
- elseif ($type == 'text')
+ elseif ($type == 'text' || $type == 'html')
{
$value=dol_htmlentitiesbr($value);
}
diff --git a/htdocs/core/tpl/commonfields_add.tpl.php b/htdocs/core/tpl/commonfields_add.tpl.php
index f6aebd6357c..7179719e7db 100644
--- a/htdocs/core/tpl/commonfields_add.tpl.php
+++ b/htdocs/core/tpl/commonfields_add.tpl.php
@@ -35,14 +35,14 @@ foreach($object->fields as $key => $val)
print '';
print $langs->trans($val['label']);
print ' | ';
print '';
if (in_array($val['type'], array('int', 'integer'))) $value = GETPOST($key, 'int');
- elseif ($val['type'] == 'text') $value = GETPOST($key, 'none');
+ elseif ($val['type'] == 'text' || $val['type'] == 'html') $value = GETPOST($key, 'none');
else $value = GETPOST($key, 'alpha');
print $object->showInputField($val, $key, $value, '', '', '', 0);
print ' | ';
diff --git a/htdocs/core/tpl/commonfields_edit.tpl.php b/htdocs/core/tpl/commonfields_edit.tpl.php
index 248cd4b4086..9605a218544 100644
--- a/htdocs/core/tpl/commonfields_edit.tpl.php
+++ b/htdocs/core/tpl/commonfields_edit.tpl.php
@@ -34,13 +34,14 @@ foreach($object->fields as $key => $val)
print '| '.$langs->trans($val['label']).' | ';
print '';
if (in_array($val['type'], array('int', 'integer'))) $value = GETPOSTISSET($key)?GETPOST($key, 'int'):$object->$key;
- elseif ($val['type'] == 'text') $value = GETPOSTISSET($key)?GETPOST($key,'none'):$object->$key;
+ elseif ($val['type'] == 'text' || $val['type'] == 'html') $value = GETPOSTISSET($key)?GETPOST($key,'none'):$object->$key;
else $value = GETPOSTISSET($key)?GETPOST($key, 'alpha'):$object->$key;
+ //var_dump($val.' '.$key.' '.$value);
print $object->showInputField($val, $key, $value, '', '', '', 0);
print ' | ';
print '
';
diff --git a/htdocs/modulebuilder/template/class/myobject.class.php b/htdocs/modulebuilder/template/class/myobject.class.php
index affda50a617..c5ae70a24f3 100644
--- a/htdocs/modulebuilder/template/class/myobject.class.php
+++ b/htdocs/modulebuilder/template/class/myobject.class.php
@@ -78,8 +78,9 @@ class MyObject extends CommonObject
'label' =>array('type'=>'varchar(255)', 'label'=>'Label', 'enabled'=>1, 'visible'=>1, 'position'=>30, 'searchall'=>1, 'css'=>'minwidth200', '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, 'searchall'=>1, 'help'=>'LinkToThirparty'),
- 'note_public' =>array('type'=>'text', 'label'=>'NotePublic', 'enabled'=>1, 'visible'=>0, 'position'=>60),
- 'note_private' =>array('type'=>'text', 'label'=>'NotePrivate', 'enabled'=>1, 'visible'=>0, 'position'=>61),
+ 'description' =>array('type'=>'text', 'label'=>'Descrption', 'enabled'=>1, 'visible'=>0, 'position'=>60),
+ 'note_public' =>array('type'=>'html', 'label'=>'NotePublic', 'enabled'=>1, 'visible'=>0, 'position'=>61),
+ 'note_private' =>array('type'=>'html', 'label'=>'NotePrivate', 'enabled'=>1, 'visible'=>0, 'position'=>62),
'date_creation' =>array('type'=>'datetime', 'label'=>'DateCreation', 'enabled'=>1, 'visible'=>-2, 'notnull'=>1, 'position'=>500),
'tms' =>array('type'=>'timestamp', 'label'=>'DateModification', 'enabled'=>1, 'visible'=>-2, 'notnull'=>1, 'position'=>501),
//'date_valid' =>array('type'=>'datetime', 'label'=>'DateCreation', 'enabled'=>1, 'visible'=>-2, 'position'=>502),