Fix support of 'help' field property. Fix bad td closing.
This commit is contained in:
parent
f4bef82bfa
commit
50aa674ebc
@ -6019,7 +6019,9 @@ abstract class CommonObject
|
|||||||
*/
|
*/
|
||||||
function showOptionals($extrafields, $mode='view', $params=null, $keysuffix='', $keyprefix='', $onetrtd=0)
|
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 = '';
|
$out = '';
|
||||||
|
|
||||||
@ -6128,12 +6130,12 @@ abstract class CommonObject
|
|||||||
|
|
||||||
$labeltoshow = $langs->trans($label);
|
$labeltoshow = $langs->trans($label);
|
||||||
|
|
||||||
if ($extrafields->attributes[$this->table_element]['required'][$key])
|
$out .= '<td class="titlefield';
|
||||||
{
|
if ($mode != 'view' && ! empty($extrafields->attributes[$this->table_element]['required'][$key])) $out .= ' fieldrequired';
|
||||||
$labeltoshow = '<span'.($mode != 'view' ? ' class="fieldrequired"':'').'>'.$labeltoshow.'</span>';
|
$out .= '">';
|
||||||
}
|
if (! empty($extrafields->attributes[$object->table_element]['help'][$key])) $out .= $form->textwithpicto($labeltoshow, $extrafields->attributes[$object->table_element]['help'][$key]);
|
||||||
|
else $out .= $labeltoshow;
|
||||||
$out .= '<td>'.$labeltoshow.'</td>';
|
$out .= '</td>';
|
||||||
|
|
||||||
$html_id = !empty($this->id) ? $this->element.'_extras_'.$key.'_'.$this->id : '';
|
$html_id = !empty($this->id) ? $this->element.'_extras_'.$key.'_'.$this->id : '';
|
||||||
$out .='<td id="'.$html_id.'" class="'.$this->element.'_extras_'.$key.'" '.($colspan?' colspan="'.$colspan.'"':'').'>';
|
$out .='<td id="'.$html_id.'" class="'.$this->element.'_extras_'.$key.'" '.($colspan?' colspan="'.$colspan.'"':'').'>';
|
||||||
|
|||||||
@ -27,6 +27,7 @@ if (empty($conf) || ! is_object($conf))
|
|||||||
print "Error, template page can't be called as URL";
|
print "Error, template page can't be called as URL";
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
|
if (! is_object($form)) $form=new Form($db);
|
||||||
|
|
||||||
?>
|
?>
|
||||||
<!-- BEGIN PHP TEMPLATE commonfields_edit.tpl.php -->
|
<!-- BEGIN PHP TEMPLATE commonfields_edit.tpl.php -->
|
||||||
@ -45,8 +46,10 @@ foreach($object->fields as $key => $val)
|
|||||||
print ' class="titlefieldcreate';
|
print ' class="titlefieldcreate';
|
||||||
if ($val['notnull'] > 0) print ' fieldrequired';
|
if ($val['notnull'] > 0) print ' fieldrequired';
|
||||||
if ($val['type'] == 'text' || $val['type'] == 'html') print ' tdtop';
|
if ($val['type'] == 'text' || $val['type'] == 'html') print ' tdtop';
|
||||||
print '"';
|
print '">';
|
||||||
print '>'.$langs->trans($val['label']).'</td>';
|
if (! empty($val['help'])) print $form->textwithpicto($langs->trans($val['label']), $val['help']);
|
||||||
|
else print $langs->trans($val['label']);
|
||||||
|
print '</td>';
|
||||||
print '<td>';
|
print '<td>';
|
||||||
if (in_array($val['type'], array('int', 'integer'))) $value = GETPOSTISSET($key)?GETPOST($key, 'int'):$object->$key;
|
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;
|
elseif ($val['type'] == 'text' || $val['type'] == 'html') $value = GETPOSTISSET($key)?GETPOST($key,'none'):$object->$key;
|
||||||
|
|||||||
@ -29,6 +29,7 @@ if (empty($conf) || ! is_object($conf))
|
|||||||
print "Error, template page can't be called as URL";
|
print "Error, template page can't be called as URL";
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
|
if (! is_object($form)) $form=new Form($db);
|
||||||
|
|
||||||
?>
|
?>
|
||||||
<!-- BEGIN PHP TEMPLATE commonfields_view.tpl.php -->
|
<!-- BEGIN PHP TEMPLATE commonfields_view.tpl.php -->
|
||||||
@ -50,8 +51,10 @@ foreach($object->fields as $key => $val)
|
|||||||
print ' class="titlefield';
|
print ' class="titlefield';
|
||||||
if ($val['notnull'] > 0) print ' fieldrequired';
|
if ($val['notnull'] > 0) print ' fieldrequired';
|
||||||
if ($val['type'] == 'text' || $val['type'] == 'html') print ' tdtop';
|
if ($val['type'] == 'text' || $val['type'] == 'html') print ' tdtop';
|
||||||
print '"';
|
print '">';
|
||||||
print '>'.$langs->trans($val['label']).'</td>';
|
if (! empty($val['help'])) print $form->textwithpicto($langs->trans($val['label']), $val['help']);
|
||||||
|
else print $langs->trans($val['label']);
|
||||||
|
print '</td>';
|
||||||
print '<td>';
|
print '<td>';
|
||||||
print $object->showOutputField($val, $key, $value, '', '', '', 0);
|
print $object->showOutputField($val, $key, $value, '', '', '', 0);
|
||||||
//print dol_escape_htmltag($object->$key, 1, 1);
|
//print dol_escape_htmltag($object->$key, 1, 1);
|
||||||
@ -87,8 +90,10 @@ foreach($object->fields as $key => $val)
|
|||||||
print ' class="titlefield';
|
print ' class="titlefield';
|
||||||
if ($val['notnull'] > 0) print ' fieldrequired';
|
if ($val['notnull'] > 0) print ' fieldrequired';
|
||||||
if ($val['type'] == 'text' || $val['type'] == 'html') print ' tdtop';
|
if ($val['type'] == 'text' || $val['type'] == 'html') print ' tdtop';
|
||||||
print '"';
|
print '">';
|
||||||
print '>'.$langs->trans($val['label']).'</td>';
|
if (! empty($val['help'])) print $form->textwithpicto($langs->trans($val['label']), $val['help']);
|
||||||
|
else print $langs->trans($val['label']);
|
||||||
|
print '</td>';
|
||||||
print '<td>';
|
print '<td>';
|
||||||
print $object->showOutputField($val, $key, $value, '', '', '', 0);
|
print $object->showOutputField($val, $key, $value, '', '', '', 0);
|
||||||
//print dol_escape_htmltag($object->$key, 1, 1);
|
//print dol_escape_htmltag($object->$key, 1, 1);
|
||||||
|
|||||||
@ -31,6 +31,7 @@ if (empty($object) || ! is_object($object))
|
|||||||
print "Error, template page can't be called as URL";
|
print "Error, template page can't be called as URL";
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
|
if (! is_object($form)) $form=new Form($db);
|
||||||
|
|
||||||
?>
|
?>
|
||||||
<!-- BEGIN PHP TEMPLATE extrafields_view.tpl.php -->
|
<!-- BEGIN PHP TEMPLATE extrafields_view.tpl.php -->
|
||||||
@ -93,9 +94,13 @@ if (empty($reshook) && is_array($extrafields->attributes[$object->table_element]
|
|||||||
print '<table width="100%" class="nobordernopadding">';
|
print '<table width="100%" class="nobordernopadding">';
|
||||||
print '<tr>';
|
print '<tr>';
|
||||||
print '<td';
|
print '<td';
|
||||||
|
print ' class="titlefield';
|
||||||
//var_dump($action);exit;
|
//var_dump($action);exit;
|
||||||
if ((! empty($action) && ($action == 'create' || $action == 'edit')) && ! empty($extrafields->attributes[$object->table_element]['required'][$key])) print ' class="fieldrequired"';
|
if ((! empty($action) && ($action == 'create' || $action == 'edit')) && ! empty($extrafields->attributes[$object->table_element]['required'][$key])) print ' fieldrequired';
|
||||||
print '>' . $langs->trans($label) . '</td>';
|
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 '</td>';
|
||||||
|
|
||||||
//TODO Improve element and rights detection
|
//TODO Improve element and rights detection
|
||||||
//var_dump($user->rights);
|
//var_dump($user->rights);
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user