';
if ($canbemodified) {
print ''.img_edit().'';
+ } else {
+ print ''.img_view().'';
}
if ($iserasable) {
print ''.img_delete().'';
@@ -1351,7 +1357,7 @@ $db->close();
* @param array $fieldlist Array of fields
* @param Object $obj If we show a particular record, obj is filled with record fields
* @param string $tabname Name of SQL table
- * @param string $context 'add'=Output field for the "add form", 'edit'=Output field for the "edit form", 'hide'=Output field for the "add form" but we don't want it to be rendered
+ * @param string $context 'add'=Output field for the "add form", 'edit'=Output field for the "edit form", 'preview'=show in readonly the template, 'hide'=Output field for the "add form" but we don't want it to be rendered
* @return void
*/
function fieldList($fieldlist, $obj = null, $tabname = '', $context = '')
@@ -1368,7 +1374,7 @@ function fieldList($fieldlist, $obj = null, $tabname = '', $context = '')
print '
';
} elseif ($value == 'fk_user') {
print '
';
- if ($user->admin) {
+ if ($user->admin && $context != 'preview') {
print $form->select_dolusers(empty($obj->$value) ? '' : $obj->$value, 'fk_user', 1, null, 0, ($user->admin ? '' : 'hierarchyme'), null, 0, 0, 0, '', 0, '', 'minwidth75 maxwidth100');
} else {
if ($context == 'add') { // I am not admin and we show the add form
@@ -1390,7 +1396,7 @@ function fieldList($fieldlist, $obj = null, $tabname = '', $context = '')
print '
';
} elseif ($value == 'lang') {
print '
';
- if (getDolGlobalInt('MAIN_MULTILANGS')) {
+ if (getDolGlobalInt('MAIN_MULTILANGS') && $context != 'preview') {
$selectedlang = GETPOSTISSET('langcode') ? GETPOST('langcode', 'aZ09') : $langs->defaultlang;
if ($context == 'edit') {
$selectedlang = $obj->lang;
@@ -1410,7 +1416,7 @@ function fieldList($fieldlist, $obj = null, $tabname = '', $context = '')
} elseif ($value == 'type_template') {
// Le type de template
print '
';
- if ($context == 'edit' && !empty($obj->type_template) && !in_array($obj->type_template, array_keys($elementList))) {
+ if (($context == 'edit' && !empty($obj->type_template) && !in_array($obj->type_template, array_keys($elementList))) || $context == 'preview') {
// Current template type is an unknown type, so we must keep it as it is.
print '';
print $obj->type_template;
@@ -1422,6 +1428,8 @@ function fieldList($fieldlist, $obj = null, $tabname = '', $context = '')
//print '