diff --git a/htdocs/core/class/extrafields.class.php b/htdocs/core/class/extrafields.class.php
index db0e7f4284a..08d6c3bfeaf 100644
--- a/htdocs/core/class/extrafields.class.php
+++ b/htdocs/core/class/extrafields.class.php
@@ -82,6 +82,7 @@ class ExtraFields
public static $type2label=array(
'varchar'=>'String',
'text'=>'TextLong',
+ 'html'=>'HtmlText',
'int'=>'Int',
'double'=>'Float',
'date'=>'Date',
@@ -133,7 +134,7 @@ class ExtraFields
*
* @param string $attrname Code of attribute
* @param string $label label of attribute
- * @param int $type Type of attribute ('boolean', 'int', 'text', 'varchar', 'date', 'datehour','price','phone','mail','password','url','select','checkbox', ...)
+ * @param int $type Type of attribute ('boolean', 'int', 'varchar', 'text', 'html', 'date', 'datehour','price','phone','mail','password','url','select','checkbox', ...)
* @param int $pos Position of attribute
* @param string $size Size/length of attribute
* @param string $elementtype Element type ('member', 'product', 'thirdparty', ...)
@@ -189,7 +190,7 @@ class ExtraFields
* This is a private method. For public method, use addExtraField.
*
* @param string $attrname code of attribute
- * @param int $type Type of attribute ('boolean', 'int', 'text', 'varchar', 'date', 'datehour','price','phone','mail','password','url','select','checkbox', ...)
+ * @param int $type Type of attribute ('boolean', 'int', 'varchar', 'text', 'html', 'date', 'datehour','price','phone','mail','password','url','select','checkbox', ...)
* @param string $length Size/length of attribute ('5', '24,8', ...)
* @param string $elementtype Element type ('member', 'product', 'thirdparty', 'contact', ...)
* @param int $unique Is field unique or not
@@ -232,6 +233,8 @@ class ExtraFields
} elseif ($type=='link') {
$typedb='int';
$lengthdb='11';
+ } elseif ($type=='html') {
+ $typedb='text';
} elseif($type=='password') {
$typedb='varchar';
$lengthdb='128';
@@ -275,7 +278,7 @@ class ExtraFields
*
* @param string $attrname code of attribute
* @param string $label label of attribute
- * @param int $type Type of attribute ('int', 'text', 'varchar', 'date', 'datehour', 'float')
+ * @param int $type Type of attribute ('int', 'varchar', 'text', 'html', 'date', 'datehour', 'float')
* @param int $pos Position of attribute
* @param string $size Size/length of attribute ('5', '24,8', ...)
* @param string $elementtype Element type ('member', 'product', 'thirdparty', ...)
@@ -483,7 +486,7 @@ class ExtraFields
*
* @param string $attrname Name of attribute
* @param string $label Label of attribute
- * @param string $type Type of attribute ('boolean', 'int', 'text', 'varchar', 'date', 'datehour','price','phone','mail','password','url','select','checkbox', ...)
+ * @param string $type Type of attribute ('boolean', 'int', 'varchar', 'text', 'html', 'date', 'datehour','price','phone','mail','password','url','select','checkbox', ...)
* @param int $length Length of attribute
* @param string $elementtype Element type ('member', 'product', 'thirdparty', 'contact', ...)
* @param int $unique Is field unique or not
@@ -529,6 +532,8 @@ class ExtraFields
} elseif (($type=='select') || ($type=='sellist') || ($type=='radio') || ($type=='checkbox') || ($type=='chkbxlst')) {
$typedb='text';
$lengthdb='';
+ } elseif ($type == 'html') {
+ $typedb='text';
} elseif ($type=='link') {
$typedb='int';
$lengthdb='11';
@@ -800,15 +805,17 @@ class ExtraFields
{
if ($obj = $this->db->fetch_object($resql_entity_name))
{
- $this->attribute_entitylabel[$tab->name]=$obj->label;
+ $this->attribute_entitylabel[$tab->name]=$obj->label; // Old usage
$this->attributes[$tab->elementtype]['entitylabel'][$tab->name]=$obj->label;
}
}
}
}
+
+ $this->attributes[$tab->elementtype]['loaded']=1;
}
}
- if ($elementtype) $this->attributes[$elementtype]['loaded']=1;
+ if ($elementtype) $this->attributes[$elementtype]['loaded']=1; // If nothing found, we also save tag 'loaded'
}
else
{
@@ -933,6 +940,19 @@ class ExtraFields
$out='';
}
elseif ($type == 'text')
+ {
+ if (! preg_match('/search_/', $keyprefix)) // If keyprefix is search_ or search_options_, we must just use a simple text field
+ {
+ require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
+ $doleditor=new DolEditor($keyprefix.$key.$keysuffix,$value,'',200,'dolibarr_notes','In',false,false,false,ROWS_5,'90%');
+ $out=$doleditor->Create(1);
+ }
+ else
+ {
+ $out='';
+ }
+ }
+ elseif ($type == 'html')
{
if (! preg_match('/search_/', $keyprefix)) // If keyprefix is search_ or search_options_, we must just use a simple text field
{
@@ -1373,7 +1393,7 @@ class ExtraFields
$list=$this->attributes[$extrafieldsobjectkey]['list'][$key];
$hidden=(($list == 0) ? 1 : 0); // If zero, we are sure it is hidden, otherwise we show. If it depends on mode (view/create/edit form or list, this must be filtered by caller)
}
- else
+ else // Old usage
{
$elementtype=$this->attribute_elementtype[$key]; // seems not used
$label=$this->attribute_label[$key];
@@ -1646,6 +1666,10 @@ class ExtraFields
{
$value=dol_htmlentitiesbr($value);
}
+ elseif ($type == 'html')
+ {
+ $value=dol_htmlentitiesbr($value);
+ }
elseif ($type == 'password')
{
$value=preg_replace('/./i','*',$value);
diff --git a/htdocs/core/tpl/admin_extrafields_add.tpl.php b/htdocs/core/tpl/admin_extrafields_add.tpl.php
index 0c141d8933a..51e6c518a7a 100644
--- a/htdocs/core/tpl/admin_extrafields_add.tpl.php
+++ b/htdocs/core/tpl/admin_extrafields_add.tpl.php
@@ -92,6 +92,7 @@ $langs->load("modulebuilder");
else if (type == 'double') { size.val('24,8').removeAttr('disabled'); unique.removeAttr('disabled'); jQuery("#value_choice").hide(); jQuery("#helpchkbxlst").hide();}
else if (type == 'int') { size.val('10').removeAttr('disabled'); unique.removeAttr('disabled'); jQuery("#value_choice").hide(); jQuery("#helpchkbxlst").hide();}
else if (type == 'text') { size.val('2000').removeAttr('disabled'); unique.prop('disabled', true).removeAttr('checked'); jQuery("#value_choice").hide();jQuery("#helpchkbxlst").hide(); }
+ else if (type == 'html') { size.val('2000').removeAttr('disabled'); unique.prop('disabled', true).removeAttr('checked'); jQuery("#value_choice").hide();jQuery("#helpchkbxlst").hide(); }
else if (type == 'varchar') { size.val('255').removeAttr('disabled'); unique.removeAttr('disabled'); jQuery("#value_choice").hide();jQuery("#helpchkbxlst").hide(); }
else if (type == 'password') { size.val('').prop('disabled', true); unique.removeAttr('checked').prop('disabled', true); required.val('').prop('disabled', true); default_value.val('').prop('disabled', true); jQuery("#value_choice").show();jQuery("#helpselect").hide();jQuery("#helpsellist").hide();jQuery("#helpchkbxlst").hide();jQuery("#helplink").hide();jQuery("#helppassword").show();}
else if (type == 'boolean') { size.val('').prop('disabled', true); unique.removeAttr('checked').prop('disabled', true); jQuery("#value_choice").hide();jQuery("#helpchkbxlst").hide();}
diff --git a/htdocs/core/tpl/admin_extrafields_edit.tpl.php b/htdocs/core/tpl/admin_extrafields_edit.tpl.php
index 63059964b74..9fb5eb27a64 100644
--- a/htdocs/core/tpl/admin_extrafields_edit.tpl.php
+++ b/htdocs/core/tpl/admin_extrafields_edit.tpl.php
@@ -90,6 +90,7 @@ $langs->load("modulebuilder");
else if (type == 'double') { size.removeAttr('disabled'); unique.removeAttr('disabled'); jQuery("#value_choice").hide(); jQuery("#helpchkbxlst").hide();}
else if (type == 'int') { size.removeAttr('disabled'); unique.removeAttr('disabled'); jQuery("#value_choice").hide(); jQuery("#helpchkbxlst").hide();}
else if (type == 'text') { size.removeAttr('disabled'); unique.prop('disabled', true).removeAttr('checked'); jQuery("#value_choice").hide();jQuery("#helpchkbxlst").hide(); }
+ else if (type == 'html') { size.removeAttr('disabled'); unique.prop('disabled', true).removeAttr('checked'); jQuery("#value_choice").hide();jQuery("#helpchkbxlst").hide(); }
else if (type == 'varchar') { size.removeAttr('disabled'); unique.removeAttr('disabled'); jQuery("#value_choice").hide();jQuery("#helpchkbxlst").hide(); }
else if (type == 'password') { size.val('').prop('disabled', true); unique.removeAttr('checked').prop('disabled', true); required.val('').prop('disabled', true); default_value.val('').prop('disabled', true); jQuery("#value_choice").show();jQuery("#helpselect").hide();jQuery("#helpsellist").hide();jQuery("#helpchkbxlst").hide();jQuery("#helplink").hide();jQuery("#helppassword").show();}
else if (type == 'boolean') { size.val('').prop('disabled', true); unique.removeAttr('checked').prop('disabled', true); jQuery("#value_choice").hide();jQuery("#helpchkbxlst").hide();}
@@ -182,7 +183,9 @@ elseif (($type== 'sellist') || ($type == 'chkbxlst') || ($type == 'link') || ($t
array('varchar', 'phone', 'mail', 'url', 'select', 'password'),
+ 'varchar'=>array('varchar', 'phone', 'mail', 'url', 'select', 'password', 'text', 'html'),
+ 'text'=>array('text','html'),
+ 'html'=>array('text','html'),
'password'=>array('password', 'varchar'),
'mail'=>array('varchar', 'phone', 'mail', 'url', 'select'),
'url'=>array('varchar', 'phone', 'mail', 'url', 'select'),
diff --git a/htdocs/langs/en_US/admin.lang b/htdocs/langs/en_US/admin.lang
index d6bf4d01fe9..0c5962c1183 100644
--- a/htdocs/langs/en_US/admin.lang
+++ b/htdocs/langs/en_US/admin.lang
@@ -392,6 +392,7 @@ PriceBaseTypeToChange=Modify on prices with base reference value defined on
MassConvert=Launch mass convert
String=String
TextLong=Long text
+HtmlText=Html text
Int=Integer
Float=Float
DateAndTime=Date and hour