diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php
index d98fcfc4717..7465cdcba7c 100644
--- a/htdocs/core/class/commonobject.class.php
+++ b/htdocs/core/class/commonobject.class.php
@@ -6019,7 +6019,9 @@ abstract class CommonObject
*/
function showOptionals($extrafields, $mode='view', $params=null, $keysuffix='', $keyprefix='', $onetrtd=0)
{
- global $_POST, $conf, $langs, $action;
+ global $db, $conf, $langs, $action, $form;
+
+ if (! is_object($form)) $form=new Form($db);
$out = '';
@@ -6128,12 +6130,12 @@ abstract class CommonObject
$labeltoshow = $langs->trans($label);
- if ($extrafields->attributes[$this->table_element]['required'][$key])
- {
- $labeltoshow = ''.$labeltoshow.'';
- }
-
- $out .= '
'.$labeltoshow.' | ';
+ $out .= '';
$html_id = !empty($this->id) ? $this->element.'_extras_'.$key.'_'.$this->id : '';
$out .='';
+ print '">';
+ if (! empty($val['help'])) print $form->textwithpicto($langs->trans($val['label']), $val['help']);
+ else print $langs->trans($val['label']);
+ print '';
print '';
if (in_array($val['type'], array('int', 'integer'))) $value = GETPOSTISSET($key)?GETPOST($key, 'int'):$object->$key;
elseif ($val['type'] == 'text' || $val['type'] == 'html') $value = GETPOSTISSET($key)?GETPOST($key,'none'):$object->$key;
diff --git a/htdocs/core/tpl/commonfields_view.tpl.php b/htdocs/core/tpl/commonfields_view.tpl.php
index 9eba9ea1a48..73f63360715 100644
--- a/htdocs/core/tpl/commonfields_view.tpl.php
+++ b/htdocs/core/tpl/commonfields_view.tpl.php
@@ -29,6 +29,7 @@ if (empty($conf) || ! is_object($conf))
print "Error, template page can't be called as URL";
exit;
}
+if (! is_object($form)) $form=new Form($db);
?>
@@ -50,8 +51,10 @@ foreach($object->fields as $key => $val)
print ' class="titlefield';
if ($val['notnull'] > 0) print ' fieldrequired';
if ($val['type'] == 'text' || $val['type'] == 'html') print ' tdtop';
- print '"';
- print '>'.$langs->trans($val['label']).' | ';
+ print '">';
+ if (! empty($val['help'])) print $form->textwithpicto($langs->trans($val['label']), $val['help']);
+ else print $langs->trans($val['label']);
+ print '';
print '';
print $object->showOutputField($val, $key, $value, '', '', '', 0);
//print dol_escape_htmltag($object->$key, 1, 1);
@@ -87,8 +90,10 @@ foreach($object->fields as $key => $val)
print ' class="titlefield';
if ($val['notnull'] > 0) print ' fieldrequired';
if ($val['type'] == 'text' || $val['type'] == 'html') print ' tdtop';
- print '"';
- print '>'.$langs->trans($val['label']).' | ';
+ print '">';
+ if (! empty($val['help'])) print $form->textwithpicto($langs->trans($val['label']), $val['help']);
+ else print $langs->trans($val['label']);
+ print '';
print '';
print $object->showOutputField($val, $key, $value, '', '', '', 0);
//print dol_escape_htmltag($object->$key, 1, 1);
diff --git a/htdocs/core/tpl/extrafields_view.tpl.php b/htdocs/core/tpl/extrafields_view.tpl.php
index 797e1e37712..dca4578e4a8 100644
--- a/htdocs/core/tpl/extrafields_view.tpl.php
+++ b/htdocs/core/tpl/extrafields_view.tpl.php
@@ -31,6 +31,7 @@ if (empty($object) || ! is_object($object))
print "Error, template page can't be called as URL";
exit;
}
+if (! is_object($form)) $form=new Form($db);
?>
@@ -93,9 +94,13 @@ if (empty($reshook) && is_array($extrafields->attributes[$object->table_element]
print '';
print '';
print '';
+ if ((! empty($action) && ($action == 'create' || $action == 'edit')) && ! empty($extrafields->attributes[$object->table_element]['required'][$key])) print ' fieldrequired';
+ print '">';
+ if (! empty($extrafields->attributes[$object->table_element]['help'][$key])) print $form->textwithpicto($langs->trans($label), $extrafields->attributes[$object->table_element]['help'][$key]);
+ else print $langs->trans($label);
+ print '';
//TODO Improve element and rights detection
//var_dump($user->rights);
|